Copied to clipboard

Flag this post as spam?

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


  • pikej 27 posts 47 karma points
    Dec 07, 2010 @ 19:03
    pikej
    0

    two title elements...

    hello guys

    I created a website http://pobierzprogram.com and it fails validations with w3c because there are two overlaping title elements when page renders. I use some templates and double checked them and they seem to be OK. 

    Where is the second title element just above </head> coming from I wonder?

    thanks in advance.

  • Rich Green 2246 posts 4008 karma points
    Dec 07, 2010 @ 19:08
    Rich Green
    0

    Hi,

    I'm not sure there's a way to tell from your site.

    Did you check your xslt files?

    Rich

     

  • pikej 27 posts 47 karma points
    Dec 07, 2010 @ 19:17
    pikej
    0

    thanks a lot Rich for prompt reply

    I use two xslt files, one for navigation and one for getting links to the content but both of them are located in body section.

    On my template I have got google analitics code just before </head> tag and when the page renders in source code I can see:

    google analitics code

    <title></title>

    </head>

    Where is the title tag coming from I haven't got a clue. 

    In my templates I do have contentplaceholders for head section and when I create pages I put there what I want and it renders correctly (the first "good" title element is above analitics code). I wonder if umbraco puts another title element somehow and if so how I can disable it...

    kind regards,

  • Rich Green 2246 posts 4008 karma points
    Dec 07, 2010 @ 19:38
    Rich Green
    0

    Hi,

    Umbraco doesn't add any code.

    Does the problem exist on all pages, ave you searched your .master files for <title> ?

    Seems like it could be added from a child page.

    Rich

  • Kim Andersen 1447 posts 2197 karma points MVP
    Dec 07, 2010 @ 20:40
    Kim Andersen
    1

    Have you set a runat="server" on your <head>-tag? This can sometimes insert an extra title-tag in some cases.

    /Kim A

  • pikej 27 posts 47 karma points
    Dec 07, 2010 @ 20:44
    pikej
    0

    Hello again Rich,

    I think it is not from the child page because when I was making data types I added property to control titles of the pages and they work OK, In other words when creating a page I can choose the title I like and you can see it on the browser. I use special ContentPlaceHolder to pull these titles from data types. Then I close down this ContentPlaceHolder, and there is google analitics code and the end of head, </head>

    Between these two elements (google and </head>) out of the blue there is another title element when page renders. Please have a look at the code from my main template and child template:

     

  • Kim Andersen 1447 posts 2197 karma points MVP
    Dec 07, 2010 @ 20:49
    Kim Andersen
    0

    The extra title tag are for sure being created because of your runat="server" that is set on the <head>-tag. the runat="server" will create the empty <title>-tag because there is no one inserted in your master template. Even though you insert one on the child template, the runat="server" will still insert an extra one.

    Either you must remove the runat="server" or you need to move the <title><umbraco:Item field="title"....></umbraco:Item></title> from the child template to the main template.

    /Kim A

  • pikej 27 posts 47 karma points
    Dec 07, 2010 @ 20:59
    pikej
    0

    You were right Kim, as soon as I removed runat it disappeared. Thanks a lot.

    Special thanks also for Rich for being so patient. All the best. 

  • Rich Green 2246 posts 4008 karma points
    Dec 07, 2010 @ 21:06
    Rich Green
    0

    Glad you got it sorted, nice spot Kim! h5yr

  • Kim Andersen 1447 posts 2197 karma points MVP
    Dec 07, 2010 @ 21:14
    Kim Andersen
    0

    Great!

    The first time I ran into this problem was when I wanted to use the umbraco.library:RegisterJavaScriptFile XSLT-extension in a project. This extension unfortunately needs the runat="server" on the <head>-tag. But since I'm creating all of the META-data (including the title-tag) in a XSLT file, I also got the extra empty title-tag.

    Well, anyway, I'm glad you got it working :)

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft