Well, you can certainly do this with the Breadcrumbs snippet (or some minor variation of it). But if all you need is one folder deep, you can also just get the pagetitle of the current document’s parent and use that in the title bar (as long as it’s not the site root). If you need to go multiple levels deep, then you’d just need to keep getting the parent of each parent until you get to the site root.
Thanks, this solution did cross my mind, problem is that the default page for the subfolder isn’t the first child, hence I end up with ex: ’mysite / clients / clients’
Hakim
So you only want to display the parent’s title when the parent is not the site root (e.g., mysite/clients, mysite/clients/whatever)?
That’s about it. To illustrate lets say site has 4 main links like:
’home’ ’about’ ’casestudies’ ’contact’
browser title should be: ’My Site Name’ / ’Home’ when on ’Home’, ’My Site Name’ / ’About’ when on ’About’ - and so on..
Now, ’casestudies’ has a landing page and a list of links to several cases sitting below this section.
The default landing page doesn’t include any particular casestudy itself, hence the title bar should display:
’My Site Name’ / ’Casestudies’.
When navigating to one of the underlying pages, title bar needs display:
’My Site Name’ / ’Casestudies’ / ’Case name’
Hakim
OK so it sounds as if you just need "Casestudies /" inserted into the title when you’re viewing a case study page. You could do that easily just by using a different template for those pages, or by having a TV that you use to insert that (or any other text) into the title bar of a page. Or you could use a simple snippet like:
<?php
$csID=2; // document id of case study container
$output='';
$parent=$modx->getParent($modx->documentIdentifier,1,'id,pagetitle');
if ($parent['id']==$csID) $output=$parent['pagetitle'].' / ';
return $output;
?>
This would display the pagetitle of only the casestudy container document, so you could put in in your regular template and it wouldn’t show anything for pages that are not children of that container. Alternatively you could modify this snippet to always show any container’s pagetitle (or alias, or whatever you like) except for specific containers that you exclude (such as the site root). In MODx there are always a dozen ways to skin a cat (stay away from my kitty, however).
No reason to add a new template if you don’t need it (it’s just more places you might need to make changes later).