argoproj / argo-workflows

Workflow Engine for Kubernetes
https://argo-workflows.readthedocs.io/
Apache License 2.0
15.11k stars 3.21k forks source link

build(docs): set `site_url` from ReadTheDocs env var #13685

Closed agilgur5 closed 19 hours ago

agilgur5 commented 1 month ago

Motivation

Modifications

Verification

  1. mkdocs serve
  2. Go to http://127.0.0.1:8000/en/latest/ now -- works
  3. Go to http://127.0.0.1:8000/en/latest/sitemap.xml -- actually has content now
  4. Go to http://127.0.0.1:8000/en/latest/wrong -- has a properly styled 404 page.
    Screenshot: Screenshot 2024-10-26 at 11 55 40 PM

agilgur5 commented 1 month ago
  • site_url is required for canonicalization and creating a sitemap.xml
  • Also for certain features like:

Ah I think site_url was also required for to make 404 links (like https://argo-workflows.readthedocs.io/en/release-3.4/wrong) render CSS properly, and that was the original purpose of this PR, but I've forgotten what links I followed (went down a rabbit hole at the time). https://github.com/mkdocs/mkdocs/issues/2318 is related

agilgur5 commented 1 month ago

Ah I think site_url was also required for to make 404 links (like https://argo-workflows.readthedocs.io/en/release-3.4/wrong) render CSS properly, and that was the original purpose of this PR, but I've forgotten what links I followed (went down a rabbit hole at the time).

Found it again: https://docs.readthedocs.io/en/stable/reference/404-not-found.html, under the MkDocs tab:

MkDocs automatically generates a 404.html which Read the Docs will use. However, assets will not be loaded correctly unless you define the site_url configuration value as your site’s canonical base URL.