Skip to content

Commit

Permalink
Respect html_show_sourcelink setting
Browse files Browse the repository at this point in the history
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_show_sourcelink

Also simplify check to disable source linking on search page.
  • Loading branch information
abitrolly committed Dec 3, 2024
1 parent 8d4d394 commit d698f72
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 13 additions & 2 deletions sphinx_rtd_theme/breadcrumbs.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@
{%- set display_gitlab = True %}
{%- endif %}

{%- set display_vcs_links = display_vcs_links if display_vcs_links is defined else True %}
{%- set sourcelinks = True %}
{%- if html_show_sourcelink is false %}
{#- https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_show_sourcelink -#}
{%- set sourcelinks = False %}
{%- elif hasdoc(pagename) is false %}
{#- disable for autogenerated pages -#}
{%- set sourcelinks = False %}
{%- elif pagename == 'search' %}
{#- explicitly disable for search page -#}
{#- https://github.com/readthedocs/sphinx_rtd_theme/issues/934 -#}
{%- set sourcelinks = False %}
{%- endif %}

{#- Translators: This is an ARIA section label for page links, including previous/next page link and links to GitHub/GitLab/etc. -#}
<div role="navigation" aria-label="{{ _('Page navigation') }}">
Expand All @@ -30,7 +41,7 @@
{%- endblock %}
{%- block breadcrumbs_aside %}
<li class="wy-breadcrumbs-aside">
{%- if hasdoc(pagename) and display_vcs_links %}
{%- if sourcelinks %}
{%- if display_github %}
{%- if check_meta and 'github_url' in meta %}
<!-- User defined GitHub URL -->
Expand Down
1 change: 0 additions & 1 deletion sphinx_rtd_theme/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#}
{%- extends "layout.html" %}
{% set title = _('Search') %}
{% set display_vcs_links = False %}
{%- block scripts %}
{{ super() }}
<script src="{{ pathto('_static/searchtools.js', 1) }}"></script>
Expand Down

0 comments on commit d698f72

Please sign in to comment.