Skip to content

Commit b93f665

Browse files
committed
Respect html_show_sourcelink setting
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_show_sourcelink Also simplify check to disable source linking on search page.
1 parent 8d4d394 commit b93f665

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

sphinx_rtd_theme/breadcrumbs.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,18 @@
1616
{%- set display_gitlab = True %}
1717
{%- endif %}
1818

19-
{%- set display_vcs_links = display_vcs_links if display_vcs_links is defined else True %}
19+
{%- set sourcelinks = True %}
20+
{%- if html_show_sourcelink is false %}
21+
{#- https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_show_sourcelink -#}
22+
{%- set sourcelinks = False %}
23+
{%- elif hasdoc(pagename} is false %}
24+
{#- disable for autogenerated pages -#}
25+
{%- set sourcelinks = False %}
26+
{%- elif pagename == 'search' %}
27+
{#- explicitly disable for search page -#}
28+
{#- https://github.com/readthedocs/sphinx_rtd_theme/issues/934 -#}
29+
{%- set sourcelinks = False %}
30+
{%- endif %}
2031

2132
{#- Translators: This is an ARIA section label for page links, including previous/next page link and links to GitHub/GitLab/etc. -#}
2233
<div role="navigation" aria-label="{{ _('Page navigation') }}">
@@ -30,7 +41,7 @@
3041
{%- endblock %}
3142
{%- block breadcrumbs_aside %}
3243
<li class="wy-breadcrumbs-aside">
33-
{%- if hasdoc(pagename) and display_vcs_links %}
44+
{%- if sourcelinks %}
3445
{%- if display_github %}
3546
{%- if check_meta and 'github_url' in meta %}
3647
<!-- User defined GitHub URL -->

sphinx_rtd_theme/search.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#}
1010
{%- extends "layout.html" %}
1111
{% set title = _('Search') %}
12-
{% set display_vcs_links = False %}
1312
{%- block scripts %}
1413
{{ super() }}
1514
<script src="{{ pathto('_static/searchtools.js', 1) }}"></script>

0 commit comments

Comments
 (0)