Skip to content

Commit 15da8bb

Browse files
committed
Fix issue with link to GitHub from RMarkdown files
Jekyll doesn't export the _episodes_rmd so we need to flag the files. Each Rmd file must have in the YAML header source: Rmd
1 parent 8874a3f commit 15da8bb

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

_includes/lesson_footer.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ <h4>
1717
</div>
1818
<div class="col-md-6" align="right">
1919
<h4>
20+
{% if page.source %}
21+
{% if page.source == "Rmd" %}
22+
<a href="{{site.github.repository_url}}/edit/gh-pages/{{page.path|replace: "_episodes", "_episodes_rmd" | replace: ".md", ".Rmd"}}">Edit on GitHub</a>
23+
{% endif %}
24+
{% else %}
2025
<a href="{{site.github.repository_url}}/edit/gh-pages/{{page.path}}">Edit on GitHub</a>
26+
{% endif %}
2127
/
2228
<a href="{{ site.github.repository_url }}/blob/gh-pages/CONTRIBUTING.md">Contributing</a>
2329
/

_includes/navbar.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,13 @@
7676

7777
{% comment %} Always show license. {% endcomment %}
7878
<li><a href="{{ page.root }}/license/">License</a></li>
79+
{% if page.source %}
80+
{% if page.source == "Rmd" %}
81+
<li><a href="{{site.github.repository_url}}/edit/gh-pages/{{page.path|replace: "_episodes", "_episodes_rmd" | replace: ".md", ".Rmd"}}">Improve this page <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a></li>
82+
{% endif %}
83+
{% else %}
7984
<li><a href="{{site.github.repository_url}}/edit/gh-pages/{{page.path}}">Improve this page <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a></li>
85+
{% endif %}
8086
</ul>
8187
<form class="navbar-form navbar-right" role="search" id="search" onsubmit="google_search(); return false;">
8288
<div class="form-group">

0 commit comments

Comments
 (0)