Skip to content

Commit 1ecdfc8

Browse files
committed
Add edit-this-page.html again
1 parent 2d889c5 commit 1ecdfc8

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{#
2+
3+
Modify the "Edit on Github" links to handle auto-generated pages in the
4+
example gallery and the API reference listings. The GH links that sphinx
5+
generates by default make the assumption that an HTML file comes from an RST
6+
file with the same filepath, which isn't the case for autogenerated files. The
7+
logic to generate the correct URL is in conf.py, but we still have to modify
8+
the template here to change the "Edit this page" text to "View on GitHub".
9+
10+
#}
11+
12+
{% if sourcename is defined and theme_use_edit_page_button==true and page_source_suffix %}
13+
{% set src = sourcename.split('.') %}
14+
<div class="tocsection editthispage">
15+
<a href="{{ make_github_url(sourcename) }}">
16+
<i class="fab fa-github-square"></i> {{ _("View on GitHub") }}
17+
</a>
18+
</div>
19+
{% endif %}

docs/sphinx/source/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,11 +480,11 @@ def make_github_url(file_name):
480480
# variables to pass into the HTML templating engine; these are accessible from
481481
# _templates/breadcrumbs.html
482482
html_context = {
483-
# 'make_github_url': make_github_url,
484-
# 'edit_page_url_template': '{{ make_github_url(file_name) }}',
483+
'make_github_url': make_github_url,
484+
'edit_page_url_template': '{{ make_github_url(file_name) }}',
485485
"github_url": "https://github.com",
486486
"github_user": "pvlib",
487487
"github_repo": "pvlib-python",
488488
"github_version": "main",
489-
"doc_path": "docs/sphinx",
489+
"doc_path": "docs/sphinx/source/",
490490
}

0 commit comments

Comments
 (0)