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

Hiding a post results in the incorrect post being hidden #504

Closed
3 tasks done
robgoyal opened this issue Feb 9, 2022 · 2 comments
Closed
3 tasks done

Hiding a post results in the incorrect post being hidden #504

robgoyal opened this issue Feb 9, 2022 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@robgoyal
Copy link

robgoyal commented Feb 9, 2022

Checklist

  • I have read the tutorials and know the correct effect of the functional design.
  • There are no similar reports on existing issues (including closed ones).
  • I found the bug on the latest code of the master branch.

Describe the bug

Note: I read through the tutorials and all of the issues but there's no indication that this is the intended functionality.

By default, Jekyll's pagination filters out any posts that have the hidden:true in the YAML front matter.

image

However, the logic in _layouts/home.html uses custom sorting to place pinned posts at the top and assign the remaining posts as default. Jekyll's paginate will filter out those posts resulting in an incorrect number of posts that the custom sorting functionality will have to go through. Refer to the screenshots below.

To Reproduce

Steps to reproduce the behavior:

  1. Add hidden:true to a post that is NOT at the end.
  2. Browse to the home page.
  3. You'll notice that the post that was meant to be hidden is not and the LAST post is.

Expected behavior

The post that was assigned with the hidden:true should be hidden.

Screenshots

No Hidden Posts

image

Hiding One Post

image

Hiding the "Customize the Favicon" post hides the LAST post which is "Text and Typography".

Software

  • Ruby version: 2.7.0p0
  • Gem version: 3.1.2
  • Bundler version: 2.3.5
  • Jekyll version: 4.2.1
  • Theme version: 5.0.2

Ruby version: ruby 2.7.0p0
Gem version: 3.1.2
Bundler version: 2.3.5
Jekyll version: 4.2.1
Theme version: 5.0.2

Desktop

Smartphone

Additional context

Unsure if this is just an oversight or intentional, I have not created a PR. To solve this issue, the following line in _layouts/home.html needs to be changed from

{% assign default = site.posts | where_exp: "item", "item.pin != true" %}

to

{% assign default = site.posts | where_exp: "item", "item.pin != true and item.hidden != true" %}

@github-actions
Copy link

github-actions bot commented Feb 9, 2022

👋 Hi @robgoyal,

This issue is being automatically closed because it does not follow the issue template. Please DO NOT open another similar issue, try to edit the current issue according to the template, then it will be reopened automatically.

@github-actions github-actions bot closed this as completed Feb 9, 2022
@github-actions github-actions bot reopened this Feb 9, 2022
@cotes2020 cotes2020 added the bug Something isn't working label Feb 10, 2022
@cotes2020
Copy link
Owner

Hi @robgoyal,

Until I saw this issue, I didn't know that the pagination plugin had the option hidden. So this bug remains.

Thanks for the bug report, very detailed and specific. If you plan to submit the above changes to a PR, I will merge it without hesitation.

@cotes2020 cotes2020 added this to the 5.1.0 milestone Feb 12, 2022
linkliu pushed a commit to linkliu/game-tech-post-old that referenced this issue Apr 10, 2022
dkbnz pushed a commit to dkbnz/jekyll-theme-chirpy that referenced this issue Jul 12, 2022
shihtiy-tw pushed a commit to shihtiy-tw/shihtiy-tw.github.io that referenced this issue Nov 26, 2022
sanjidnet pushed a commit to sanjidnet/sanjidnet.github.io that referenced this issue Jan 9, 2023
Ap3x pushed a commit to Ap3x/ap3x.github.com that referenced this issue Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants