Ability to configure fallback to creation date when `as_update` not found?
Hello ,
It seems like the plugin falls back to git logs, and then to build time, if a preconfigured as_update field is not found in the page's meta. Is it possible to configure fallback to another method, e.g. to as_created field?
I wanna explicitly define the update times of my RSS entries, and would like unspecified posts to show creation time as pubTime in the update feed. On a wider scope, it'd be nice to configure different fallback mechanisms for the created and updated fields.
Any current workarounds is appreciated. Thanks a lot.
I managed to monkeypatch this by using mkdocs-macros-plugin to replace updated with created if said key isn't found:
def on_pre_page_macros(env):
try:
env.page.meta['updated']
except KeyError:
env.page.meta['updated'] = env.page.meta['created']
Per their technical notes, on_pre_page_macros(env) should intercept the meta before HTML (and other plugins) are triggered.
Thank you for that workaround! I'm using a date dictionary, my front matter looks like this:
date:
created: 2025-11-15T22:25:53+01:00
I have configured date_from_meta accordingly.
If anyone else is using a setup like that, you can use this version of on_pre_page_macros instead:
def on_pre_page_macros(env):
if (
(dates := env.page.meta.get("date"))
and "created" in dates
and "updated" not in dates
):
dates["updated"] = dates["created"]