You’re right and I think that’s the whole point. There is no reason separating both in terms of functionality but when it comes to explaining how to use zola, it’s very useful to introduce two concepts.
Here is a detail of the front-matter of page only, section only, and both:
# page
date =
updated =
draft = false
slug = ""
path = ""
[taxonomies]
# section
sort_by = "none"
page_template =
paginate_by = 0
paginate_path = "page"
insert_anchor_links = "none"
render = true
redirect_to =
transparent = false
# both
title = ""
description = ""
weight = 0
in_search_index = true
template = "some.html"
aliases = []
[extra]
Here is a detail of the variables available in a template for page only, section only, and both:
# page
date: String?;
year: Number?;
month: Number?;
day: Number?;
updated: String?;
slug: String;
draft: Bool;
summary: String?;
taxonomies: HashMap<String, Array<String>>;
earlier: Page?;
later: Page?;
heavier: Page?;
lighter: Page?;
# section
pages: Array<Page>;
subsections: Array<String>;
# both
content: String;
title: String?;
description: String?;
path: String;
components: Array<String>;
permalink: String;
toc: Array<Header>,
word_count: Number;
extra: HashMap<String, Any>;
translations: Array<TranslatedContent>;
lang: String;
relative_path: String;
ancestors: Array<String>;
assets: Array<String>;
reading_time: Number;
Right now I need my section to have taxonomies and the clean way to do that is to make it a page and to have a section to organize content. In the template, I have to load the section to get the content organization stuff. So I have a template mixing page and section. I think a cleaner way to do that is to have page and section the same object (lets call it “resource”) with the only difference that _index.md
is a resource whose default template is section.html and index.md
or something else is a resource whose default template is page.html
. In both templates, the resource will be available with the resource
keyword so that template elements (like macros) can be reused for pages and sections.
You can look for example at the http://duniter.trentesaux.fr/wiki/ section (I ported the site from pelican). It has a breadcrumb feature allowing to browse between subsections and subpages as follows:
But I want it to benefit from the date and taxonomies today reserved to a page (here is a page example):
And I will have to compensate this lack of feature of a section by mixing page and section in my template. That’s an example which might be interesting later when thinking about the design