Copied to clipboard

Flag this post as spam?

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


  • Thor Madsen-Holm 82 posts 212 karma points c-trib
    Jan 21, 2011 @ 15:25
    Thor Madsen-Holm
    2

    RegisterJavaScriptFile without runat="server" in <head> tag

    Hi, 

    I was wondering if it is possible to use umbraco.library:RegisterJavaScriptFile() without having a runat="server" ind the <head> tag ? 

    Any suggestions will be much appreciated :-)

    /Thor

     

     

  • Michael Latouche 502 posts 816 karma points
    Jan 21, 2011 @ 16:40
    Michael Latouche
    0

    Hi Thor,

    Unfortunately not: see the wiki page http://our.umbraco.org/wiki/reference/umbracolibrary/registerjavascriptfile

    Cheers,

    Michael.

  • Tom Smith 98 posts 172 karma points
    Jan 21, 2011 @ 17:48
    Tom Smith
    0

    Hi Thor,

    Why are you so keen to avoid that runat server tag?! Perhaps there might be a way round what it's breaking?

    Many Thanks,

    Tom

  • Kim Andersen 1447 posts 2194 karma points MVP
    Jan 22, 2011 @ 11:44
    Kim Andersen
    0

    Hi Tom

    I can see a disadvantage in having the runat server on the head-tag if we are using a macro to generate the different meta tags including the title-tag. I always use a XSLT macro to create the meta-tags and the title tag in my head, so that I can have some different fallback, and the admins can have some different opportunities. But the problem is, that if I have the runat server on my head-tag and there is no title-tag in the template, then the runat server will create an empty title-tag like this:

    <title></title>

    When my page is rendered then, I'm suddently having two title-tags in my head-tag, and one of them will even be empty. And we all know that two title-tags in the head-tag will not work at all.

    Just my five cents :)

    /Kim A

  • Thor Madsen-Holm 82 posts 212 karma points c-trib
    Jan 22, 2011 @ 19:25
    Thor Madsen-Holm
    0

    Hi Tom, 

    I also use a "header" macro to fill out metatags etc exactly as Kim does. 
    And the reason i want to avoid the runat="server" attribute on the <head> tag is the same. I dont want two <title> tags in my header. 

    So if there is a way to supress the empty title tag i would not mind having the runat="server" attribute on my <head> tag. 
    Not sure if that is possible though ? 

    Any ideas will be much appreciated :-)

     

  • Jan Skovgaard 11244 posts 23417 karma points MVP 6x admin c-trib
    Jan 23, 2011 @ 18:04
    Jan Skovgaard
    0

    Hi Thor

    Could you perhaps avoid using the extension by using a content placeholder i the head section, which you then use in the template where you put the macro that's in need of the specific JavaScript?

    Like Tentonipete is demonstrating in his post here: http://our.umbraco.org/forum/templating/templates-and-document-types/16193-css-for-templates-%28not-master%29

    /Jan

  • Thor Madsen-Holm 82 posts 212 karma points c-trib
    Jan 23, 2011 @ 18:27
    Thor Madsen-Holm
    0

    Hi Jan, 

    That actually sounds like a possible solution to the problem, thanks for your input :-)

    /Thor

  • Jan Skovgaard 11244 posts 23417 karma points MVP 6x admin c-trib
    Jan 23, 2011 @ 18:31
    Jan Skovgaard
    0

    Hi Thor

    That's great. I'm actually a bit stunned that I have never thought of this option myself before. But it's definately something I'll play around with. I'm thinking it should be possible to use in conjunction with the clientdependency framework somehow.

    /Jan

  • Tom Smith 98 posts 172 karma points
    Jan 24, 2011 @ 10:31
    Tom Smith
    0

    Hi Kim,

    Ahhhh! I see where you're coming from, I only ever tend to do things like;

    <umbraco:Item insertTextBefore="<meta name=&quot;keywords&quot; content=&quot;" field='globalKeywords' recursive='true' runat='server'></umbraco:Item><umbraco:Item insertTextBefore="&nbsp;" field='metaKeywords' insertTextAfter="&quot;/>" runat='server'></umbraco:Item>

    So authors have to put their meta in manually. Haven't looked into generating meta tags with a macro before. Sounds handy! Will definitely have a read up :)

    Many Thanks,

    Tom

  • Kim Andersen 1447 posts 2194 karma points MVP
    Jan 24, 2011 @ 10:43
    Kim Andersen
    0

    Hi Tom

    Actually, the way I described is quite nifty, as the users always have the full access to how the meta tags will look - If they want to :)

    If the users are lazy and doesn't take the time to write some unique titles, descriptions etc., the macro will generate some fairly unique and descriptive content to be put in the meta tags.

    So if the users want to, they have the full access to how the content of the tags looks like, and even if they don't take the time, the titles etc. will still be quite good and unique for the search engines :)

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft