Test the value of the metadata system tags
In the page templates, is there a way to test the metadata system tags (e.g. <system-page-keywords/>) to determine if the page's meta fields (e.g. keywords) has a value or not?
And if it doesn't have a value (it's empty), is there a way to access the site's Global Keywords (under Tools >Preferences>Content) and output them on the page template instead?
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Tim on 11 May, 2010 07:45 PM
Hi Alicia,
There is no way to insert logic in a Template which will swap out certain metadata tags when values for a tag do not exist. You should be able to accomplish this with one system region, however. Try doing something like this:
<head>
tag). For example, your region might be named something like this:<system-region name="keywords"/>
You could easily add some logic in your Format to determine whether or not keywords exist in the XML returned by the index block. If you have a list of keywords for your site handy, you could even create a variable in your Format and have those inserted as keywords should the page not have any keywords. This, of course, would mean that the Format would need to be maintained if you plan on changing keywords often.
If you don't want to go this route, you could potentially make the Keywords field required for users. This would force them to either enter keywords for the asset or select from the Global Keywords defined in your Content Preferences.
Hope this helps!
Tim closed this discussion on 11 May, 2010 07:45 PM.