Skip to content

Custom Pages

0/0 edited this page Jan 28, 2022 · 1 revision

nbb supports custom pages out-of-the-box. You can easily override the built-in HTML templates by setting a single configuration variable.

Some notes:

  • You must override all three pages if you use your own HTML.
  • All fields must still be placed in.
  • Template syntax is that of Jinja2, and uses the Tera templating engine.

All pages have the following fields exposed:

  • lang: blog language
  • title: blog title
  • custom_css: custom CSS to be injected in a <style> tag
  • custom_html: for HTML to be injected
    • custom_html.head: custom HTML to be injected just before the closing </head> tag.
    • custom_html.body: custom HTML to be injected just before the closing </body> tag.
  • nbb_version: current version of nbb

index.html has the following additional fields.

  • posts: Vec
    • posts.title: the title of this post.
    • posts.description: Option<String>: the description of this post.
    • posts.target: the relative URL to this post
    • posts.date: a UTC Unix timestamp at when this post was created/edited at.

blog_post.html has the following additional fields.

  • post: BlogPost
    • post.title: the title of the post.
    • post.description: Option<String>: the description of the post.
    • post.date: a UTC Unix timestamp at when the post was created/edited at.
    • post.body: the body of the post: this is rendered Markdown.
Clone this wiki locally