Skip to content

Commit 2defd13

Browse files
committed
support arbitrary source URLs
This allows the user to specify a different repository, possibly outside of GitHub to link the "show source" to. Closes: #87
1 parent a5ec3ee commit 2defd13

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

alabaster/layout.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,14 @@
5151
{% endif %}
5252
{%- if show_source and has_source and sourcename %}
5353
{% if show_copyright or theme_show_powered_by %}|{% endif %}
54+
{%- if source_url_prefix %}
55+
<a href="{{ source_url_prefix }}{{ pagename }}{{ source_suffix }}"
56+
rel="nofollow">{{ _('Page source') }}</a>
57+
{%- else %}
5458
<a href="{{ pathto('_sources/' + sourcename, true)|e }}"
5559
rel="nofollow">{{ _('Page source') }}</a>
5660
{%- endif %}
61+
{%- endif %}
5762
</div>
5863

5964
{% if theme_github_banner|lower != 'false' %}

alabaster/theme.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ sidebar_includehidden = true
2828
sidebar_collapse = true
2929
show_powered_by = true
3030
show_related = false
31+
source_url_prefix =
3132

3233
gray_1 = #444
3334
gray_2 = #EEE

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Changelog
33
=========
44

5+
* :feature:`87` Add support for arbitrary "edit source" link
6+
targets. Credit: ``@anarcat``.
57
* :support:`- backported` Miscellaneous project maintenance updates such as
68
adding to Travis CI and enforcing the use of ``flake8``.
79
* :feature:`110 backported` Add ``badge_branch`` option allowing

0 commit comments

Comments
 (0)