Hi,
I’m not sure if I require a snippet for this or not but the problem we have is that we want to achieve a particular format for our page titles.
The code we want to output in our template is either 1 or 2 below depending on whether the page has a parent document or not.
1. <title>[*pagetitle*] | [(site_name)]</title>
2. <title>[[GetField? &parent=`1` &parentLevel=`1`]] - [*pagetitle*] | [(site_name)]</title>
An example of 1 is “Specifcation | Company Name”
An example of 2 is “Product Name – Specification | Company Name”
But using the second format on all pages causes this:
Home – Home | Company Name
So if a page doesn’t actually have a parent we want it to revert to 1:
Home | Company Name
I’ve searched for a snippet but the closest thing I can find is this one, which would need some further work:
http://modxcms.com/extras.html?view=package/view&package=417
Any help you can offer is gratefully received.