Skip to content

Commit c23ca25

Browse files
authored
Merge pull request #202 from timvink/copilot/update-mkdocs-theme-documentation
Guard against `page is None` in mkdocs theme override Jinja2 templates
2 parents bbd7758 + a820427 commit c23ca25

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

docs/howto/override-a-theme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ Then you can extend the base `mkdocs` theme by adding a new file `docs/overrides
3232
{{ page.content }}
3333

3434
<!-- This section adds support for localized revision dates -->
35-
{% if page.meta.git_revision_date_localized %}
35+
{% if page and page.meta.git_revision_date_localized %}
3636
<small>Last update: {{ page.meta.git_revision_date_localized }}</small>
3737
{% endif %}
38-
{% if page.meta.git_created_date_localized %}
38+
{% if page and page.meta.git_created_date_localized %}
3939
<small>Created: {{ page.meta.git_created_date_localized }}</small>
4040
{% endif %}
4141
```

tests/fixtures/basic_project/docs/overrides_mkdocs_theme/content.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
{{ page.content }}
1313

14-
{% if page.meta.git_revision_date_localized %}
14+
{% if page and page.meta.git_revision_date_localized %}
1515
<small>Last update: {{ page.meta.git_revision_date_localized }}</small>
1616
{% endif %}

0 commit comments

Comments
 (0)