Examples

Blog site example

For the blog, we will need to create three template files and at least two .rst files.

Edit your settings.toml:

[defaults]
template = 'post.jinja2'
type = 'post'

[site]
title = 'My Blog'

Generate Pygments theme:

make css default

Create basic template layouts/base.jinja2:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="/css/pygments/{{ pygments_theme }}.css">
    <link rel="stylesheet" href="/css/style.css">
    <title>{{ page.title }} | {{ site.title }}</title>
  </head>
<body>
  {% block content %}{% endblock %}
</body>
</html>

Home page template layouts/index.jinja2:

{% extends "base.jinja2" %}
{% block content %}
  <h1>{{ site.title }}</h1>
  <ul id="posts">
    {% for post in aggr.posts %}
      <li>
        <a href="{{ post.path }}">{{ post.title }}</a>
        <span class="meta"> — {{ post.date }}</span>
      </li>
    {% endfor %}
  </ul>
  {{ html | safe }}
{% endblock %}

Posts tempalte layouts/post.jinja2:

{% extends "base.jinja2" %}
{% block content %}
  <a href="/">Back to the home page</a>
  <article>
    {{ html | safe }}
  </article>
{% endblock %}

Create dummy home page content/index.rst with fields:

:title: Homepage
:date: 1970-01-01
:type: page
:template: index.jinja2

Create first blog post content/hello_world.rst:

:title: Hello, World!
:date: 1970-01-01

=============
Hello, World!
=============

Hello, there! This is my first site built with *re*\ **Structured**\ *Web*!

Now build site:

make
make serve