Zola

Content

content dir

  • Each child directory in the content directory represents a section that contains pages (your .md files).

inside section dir

  • _index.md: store both the metadata and content of the section itself and is not considered a page.
  • pages with co-located assets
    1. make the page a dir instead of a .md
    2. put page contents into the index.md file in the page dir
    3. put assets into the same dir
  • static asset: you can put assets in the static dir

Section

  • A section is created whenever a directory (or subdirectory) in the content section contains an _index.md file.
  • The homepage is a section, regardless of the existence of an _index.md file. But can be overridden by a _index.md file.
  • templates gets content via section.content after the +++
  • can be nested infinitely

Page

  • file names cannot contain _index. at all
  • If a file ending with .md is named index.md, it will generate a page with the name of its directory (for example, /content/about/index.md would create a page at [base_url]/about).
  • Another exception to this rule is that a filename starting with a datetime (YYYY-mm-dd or an RFC3339 datetime) followed by an underscore (_) or a dash (-) will use that date as the page date, unless already set in the front matter.

Templates

  • 3 templates Zola always look for

    1. index.html: site homepage
    2. section.html: all sections
    3. page.html: all pages
    • homepage is also a section. so index.html has access to section variables as well
  • a custom template will only be used if you apply it by setting the template front-matter variable

+++
title = "..."
template = "about.html"
+++

Built-in Templates

  • Zola comes with four built-in templates: atom.xml and rss.xml (described in Feeds), sitemap.xml (described in Sitemap), and robots.txt