I’m working with a theme that inherits from Quark. I’d like new blog posts to automatically be set to visible: false. I’ve copied item.yaml to my inherited theme and added the following:
In admin, the check box next to the page visibility override is left unchecked as seen in the attached image. Is there a way I can specify that this override should be checked/enabled?
@prw, Presuming the folders containing a blog item do not have a numeric prefix, shouldn’t items be invisible by default? Or are numeric prefixes used in your use-case? See variable visible.
By default, a page is visible in the navigation if the surrounding folder has a numerical prefix, i.e. /01.home is visible, while /error is not visible .
Anyway, if you add toggleable: false it should force adding visible: false to the header of the page.
@anon76427325, Thanks for your reply. I did try toggleable: false, and while it removes the checkbox next to the “Visible” item in admin, it does not enter visible: false to the page header. I have to manually click “Disabled” in admin and save again for the header to change. (Edit: To clarify, “Disabled” shows up as selected, but still needs to be clicked and saved to work.)
Thanks for the heads up about the numeric prefix. I didn’t notice that that’s a blog setting that can be enabled or disabled. I may want to keep numeric prefixing, though. So it would still be nice to find a solution to this that makes visible: false to be applied fully automatically.
Added new blog item ‘My new blog item’ with root ‘Home’ and page template ‘Item’, leaving everything else to their default values.
The field ‘visible’ looks as follows
Saved new blog item.
Header of page ‘01.home/my-new-blog-item/item.md’:
---
title: 'My new blog item'
visible: false
feed:
limit: 10
---
To mimic your use-case with numeric prefixes for blog items:
Copied folder ‘01.blog’ to ‘02.blog2’
Prefixed 2 blog items with numbers and removed the others.
Created new blog item ‘Prefixed blog item’, with root ‘Home2’ and template ‘Item’, leaving everything else to their defaults.
Saved blog item
Header of ‘02.blog2/03.prefixed-blog-item/item.md’ is:
Thanks, @anon76427325 for your reply and taking the time to do a test case. I’ve been away from the project for a few days, and just coming back to it.
I tried repeating your steps with a fresh download of Quark and could not replicate your results. Until I tried with grav 1.6.x. Then it works as you demonstrated.
I have been using the 1.7 RC and it does not work. Do you think that’s a bug?