Adolfo: Okay, excellent.
Hello, everyone and
nice meeting you. Let me
thank the the organizer for all the
organization and all the work they are
doing to support us.
My name is Adolfo Villafiorita.
I'm teaching at the University of Trento.
I will shortly be working at
shared.tech, which is
a non-profit organization developing
applications to
recover surplus food.
The reason of the talk today
and the reason I'm here today
is to talk about my experience in moving
from Jekyll static website generator to Org Mode.
The reason I moved to Org Mode
is to have better support for
literate programming on the websites
at the University of Trento, where we
make available the content for the
the students.
First of all, what is a static website generator?
It is basically a tool which
allows you to
generate HTML files out of text files
containing basically two types of
information: metadata and content.
Metadata is a
set of key pairs describing the
content of the file, such as the title,
author, tags, and so on and so forth.
The content is what you actually want to
get published on the Internet in
the HTML file.
Usually the content is written in
some kind of markup language,
such as Markdown or possibly
Org Mode. Jekyll is a very
popular static website generator.
It is written in Ruby.
What it does: it systematically
transforms all the input files
by making the content into
HTML and systematically applying a
template in order to generate the
HTML files, which you can then deploy
on your server of choice to make them
available on the Internet.
One of the features most--
well, I would say all
static website generators have
is that of being able to
collect the metadata information
of the files being part of
your project.
The reason they do that is because
you sometimes want to generate pages
based on the content
of your projects,
such as, for instance, the list of
posts you have recently published, or
maybe the list of tags
you have defined for your post,
and so on and so forth.
Jekyll gives the possibility of
generating this kind of dynamic
content by using Liquid,
which is a templating language which
looks like this.
So basically, you have all the
constructs you can
expect in a programming language.
This, for instance,
is a for cycle which
iterates over all the posts or the
files in a specific directory of the
Jekyll project.
For each post, it takes the title
and the URL and generates a link.
So Jekyll is nice and sweet,
but over the years
I started using more and more
systematically
Org Mode to write all my files.
I moved from Markdown to Org Mode
I am a long time Emacs user.
I've been using Emacs for 30 years now,
so Org Mode is a more recent discovery,
but it is a very nice discovery I made.
The reason I like Org Mode
is because, for instance, you can write
formulas using MathJax
and you can generate diagrams
or plots with Gnuplot.
Also important is the fact that you have
the possibility of publishing
your documents to multiple backends such as PDF,
or maybe a Reveal presentation,
or HTML. This is all made possible
by Babel, which is
exactly what we just saw in the
previous talk:
Namely, the possibility of executing a
snippet of code
embedded in in your pages.
Our model can also be used
within Jekyll. In fact,
there is a a nice gem, a nice library,
called jekyll-org which allows you
to use Org Mode files directly
into jekyll. But when you start using
Org Mode... When I started using
Org Mode, I realized I could move
all my workflow, all my publishing
workflow to Emacs.
In fact, Org Mode is also a
static website generator because
it has got the possibility of publishing
projects made of Org Mode files.
One of the nice things about
the publishing features of Org Mode
is that it allows you to define in the
org-publish-project-alist,
all the the components
which are part of your project.
In a sense, it is
also more flexible than Jekyll,
because it also allows you, for instance,
to publish a single file rather
than having to recompile everything
every time you want to publish your
your project to your website.
However, there are some short comments
I would say, or some areas of improvement.
The first is that support for templating
is not so obvious as it is
in Jekyll, even though there are some
nice extensions such as org-thtml,
for instance, which allows you to use templates.
More important to me was the fact that
apparently, there is little support for
the creation of dynamic content
So I was very curious
and very keen to use
Org Mode for publishing my blog
and the courses at the university,
but then I had to find a way
to being able to publish these
dynamic pages, finding some kind of
replacement, so to speak,
for the liquid engine.
The solution was there at hand, actually, because
basically, I realized I could use Babel
for exactly this purpose. Rather than
using Babel for generating
plots or my other computations
or whatever I was using them for,
I realized I could use Babel to
generate HTML which could be
then published in the project
All I needed to do then
was defining some kind of functions,
some kind of code in order to read
the metadata of all
the Org Mode files of my web project,
so that I could then publish--
generate the dynamic content.
This is a snippet taken from
one of my HTML projects,
which basically shows the way in which
I generate the list of posts on
my page. It is exactly how the Liquid that we saw
a couple of slides earlier that looks like
in Org Mode.
Basically, what I'm doing... I'm using...
I wrote a Ruby script which
reads all the metadata. So this
highlighted code
basically loads the script
which is stored externally.
Then it collects all the
metadata from the
Org Mode files in the
current directory.
And then the following... The code
you can see here
basically iterates over all the
posts read at the previous step.
It generates
a list with the title
and the URLS, basically
replicating what Jekyll does.
There are some other things
I have to deal with in order to
accommodate my workflow. But that was
relatively easy in the sense that one of
the problems, one of the issues I had to
solve was that of having
a common navigation on all my
pages. That was easily solved
using the #+INCLUDE feature.
So I basically
made available
an #+INCLUDE with all the navigation
which is embedded in all the pages of
my websites
through the #+INCLUDE.
Another nice feature which
Jekyll has is the possibility of
previewing a website before deploying it.
Emacs also has got a node which allows
you to launch a web server. In fact,
I wrote a quick hack
which allows you to
invoke a node on an Org Mode
project, start a local preview,
and then use rsync
in order to deploy the the website.
Five minutes left. More than
enough. Okay.
Thanks. Thank you, thank you very much.
I'm nearly done. So then I can take some questions.
Just to give you maybe
a slightly more in-depth
view of what the pages look like,
so these are
one of the pages, or the source files
of one of the websites. It is
in literate programming. Basically,
you see there is some metadata here.
I mean this is a regular Org Mode file.
This part here
basically defines some common options
for publication.
These two includes here
put some extra HTML in the head part and
the navigation. Here, as you can see,
is the code generating the
the list in chronological order. It is
slightly more complex than the example I
made in the slide
because there is some more
elaboration to do, including putting some
Javascript to identify
according to the tags.
To go back to the presentation...
I managed this migration
a few months ago,
and then all my workflow is within
Org Mode and within Emacs.
I'm very happy with it because it's
simplified quite a bit
my publication process.
One of the advantages... Another
advantage... So the first advantage is that
everything is in Org Mode and Emacs.
Second advantage
is that everything is based on the
standard machinery provided by Org Mode.
So in a sense, it is
more robust with respect to
dependencies, possible errors, and so
on and so forth.
The fact that Org Mode
allows you to publish
a single file in a project is also
very interesting because
it allows to be more robust to
problems you might introduce when
you're changing--when I'm changing the setup.
Another interesting thing which I
realized that I could have is that
in a sense, the specification of the
website can be embedded in the website itself.
In a sense this is some kind of
self-documenting...
It's a way of self-documenting
what I'm actually doing.
For instance, here on my website,
you can see the
specification of the
project which is loaded
from my initialization file,
but then it is also published
together with my home page. It lives
with the repository where
I keep all the sources of my website,
which is kind of nice because it
basically isolates
everything in a single place.
So there are some examples. I'm
showing them more because of the
source code which
you can grab from the git repositories
if you are interested.
Of course I'm also available
to provide some support and help
if you are interested
in this kind of stuff.
The the next step for me will be that of
trying, making this kind of machinery available
for more general use at the moment.
If you are interested in trying out my
suggestion, grabbing the
sources for one of the websites
to seehow they look like,
and maybe try and
customize it for your purposes...
This is basically the content of my talk.
I'm open to questions and thank you
for your attention.
(Amin: Thank you very much, Adolfo, for your
awesome presentation.
I think we have time for maybe like
one or two questions,
and then the rest maybe you could
take up after the stream.)
Adolfo: What should we do?
(Amin: Would you like me
to read you the questions?)
Adolfo: Yeah, probably better because
I'm kind of lost there.
(Amin: Okay, no problem.
So someone asks, "Do you have any
opinion on Firn?")
Adolfo: Firn. I don't know Firn,
so I'll give it a try
and check it out.
(Amin: Thanks. People are also asking,
do you discuss this, for example, in a blog
or anywhere else they could find more
about it?)
Adolfo: Oh yes. I'm going to publish the
the talk and the content
on my website, and then I'll link it from
the EmacsConf conference
so that it will be easier for
people to to reach it
I will shortly make it
available right after the conference.
(Amin: Wonderful. I think that's all for the questions.
Thank you very much.)
Adolfo: Thank you very much. Thank you.
(Amin: Cheers.) Adolfo: Bye, cheers. (Amin: Bye.)