I have just started using this tool for a new project. I can't seem to find a good way to add my meta data. I have created my page properties but can not find a way to bind them into my meta tags. I have tried:
Other than that, I would add: recursive="true" so that you don't have to fill in the meta info on every page, If recursive is on, it will look at the parent for existing meta info and if the parent doesn't have anything, it looks in the grandparent, and up, all the way to the highest node in the tree.
Add meta description and keywords???
Hi All,
I have just started using this tool for a new project. I can't seem to find a good way to add my meta data. I have created my page properties but can not find a way to bind them into my meta tags. I have tried:
<meta name="keywords" Content="<umbraco:Item field='Keywords' runat='server'></umbraco:Item>" />
What is the best practice way of doing this? Any suggestions would be welcome.
Thanks,
Shane
Try it with the single/double quotes the other way around:
Other than that, I would add: recursive="true" so that you don't have to fill in the meta info on every page, If recursive is on, it will look at the parent for existing meta info and if the parent doesn't have anything, it looks in the grandparent, and up, all the way to the highest node in the tree.
Hi Sebastiaan,
Thanks for the reply. I still get the same problem though, my source comes out like this:
Can you post the original line of code? I just used the following code:
<meta name="description" content='<umbraco:Item field="metaDescription" recursive="true" runat="server" />'> <meta name="keywords" content='<umbraco:Item field="metaKeywords" recursive="true" runat="server" />'>
And it worked. Try change the double quotes after content= to a single quote.
Mine works fine like this
<meta name="description" content="<umbraco:Item field='metaDescription' recursive='true' runat='server'></umbraco:Item>" />
Do you have runat="server" on your head tag?
See this post http://www.richardsoeteman.net/CommentView,guid,90e0ca4a-0e98-4962-9d86-5381d57e6ae7.aspx#commentstart
specially my comment :-)
Thanks for the help guys, I can't explain why it wasn't working.
Petr, your solution did the trick!Thanks a lot.
I don't get the Richard Soeteman thing... my tags remain empty.
I've sorted it out.
Hi,
In case anyone else has this problem, I always use the same XSLT Macro for adding my meta tags and I have just uploaded it.
Meta Tags for Umbraco
It is a very simple macro, so don't expect rocket science :)
Cheers,
Chris
Chris , your link is dead. Could you please update it.
@kashif the new links is: http://our.umbraco.org/projects/website-utilities/meta-tags-for-umbraco
It wont work with runat="server" at the head-tag.
Use this instead.
<umbraco:Item field='metaKeywords' insertTextBefore="<meta http-equiv='keywords' content='" insertTextAfter="' />" runat='server'></umbraco:Item>
When you have the runat="server"in the head tag.
Or in Razor you can now do:
<umbraco:Macro language="cshtml" runat="server">
<meta name="keywords" content="@Model.AncestorsOrSelf().Where("metaKeywords != string.Empty").Last().metaKeywords" />
<meta name="description" content="@Model.AncestorsOrSelf().Where("metaDescription != string.Empty").Last().metaDescription" />
<umbraco:Macro>
even in a runat=server head.
is working on a reply...