Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sphinx_rtd_theme/breadcrumbs.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
{%- endif %}

{%- set display_vcs_links = display_vcs_links if display_vcs_links is defined else True %}
{%- set has_source_page = pagename not in ['genindex', 'search'] %}

{#- 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 +31,7 @@
{%- endblock %}
{%- block breadcrumbs_aside %}
<li class="wy-breadcrumbs-aside">
{%- if hasdoc(pagename) and display_vcs_links %}
{%- if hasdoc(pagename) and has_source_page and display_vcs_links %}
{%- if display_github %}
{%- if check_meta and 'github_url' in meta %}
<!-- User defined GitHub URL -->
Expand Down
30 changes: 29 additions & 1 deletion tests/test_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
SingleFileHTMLBuilder,
)

from .util import build_all
from .util import build, build_all


def test_basic():
Expand Down Expand Up @@ -66,6 +66,34 @@ def test_basic():
.format(app.builder.name))


def test_edit_links_are_skipped_for_generated_pages():
html_context = {
'display_github': True,
'github_user': 'readthedocs',
'github_repo': 'sphinx_rtd_theme',
'github_version': 'master/',
'conf_py_path': 'tests/roots/test-basic/',
}

with build('test-basic', confoverrides={'html_context': html_context}) as (
app,
_status,
_warning,
):
content = open(
os.path.join(app.outdir, 'index.html'),
encoding='utf-8',
).read()
assert 'Edit on GitHub' in content

for filename in ['genindex.html', 'search.html']:
content = open(
os.path.join(app.outdir, filename),
encoding='utf-8',
).read()
assert 'Edit on GitHub' not in content


def test_empty():
"""Local TOC is showing, as toctree was empty"""
for (app, status, warning) in build_all('test-empty'):
Expand Down