Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-11-16 13:21:34

korpulente
Member
Registered: 2009-01-29
Posts: 36

Excerpts outside article context

I would like to use article excerpts in the meta description, for the page that displays articles. How can that be achieved?

Is it possible in any way to use an article excerpt outside the article context?

Things like <meta name="description" content="<txp:excerpt />" /> obviously doesn’t work.

Last edited by korpulente (2009-11-16 13:22:43)

Offline

#2 2009-11-16 14:06:56

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Excerpts outside article context

Your code should work fine but only when viewing in “individual_article” mode by virtue of the fact that it is an article tag you are using. When in “article_list” mode such as a section front-page or category listing you would have to use a general description so you could use something like:-

<txp:if_individual_article>
<meta name="description" content="<txp:excerpt />" />
<txp:else />
<meta name="description" content="create a general description here" />
</txp:if_individual_article>

You could create a form template for this and call it to the “head” with a <txp:output_form form="form_name" /> tag. I mention this because you can get quite creative with judicious use of <txp:if_section> and <txp:if_category> tags as well.

Same thing goes for the <txp:keywords /> tag.

Last edited by thebombsite (2009-11-16 14:08:28)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#3 2009-11-16 14:23:51

korpulente
Member
Registered: 2009-01-29
Posts: 36

Re: Excerpts outside article context

That works just fine. Thank you!

Offline

Board footer

Powered by FluxBB