I have section Clients in panel. It’s showing children of page “Clients”. When page “Clients” is set to be Unpublished, then section Clients is showing first level pages, so it’s confusing and is not necessary, how can I make this section invisible in this case?
Could you post yourblueprint for this page , please?
/site/blueprints/site.yml
title: Site
tabs:
pages:
label:
lt: Puslapiai
en: Pages
icon: page
columns:
- width: 1/3
sections:
pages:
type: pages
create:
- default
- default-text
- contact
partners: sections/partners
- width: 2/3
sections:
projects: sections/blog
Thanks, but in this case, I would also need the section blueprints, or the one for the clients section.
/site/blueprints/sections/partners.yml (sorry, I actually use machine name “partners” for Clients)
type: pages
headline:
lt: Klientai
en: Clients
ru: Клиенты
parent: site.find("partners")
info: "{{ page.featured }}"
layout: list
size: tiny
limit: 20
image:
cover: false
create:
- partner
empty:
lt: Dar nėra rėmėjų
en: No sponsors yet
I think the reason why this is happening is that you don’t specify a template. At the same time, site.find("partners")
doesn’t return anything if the page is in draft state. So the solution to hide the pages in that case would be to add the template
option in addition to the create
option.
type: pages
headline:
lt: Klientai
en: Clients
ru: Клиенты
parent: site.find("partners")
info: "{{ page.featured }}"
layout: list
size: tiny
limit: 20
image:
cover: false
template: partner
create:
- partner
empty:
lt: Dar nėra rėmėjų
en: No sponsors yet
Cool, it works. But now it’s showing, like there are no clients, although I have children pages in Clients.
By the way, if I make page Clients “Unlisted”, then section shows children.
If Clients is Unpublished, would be best to show children as well, or to hide completely.
Ok, this should work, with or without template:
parent: site.childrenAndDrafts.find("partners")
Yes, perfect, now it shows children. Thanks a lot.