Social cards and structured data
Markup you own, from values that already exist
sqzass injects nothing into <head>. There is no injection point and there will
not be one — a generator that quietly adds tags is a generator you cannot fully
read the output of. Everything below is markup you put in your own base.html,
built from values already in the template context.
OpenGraph and Twitter
Without these, every page of your site renders as a bare URL in Slack, Discord and KakaoTalk.
{%- if page.description %}
{%- endif %}
summary, not summary_large_image — the large variant needs an image, and
declaring it without one produces an empty box rather than a nicer card. If you
have a per-page image, put it in front matter and switch:
+++
= "Installation"
[]
= "/images/install.png"
+++
{%- if page.extra.image %}
{%- else %}
{%- endif %}
og:image must be absolute, which is what site.origin is for.
Breadcrumbs as JSON-LD
This is the one piece of structured data that visibly changes a Google result
for a documentation site: the result shows Home › Writing content › Front matter
instead of a bare URL.
{%- if page.section %}
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{"@type": "ListItem", "position": 1, "name": "{{ site.title }}", "item": "{{ site.origin }}{{ site.base_path }}/"},
{"@type": "ListItem", "position": 2, "name": "{{ page.section.title }}", "item": "{{ site.origin }}{{ page.section.url }}"},
{"@type": "ListItem", "position": 3, "name": "{{ page.title }}", "item": "{{ page.permalink }}"}
]
}
{%- endif %}
Note the {%- if page.section %}: top-level pages have no section, and a
breadcrumb with a missing rung is worse than none.
Warning
This block is inside <script>, where HTML escaping is wrong — a title
containing " produces invalid JSON. Keep titles free of quotes, or drop the
structured data rather than shipping JSON that silently fails to parse. This
is the one place in a template where our escaping does not protect you.
Site-level
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "{{ site.title }}",
"url": "{{ site.origin }}{{ site.base_path }}/"
}
One block, on every page, is enough. Search engines read it once.