Change DNN Page Title via Razor Template

May 30, 2014 at 9:20 PM
I'm working on a Detail template and I'm wondering if there is a way to update the DNN Page Title using the Razor template to access DNN? Is this possible? I used a Parent-Child demo as an example to make a simple product catalog and since the detail template is creating an actual page link that Google will be able to see, I'm wondering if it's possible to edit the meta data via Razor from the Detail template when it loads?
Jun 2, 2014 at 8:01 AM
I don't have the full answer but yes, you can. It's not a 2sxc specific issue but related to DNN &

You'll have to go through standard dnn-mechanisms, so best to google that. I'll see if I can find a code sample...
Jun 2, 2014 at 8:41 AM
No answer here as well but I did remember this blog post

Post the final answer when you have it figured out
Jun 2, 2014 at 9:04 AM
Please try this:
    var page = (Page)HttpContext.Current.Handler;
    page.Title = "Sample";
Jun 2, 2014 at 9:16 AM
worked for me, since its a page object you should be able to set other items liek description etc. as well for SEO purposes and then check in Google if everything is recognized
Jun 2, 2014 at 9:50 AM
just an FYI

This will only update the HTML page title, PortalSettings.ActiveTab.TabName will still show the old one.

I don't know if there is an option to override this part , any ideas?