Skip to content

Conversation

@simondeziel
Copy link
Member

No description provided.

@github-actions github-actions bot added the Documentation Documentation needs updating label Aug 18, 2025
@simondeziel simondeziel marked this pull request as ready for review August 18, 2025 19:31
@simondeziel
Copy link
Member Author

@minaelee I couldn't find why the git repo was "unshallowed" but it seems to work if we don't do this step. It also saves ~15s.

@tomponline tomponline merged commit ce275af into canonical:main Aug 18, 2025
25 checks passed
@minaelee
Copy link
Contributor

minaelee commented Aug 18, 2025

@minaelee I couldn't find why the git repo was "unshallowed" but it seems to work if we don't do this step. It also saves ~15s.

It was unshallowed because at the time I added sphinx-sitemap as newly required this cycle, there was a default setting in sphinx-sitemap that used sphinx-last-updated-by-git, which is needed to set the sphinx-sitemap's last updated times for each page in the sitemap (preferred for SEO). This also fixed a long-standing bug where the "Last updated on" note at the bottom of each page in the docs was incorrect (showed the same date for every page). However, since that addition, sphinx-sitemap changed its default not to use sphinx-last-updated-by-git, which had the effect of removing the benefits noted above.

So right now it works with a shallow clone, but I will need to update our implementation of sphinx-sitemap so that it needs an unshallowed clone again. Long story short, please leave it as an unshallowed clone.

Edit: Since it's already merged, I can wait to revert the change when I update (and version lock) sphinx-sitemap!

@simondeziel simondeziel deleted the refresh-rtd branch August 18, 2025 19:55
@simondeziel
Copy link
Member Author

@minaelee I couldn't find why the git repo was "unshallowed" but it seems to work if we don't do this step. It also saves ~15s.

It was unshallowed because at the time I added sphinx-sitemap as newly required this cycle, there was a default setting in sphinx-sitemap that used sphinx-last-updated-by-git, which is needed to set the sphinx-sitemap's last updated times for each page in the sitemap (preferred for SEO). This also fixed a long-standing bug where the "Last updated on" note at the bottom of each page in the docs was incorrect (showed the same date for every page). However, since that addition, sphinx-sitemap changed its default not to use sphinx-last-updated-by-git, which had the effect of removing the benefits noted above.

Thanks for the explanation. I'm surprised the "Last updated on" note needs a full clone but I must be missing some context. Anyway, in a shallow clone:

$ git clone --depth 1 https://github.com/canonical/lxd && cd lxd
$ git log -1 --format="%aD" doc/authentication.md
Mon, 18 Aug 2025 20:45:36 +0100

Edit: Since it's already merged, I can wait to revert the change when I update (and version lock) sphinx-sitemap!

OK, thanks.

@minaelee
Copy link
Contributor

Thanks for the explanation. I'm surprised the "Last updated on" note needs a full clone but I must be missing some context.

Per: https://sphinx-sitemap.readthedocs.io/en/latest/advanced-configuration.html#adding-last-modified-timestamps

tomponline added a commit that referenced this pull request Dec 4, 2025
## PR description

Replaces the statically set value for `html_baseurl` to use RTD
environment variable, or `"/"` if not available (for local builds). This
ensures that the HTML metadata canonical URL is set correctly, including
the version in the URL. This change required also updating the
`sitemap_url_scheme` to prevent duplicating the version string, since
the sitemap extension uses `html_baseurl` to create the link.

References:
- https://docs.readthedocs.com/platform/stable/canonical-urls.html
-
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl

Also:
- Adds last modified timestamps to sitemap URLs to improve SEO. This
used to be the default for the sitemap but was changed upstream.
Requires setting `.readthedocs.yaml` to use a non-shallow clone (see
previous discussion in #16249).
- Adds a list of files to exclude from the sitemap.


## Checklist

- [x] I have read the [contributing
guidelines](https://github.com/canonical/lxd/blob/main/CONTRIBUTING.md)
and attest that all commits in this PR are [signed
off](https://github.com/canonical/lxd/blob/main/CONTRIBUTING.md#including-a-signed-off-by-line-in-your-commits),
[cryptographically
signed](https://github.com/canonical/lxd/blob/main/CONTRIBUTING.md#commit-signature-verification),
and follow this project's [commit
structure](https://github.com/canonical/lxd/blob/main/CONTRIBUTING.md#commit-structure).
- [x] I have checked and added or updated relevant documentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Documentation needs updating

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants