Skip to content

Are page.meta variables visible in templates #7555

Answered by kamilkrzyskow
DeNelo asked this question in Q&A
Discussion options

You must be logged in to vote

MkDocs processes everything using the same templates, including the static template 404 page that doesn't include its own page.meta.

Therefore before every page.meta access you need to validate that it exists:

{% if page.meta and page.meta.description %}

The header partial, for example, uses {{ page.meta.title }}

The header title also does this validation:

  • {% if page.meta and page.meta.title %}

I can't run the -info plugin because I can't build my minimum installation

iirc the info plugin creates the archive in on_config event and then quits early before the template build stage.
Therefore I believe you hav…

Replies: 1 comment 3 replies

Comment options

alexvoss
Sep 23, 2024
Collaborator Sponsor

You must be logged in to vote
3 replies
@DeNelo
Comment options

@kamilkrzyskow
Comment options

Answer selected by DeNelo
@DeNelo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants