Title for search engines - simple question
Hi,
I have a simple question.
I would like to create a suffix for all of my pages. I intend to put this code in my master page. All I want to do is get the value of the "Title for search engines" from the code behind of the current page and append " - XYZ Company" to the title of every page, instead of manually doing it for every page.
How do I get the property "Title for search engines" using the fluent API?
Thanks
Hello Raul,
You can access the field by getting Page.Htmltitle property. Please review the attached code which gets all pages with that particular title:
App.WorkWith().Pages()
.Where(p => p.Page.HtmlTitle == "titleforsearchengines")
.Get();
Raul,
<
title
><%=Page.Title %> - XYZ Company</
title
>
Hey Tim,
That gets the pages title, but the question was for the 'title for search engines'. I'm looking around for it now but if someone has that answer before I post it, would be appreciated.
Yup. Nice'en e.z. Just like SF. Could this be simplified or optimized?
var currentPageNode = SiteMapBase.GetActualCurrentNode();
IQueryable<PageNode> pageNodes = App.WorkWith().Pages()
.Where(p => p.Id == currentPageNode.Id)
.Get();
foreach (var pageNode in pageNodes)
var t = pageNode.Page.HtmlTitle;
Hello Richard,
Here is a simpler way to get html title of the current page:
var CurrentPageId = SiteMapBase.GetActualCurrentNode().Id;
var HtmlTitle = PageManager.GetManager().GetPageNode(CurrentPageId).Page.HtmlTitle;