Blog site example

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

Edit your settings.toml:

template = 'post.jinja2'
type = 'post'

title = 'My Blog'

Generate Pygments theme:

make css default

Create basic template layouts/base.jinja2:

<!DOCTYPE html>
<html lang="en">
    <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>
  {% block content %}{% endblock %}

Home page template layouts/index.jinja2:

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

Posts tempalte layouts/post.jinja2:

{% extends "base.jinja2" %}
{% block content %}
  <a href="/">Back to the home page</a>
    {{ html | safe }}
{% 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 serve