basalt-ng documentation
Docs» Theme template variables

Theme template variables

At page render time, a number of variables are exposed to the theme with information relating to the rendering. This is how the theme can know, for example, to render a post list or a post display page or any other combination.

Variables present on all renders

NameTypeDescription
ssg_site_titleStringTitle as defined in site configuration
ssg_site_subtitleStringSubtitle as defined in site configuration
ssg_titleStringTitle of the page being rendered
ssg_contentStringRendered markdown as HTML representing the content of the page
ssg_page_typeStringIndicates type of page being rendered. Can be “generic” for a simple page, “post” for a post (requiring date and tags rendering extra), or “post_list” for a postlist.
ssg_site_baseurlStringBase URL Defined in site configuration
ssg_page_pathStringPath to the page that is currently being rendered. Can be useful for certain analytics tools.
nav_linksArrayLinks for the navigation bar. Element 0 is the text for the link, Element 1 is the link itself.
ssg_site_postsArrayArray of all posts on the site. When rendering a postlist for a specific tag or post type, this will only contain the posts for that.

Variables only present on post page renders

NameTypeDescription
ssg_post_dateStringDate the post was created, pre-transformed into a string.
ssg_post_tagsArrayList of the tags the post has assigned.
ssg_post_metaHashUser defined data on a post. Can be used to store extra information, e.g. a featured image.

Custom Post Type variables

Namepage_typeTypeDescription
ssg_post_typepostStringName of the post type being used by the post. Can be used to render the post page differently for custom post types
ssg_post_typepost_listStringName of the post type being listed
Previous Next

basalt-ng documentation

Table of Contents

Table of Contents

  • Theme template variables
    • Variables present on all renders
    • Variables only present on post page renders
    • Custom Post Type variables

GENERAL

  • Home/About basalt-ng
  • Download
  • Release Notes

Documentation

  • Configuration
    • Automatic Build Uploading
    • Custom Menu
    • Netlify
    • Secrets
    • Site Configuration
  • Theme Development
    • Custom Post Types
    • Theme template variables
    • Themes
  • Usage
    • Getting Started
    • Pages
    • Posts