Zola Content Types

2023-07-13

Basic Content format

Content is usually stored in .md files.

Specifically, content is written in CommonMark via pulldown-cmark. Further, it optionally supports parsing footnotes, Github flavored tables, Github flavored task lists and strikethrough.

---
title: YAML frontmatter
---

# title
## subtitle

Text with [link](http://www.example.com)

* listitem 
* listitem

| foo | bar |
| --- | --- |
| baz | bim |

- [ ] foo
- [x] bar

Hello, ~wrld~ world!

index.md and _index.md

_index.md signals that the directory is a section1. The other *.md files are pages.

index.md signals that the directory is a page2 with colocated assets3. It should be the only *.md file in the directory.

Frontmatter

YAML or TOML frontmatter needs to be embedded into most md files.

---
title: Zola Macros
slug: zola-macros
date: 2023-07-12
---
+++
title = "Zola Macros"
slug = "zola-macros"
date = 2023-07-12T00:00:00.000Z
+++

*.md files in the content directory

Zola indexes all *.md-files in the content directory and makes them available in the following ways.

other files

are not indexed and are not available via get_page(path=*). If you need the final URL of the file it needs to be constructed.

for colocated assets3 constructing a direct link would look like this:

<a href="{{page.permalink}}{{page.assets[i]}}"> linktext </a>

For assets not colocated, but stored next to the content:

<a href="{{page.permalink | split(sep="/") | slice(start=0, end=-1) | join(sep="/") }}{{page.assets[i]}}"> linktext </a>

However they are copied to the final site as a static asset, if it's not in ignored_content4 in the config file:

image files

{% set page_dir = page.components | slice(start=0, end=-1) | join(sep="/") %} {% set image_path = page_dir ~ "/" ~ page.extra.image %}

data files

Zola supports file types toml, json, csv, bibtex, yaml/yml, and xml via load-data()5 in templates and shortcodes. Only UTF-8 encoding is supported.