Render contexts

The top-level names each kind of template sees, and the fields of every render hook.

What a template can read depends on what is being rendered. A layout sees page, site, build and lang; a shortcode also sees shortcode and inner; a render hook sees its node’s fields directly (destination, text, …). A name a template uses outside its context is reported by fugo templates check.

Templates and their names#

TemplateTop-level names
Layout jobpage, site, build, lang, output_format, __nh
Shortcodepage, site, build, lang, shortcode, inner, inner_deindent, __nh
Render hookpage, page_inner, site, build, lang, __nh; plus the hook’s fields, flattened (below)
partial(name=…, …)page, site, build, lang, output_format, __nh; plus the call’s kwargs as top-level names
Component; only its declared arguments; @page, @site, @build, @lang and @__nh may be declared as implicit arguments (looked up in the caller’s scope)
defer templatedata, site, build, __nh
execute_as_templatedata, site, build, __nh
Aliaspermalink, page, site, build
Sitemap, robots, 404page, site, build, lang, __nh
Sitemapindexpage, site, build, lang, __nh, sites
Content adapter (content/**/_content.html)site, build, lang, __nh; site has no page lists (home, pages, regular_pages, all_pages, sections, main_sections, taxonomies, menus): the model is not built yet

What the names hold#

NameMeaning
pagethe full page value of the Full generation
siteSiteView of the current language
buildBuildView: version, environment, generator
langthe language code of the page
output_formatOutputFormatView being rendered
__nhthe render scope (RenderScope); read by site-bound functions
shortcodeShortcodeView: name, args, params, is_named_params, ordinal, parent, position
innerthe inner content (safe)
inner_deindentthe inner content without common indentation
page_innerthe page whose source holds the hooked node (differs inside render_shortcodes)
datathe data= value of the call
permalinkthe target URL
sites[{language, sitemap_abs_url, last_mod}]

__nh is fugo’s render scope. You never print it; site-bound functions such as get_page, paginate or partial read it. A component does not see the caller’s names, so a component that calls a site-bound function declares @__nh, or is passed page=.

Render hook fields#

A render hook’s fields are top-level names: in _markup/render-link.html, write {{ destination }}, not {{ .Destination }}.

Render hookFields
link, imagedestination, title, text, plain_text, is_block, attributes, ordinal, position
headinglevel, anchor, text, plain_text, attributes
codeblocktype, inner, options, attributes, ordinal, position
blockquotetype, alert_type, alert_title, alert_sign, text, attributes, ordinal
tablethead, tbody, attributes, ordinal
passthroughtype, inner, attributes, ordinal, position

    Type to search titles, headings and text.