Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b5065d4

Browse files
make edit-this-page links more robust
1 parent 5c97642 commit b5065d4

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

_includes/layouts/breadcrumb.html

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,21 @@
7171
-->
7272

7373
<div class="--fork">
74-
{% if page.language == "python" and page.layout != "langindex" %}
75-
{% assign offset = page.permalink | size | minus: 1 %}
76-
{% assign filename = page.permalink | slice: 0, offset %}
74+
{% if page.path contains "/python/html/" %}
75+
{% assign filename = page.path | replace: "_posts/python/html/2019-07-03-", "" | replace: ".html", ".md" %}
7776

78-
<a href= "{{ filename | prepend: "https://mybinder.org/v2/gh/plotly/plotly.py/doc-prod?filepath=doc%2F" | append: ".md" }}"
79-
target="_blank" style="float: right; margin-left: 20px;">
80-
<img src="/all_static/images/binder_badge.svg" />
81-
</a>
77+
<a href= "{{ filename | prepend: "https://mybinder.org/v2/gh/plotly/plotly.py/doc-prod?filepath=doc%2Fpython%2F" }}"
78+
target="_blank" style="float: right; margin-left: 20px;">
79+
<img src="/all_static/images/binder_badge.svg" />
80+
</a>
8281

83-
<a id="forklink" href= "{{ filename | prepend: "https://github.com/plotly/plotly.py/edit/doc-prod/doc/" | append: ".md" }}" >
82+
<a id="forklink" href= "{{ filename | prepend: "https://github.com/plotly/plotly.py/edit/doc-prod/doc/python/" }}" >
83+
{% elsif page.path contains "/r/md/" %}
84+
{% assign filename = page.path | replace: "_posts/r/md/", "" | replace: ".md", ".Rmd" %}
85+
<a id="forklink" href= "{{ filename | prepend: "https://github.com/plotly/plotly.r-docs/edit/master/r/" }}" >
8486
{% else %}
85-
{% assign filename = page.path | split, "/" | last %}
86-
<a id="forklink" href= "{{ page.path | remove: filename | prepend: "https://github.com/plotly/documentation/tree/source-design-merge/" }}" >
87+
{% assign filename = page.path | split, "/" | last %}
88+
<a id="forklink" href= "{{ page.path | remove: filename | prepend: "https://github.com/plotly/documentation/tree/source-design-merge/" }}" >
8789
{% endif %}
8890
<div class="icon">
8991
<svg style="width:24px;height:24px" viewbox="0 0 24 24">

0 commit comments

Comments
 (0)