This is a list of posts, first grouped by year, then month, then sorted by age.
{% set chronological = config['chronological'] %}
{% for year in chronological|sort(reverse=True) %}
<h3>{{ year | strftime("%Y") }}</h3>
{% for month in chronological[year] %}
<h4>{{ month | strftime("%B") }}</h4>
{% for mtime in chronological[year][month]|sort(reverse=True) %}
{% set page = chronological[year][month][mtime] %}
<a href="/{{ page.url }}">{{ page.title }}</a>
<br />
{% endfor %}
{% endfor %}
{% endfor %}
the page titles are shown as None.
I debugged it a little and printed page.meta which was an empty dictionary when printed to the jinja template, although I have set it using YAML syntax (also tried without setting the metadata title since I guess it should be set from the filename). I checked using a breakpoint() inside the mkdocs source code that the page.meta (and also page.title) is read correctly (inside the Page class code), so something happens between that point of code and passing the page to the jinja template.
Workaround
At time being, seems that replacing {{ page.title }} with {{ page.file.url[:-5].split('/')[-1] }} or {{ page.file.url[:-5] }} gives a desired output.
When following the example "archive.md"
the page titles are shown as
None
.I debugged it a little and printed
page.meta
which was an empty dictionary when printed to the jinja template, although I have set it using YAML syntax (also tried without setting the metadatatitle
since I guess it should be set from the filename). I checked using abreakpoint()
inside themkdocs
source code that thepage.meta
(and alsopage.title
) is read correctly (inside the Page class code), so something happens between that point of code and passing the page to the jinja template.Workaround
At time being, seems that replacing
{{ page.title }}
with{{ page.file.url[:-5].split('/')[-1] }}
or{{ page.file.url[:-5] }}
gives a desired output.Versions
(tried also while disabling the mkdocs-bootstrap4 theme).