Copied to clipboard

Flag this post as spam?

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


  • Dominic Brown 91 posts 111 karma points
    Jul 13, 2011 @ 16:02
    Dominic Brown
    0

    Meta Tags

    Hi,

    is it possible to creat editable meta tags?

    in other words, let the end user change these when they want?

    thanks

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 13, 2011 @ 16:16
    Fuji Kusaka
    1

    Hi Dominic,

     

    Yes this can be done just by creating a Field in your Doc Type with Textbox Multiple under and then just call it in your template. But at some level i think its better to give only meta kyewords and Description editable.

     

    //Fuji

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jul 13, 2011 @ 16:16
    Lee Kelleher
    2

    Hi Dominic,

    When you say end-user, do you mean a content-editor?

    If so, then yes absolutely! Create a couple of extra properties on your document type for the meta tags (call them something like "metaKeywords" and "metaDescription") - then reference those in your templates.

    I use the following code snippet in my master template:

    <umbraco:Item runat="server" field="metaKeywords" insertTextBefore="&lt;meta name=&quot;keywords&quot; content=&quot;" insertTextAfter="&quot; /&gt;" />
    <umbraco:Item runat="server" field="metaDescription" insertTextBefore="&lt;meta name=&quot;description&quot; content=&quot;" insertTextAfter="&quot; /&gt;" />

    Cheers, Lee.

  • Dominic Brown 91 posts 111 karma points
    Jul 13, 2011 @ 16:18
    Dominic Brown
    0

    thanks, i made the fields in the doc types already, was just wondering about the rest lol

    i'll try this, thanks

     

  • Dominic Brown 91 posts 111 karma points
    Jul 13, 2011 @ 16:19
    Dominic Brown
    0

    sorry, do i put this into the head section?

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Jul 13, 2011 @ 16:21
    Lee Kelleher
    0

    Yes, <meta> tags go inside the <head>.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 13, 2011 @ 16:26
    Dennis Aaen
    1

    Hi, Dominic,

    Yes, you should just put the umbraco item´s it in the header section. As a complement to what Lee says. Another possibility is to create an XSLT file for example by name metaTags.xslt. And get the values via XSLT. I have used both methods. Don´t know if the one solution is better than the other.

    /Dennis

  • Dominic Brown 91 posts 111 karma points
    Jul 13, 2011 @ 16:30
    Dominic Brown
    0

    thanks all.

    i've gone with Lee's solution

  • Dominic Brown 91 posts 111 karma points
    Jul 13, 2011 @ 16:31
    Dominic Brown
    0

    as a total noob tho, i am not sure how to test if this is doing what its meant to be doing

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 13, 2011 @ 16:35
    Dennis Aaen
    0

    The way you could test it, is to put some text into the metaDescription and metaKeywords fields on document type, and then view the source code of the page to check if it gets printed.

    /Dennis  

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 13, 2011 @ 16:36
    Fuji Kusaka
    1

    Try  Lees' solution and just add some text from you content node then view the source code generated by your browser.

     

    //fuji

  • Dominic Brown 91 posts 111 karma points
    Jul 13, 2011 @ 16:45
    Dominic Brown
    0

    as i am reading your replies i am slapping myself.

    makes perfect sense lol

     

    thanks again

  • Andy Boston 28 posts 47 karma points
    Mar 23, 2015 @ 11:41
    Andy Boston
    0

    Hi,

    I just tried this solution in Umbraco 7.2.2 and it doesn't work.

    Please can anyone tell me how to do this now?

    I also tried an old extension built in 2010 but that doesn't work either...

    Thanks in advance

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Mar 23, 2015 @ 11:51
    Dennis Aaen
    2

    Hi Andy,

    The reason why this old solution not works for you is that, it´s for websites that running in WebForms mode. Since you are using Umbraco 7.2.2, it uses MVC as default,

    In MVC templates you can called it like this.

    @Umbraco.Field("AliasOfTheField")

    https://our.umbraco.org/Documentation/Reference/Mvc/views#RenderingafieldwithUmbracoHelper

    So for the meta description, and meta keywords it would look like this.

    @Umbraco.Field("metaDescription")
    @Umbraco.Field("metaKeywords")

    Hope this helps,

    /Dennis

  • Andy Boston 28 posts 47 karma points
    Mar 23, 2015 @ 11:58
    Andy Boston
    0

    Hi Dennis,

    That works perfectly. Thank you :)

Please Sign in or register to post replies

Write your reply to:

Draft