Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Meta tags for SEO
Hi guys,
I’ve been trying to figure out how to create custom meta descriptions and keywords for individual entry pages. It’s for a client site and it would be best if the method used the info already supplied in the entry excerpt and keyword fields under the write tab. Meaning, the best solution will not entail use of custom tags specially for descriptions and keywords.
I tried <meta name="description" content="<txp:excerpt />" />
but that doesn’t seem to work. I think you can’t call <txp:excerpt />
before <txp:article />
on a page. Is there someway I can get around this? Other methods would be appreciated too.
The plugin that came closest to doing what I want was jad_metadata. But unfortunately it uses the whole excerpt (even if its 200 words long) and it will output textile links (e.g. "link":http://www.example.com) in the meta description tag.
Thanks in advance…
Offline
#2 2006-03-18 18:22:07
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Meta tags for SEO
You can only use <txp:excerpt />
in an article form. So you have to create an article form that contains that tag, and then on the page use <txp:if_individual_article><meta name="description" content="<txp:article form="nameofform" />" /></txp:if_individual_article>
. Note that you’ll have to strip the html tags from the excerpt. And it’s not possible if you have set ‘automatically append comments to articles’ to ‘yes’.
Then you can add another meta description tag for article list pages, or one for every section, or whatever…
Offline
Re: Meta tags for SEO
Ahh.. I see. Els, I did what you suggested and the excerpt shows. Unfortunately it’s still got all the attached html tags. Is there anyway I can strip html tags from the excerpt?
Offline
Re: Meta tags for SEO
I generated a form (head).
In it, there are the meta tags. I use for example:
<title><txp:ob1_title order="%article,%category" separator=" - " /> Robert Hartl Weblog</title>
If You want for different sections different solutions use for example
<txp:ob1_if_section section="blog"><title><txp:ob1_title order="%article,%category" separator=" - " /> Robert Hartl Weblog (Blog)</title></txp:ob1_if_section>
BTW meta description and the title are important for seo.
Meine Textpattern-Seite mit kuriose, lustige Fotos – TXP-Template
Infos zu Webseitenoptimierung für Suchmaschinen.
Offline
Re: Meta tags for SEO
I’ve figured it out!
In my <head>
, I have
<txp:if_individual_article>
<meta name="description" content="<txp:article form="metadescription" />" />
<txp:meta_keywords />
</txp:if_individual_article>
In my metadescription form, I make use of 2 plugins:
1. kgr_safe_excerpt
2. sab_striphtml
In the metadescription form:
<txp:sab_striphtml><txp:kgr_safe_excerpt countexcerpt="true" count="20" linktext=" ..." /></txp:sab_striphtml>
kgr_safe_excerpt will display the first 20 words from the body text, or excerpt text if it exists. I use linktext=” …” so that it indicates that the description has been cut off midway. sab_striphtml then strips it off any html tags that don’t belong in the meta tag.
Thanks to everyone for helping me refine my ideas till I got the solution!
Offline
Re: Meta tags for SEO
There is a txp:meta_author
for author. It’s the only one, as far as I know.
Offline
Offline
Re: Meta tags for SEO
David,
thanks! This looks quite interesting.
Meine Textpattern-Seite mit kuriose, lustige Fotos – TXP-Template
Infos zu Webseitenoptimierung für Suchmaschinen.
Offline
#9 2006-03-29 17:31:17
- alannie
- Member
- From: Minnesota, USA
- Registered: 2005-09-15
- Posts: 150
Re: Meta tags for SEO
davidwang, you may want to check out my post on the same topic. Something to watch out for is that both your and my approaches require multiple <code>txp:article</code> tags. This can cause issues with other functions such as comments and zem_contact_reborn forms. Other than using different page templates for articles where it’s a problem, I have yet to find a solution.
Offline
#10 2006-03-29 21:20:17
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Meta tags for SEO
alannie wrote:
This can cause issues with other functions such as comments
If you need to use more than one <txp:article />
tag on a page, switch ‘automatically append comments to articles’ off. Comment display confusion.
Offline
Re: Meta tags for SEO
alannie, thanks for your link. Didn’t see your article first before trying to figure out the meta tags. I’m sure it would’ve saved me a lot of trouble.
Els, it sounds like you learnt about switching automatically appended comments off the hard way.
Thanks all for your help and advice. Cheers!
Offline
Re: Meta tags for SEO
I fixed the problems David describes with the jad_metadata
plugin (this post).
Offline
Pages: 1