Closed hugovk closed 1 year ago
Build docs using dirhtml that has ogp_site_url = "https://devguide.python.org/" in conf.py
dirhtml
ogp_site_url = "https://devguide.python.org/"
conf.py
git clone https://github.com/python/devguide cd devguide make dirhtml # or: # sphinx-build -b dirhtml -d _build/doctrees -W --keep-going -n . _build/dirhtml
Open a non-index page, for example _build/dirhtml/getting-started/getting-help/index.html and check og:url:
_build/dirhtml/getting-started/getting-help/index.html
og:url
<meta property="og:url" content="https://devguide.python.org/getting-started/getting-help/" />
✅
_build/dirhtml/index.html
❌ Appends index to give a 404 URL: https://devguide.python.org/index/
index
<meta property="og:url" content="https://devguide.python.org/index/" />
Don't append index for the main page:
This came up at https://github.com/python/devguide/pull/953#issuecomment-1274377631, see the demo build at https://cpython-devguide--953.org.readthedocs.build/
Also need to deal with other index pages, such as _build/dirhtml/getting-started/index.html:
_build/dirhtml/getting-started/index.html
<meta property="og:url" content="https://devguide.python.org/getting-started/index/" />
❌ https://devguide.python.org/getting-started/index/
✅ https://devguide.python.org/getting-started/
PR https://github.com/wpilibsuite/sphinxext-opengraph/pull/78 updated.
Steps to reproduce
Build docs using
dirhtml
that hasogp_site_url = "https://devguide.python.org/"
inconf.py
Open a non-index page, for example
_build/dirhtml/getting-started/getting-help/index.html
and checkog:url
:✅
_build/dirhtml/index.html
and checkog:url
Actual result
❌ Appends
index
to give a 404 URL: https://devguide.python.org/index/Expected result
Don't append
index
for the main page:See also
This came up at https://github.com/python/devguide/pull/953#issuecomment-1274377631, see the demo build at https://cpython-devguide--953.org.readthedocs.build/