Patterns
========
This documents lists useful patterns.
Creating an index page
----------------------
The easiest way to create an index page is to create an ``index.html`` file
in the ``input`` directory and loop over the ``articles`` variable:
Create the file::
touch input/index.html
The content might look like this::
status: hidden
template: self
{% extends "base.html" %}
{% block content %}
{% endblock %}
Setting the status to ``hidden`` prevents that the index page itself will
show up in the ``articles`` variable.
Creating an Atom feed
---------------------
Creating a feed is similar to creating an index page. Create an ``atom.xml``
file::
touch input/atom.xml
And make sure you set ``status: hidden``, so the feed itself doesn't show up in the
``articles`` variable::
status: hidden
template: self
My Website{{ articles[-1].headers.date|datetimeformat("%Y-%m-%dT%H:%M:%SZ") }}http://example.org/Foo Barfoobar@example.org
{% for article in articles %}
{{ article.headers.title }}{{ article.headers.date|datetimeformat("%Y-%m-%dT%H:%M:%SZ") }}http://example.org/{{ article.headers.url }}{{ article.body|e }}
{% endfor %}