Override how page title is generated
I would like to override how the page titles for all pages on a site are generated. The client wants the title to be similar to the site breadcrumb where it is a concatenated list of ancestral page names plus the current page.
I figure that this could be generated when a page is saved but I would have to alter the page title of the current page and all child pages. If I did it this way then if they changed their mind later then I would have to regenerate all of the page names.
Alternatively if I could just override how the page titles are put on the page then I could go get the ancestors and generate the title when the page is viewed by a user.
I lean toward the second but I don't know how to do either. Any ideas? I am also curious how the solutions will work in relation to widgets that overwrite the title of a page.
I am working on 5.X.
I definitely recommend you go the dynamic route so it does everything for you. You can use this method:
SiteMapBase.GetActualCurrentNode()
Hi Erik,
Thanks Liam. I got it working on my codebehind for my template page last night but then I would have to implement the code on all my templates (at least the non-nested ones). The way you suggested is a lot better. Thanks!
Hi Erik,