-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 pages in branded grav site #1494
Comments
so you have different site yaml files in different environment setups? like:
And you can't access these? I'm not fully understanding what you are trying to do or trying to do it. |
Hi, not quite. We have one grav source tree, but we have multiple site.yaml files for each brand. e.g. Before running a branded site we simply copy one of those to : mysite/user/config/site.yaml Lets say we have two pages in the site : mysite/user/1.pagea Lets say in brand1 I want all pages but in brand2 I want only pagea and pageb. One simple solution is to delete or rename mysite/user/3.pagec before spinning up the site, but ideally Id like a neater solution. There are the 'published' and 'visible' attributes in the frontmatter for the page, but these dont seem to accept twig e.g. the following doesnt work published : {{ site.brand_name != "brand2" }}Is there some way of dynamically hiding a page? Or perhaps is there some way of declaring hidden pages in brand2.site.yaml? Alternatively, can I do something in the blueprint? Thanks Andy |
You can use twig in frontmatter if you enable it in system.yaml: |
(Note we are running grav 1.2.4) Thanks, Ive been trying this many different ways but cannot get it to work. Ive set the value in system.yaml and created a page :
I get the following error :
If I remove the space padding inside the {{ }} e.g. :
I get this error :
If I try to return the string "true" or "false" instead e.g. :
I get :
|
Wrap the frontmatter twig in a string: |
Great, thank you for clarifying that... :o) |
Hi,
We have a site which we brand using site variables in different site.yaml files. However, certain brands should not publish certain pages.
I have tried to set the published flag in the page frontmatter dynamically using twig but it seems that this is not supported? Can I do this?
Can I do anything with page collections or taxonomies?
What other options are there for doing this?
Thanks for your help
Andy
The text was updated successfully, but these errors were encountered: