Copied to clipboard

Flag this post as spam?

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


  • Sean 141 posts 179 karma points
    Jan 26, 2011 @ 09:31
    Sean
    0

    Getting data into the Meta Data fields

    Hi There,

    I'm getting blank fields. I just want to clarify why this is? Do I need to extend the umbraco API and create some fields in the cms for them?

    Where can I find more about how do this?

    Thanks in advance.


    <meta name="keywords" content="" /><meta name="description" content="" />
  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Jan 26, 2011 @ 09:53
    Rasmus Berntsen
    0

    Ah sry, didn't see it was a comment to a package. :-/

  • Sean 141 posts 179 karma points
    Jan 26, 2011 @ 10:00
    Sean
    0

    I'm not sure that I'm following you. I need to give the user access to change this text. Do I need to create custom fields for each page?

  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Jan 26, 2011 @ 10:07
    Rasmus Berntsen
    0

    Yes, it looks like you do:

    1) Add the macro to your master template in the <HEAD> section
    2) Add the following to all your page document type's (or inherit from one generic doctype)

    title | text field
    description | multi-line text
    keywords | multi-line text

     

    So for each documenttype you need to add the title, description and keywords.

  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Jan 26, 2011 @ 10:09
    Rasmus Berntsen
    0

    Usually I create a master doctype with all of the SEO-properties, which basically most of my doctypes inherit from.

  • Sean 141 posts 179 karma points
    Jan 26, 2011 @ 11:09
    Sean
    0

    Ok. Thanks for the tips. I will give it a go.

    Sean

  • Sean 141 posts 179 karma points
    Jan 27, 2011 @ 12:09
    Sean
    0

    Hi there,

    It's not working i'm afraid. I have added the macro and that worked fine but there is no data from the fields coming through.

    I added a generic property for each and it's not working. The fields are in the document but the text I have added is not coming through.

    title | text field
    description | multi-line text
    keywords | multi-line text

     

     <title /><meta name="keywords" content="" /><meta name="description" content="" />
  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Jan 27, 2011 @ 12:13
    Rasmus Berntsen
    0

    Hi Sean,

    I've just taken a look at the package and it looks like it's based on the old XML schema. You're probably running Umbraco 4.5+, right? :)

  • Sean 141 posts 179 karma points
    Jan 27, 2011 @ 12:16
    Sean
    0

    Yes I am. Do I need to do something like this instead?

     

    <meta name="description" content='<umbraco:Item field="metaDescription" recursive="true" runat="server" />'>
    <meta name="keywords" content='<umbraco:Item field="metaKeywords" recursive="true" runat="server" />'>

  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Jan 27, 2011 @ 12:24
    Rasmus Berntsen
    0

    Yearh, that could be one solution, if you don't want to try some XSLT... :)

     

    <umbraco:Item field="metaDescription" insertTextBefore="&lt;meta name=&quot;description&quot; content=&quot;" insertTextAfter="&quot; /&gt;" runat="server"></umbraco:Item>
  • Sean 141 posts 179 karma points
    Jan 27, 2011 @ 12:29
    Sean
    0

    So could I use that you posted above? Would I put this into the master template? In the same spot?

  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Jan 27, 2011 @ 12:35
    Rasmus Berntsen
    0

    In the masterpage, in the head-section. Please make sure your field on the documenttypes matches the field "metaDescription" or edit the field so it matches. It should work, as far as I know.

  • Sean 141 posts 179 karma points
    Jan 27, 2011 @ 12:44
    Sean
    0

    Wow. That worked like a treat. Thank you.

    Is there any performance benefit to using xslt?

    Once again. I really appreciate the help you gave me. Now I can get some sleep.

  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Jan 27, 2011 @ 13:42
    Rasmus Berntsen
    0

    I don't think there's any noticeable performance benefit in the xslt but it's a much nicer/cleaner solution. And when you've created that one "perfect" SEO-XSLT you could re-use it for all your new sites. I've one with title-tag, meta keywords, meta description and no-index (true/false) and I've used it for many sites.

    Please remember to mark the right answer as the solution to your problem. :-)

  • Sean 141 posts 179 karma points
    Feb 02, 2011 @ 08:34
    Sean
    0

    For anyone else reading this post. I managed to accomplish the task of displaying meta data using the following methods.

    1. referencing the metadata fields in the master page like:

    <meta name="description" content='<umbraco:Item field="metaDescription" recursive="true" runat="server" />'>
    <meta name="keywords" content='<umbraco:Item field="metaKeywords" recursive="true" runat="server" />'>

    or using XSLT like this:

    2.

    <umbraco:Item field="metaDescription" insertTextBefore="&lt;meta name=&quot;description&quot; content=&quot;" insertTextAfter="&quot; /&gt;" runat="server"></umbraco:Item>
       <umbraco:Item field="metaKeywords" insertTextBefore="&lt;meta name=&quot;keywords&quot; content=&quot;" insertTextAfter="&quot; /&gt;" runat="server"></umbraco:Item>
Please Sign in or register to post replies

Write your reply to:

Draft