Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: place the las_update value in the meta of each page #1409

Merged
merged 9 commits into from
Aug 21, 2023
Merged
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
html_logo = "_static/logo.svg"
html_favicon = "_static/logo.svg"
html_sourcelink_suffix = ""
html_last_updated_fmt = "" # to reveal the build date in the pages meta

# Define the json_url for our version switcher.
json_url = "https://pydata-sphinx-theme.readthedocs.io/en/latest/_static/switcher.json"
Expand Down
15 changes: 15 additions & 0 deletions docs/user_guide/layout.rst
Original file line number Diff line number Diff line change
Expand Up @@ -567,3 +567,18 @@ could do so with the following steps:
"navbar_start": ["navbar-logo", "version"],
# ...
}

Build date
==========

By default the build date cannot be seen in our template even when the `html_last_updated_fmt <https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_last_updated_fmt>`__ is set. Instead the theme adds a ``meta`` tag in the HTML head that specifies the build date, which can be inspected by viewing the page source or extracted with an HTML parser. The tag will look like:
drammock marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: html

<meta name="docbuild:last-update" content="Aug 15, 2023">

The tag's ``content`` attribute will follow the format specified in the ``html_last_updated_fmt`` configuration variable.

.. note::

If a special component to display such an information in your page is your need please use the built-in :code:`last-updated`.
drammock marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
{%- block extrahead %}
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="docsearch:language" content="{{ language }}"/>
{%- if last_updated %}
<meta name="docbuild:last-update" content="{{ last_updated | e }}"/>
{%- endif %}
{%- endblock extrahead %}
{% block body_tag %}
{# set up with scrollspy to update the toc as we scroll #}
Expand Down
Loading