-
Notifications
You must be signed in to change notification settings - Fork 3.8k
add header_pages
config to link only specific files in header
#52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cc: @benbalter |
_includes/header.html
Outdated
@@ -4,6 +4,17 @@ | |||
|
|||
{% assign custom_url = site.url | append: site.baseurl %} | |||
{% assign full_base_url = custom_url | default: site.github.url %} | |||
{% if site.header_pages %} | |||
{% assign header_pages = "" | split:"|" %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's going on here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got this from https://talk.jekyllrb.com/t/how-do-you-add-items-to-an-array-in-jekyll/324/4 to initialize an empty array.
_includes/header.html
Outdated
@@ -4,6 +4,17 @@ | |||
|
|||
{% assign custom_url = site.url | append: site.baseurl %} | |||
{% assign full_base_url = custom_url | default: site.github.url %} | |||
{% if site.header_pages %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be written as {% assign header_pages = site.header_pages | default: site.pages %}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe, if we do that, we'll only need to iterate through the pages once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion! Yes we could do that,
but i think we should use something like this then:
{% assign default_paths = site.pages | map: "path" %}
{% assign header_pages = site.header_pages | default: default_paths %}
To make sure in both cases we're dealing with Strings
and not in one case Strings
, in the other one with Page
objects.
In the remaining loop we could then convert these back to Pages
one by one. What do you think?
Nice start! A few questions on the implementation to try to DRY things up a bit, but I really like it. |
@benbalter Thanks for the review! Improved it now to use only one loop |
Up vote. |
Thanks @Crunch09! Sorry for the delay. |
@benbalter No worries! Thank you for merging it. |
Added a declaration of header_pages to control which pages show up in the sidebar and their order. Thats some undocumented voodoo I found in an issue for the Minima theme jekyll/minima#52 Also a placeholder reading list and removed some obsolete stuff in the about page.
fixes #19