Skip to content

Unable to display raw_timeago value #81

@Andre601

Description

@Andre601

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:

{% import "partials/language.html" as lang with context %}

<hr />
<div class="md-source-file">
  <small>

    <!-- mkdocs-git-revision-date-localized-plugin -->
    {% if page.meta.git_revision_date_localized %}
      <span class="twemoji">
        {% include ".icons/octicons/pencil-24.svg" %}
      </span>
      {{ lang.t("source.file.date.updated") }}:
      {{ page.meta.git_revision_date_localized_raw_datetime }} ({{ page.meta.git_revision_date_localized_raw_timeago }})
      {% if page.meta.git_creation_date_localized %}
        <br />
        <span class="twemoji">
          {% include ".icons/octicons/checklist-24.svg" %}
        </span>
        {{ lang.t("source.file.date.created") }}:
        {{ page.meta.git_creation_date_localized_raw_datetime }} ({{ page.meta.git_creation_date_localized_raw_timeago }})
      {% endif %}

    <!-- mkdocs-git-revision-date-plugin -->
    {% elif page.meta.revision_date %}
      <span class="twemoji">
        {% include ".icons/octicons/pencil-24.svg" %}
      </span>
      {{ lang.t("source.file.date.updated") }}:
      {{ page.meta.revision_date }}
    {% endif %}
  </small>
</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions