Skip to content

Commit

Permalink
fix: canonical links (#1258)
Browse files Browse the repository at this point in the history
This PR fixes canonical links for "index" pages.

When using the `dirhtml` builder, the canonical link should be
`https://example.org/` instead of `https://example.org/index/`. I think
this is an upstream bug in Sphinx.
  • Loading branch information
kai687 authored Apr 15, 2023
1 parent 2aa932c commit dbbac49
Show file tree
Hide file tree
Showing 5 changed files with 462 additions and 485 deletions.
88 changes: 44 additions & 44 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 17 additions & 18 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
alabaster==0.7.13; python_version >= "3.8" and python_version < "4.0"
attrs==22.2.0; python_version >= "3.8" and python_version < "4.0"
babel==2.12.1; python_version >= "3.8" and python_version < "4.0"
beautifulsoup4==4.11.2; python_version >= "3.8" and python_version < "4.0"
black==23.1.0; python_version >= "3.8" and python_version < "4.0"
beautifulsoup4==4.12.2; python_version >= "3.8" and python_version < "4.0"
black==23.3.0; python_version >= "3.8" and python_version < "4.0"
certifi==2022.12.7; python_version >= "3.8" and python_version < "4"
cfgv==3.3.1; python_version >= "3.8" and python_version < "4.0"
charset-normalizer==3.1.0; python_version >= "3.8" and python_version < "4"
click==8.1.3; python_version >= "3.8" and python_version < "4.0"
colorama==0.4.6; python_version >= "3.8" and python_version < "4.0"
coverage==7.2.1; python_version >= "3.8" and python_version < "4.0"
coverage==7.2.3; python_version >= "3.8" and python_version < "4.0"
distlib==0.3.6; python_version >= "3.8" and python_version < "4.0"
docutils==0.19; python_version >= "3.8" and python_version < "4.0"
exceptiongroup==1.1.1; python_version >= "3.8" and python_version < "3.11"
filelock==3.9.0; python_version >= "3.8" and python_version < "4.0"
identify==2.5.20; python_version >= "3.8" and python_version < "4.0"
filelock==3.11.0; python_version >= "3.8" and python_version < "4.0"
identify==2.5.22; python_version >= "3.8" and python_version < "4.0"
idna==3.4; python_version >= "3.8" and python_version < "4"
imagesize==1.4.1; python_version >= "3.8" and python_version < "4.0"
importlib-metadata==6.0.0; python_version >= "3.8" and python_version < "3.10"
importlib-metadata==6.4.1; python_version >= "3.8" and python_version < "3.10"
iniconfig==2.0.0; python_version >= "3.8" and python_version < "4.0"
jinja2==3.1.2; python_version >= "3.8" and python_version < "4.0"
livereload==2.6.3; python_version >= "3.8" and python_version < "4.0"
Expand All @@ -25,23 +24,23 @@ markupsafe==2.1.2; python_version >= "3.8" and python_version < "4.0"
mdit-py-plugins==0.3.5; python_version >= "3.8" and python_version < "4.0"
mdurl==0.1.2; python_version >= "3.8" and python_version < "4.0"
mypy-extensions==1.0.0; python_version >= "3.8" and python_version < "4.0"
mypy==1.1.1; python_version >= "3.8" and python_version < "4.0"
mypy==1.2.0; python_version >= "3.8" and python_version < "4.0"
myst-parser==1.0.0; python_version >= "3.8" and python_version < "4.0"
nodeenv==1.7.0; python_version >= "3.8" and python_version < "4.0"
packaging==23.0; python_version >= "3.8" and python_version < "4.0"
pathspec==0.11.0; python_version >= "3.8" and python_version < "4.0"
platformdirs==3.1.1; python_version >= "3.8" and python_version < "4.0"
packaging==23.1; python_version >= "3.8" and python_version < "4.0"
pathspec==0.11.1; python_version >= "3.8" and python_version < "4.0"
platformdirs==3.2.0; python_version >= "3.8" and python_version < "4.0"
pluggy==1.0.0; python_version >= "3.8" and python_version < "4.0"
pre-commit==3.1.1; python_version >= "3.8" and python_version < "4.0"
pygments==2.14.0; python_version >= "3.8" and python_version < "4.0"
pre-commit==3.2.2; python_version >= "3.8" and python_version < "4.0"
pygments==2.15.0; python_version >= "3.8" and python_version < "4.0"
pytest-cov==4.0.0; python_version >= "3.8" and python_version < "4.0"
pytest==7.2.2; python_version >= "3.8" and python_version < "4.0"
pytest==7.3.1; python_version >= "3.8" and python_version < "4.0"
python-dotenv==1.0.0; python_version >= "3.8" and python_version < "4.0"
pytz==2022.7.1; python_version >= "3.8" and python_version < "3.9"
pytz==2023.3; python_version >= "3.8" and python_version < "3.9"
pyyaml==6.0; python_version >= "3.8" and python_version < "4.0"
requests==2.28.2; python_version >= "3.8" and python_version < "4"
ruff==0.0.254; python_version >= "3.8" and python_version < "4.0"
setuptools==67.6.0; python_version >= "3.8" and python_version < "4.0"
ruff==0.0.260; python_version >= "3.8" and python_version < "4.0"
setuptools==67.6.1; python_version >= "3.8" and python_version < "4.0"
six==1.16.0; python_version >= "3.8" and python_version < "4.0"
snowballstemmer==2.2.0; python_version >= "3.8" and python_version < "4.0"
soupsieve==2.4; python_version >= "3.8" and python_version < "4.0"
Expand All @@ -56,7 +55,7 @@ sphinxcontrib-qthelp==1.0.3; python_version >= "3.8" and python_version < "4.0"
sphinxcontrib-serializinghtml==1.1.5; python_version >= "3.8" and python_version < "4.0"
tomli==2.0.1; python_version >= "3.8" and python_full_version <= "3.11.0a6"
tornado==6.2; python_version >= "3.8" and python_version < "4.0"
types-docutils==0.19.1.6; python_version >= "3.8" and python_version < "4.0"
types-docutils==0.19.1.7; python_version >= "3.8" and python_version < "4.0"
typing-extensions==4.5.0; python_version >= "3.8" and python_version < "4.0"
urllib3==1.26.15; python_version >= "3.8" and python_version < "4"
virtualenv==20.21.0; python_version >= "3.8" and python_version < "4.0"
Expand Down
6 changes: 4 additions & 2 deletions src/sphinxawesome_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
{%- if docsearch %}
<link rel="preconnect" href="https://{{ docsearch_config.app_id }}-dsn.algolia.net" crossorigin />
{% endif %}
{%- if pageurl %}
<link rel="canonical" href="{{ pageurl }}" />
{%- if pageurl and pageurl.endswith("index/") %}
<link rel="canonical" href="{{ pageurl.replace('index/', '')|e }}" />
{%- elif pageurl %}
<link rel="canonical" href="{{ pageurl|e }}" />
{%- endif %}
{%- set _favicon_url = favicon_url | default(pathto('_static/' + (favicon or ""), 1)) %}
{%- if favicon_url or favicon %}
Expand Down
2 changes: 1 addition & 1 deletion src/theme-src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"postcss-loader": "^7.2.4",
"postcss-preset-env": "^8.1.0",
"prettier": "^2.8.7",
"stylelint": "^14.16.1",
"stylelint": "^15.4.0",
"stylelint-config-prettier": "^9.0.5",
"stylelint-prettier": "^3.0.0",
"stylelint-webpack-plugin": "^4.1.0",
Expand Down
Loading

0 comments on commit dbbac49

Please sign in to comment.