You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My goal is to display both the last update and creation date as <day>. <month> <year> <h>:<m>:<s> (<relative time>)
For example, a page created on the 13th of June 2021 and last updated on the 18th of January 2022 should display something like this:
Last updated: 18. January 2022 00:00:01 (1 month ago)
Created: 13. June 2021 00:00:01 (7 months ago)
When I however use the {{ page.meta.git_creation_date_localized_raw_timeago }} value, as mentioned by the docs, inside the partial override does this end up in an empty parenthesis (()) being displayed.
I'm not sure if I'm doing anything wrong in particular, so feedback is appreciated.
Here is the current source-file.html override in its entirety:
Small update.
Looking at the generated HTML source, does it seem like that {{page.meta.git_revision_date_localized_raw_timeago }} and its creation counterpart are replaces with a <span> element having the timeago class applied alongside a datetime and locale setting.
The span itself is completely empty.
I found a temporary workaround for this weird situation.
I changed type in the mkdocs.yml to timeago and updated the above lines to {{ page.meta.git_revision_date_localized_raw_datetime }} ({{ page.meta.git_revision_date_localized }})
My personal guess as to why this acts so weird is the fact that the timeago.js isn't added by default, which causes this unwanted behaviour. Maybe a setting to manually enable this in the future would be useful?
Hi @Andre601. You figured it out. timeago.js dependency is only added when type: timeago is set. The empty <span> is correct.. the javascript library will populate it.
I will update the documentation with instructions to use extra_javascript in mkdocs.yml.
My goal is to display both the last update and creation date as
<day>. <month> <year> <h>:<m>:<s> (<relative time>)
For example, a page created on the 13th of June 2021 and last updated on the 18th of January 2022 should display something like this:
When I however use the
{{ page.meta.git_creation_date_localized_raw_timeago }}
value, as mentioned by the docs, inside the partial override does this end up in an empty parenthesis (()
) being displayed.I'm not sure if I'm doing anything wrong in particular, so feedback is appreciated.
Here is the current
source-file.html
override in its entirety:The text was updated successfully, but these errors were encountered: