Skip to content
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

Remove hidden posts from /posts #2623

Closed
amkartashov opened this issue Jul 27, 2020 · 3 comments · Fixed by #2625
Closed

Remove hidden posts from /posts #2623

amkartashov opened this issue Jul 27, 2020 · 3 comments · Fixed by #2625

Comments

@amkartashov
Copy link
Contributor

amkartashov commented Jul 27, 2020

This is follow-up for #2345 which does not remove hidden posts from posts layout (posts by year).

Diff to fix for _layouts/posts.html:

@@ -5,7 +5,7 @@
 {{ content }}

 <ul class="taxonomy__index">
-  {% assign postsInYear = site.posts | group_by_exp: 'post', 'post.date | date: "%Y"' %}
+  {% assign postsInYear = site.posts | where_exp:"item", "item.hidden != true" | group_by_exp: 'post', 'post.date | date: "%Y"' %}
   {% for year in postsInYear %}
     <li>
       <a href="#{{ year.name }}">
@@ -15,7 +15,7 @@
   {% endfor %}
 </ul>

-{% assign postsByYear = site.posts | group_by_exp: 'post', 'post.date | date: "%Y"' %}
+{% assign postsByYear = site.posts | where_exp:"item", "item.hidden != true" | group_by_exp: 'post', 'post.date | date: "%Y"' %}
 {% for year in postsByYear %}
   <section id="{{ year.name }}" class="taxonomy__section">
     <h2 class="archive__subtitle">{{ year.name }}</h2>
@iBug

This comment has been minimized.

@iBug
Copy link
Collaborator

iBug commented Jul 27, 2020

Looks good to me. You can send a PR for this patch so your contribution gets permanently recorded.

One small improvement, though:

-where_exp:"item", "item.hidden != true"
+where_exp: "item", "item.hidden != true"

@amkartashov
Copy link
Contributor Author

@iBug,
thanks! PR is submitted, see above

amkartashov added a commit to amkartashov/blog that referenced this issue Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants