Skip to content

Commit

Permalink
DOC: better escaping for utteranc.es issue-term
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Oct 9, 2022
1 parent 8bfff15 commit 7c046be
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion doc/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@
{% if sourcename is defined %}
<script src="https://utteranc.es/client.js"
repo="mgeier/insipid-sphinx-theme"
issue-term="comments:{{ pagename|urlencode }}"
{#-
Github's issue search is somewhat fuzzy, but we would like an exact match for issue-term.
Spaces, commas, hyphens, slashes etc. would be treated as search term separators,
which might lead to the wrong comments being included. Therefore, we are replacing
some characters with underscores, and "urlencode" will take care of the rest.
#}
issue-term="comments:{{ pagename
|replace(' ', '_')
|replace(',', '_')
|replace('-', '_')
|replace('~', '_')
|replace('/', '_')
|urlencode
}}"
label="comments"
theme="preferred-color-scheme"
crossorigin="anonymous"
Expand Down

0 comments on commit 7c046be

Please sign in to comment.