I’ve been trying to find an answer, but I don’t know the vocab to ask the question:
I’d like the client to be able to write page / meta descriptions for each page. But my hunch is this will get overlooked. Rather than have no page / meta description, is it possible to have a “fallback” value, set on the Site page?
Page blueprint, something like this:
meta_description:
label: Meta / page description
type: text
fallback: Default text if no text is provided (set on the Site page)
Is something like this possible without using a plugin (which look very complicated)?
Using a default value only works on page creation, not if the page already exist. Why do you want to provide a default if you define it in site anyway? then you can no longer check if the field is empty and fall back to the site default.
Why do you want to provide a default if you define it in site anyway? then you can no longer check if the field is empty and fall back to the site default.
Because that looks well beyond me! I was hoping I could simply hard code a default description (that might get over written by the client).
As I said, the default property only works at page creation. Otherwise you have to add the default value manually to every existing page.
But I don’t really understand what exactly the problem is for you. In the topic title you asked to overwrite the value if info from site. There is an easier way to use the default than the condition:
If you know what it does, it’s pretty easy to understand. The ternary expression above translates to the following if-else statement, which is much more verbose: