-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Provide exclude mechanism for minima #128
Conversation
To exclude a page from being processed, simply add |
@ashmaroli It looks like this is about excluding a page from the default navigation, rather than preventing it from being published. |
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.
We'll also need to update the docs.
_includes/header.html
Outdated
@@ -21,7 +21,7 @@ | |||
<div class="trigger"> | |||
{% for path in page_paths %} | |||
{% assign my_page = site.pages | where: "path", path | first %} | |||
{% if my_page.title %} | |||
{% if my_page.title and !my_page.exclude != true %} |
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'd recommend this be something more descriptive, like exclude_from_nav
to prevent collisions with existing YAML.
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.
Where in the docs would I put that? I can't find a section that seems a good fit to me (and I'm a Jekyll newbie, so a bit lost anyway).
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.
@dirkgomez Looking at the existing content, I would expect to see it as a new h3 in the Usage section
@pathawks You're right. My bad.. |
I find whitelisting pages with an include field rather than blacklisting with an exclude more useful more often. |
Wouldn't that be a breaking change though? |
Oh, that's right. Good point. |
_includes/header.html
Outdated
@@ -21,7 +21,7 @@ | |||
<div class="trigger"> | |||
{% for path in page_paths %} | |||
{% assign my_page = site.pages | where: "path", path | first %} | |||
{% if my_page.title %} | |||
{% if my_page.title and !my_page.exclude_from_nav != true %} |
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.
Shouldn't this be == true
?
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 think the issue is the unary not (!
), which I understand is not supported in liquid. I believe this is sufficient:
if my_page.title and my_page.exclude_from_nav != true
Unfortunately, == false
isn't available to us here because of a defect with truthiness in liquid/ruby with respect to booleans, nulls, empty string, uninitialized values, and so on...
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.
@dirkgomez I tested and confirmed @ashawley's logic to be correct. In the current state (8fb7b81) the boolean is working opposite from desired behavior.
Also, it is up to you if you care or not, but I noticed your first commit (41529ce) was done with a different e-mail address than the others, and that e-mail address is not associated with your GitHub account. You may wish to squash/rebase (then force-push) to bring them all under one address or to add your other e-mail address to your GitHub account so it is recognized as yours.
_includes/header.html
Outdated
@@ -21,7 +21,7 @@ | |||
<div class="trigger"> | |||
{% for path in page_paths %} | |||
{% assign my_page = site.pages | where: "path", path | first %} | |||
{% if my_page.title %} | |||
{% if my_page.title and my_page.exclude_from_nav == true %} |
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.
Should be,
and my_page.exclude_from_nav != true
Thanks for sticking with this. I know from experience getting boolean logic right can be a pain :-)
Put this into your front matter to exclude pages from showing up in the navigation: exclude_from_nav: true
Amended the commits accordings - and thank you for the patience, still grappling with Jekyll. |
Why isn't whitelisting with |
Looks very similar indeed, how do I use header_pages? |
Looks like #52 documented it in the config but not the README |
ashawley is right, I'm closing this pull request. |
For the record, I wasn't opposed to this change. I was just wondering why the question wasn't raised about the overlap with To be honest, I would still entertain this improvement. I predict it will come up again for scenarios where blacklisting may be easier to maintain than whitelisting (with |
#134 continues from the discussion here by adding documentation for @ashawley Like @dirkgomez I had need for something like this. I agree in not being opposed to this, but I am not sure there is enough reason to push for it now either. If you look at the behavior of minima when there are lots of nav links, I think from a practical standpoint the number of desired nav links will be kept low, favoring a whitelist approach. Plus, The main advantage of the approach in this PR would be the resilience to file moves/renames. |
Put this into your front matter to exclude pages:
exclude: true