Title for search engines - simple question - General Discussions - General Discussions - Progress Community
 General Discussions

Title for search engines - simple question

  • 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();


    All the best,
    Victor Velev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Raul,

    This is a really simply way of doing it. You just need to put this in your master page:

    <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;

    Hope this helps.

    Regards,
    Vassil Vassilev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items