I would like to add meta tags (keywords, description,author,copyrights) in blog 4. So I added in my blog and blogPost document type meta tags and in blogMaster template I added
If I add the meta tag AUTHOR to title, it's working. And one more question. You see, before the <umbraco:Item field... I must use ' and not ", otherwise I get an error. Why is that? Are meta tags read by search engines the same if I use ' and not "?
The reason you use the single quote ' before the <umbraco:Item... is that if you use the same type of quotes as you are using within the <umbraco:Item> tag the parser will confuse the quotes and not be able to tell where the outside attribute ends. I believe you could switch it around and use double quotes " for the html tag and single quotes in the umbraco:item tag as long as you don't use the same quotes for both.
As for your question as to why the meta tags are working a quick look suggests two possiblities:
Your meta tags aren't closed. Depending on the dtd you are using, it may require you to self-close them with the />. It is best practice regardless.
e.g. <meta name="description" content='<umbraco:Item
field="MetaDescription" runat="server"></umbraco:Item>' />
Are you using the correct Alias for the data fields? Are they textstring or textboxmultiple datatypes?
If you want to make sure you get it right use the "Insert Umbraco Page Field" button to insert the <umbraco:Item> tag.
As for the meta tags being in the master template and the data being in the doctypes, that doesn't matter. When you place <umbraco:Item> tags in a template it will pull from the current page and if you use the recursive option, if the data doesn't exist in the current page it will look in the parent nodes for the data as well.
Chris, I've solved the problem. The problem was caused by runat="server" in the head tag. So I've changed <head profile="http://gmpg.org/xfn/11" runat="server"> to <head profile="http://gmpg.org/xfn/11">. THX for your help.
Adding meta tags in blog4
Hi,
I would like to add meta tags (keywords, description,author,copyrights) in blog 4. So I added in my blog and blogPost document type meta tags and in blogMaster template I added
<meta name="description" content='<umbraco:Item field="MetaDescription" runat="server"></umbraco:Item>'>
<meta name="keywords" content='<umbraco:Item field="MetaKeywords" runat="server"></umbraco:Item>'>
<meta name="copyright" content='Copyright (c) 2010 by <umbraco:Item field="MetaCopyright" runat="server"></umbraco:Item>'>
<meta name="author" content='<umbraco:Item field="MetaAuthor" runat="server"></umbraco:Item>'>
But it's not working. I see that that way it's working for the pageName. Why not the meta tags?
THX for your help.
Uros
If I add the meta tag AUTHOR to title, it's working. And one more question. You see, before the <umbraco:Item field... I must use ' and not ", otherwise I get an error. Why is that? Are meta tags read by search engines the same if I use ' and not "?
Uros,
The reason you use the single quote ' before the <umbraco:Item... is that if you use the same type of quotes as you are using within the <umbraco:Item> tag the parser will confuse the quotes and not be able to tell where the outside attribute ends. I believe you could switch it around and use double quotes " for the html tag and single quotes in the umbraco:item tag as long as you don't use the same quotes for both.
As for your question as to why the meta tags are working a quick look suggests two possiblities:
--Chris
Tey are textstring datatype. Here's the HTML, which I copied from browser:
<meta name="description" content="<umbraco:Item field="MetaDescription" runat="server"></umbraco:Item>" />
THX for you reply!
Uros
One more thing. The meta tags are in master template, the data are in blog and blogpost templates. Does that matter in any way?
Sorry, data is in blog and blogPost documenttype. That way I want for meta tags to change with every post.
It looks like part of your umbraco tag was html encoded. You need to replace the encoding with the actual characters.
This:
<meta name="description" content="<umbraco:Item field="MetaDescription" runat="server"></umbraco:Item>" />Needs to become this:
If you want to make sure you get it right use the "Insert Umbraco Page Field" button to insert the <umbraco:Item> tag.
As for the meta tags being in the master template and the data being in the doctypes, that doesn't matter. When you place <umbraco:Item> tags in a template it will pull from the current page and if you use the recursive option, if the data doesn't exist in the current page it will look in the parent nodes for the data as well.
--Chris
I did use the "Insert Umbraco Page Field" button - still the same "output"
I'm using the same lines in site master template and it's working.So I really don't know why the blog master doesn't work. THX for your help so far
Chris, I've solved the problem. The problem was caused by runat="server" in the head tag. So I've changed <head profile="http://gmpg.org/xfn/11" runat="server"> to <head profile="http://gmpg.org/xfn/11">. THX for your help.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.