Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Dynamic display of meta
Hello, I’m trying to generate the meta tags with this code:
<!-- meta -->
<txp:article limit="1">
<txp:if_custom_field name="meta_description">
<meta name="description" content="<txp:custom_field name='meta_description' />" />
<txp:else />
<meta name="description" content="Lorem ipsum dolor sit amet" />
</txp:if_custom_field>
<!-- keywords -->
<txp:if_keywords>
<txp:meta_keywords />
<txp:else />
<meta name="keywords" content="One, two, three, four" />
</txp:if_keywords>
</txp:article>
But on the homepage I get a double copy of the article body itself, one below the other.
Thanks for any suggestion
Offline
Re: Dynamic display of meta
You could try
<!-- meta -->
<txp:article_custom limit="1">
<txp:if_custom_field name="meta_description">
<meta name="description" content="<txp:custom_field name="meta_description" />" />
<txp:else />
<meta name="description" content="Lorem ipsum dolor sit amet" />
</txp:if_custom_field>
<!-- keywords -->
<txp:if_keywords>
<txp:meta_keywords />
<txp:else />
<meta name="keywords" content="One, two, three, four" />
</txp:if_keywords>
</txp:article_custom>
note that you also have double quotes where there should be single ones. I corrected them in the above code.
You have single quotes where there should be double ones:) – corrected my code too.
Last edited by colak (2012-10-30 18:54:27)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Pages: 1