Add `last updated` for document (#11164)
Some checks are pending
CI / check system | python3.13 on windows x86-64 (push) Blocked by required conditions
CI / check system | windows registry (push) Blocked by required conditions
CI / check system | python3.12 via chocolatey (push) Blocked by required conditions
CI / check system | conda3.11 on windows x86-64 (push) Blocked by required conditions
CI / check system | conda3.8 on windows x86-64 (push) Blocked by required conditions
CI / check system | python3.10 on windows x86-64 (push) Blocked by required conditions
CI / check system | python3.10 on windows x86 (push) Blocked by required conditions
CI / typos (push) Waiting to run
CI / cargo dev generate-all (push) Blocked by required conditions
CI / cargo shear (push) Waiting to run
CI / cargo test | ubuntu (push) Blocked by required conditions
CI / test windows trampoline | i686 (push) Blocked by required conditions
CI / test windows trampoline | x86_64 (push) Blocked by required conditions
CI / Determine changes (push) Waiting to run
CI / lint (push) Waiting to run
CI / cargo clippy | ubuntu (push) Blocked by required conditions
CI / cargo clippy | windows (push) Blocked by required conditions
CI / cargo test | macos (push) Blocked by required conditions
CI / smoke test | windows aarch64 (push) Blocked by required conditions
CI / check system | python on macos aarch64 (push) Blocked by required conditions
CI / check system | homebrew python on macos aarch64 (push) Blocked by required conditions
CI / check system | python on macos x86-64 (push) Blocked by required conditions
CI / cargo test | windows (push) Blocked by required conditions
CI / check windows trampoline | aarch64 (push) Blocked by required conditions
CI / check windows trampoline | i686 (push) Blocked by required conditions
CI / check windows trampoline | x86_64 (push) Blocked by required conditions
CI / mkdocs (push) Waiting to run
CI / build binary | linux libc (push) Blocked by required conditions
CI / build binary | linux musl (push) Blocked by required conditions
CI / build binary | macos aarch64 (push) Blocked by required conditions
CI / build binary | macos x86_64 (push) Blocked by required conditions
CI / build binary | windows x86_64 (push) Blocked by required conditions
CI / build binary | windows aarch64 (push) Blocked by required conditions
CI / cargo build (msrv) (push) Blocked by required conditions
CI / build binary | freebsd (push) Blocked by required conditions
CI / smoke test | windows x86_64 (push) Blocked by required conditions
CI / ecosystem test | pydantic/pydantic-core (push) Blocked by required conditions
CI / ecosystem test | prefecthq/prefect (push) Blocked by required conditions
CI / ecosystem test | pallets/flask (push) Blocked by required conditions
CI / smoke test | linux (push) Blocked by required conditions
CI / smoke test | macos (push) Blocked by required conditions
CI / integration test | conda on ubuntu (push) Blocked by required conditions
CI / integration test | deadsnakes python3.9 on ubuntu (push) Blocked by required conditions
CI / integration test | free-threaded on linux (push) Blocked by required conditions
CI / integration test | free-threaded on windows (push) Blocked by required conditions
CI / integration test | pypy on ubuntu (push) Blocked by required conditions
CI / integration test | pypy on windows (push) Blocked by required conditions
CI / integration test | graalpy on ubuntu (push) Blocked by required conditions
CI / integration test | graalpy on windows (push) Blocked by required conditions
CI / integration test | github actions (push) Blocked by required conditions
CI / integration test | determine publish changes (push) Blocked by required conditions
CI / check system | alpine (push) Blocked by required conditions
CI / integration test | uv publish (push) Blocked by required conditions
CI / check cache | ubuntu (push) Blocked by required conditions
CI / check cache | macos aarch64 (push) Blocked by required conditions
CI / check system | python on debian (push) Blocked by required conditions
CI / check system | python on fedora (push) Blocked by required conditions
CI / check system | python on ubuntu (push) Blocked by required conditions
CI / check system | python on opensuse (push) Blocked by required conditions
CI / check system | python on rocky linux 8 (push) Blocked by required conditions
CI / check system | python on rocky linux 9 (push) Blocked by required conditions
CI / check system | pypy on ubuntu (push) Blocked by required conditions
CI / check system | pyston (push) Blocked by required conditions
CI / check system | python3.9 via pyenv (push) Blocked by required conditions
CI / check system | python3.13 (push) Blocked by required conditions
CI / check system | conda3.11 on macos aarch64 (push) Blocked by required conditions
CI / check system | conda3.8 on macos aarch64 (push) Blocked by required conditions
CI / check system | conda3.11 on linux x86-64 (push) Blocked by required conditions
CI / check system | conda3.8 on linux x86-64 (push) Blocked by required conditions
CI / check system | amazonlinux (push) Blocked by required conditions
CI / check system | embedded python3.10 on windows x86-64 (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions

## Summary

![image](https://github.com/user-attachments/assets/75431f9f-debe-435d-a02e-d216be7a3a01)

![image](https://github.com/user-attachments/assets/2d1b895e-4878-410e-90ff-ff8e932cbf24)
Display the last document update time, excluding any automatically
generated parts of the document, while ensuring that Google can
accurately read and recognize the webpage's time.

Note that I do not have permission to update
``requirements-insiders.txt``


Google time info
*
https://developers.google.com/search/blog/2019/03/help-google-search-know-best-date-for
*
https://developers.google.com/search/docs/appearance/structured-data/article#amp

Similar https://github.com/astral-sh/uv/pull/11162
Closes #11148
## Test Plan
uvx --with-requirements docs/requirements.txt -- mkdocs serve -f
mkdocs.public.yml --strict

![image](https://github.com/user-attachments/assets/6e8cd609-2e60-489c-97cc-fb28aa3204e0)
The correct format is actually ``2024-08-08T22:01:08Z``, but Google
Search happens to be lenient and accepts this format.

![image](https://github.com/user-attachments/assets/2ec8ce98-49ea-403b-bbd2-3d0d5630a562)
This commit is contained in:
FishAlchemist 2025-02-04 11:28:47 +08:00 committed by GitHub
parent 73e9928d40
commit 49b85d2e65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 22 additions and 1 deletions

View file

@ -26,6 +26,7 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
fetch-depth: 0
- uses: actions/setup-python@v5
with:

View file

@ -21,6 +21,10 @@
<meta name="robots" content="index,follow"/>
<script type="application/ld+json">
{
{% if page and page.meta.git_revision_date_localized_raw_iso_datetime %}
"datePublished": "{{ page.meta.git_revision_date_localized_raw_iso_datetime }}Z",
"dateModified": "{{ page.meta.git_revision_date_localized_raw_iso_datetime }}Z",
{% endif %}
"@context": "https://schema.org",
"@type": "WebSite",
"name": "Astral Docs",

View file

@ -6,3 +6,4 @@ mdformat>=0.7.17
mdformat-mkdocs>=2.0.4
mdformat-admon>=2.0.2
mkdocs-redirects>=1.2.2
mkdocs-git-revision-date-localized-plugin>=1.3.0

View file

@ -1,7 +1,9 @@
# This file was autogenerated by uv via the following command:
# uv pip compile docs/requirements.in -o docs/requirements.txt --universal -p 3.12
babel==2.15.0
# via mkdocs-material
# via
# mkdocs-git-revision-date-localized-plugin
# mkdocs-material
black==24.4.2
# via -r docs/requirements.in
certifi==2024.7.4
@ -19,6 +21,10 @@ colorama==0.4.6
# mkdocs-material
ghp-import==2.1.0
# via mkdocs
gitdb==4.0.12
# via gitpython
gitpython==3.1.44
# via mkdocs-git-revision-date-localized-plugin
idna==3.7
# via requests
jinja2==3.1.4
@ -72,10 +78,13 @@ mergedeep==1.3.4
mkdocs==1.6.0
# via
# -r docs/requirements.in
# mkdocs-git-revision-date-localized-plugin
# mkdocs-material
# mkdocs-redirects
mkdocs-get-deps==0.2.0
# via mkdocs
mkdocs-git-revision-date-localized-plugin==1.3.0
# via -r docs/requirements.in
mkdocs-material==9.5.29
# via -r docs/requirements.in
mkdocs-material-extensions==1.3.1
@ -106,6 +115,8 @@ pymdown-extensions==10.8.1
# via mkdocs-material
python-dateutil==2.9.0.post0
# via ghp-import
pytz==2025.1
# via mkdocs-git-revision-date-localized-plugin
pyyaml==6.0.1
# via
# mkdocs
@ -120,6 +131,8 @@ requests==2.32.3
# via mkdocs-material
six==1.16.0
# via python-dateutil
smmap==5.0.2
# via gitdb
uc-micro-py==1.0.3
# via linkify-it-py
urllib3==2.2.2

View file

@ -2,6 +2,8 @@ INHERIT: mkdocs.template.yml
# Omit the `typeset` plugin which is only available in the Insiders version.
plugins:
- search
- git-revision-date-localized:
timezone: UTC # It can only be in UTC unless the ISO time can include timezone.
validation:
anchors: warn
watch: