Templates: context
Blurry populates Jinja templates with context from multiple sources:
blurry.toml
configuration file, usingblurry.schema_data
(seeblurry.toml
for more information)- Dynamic variables constructed by Blurry
- Front matter from Markdown files
The template context variables are:
Variable(s) | Description |
---|---|
body | an HTML string converted from Markdown |
url | the absolute URL for the given page |
schema_type_tag | a <script type="application/ld+json"> tag containing Schema.org markup |
open_graph_tags | Open Graph meta tags, like <meta property="og:title" content="..." /> |
**schema_variables | front matter from the Markdown file, like datePublished |
schema_data | Schema data from blurry.toml |
sibling_pages | for index.md files, includes [{"url", **MarkdownFileData}] for files in the same directory |
file_data_by_directory | all file data grouped by directory, like {"path", list[MarkdownFileData]} |
Example: this page's context variables
Some of the context variable types are pretty complex, and a real-world example could be helpful to show what data they contain. Below are some context variables available to the template used in this very page.
schema_data
{"@context": "https://schema.org", "author": {"@type": "Person", "name": "John Franey", "url": "https://johnfraney.ca"}, "sourceOrganization": {"name": "Blurry"}, "@type": "WebPage", "name": "Templates: context", "abstract": "Documentation for Blurry's template context variables", "datePublished": null, "url": "https://blurry-docs.netlify.app/templates/context/"}
file_data_by_directory
{
'.': [
{
'body': '<h1><span class="blurry">Blurry</span>: A Pyt...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Introduction', 'abstract': 'A Python-powered static site generator with a focus on page speed and SEO.', 'datePublished': datetime.date(2023, 4, 9), 'url': 'https://blurry-docs.netlify.app/'},'path': 'index.md',
},
],
'configuration': [
{
'body': '<h1>Configuration: environment variables</h1>...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Configuration: environment variables', 'abstract': "Documentation for Blurry's settings configuration using environment variables", 'datePublished': datetime.date(2023, 4, 9), 'url': 'https://blurry-docs.netlify.app/configuration/environment-variables/'},'path': 'configuration/environment-variables.md',
},
{
'body': '<h1>Configuration: settings</h1><h2>Reslutio...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Configuration: settings', 'abstract': "Documentation for Blurry's available settings", 'datePublished': datetime.date(2023, 4, 9), 'url': 'https://blurry-docs.netlify.app/configuration/settings/'},'path': 'configuration/settings.md',
},
{
'body': '<h1>blurry.toml</h1><p><span class="blurry">...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Configuration: blurry.toml', 'abstract': "Documentation for Blurry's blurry.toml configuration file", 'datePublished': datetime.date(2023, 4, 9), 'url': 'https://blurry-docs.netlify.app/configuration/blurry.toml/'},'path': 'configuration/blurry.toml.md',
},
],
'getting-started': [
{
'body': '<h1>Getting started: quick start</h1><h2>Req...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Getting started: quick start', 'abstract': 'Documentation for how to get started with Blurry', 'datePublished': datetime.date(2023, 4, 9), 'dateModified': datetime.date(2022, 5, 17), 'url': 'https://blurry-docs.netlify.app/getting-started/quick-start/'},'path': 'getting-started/quick-start.md',
},
],
'content': [
{
'body': '<h1>Content: dynamic</h1><p>When a file in y...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Content: dynamic', 'abstract': "Documentation for Blurry's dynamic file handling using Jinja", 'datePublished': datetime.date(2024, 12, 12), 'url': 'https://blurry-docs.netlify.app/content/dynamic/'},'path': 'content/dynamic.md',
},
{
'body': '<h1>Content: videos</h1><p><span class="blur...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Content: videos', 'abstract': "Documentation for Blurry's video handling", 'datePublished': datetime.date(2023, 6, 4), 'url': 'https://blurry-docs.netlify.app/content/videos/'},'path': 'content/videos.md',
},
{
'body': '<h1>Content: images</h1><p>Image handling is...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Content: images', 'abstract': "Documentation for Blurry's image handling", 'datePublished': datetime.date(2023, 4, 9), 'url': 'https://blurry-docs.netlify.app/content/images/'},'path': 'content/images.md',
},
{
'body': '<h1>Content: Markdown</h1><p>Content is writ...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Content: Markdown', 'abstract': "Documentation for Blurry's Markdown handling", 'datePublished': datetime.date(2023, 4, 9), 'dateModified': datetime.date(2023, 6, 4), 'url': 'https://blurry-docs.netlify.app/content/markdown/'},'path': 'content/markdown.md',
},
],
'plugins': [
{
'body': '<h1>Plugins: write an Jinja extension plugin<...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Plugins: write a Jinja extension plugin', 'abstract': "Documentation for Blurry's Jinja extension plugins", 'datePublished': datetime.date(2024, 4, 28), 'url': 'https://blurry-docs.netlify.app/plugins/write-a-jinja-extension-plugin/'},'path': 'plugins/write-a-jinja-extension-plugin.md',
},
{
'body': '<h1>Plugins: write an Jinja filter plugin</h1...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Plugins: write a Jinja filter plugin', 'abstract': "Documentation for Blurry's Jinja filter plugins", 'datePublished': datetime.date(2024, 2, 29), 'url': 'https://blurry-docs.netlify.app/plugins/write-a-jinja-filter-plugin/'},'path': 'plugins/write-a-jinja-filter-plugin.md',
},
{
'body': '<h1>Plugins: intro</h1><aside role="note" cl...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Plugins: intro', 'abstract': "Documentation for Blurry's plugin architecture", 'datePublished': datetime.date(2023, 4, 15), 'url': 'https://blurry-docs.netlify.app/plugins/intro/'},'path': 'plugins/intro.md',
},
{
'body': '<h1>Plugins: write a Markdown plugin</h1><p>...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Plugins: write a Markdown plugin', 'abstract': "Documentation for Blurry's Markdown plugins", 'datePublished': datetime.date(2023, 4, 15), 'url': 'https://blurry-docs.netlify.app/plugins/write-a-markdown-plugin/'},'path': 'plugins/write-a-markdown-plugin.md',
},
{
'body': '<h1>Plugins: write an HTML plugin</h1><p>A <...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Plugins: write an HTML plugin', 'abstract': "Documentation for Blurry's HTML plugins", 'datePublished': datetime.date(2023, 4, 15), 'url': 'https://blurry-docs.netlify.app/plugins/write-an-html-plugin/'},'path': 'plugins/write-an-html-plugin.md',
},
],
'commands': [
{
'body': '<h1>Commands: <code>runserver</code></h1><p>...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Commands: runserver', 'abstract': "Documentation for Blurry's runserver command", 'datePublished': datetime.date(2023, 4, 9), 'url': 'https://blurry-docs.netlify.app/commands/runserver/'},'path': 'commands/runserver.md',
},
{
'body': '<h1>Commands: build</h1><p><code>build</code...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Commands: build', 'abstract': "Documentation for Blurry's build command", 'datePublished': datetime.date(2023, 4, 9), 'url': 'https://blurry-docs.netlify.app/commands/build/'},'path': 'commands/build.md',
},
],
'templates': [
{
'body': '<h1>Templates: components</h1><p>Template co...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Templates: components', 'abstract': "Documentation for Blurry's template components using JinjaX", 'datePublished': datetime.date(2023, 12, 6), 'url': 'https://blurry-docs.netlify.app/templates/components/'},'path': 'templates/components.md',
},
{
'body': '<h1>Templates: syntax</h1><h2>Overview</h2>...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Templates: syntax', 'abstract': "Documentation for Blurry's template files and Jinja syntax", 'datePublished': datetime.date(2023, 4, 9), 'dateModified': datetime.date(2023, 4, 28), 'image': {'contentUrl': 'https://blurry-docs.netlify.app/images/schema.org-logo.png'}, 'url': 'https://blurry-docs.netlify.app/templates/syntax/'},'path': 'templates/syntax.md',
},
{
'body': '<h1>Templates: examples</h1><h2>Base templat...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Templates: examples', 'abstract': 'Example Jinja templates for your Blurry project', 'datePublished': datetime.date(2023, 4, 9), 'url': 'https://blurry-docs.netlify.app/templates/examples/'},'path': 'templates/examples.md',
},
{
'body': '<h1>Templates: context</h1><p><span class="b...',
'front_matter': {'author': {'@type': 'Person', 'name': 'John Franey', 'url': 'https://johnfraney.ca'}, 'sourceOrganization': {'name': 'Blurry'}, '@type': 'WebPage', 'name': 'Templates: context', 'abstract': "Documentation for Blurry's template context variables", 'datePublished': datetime.date(2023, 4, 9), 'url': 'https://blurry-docs.netlify.app/templates/context/'},'path': 'templates/context.md',
},
],
}
open_graph_tags
<meta property="og:type" content="website">
<meta property="og:url" content="https://blurry-docs.netlify.app/templates/context/">
<meta property="og:description" content="Documentation for Blurry's template context variables">
<meta property="og:site_name" content="Blurry">
schema_type_tag
<script type="application/ld+json">{"@context": "https://schema.org", "author": {"@type": "Person", "name": "John Franey", "url": "https://johnfraney.ca"}, "sourceOrganization": {"name": "Blurry"}, "@type": "WebPage", "name": "Templates: context", "abstract": "Documentation for Blurry's template context variables", "datePublished": null, "url": "https://blurry-docs.netlify.app/templates/context/"}</script>