Skip to content

Commit 95d4e89

Browse files
committed
sidebar scrolls to active page + updated to boilerplate v4
1 parent bf78e5d commit 95d4e89

File tree

7 files changed

+382
-177
lines changed

7 files changed

+382
-177
lines changed

_layouts/chapter.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ <h5 class="sidebar-title">Chapters Index</h5>
7676
{% capture url %}/chapters/{{ chapter | replace: ' ', '_' | downcase }}{% endcapture %}
7777
{% capture indexurl %}{{ url }}/index.html{% endcapture %}
7878
<li class="chapter">
79-
<div class="sidebar-subtitle"><strong><a class="chapter-title" href="{{ url }}">{{ chapter }}</a></strong></div>
79+
<div class="sidebar-subtitle{% if page.url == indexurl %} page-active{% endif %}"><strong><a class="chapter-title" href="{{ url }}">{{ chapter }}</a></strong></div>
8080
<ul class="pseudo-list recipes-list">
81-
{% for page in site.pages %}
82-
{% if page.url contains url %}
83-
{% unless page.url == indexurl %}
84-
<li class="list-item recipe"><a class="recipe-title" href="{{ page.url | replace: '.html', '' }}">{{ page.title }}</a></li>
81+
{% for site_page in site.pages %}
82+
{% if site_page.url contains url %}
83+
{% unless site_page.url == indexurl %}
84+
<li class="list-item recipe{% if page.url == site_page.url %} page-active{% endif %}"><a class="recipe-title" href="{{ site_page.url | replace: '.html', '' }}">{{ site_page.title }}</a></li>
8585
{% endunless %}
8686
{% endif %}
8787
{% endfor %}
@@ -93,6 +93,8 @@ <h5 class="sidebar-title">Chapters Index</h5>
9393

9494
</aside>
9595

96-
</body>
96+
<script type="text/javascript" src="/js/scripts.js"></script>
97+
98+
</body>
9799
</html>
98100

_layouts/default.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ <h5 class="sidebar-title">Chapters Index</h5>
7373
{% capture url %}/chapters/{{ chapter | replace: ' ', '_' | downcase }}{% endcapture %}
7474
{% capture indexurl %}{{ url }}/index.html{% endcapture %}
7575
<li class="chapter">
76-
<div class="sidebar-subtitle"><strong><a class="chapter-title" href="{{ url }}">{{ chapter }}</a></strong></div>
76+
<div class="sidebar-subtitle{% if page.url == indexurl %} page-active{% endif %}"><strong><a class="chapter-title" href="{{ url }}">{{ chapter }}</a></strong></div>
7777
<ul class="pseudo-list recipes-list">
78-
{% for page in site.pages %}
79-
{% if page.url contains url %}
80-
{% unless page.url == indexurl %}
81-
<li class="list-item recipe"><a class="recipe-title" href="{{ page.url | replace: '.html', '' }}">{{ page.title }}</a></li>
78+
{% for site_page in site.pages %}
79+
{% if site_page.url contains url %}
80+
{% unless site_page.url == indexurl %}
81+
<li class="list-item recipe{% if page.url == site_page.url %} page-active{% endif %}"><a class="recipe-title" href="{{ site_page.url | replace: '.html', '' }}">{{ site_page.title }}</a></li>
8282
{% endunless %}
8383
{% endif %}
8484
{% endfor %}
@@ -90,6 +90,8 @@ <h5 class="sidebar-title">Chapters Index</h5>
9090

9191
</aside>
9292

93-
</body>
93+
<script type="text/javascript" src="/js/scripts.js"></script>
94+
95+
</body>
9496
</html>
9597

_layouts/recipe.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ <h5 class="sidebar-title">Chapters Index</h5>
7575
{% capture url %}/chapters/{{ chapter | replace: ' ', '_' | downcase }}{% endcapture %}
7676
{% capture indexurl %}{{ url }}/index.html{% endcapture %}
7777
<li class="chapter">
78-
<div class="sidebar-subtitle"><strong><a class="chapter-title" href="{{ url }}">{{ chapter }}</a></strong></div>
78+
<div class="sidebar-subtitle{% if page.url == indexurl %} page-active{% endif %}"><strong><a class="chapter-title" href="{{ url }}">{{ chapter }}</a></strong></div>
7979
<ul class="pseudo-list recipes-list">
80-
{% for page in site.pages %}
81-
{% if page.url contains url %}
82-
{% unless page.url == indexurl %}
83-
<li class="list-item recipe"><a class="recipe-title" href="{{ page.url | replace: '.html', '' }}">{{ page.title }}</a></li>
80+
{% for site_page in site.pages %}
81+
{% if site_page.url contains url %}
82+
{% unless site_page.url == indexurl %}
83+
<li class="list-item recipe{% if page.url == site_page.url %} page-active{% endif %}"><a class="recipe-title" href="{{ site_page.url | replace: '.html', '' }}">{{ site_page.title }}</a></li>
8484
{% endunless %}
8585
{% endif %}
8686
{% endfor %}
@@ -92,6 +92,8 @@ <h5 class="sidebar-title">Chapters Index</h5>
9292

9393
</aside>
9494

95+
<script type="text/javascript" src="/js/scripts.js"></script>
96+
9597
</body>
9698
</html>
9799

0 commit comments

Comments
 (0)