{# Facts about the current page that are not part of its own prose: when it was written, when it last changed, how long it takes to read. A byline under the page title, the way a published article carries one -- read once on the way into the page rather than kept beside it, which is why this is no longer rail furniture next to the outline. `git_creation_date_localized` and `git_revision_date_localized` are set on `page.meta` by mkdocs-git-revision-date-localized-plugin -- the first only with `enable_creation_date: true`, the plugin's own default being off. Both come wrapped in a span whose `title` is the same moment down to the second, in UTC. That tooltip is reachable with a mouse and nothing else, and a browser hands it to assistive technology as the name of the date, so a screen reader read out a timestamp where the page showed a plain date. The plugin publishes every format a second time as a bare string, under `..._raw_`, and those are what this uses -- keyed on the type the site configured, since that is the one it means to display. `timeago` is the exception. That variant is an empty element a script fills in, and the plugin pairs it with a hidden `iso_date` so the date still prints and still reads for someone whose scripts did not run -- both keyed on classes only the wrapped output carries. Taking it apart would break those, so a site on `timeago` keeps the plugin's own markup, tooltip and all. `git_page_authors` is put on the page context by mkdocs-git-authors-plugin, as a string of HTML (mailto links), which is why it is not escaped here. `theme.show_metadata` is the line's own switch; each field has its own `theme.show_metadata_*` option too, for a site that wants the dates but not the reading time, say. An item with nothing behind it -- a field turned off, or the plugin it depends on not enabled -- is left out rather than printed empty, and the whole line disappears if every item would be. #} {# The raw key is named after the format in use, and an `or` falls back to the wrapped date: a plugin too old to publish the raw variants would otherwise drop both dates off the page rather than merely keep their tooltips. #} {%- set date_plugin = config.plugins.get('git-revision-date-localized') %} {%- set date_suffix = ('_raw_' ~ date_plugin.config.type) if date_plugin and date_plugin.config.type != 'timeago' else '' %} {%- set created = (page.meta.get('git_creation_date_localized' ~ date_suffix) or page.meta.get('git_creation_date_localized')) if config.theme.show_metadata_created and page and page.meta else none %} {%- set updated = (page.meta.get('git_revision_date_localized' ~ date_suffix) or page.meta.get('git_revision_date_localized')) if config.theme.show_metadata_updated and page and page.meta else none %} {%- set word_count = (page.content | striptags | wordcount) if config.theme.show_metadata_reading_time and page and page.content else 0 %} {%- set reading_minutes = ([1, ((word_count / 265) | round(0, 'ceil')) | int] | max) if word_count else 0 %} {%- set authors = git_page_authors if config.theme.show_metadata_authors else none %} {%- if config.theme.show_metadata and (created or updated or reading_minutes or authors) %} {# The list names itself rather than sitting under a visible heading: a line of facts under the title needs no label on screen, but a screen reader reaching a bare list of dates deserves to be told what it is. `role` on every row of it, which looks redundant on a