Reputation: 21
I am trying to modify dc tags element for blogger, the tags is something like this:
<meta name="DC.Title" content="title" />
<meta name="DC.Creator" content="creator" />
<meta name="DC.Description" content="description" />
But this tags can only be applied in one page(static), if say, I have 100 pages then all of the pages will be using the same tags and hence the wrong ones.
I am trying to automatically generate the tags according to the page info and to get the meta description from the template, I am using below code:
<meta expr:content='data:blog.metaDescription' name='description'/>
So I modify it to something like this:
<meta name="DC.Title" content="<data:blog.pageTitle/>" />
<meta name="DC.Description" content="data:blog.metaDescription" />
I am trying this, so that the tags chang automatically according to the pages, and the same tags info isn't repeated in all pages. But it isn't working.
Upvotes: 2
Views: 51
Reputation: 813
This content="<meta name="DC.Title" content="<data:blog.pageTitle/>" />"
and <meta name="DC.Description" content="data:blog.metaDescription" />
will insert a static value for the DC.title
tag and DC.description
tag respectively instead of inserting a dynamic value. This is also a coding error and to fix that expr:content
should be used.
<meta expr:content='data:blog.pageName' name='dc.title'/>
<b:if cond='data:blog.metaDescription'>
<meta expr:content='data:blog.metaDescription' name='dc.description'/>
<b:else/>
<meta expr:content='data:post.snippet' property='dc.description'/>
</b:if>
Upvotes: 0
Reputation: 5651
Use the following code instead -
<meta name="DC.Title" expr:content="data:blog.pageName" />
<meta name="DC.Description" expr:content="data:blog.metaDescription" />
You will notice that we have added expr:
in front of the content
attribute. This is needed for telling the Blogger XML parser to replace the data layout tag with its dynamic value according to the page being viewed
Upvotes: 1