Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Robert 19 posts 39 karma points
    Mar 15, 2012 @ 16:48
    Robert
    0

    Efficient way of adding Page Titles

    What would be the best way to add Page Titles?

    At the moment I have a field set up in my master template for this but I dont want to be adding titles manually for every node. I still want to keep this field incase I want to manually override the titles.

    I was thinking could I create different doc types for this under a content structure called SEO. Might look like this.

    SEO (Content Folder)
    -- Page Titles
    -- Meta Descriptions
    -- Meta Keywords

    Not sure if this is the best way or how to then apply these to the correct nodes.

    Any ideas?

     

    Thanks
    Robert

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 15, 2012 @ 21:45
    Jan Skovgaard
    0

    Hi Robert

    I would suggest that you have the above properties on each document type that represents a page on your website. And then you could create a seo fallback tab on your "home" (root node) to use when the seo fields have not been filled in on one or more of the child nodes.

    I will also recommend that you make some generic fallback for the page title where you take the nodename and concat it with the fallback title value to make sure each page has a unique page title value in case it has not been filled out.

    I hope this helps.

    /Jan

  • Mike Chambers 636 posts 1253 karma points c-trib
    Mar 16, 2012 @ 10:17
    Mike Chambers
    0

    We've often found that if you give Jan's sort of setup to the client that they very rarely undestand the if you don't put anything in then it will default to x + y... So we extend slightly on Jan's approach, and use the parameters as he has, but hook into the page creation event to automatically put the default into the seo page title.

     

    public class SetDefaultsHandler : ApplicationBase
        {
            public SetDefaultsHandler()
            {
                Document.New += new Document.NewEventHandler(Document_New);
            }
    
            void Document_New(Document sender, umbraco.cms.businesslogic.NewEventArgs e)
            {
                Document doc = (Document)sender;
    
                try
                {
                    doc.getProperty("menubarTitle").Value = doc.Text + UmbracoJPT.Utils.Util.GetPropertyValueRecursive(doc, "seoAppend");
                    doc.getProperty("altTitle").Value = doc.Text;
                    doc.getProperty("title").Value = doc.Text;
    
                    //System.Web.HttpContext.Current.Response.Write(doc.ContentType.Alias);
                    switch (doc.ContentType.Alias)
                    {
                        case "NewsDocument":
                            doc.getProperty("hideInNavigation").Value = true;
                            break;
                        case "FileDocument":
                            doc.getProperty("hideInNavigation").Value = true;
                            break;
                        case "MemberDocument":
                            doc.getProperty("hideInNavigation").Value = true;
                            break;
                        default:
                            break;
                    }
                }
                catch { }
    
                //Log.Add(LogTypes.Custom, doc.Id, "Document_AfterNew Executed in AutoUnpublishNewsHandler");
            }

    We also have a dashboard to do search and replace type updates across all pages for if the SEO title changes at some point in the project.

  • Robert 19 posts 39 karma points
    Mar 16, 2012 @ 16:01
    Robert
    0

    Thanks

    I have set up an SEO tab on my content types which is all working fine.

    How do I get it to use the Home node as the fallback title? I can set it to use a different field such as @pagename, but I dont see a different node option?

     

    Thanks
    Robert 

Please Sign in or register to post replies

Write your reply to:

Draft