- aliases: Relative paths in the destination directory where the page should also show up. Like in Hugo, this can be used to maintain existing links when moving a page to a different location.
- asset: If set to True for a file (for example, by a
file:
pattern in a directory index), the file is loaded as a static asset, regardless of whether a feature would load it. - author: A string with the name of the author for this page.
- copyright: Copyright notice for the page. If missing, it's generated using
template_copyright
. - data_type: Type of data for this file.
- date: Publication date for the page.
- description: The page description. If omitted, the page will have no description.
- draft: If true, the page is still a draft and will not appear in the destination site, unless draft mode is enabled.
- front_matter: Front matter as parsed by the source file
- image: Image used for this post.
- indexed: If true, the page appears in directory indices and in page filter results.
- links: Extra metadata for external links.
- nav: List of page paths, relative to the page defining the nav element, that are used for the navbar.
- nav_title: Title to use when this page is linked in a navbar.
- pages: The
pages
metadata can use to select a set of pages shown by the current page. Although defaultpage.html
template will not do anything with them, other page templates, likeblog.html
, use this to select the pages to show. - related: Readonly mapping of pages related to this page, indexed by name.
- series: List of categories for the
series
taxonomy. - series_title: Series title from this page onwards.
- site_name: Name of the site. If missing, it defaults to the title of the toplevel index page. If missing, it defaults to the name of the content directory.
- site_url: Base URL for the site, used to generate an absolute URL to the page.
- syndicated: Set to true if the page can be included in a syndication, else to false.
- syndication: Defines syndication for the contents of this page.
- syndication_date: Syndication date for this page.
- tags: List of categories for the
tags
taxonomy. - template: Template used to render the page. Defaults to
page.html
, although specific pages of some features can default to other template names. - template_copyright: jinja2 template to use to generate
copyright
when it is not explicitly set. - template_description: jinja2 template to use to generate
description
when it is not explicitly set. - template_title: jinja2 template to use to generate
title
when it is not explicitly set. - title: Page title.
Markdown files have a .md
extension and are prefixed by
front matter metadata.
The flavour of markdown is what's supported by python-markdown with the Extra, CodeHilite and Fenced Code Blocks extensions, and is quite close to GitHub Flavored Markdown or GitLab Markdown.
staticsite
adds an extra internal plugin to Python-Markdown to postprocess
the page contents to adjust internal links to guarantee that they point where
they should.
Adding a horizontal rule using underscores (3 or more underscores), creates a page fold. When rendering the page inline, such as in a blog index page, or in RSS/Atom syndication, the content from the horizontal rule onwards will not be shown.
If you want to add a horizontal rule without introducing a page fold, use a
sequence of three or more asterisks (***
) or dashes (---
) instead.
Pages can link to other pages via normal Markdown links ([text](link)
).
Links that start with a /
will be rooted at the top of the site contents.
Relative links are resolved relative to the location of the current page first, and failing that relative to its parent directory, and so on until the root of the site.
For example, if you have blog/2016/page.md
that contains a link like
![a photo](images/photo.jpg)
, the link will point to the first of this
options that will be found:
blog/2016/images/photo.jpg
blog/images/photo.jpg
images/photo.jpg
This allows one to organise pages pointing to other pages or assets without needing to worry about where they are located in the site.
You can link to other Markdown pages with the .md
extension
(like GitHub does)
or without, as if you were editing a wiki.
The front matter of the post can be written in TOML, YAML or JSON, just like in Hugo.
Use ---
delimiters to mark YAML front matter. Use +++
delimiters to mark
TOML front matter. Use {
…}
delimiters to mark JSON front matter.
You can also usea triple-backticks code blocks
first thing in the file to mark front matter, optionally specifying yaml
,
toml
, or json
as the format (yaml is used as a default):
```yaml
date: 2020-01-02 12:00
```
# My page
If you want to start your markdown content with a code block, add an empty line at the top: front matter detection only happens on the first line of the file.
See page metadata for a list of commonly used metadata.
Markdown rendering makes use of these settings:
Extensions used by python-markdown. Defaults to:
MARKDOWN_EXTENSIONS = [
"markdown.extensions.extra",
"markdown.extensions.codehilite",
"markdown.extensions.fenced_code",
]
Configuration for markdown extensions. Defaults to:
MARKDOWN_EXTENSION_CONFIGS = {
'markdown.extensions.extra': {
'markdown.extensions.footnotes': {
# See https://github.com/spanezz/staticsite/issues/13
'UNIQUE_IDS': True,
},
},
}
Besides the usual meta
, markdown pages have also these attributes:
page.contents
: the Markdown contents rendered as HTML. You may want to use it with the|safe
filter to prevent double escaping