Skip to content

Commit 34bf910

Browse files
committed
Add canonical url link in header
Add canonical url to all pages. Requires upgrade to at least 1.8.0 of sphinx. Upgraded virualenv on sourceforge to have sphinx 1.8.5 to allow it to work. Hand patched the files on sourceforge and deployed. Also added a postprocess step to Makefile needed on sourceforge to load searchtools.js.
1 parent 86f07b1 commit 34bf910

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

website/www/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ docs:
1515
ln -s ../../doc ./docs
1616
ln -s ../../COPYING.txt
1717

18+
# after upgrade to sphinx 1.8.5, search.html is missing load of searchtools.
19+
# fix that in postprocess
1820
html: docs
1921
mkdir -p $(TMP)/doctrees $(HTML)
2022
sphinx-build -n -W -b html -d $(TMP)/doctrees . $(HTML)
23+
grep 'searchtools.js' html/search.html || sed -i -e '/language_data.js/s#</script>#</script>\n <script type="text/javascript" src="_static/searchtools.js"></script>#' html/search.html
2124

2225
linkcheck:
2326
mkdir -p $(TMP)/linkcheck $(TMP)/doctrees

website/www/_templates/layout.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
{%- for scriptfile in script_files %}
3535
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
3636
{%- endfor %}
37+
{%- if pageurl %}
38+
<link rel="canonical" href="{{ pageurl|e }}" />
39+
{%- endif %}
3740
{%- if use_opensearch %}
3841
<link rel="search" type="application/opensearchdescription+xml"
3942
title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"

website/www/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@
106106
# A shorter title for the navigation bar. Default is the same as html_title.
107107
#html_short_title = None
108108

109+
# The base URL which points to the root of the HTML documentation. It is
110+
# used to indicate the location of document using The Canonical Link Relation.
111+
html_baseurl = "https://www.roundup-tracker.org/"
112+
109113
# The name of an image file (relative to this directory) to place at the top
110114
# of the sidebar.
111115
#html_logo = None

0 commit comments

Comments
 (0)