Skip to content

API Refrence ๐Ÿ‘๐Ÿ‘๐Ÿ‘

Breadcrumb edited this page Jun 8, 2021 · 3 revisions

This API reference can be used for themes and plugins.

Plugin API

When making a plugin, the functions you are using to connect with Rootbeer must take in a parameter (almost always sender) and the parameter will give you the things needed too create all the things you want.

sender.config

Dictionary -- The parsed config file.

sender.site_title

String. -- The site's title

sender.pretty_p

Bool. -- Weather or not the posts will have pretty permalinks.

sender.pretty_p_pages

Bool. -- Weather or not the pages will have pretty permalinks.

sender.cont_dir

String. -- The directory containing the content.

sender.out_dir

String. -- The directory to export all the rendered content.

sender.blog_dir

String. -- The directory to put the blog posts when rendered.

sender.theme

String. -- The name of the theme being used.

sender.themes_dir

String. -- The name of the directory containing the themes.

sender.date_format

String. -- The format of the date for the content.

sender.sort_pages

String. -- How to sort the pages

sender.sort_pages_reversed

Bool. -- Weather to sort the pages reversed.

sender.sort_posts

String. -- How to sort the posts.

sender.sort_posts_reversed

Bool. -- Weather to sort the pages reversed.

sender.required_metadata_fields

List. -- A list of required metadata fields.

sender.md_extentions

Dictionary -- The install and import names of extensions for the markdown parser.

sender.content

List -- A list of all the content and their data. The content is stored in dictionaries.

sender.content_types

List -- A list of the content types.

sender.site_url

String. -- The site's base url.

sender.md

Class <markdown.Markdown> -- The markdown parser.

sender.env

Class <Jinja2.Environment> -- The Jinja2 environment.

sender.md_ext

String. -- The extension of the markdown files.

sender.pages

List. -- A list of all the pages.

sender.posts

List. -- A list of all the posts.

Theme API

Content Type Templates

this

Dictionary -- The posts' data. Includes the file name, the metadata, the date, a readable date, the slug, the url, and the content.

config

Dictionary -- The site's config.

rootbeer

The RootbeerSSG class. Use this to access things in the Plugins API in the theme.

Index Template

posts

List -- A list of all the posts

pages

List -- A list of all the pages.

config

Dictionary -- The site's config.

rootbeer

The RootbeerSSG class. Use this to access things in the Plugins API in the theme.

Archive Template

posts

List -- A list of all the posts

config

Dictionary -- The site's config.

rootbeer

The RootbeerSSG class. Use this to access things in the Plugins API in the theme.

Theme Jinja2 Filters

Filters will take an input and change it. You can use a filter like this:

{{ yo | <filter> }}
mdify

Will parse Markdown syntax into HTML. Example:

{{ '# Very epicness' | mdify  }} 

will turn into

<h1>Very epicness</h1>
abs_url

Will get the url of the relative path. Example:

{{ '../static/image/very_cool_img.png' | abs_url  }}

will turn into

https://example.com/static/image/very_cool_img.png