Skip to content

Commit 55ff779

Browse files
authored
Merge pull request #52 from Crunch09/header_pages_config
add `header_pages` config to link only specific files in header
2 parents bcabdbd + d4f35ba commit 55ff779

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

_includes/header.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<header class="site-header" role="banner">
22

33
<div class="wrapper">
4-
5-
<a class="site-title" href="{{ "/" | relative_url}}">{{ site.title | escape }}</a>
4+
{% assign default_paths = site.pages | map: "path" %}
5+
{% assign page_paths = site.header_pages | default: default_paths %}
6+
<a class="site-title" href="{{ "/" | relative_url }}">{{ site.title | escape }}</a>
67

78
<nav class="site-nav">
89
<span class="menu-icon">
@@ -14,7 +15,8 @@
1415
</span>
1516

1617
<div class="trigger">
17-
{% for my_page in site.pages %}
18+
{% for path in page_paths %}
19+
{% assign my_page = site.pages | where: "path", path | first %}
1820
{% if my_page.title %}
1921
<a class="page-link" href="{{ my_page.url | relative_url }}">{{ my_page.title | escape }}</a>
2022
{% endif %}

example/_config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ baseurl: "/minima"
99
twitter_username: jekyllrb
1010
github_username: jekyll
1111

12+
# If you want to link only specific pages in your header, uncomment
13+
# this and add the path to the pages in order as they should show up
14+
#header_pages:
15+
# - about.html
16+
1217
# Build settings
1318
markdown: kramdown
1419
theme: minima

0 commit comments

Comments
 (0)