Skip to content

Commit 5aaa87a

Browse files
committed
Add "Offline" Capable
This is based on carpentries#127.
1 parent 5edc669 commit 5aaa87a

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

_includes/main_title.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{% comment %}
22
Main title for lesson pages.
33
{% endcomment %}
4-
<h1 class="maintitle"><a href="{{ page.root }}/">{{ site.title }}</a>{% if page.title %}: {{ page.title }}{% endif %}</h1>
4+
<h1 class="maintitle"><a href="{{ page.root }}{% link index.md %}">{{ site.title }}</a>{% if page.title %}: {{ page.title }}{% endif %}</h1>

_includes/navbar.html

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,43 @@
1212
</button>
1313

1414
{% comment %} Select what logo to display. {% endcomment %}
15-
{% if site.carpentry == "swc" %}
15+
{% if page.carpentry == "swc" %}
1616
<a href="{{ site.swc_site }}" class="pull-left">
1717
<img class="navbar-logo" src="{{ page.root }}/assets/img/swc-icon-blue.svg" alt="Software Carpentry logo" />
1818
</a>
19-
{% elsif site.carpentry == "dc" %}
19+
{% elsif page.carpentry == "dc" %}
2020
<a href="{{ site.dc_site }}" class="pull-left">
2121
<img class="navbar-logo" src="{{ page.root }}/assets/img/dc-icon-black.svg" alt="Data Carpentry logo" />
2222
</a>
23-
{% elsif site.carpentry == "lc" %}
23+
{% elsif page.carpentry == "lc" %}
2424
<a href="{{ site.lc_site }}" class="pull-left">
2525
<img class="navbar-logo" src="{{ page.root }}/assets/img/lc-icon-black.png" alt="Library Carpentry logo" />
2626
</a>
2727
{% endif %}
2828

2929
{% comment %} Always show link to home page. {% endcomment %}
30-
<a class="navbar-brand" href="{{ page.root }}/">Home</a>
30+
<a class="navbar-brand" href="{{ page.root }}{% link index.md %}">Home</a>
3131

3232
</div>
3333
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
3434
<ul class="nav navbar-nav">
3535

3636
{% comment %} Always show code of conduct. {% endcomment %}
37-
<li><a href="{{ page.root }}/conduct/">Code of Conduct</a></li>
37+
<li><a href="{{ page.root }}{% link CONDUCT.md %}">Code of Conduct</a></li>
3838

39-
{% comment %} Show setup instructions, reference guide, and lesson episodes for lessons. {% endcomment %}
4039
{% if site.kind == "lesson" %}
41-
<li><a href="{{ page.root }}/setup/">Setup</a></li>
40+
{% comment %} Show setup instructions. {% endcomment %}
41+
<li><a href="{{ page.root }}{% link setup.md %}">Setup</a></li>
42+
43+
{% comment %} Show lesson episodes for lessons. {% endcomment %}
4244
<li class="dropdown">
4345
<a href="{{ page.root }}/" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Episodes <span class="caret"></span></a>
4446
<ul class="dropdown-menu">
4547
{% for episode in site.episodes %}
4648
<li><a href="{{ page.root }}{{ episode.url }}">{{ episode.title }}</a></li>
4749
{% endfor %}
4850
<li role="separator" class="divider"></li>
49-
<li><a href="{{ page.root }}/aio/">All in one page (Beta)</a></li>
51+
<li><a href="{{ page.root }}{% link aio.md %}">All in one page (Beta)</a></li>
5052
</ul>
5153
</li>
5254
{% endif %}
@@ -56,7 +58,7 @@
5658
<li class="dropdown">
5759
<a href="{{ page.root }}/" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Extras <span class="caret"></span></a>
5860
<ul class="dropdown-menu">
59-
<li><a href="{{ page.root }}/reference/">Reference</a></li>
61+
<li><a href="{{ page.root }}{% link reference.md %}">Reference</a></li>
6062
{% for extra in site.extras %}
6163
<li><a href="{{ page.root }}{{ extra.url }}">{{ extra.title }}</a></li>
6264
{% endfor %}
@@ -65,7 +67,7 @@
6567
{% endif %}
6668

6769
{% comment %} Always show license. {% endcomment %}
68-
<li><a href="{{ page.root }}/license/">License</a></li>
70+
<li><a href="{{ page.root }}{% link LICENSE.md %}">License</a></li>
6971
{% if page.source %}
7072
{% if page.source == "Rmd" %}
7173
<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>

bin/lesson_initialize.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,10 @@
222222
collections:
223223
episodes:
224224
output: true
225-
permalink: /:path/
225+
permalink: /:path/index.html
226226
extras:
227227
output: true
228+
permalink: /:path/index.html
228229
229230
# Set the default layout for things in the episodes collection.
230231
defaults:
@@ -249,6 +250,7 @@
249250
---
250251
layout: lesson
251252
root: .
253+
permalink: index.html # Is the only page that don't follow the partner /:path/index.html
252254
---
253255
FIXME: home page introduction
254256
@@ -261,7 +263,6 @@
261263
ROOT_REFERENCE_MD = '''\
262264
---
263265
layout: reference
264-
permalink: /reference/
265266
---
266267
267268
## Glossary
@@ -273,15 +274,13 @@
273274
---
274275
layout: page
275276
title: Setup
276-
permalink: /setup/
277277
---
278278
FIXME
279279
'''
280280

281281
ROOT_AIO_MD = '''\
282282
---
283283
layout: page
284-
permalink: /aio/
285284
---
286285
<script>
287286
window.onload = function() {
@@ -335,7 +334,6 @@
335334
---
336335
layout: page
337336
title: About
338-
permalink: /about/
339337
---
340338
{% include carpentries.html %}
341339
'''
@@ -344,7 +342,6 @@
344342
---
345343
layout: page
346344
title: Discussion
347-
permalink: /discuss/
348345
---
349346
FIXME
350347
'''
@@ -353,7 +350,6 @@
353350
---
354351
layout: page
355352
title: Figures
356-
permalink: /figures/
357353
---
358354
{% include all_figures.html %}
359355
'''
@@ -362,7 +358,6 @@
362358
---
363359
layout: page
364360
title: "Instructor Notes"
365-
permalink: /guide/
366361
---
367362
FIXME
368363
'''

0 commit comments

Comments
 (0)