Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2005-04-24 09:15:45
- lee
- Member
- From: Normandy, France
- Registered: 2004-06-17
- Posts: 831
Meta description & title
Is there or will there be a built in way to handle meta description and title on a section or article basis in a Page?
Offline
Re: Meta description & title
I was thinking about how to improve the management of meta tags. Since I don’t know anything about the TXP development or plugins I can only give some ideas to develop it ^^
It would be in a page with all sections and articles listed and for each of those, we could define description and keywords meta tags.
An option would help to define if the meta description is like the except of the article.
We could also define the keywords for the entire website for example.
By default, all the articles in a section / category would have the same meta and these could be redefined if needed.
Hope this help ;)
Last edited by Perrine (2005-10-19 13:05:35)
Offline
#3 2005-10-19 14:28:27
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Meta description & title
Just until there will be a built in functionality for handling meta keywords and description, there is a way to – sort of – do this. This is what I do:
I named two of the custom fields MetaKeywords and MetaDescription. So for every article I can create specific content.
Then I have a form called ‘meta-article’:
<code>
<meta name=“description” content=”<txp:if_custom_field name=“MetaDescription”>
<txp:custom_field name=“MetaDescription” />
<txp:else />general site description</txp:if_custom_field>” />
<meta name=“keywords” content=”<txp:if_custom_field name=“MetaKeywords”>
<txp:custom_field name=“MetaKeywords” />
<txp:else />general site keywords</txp:if_custom_field>” />
</code><br />
and a form ‘meta-site’:<br />
<code>
<meta name=“keywords” content=“general site keywords” />
<meta name=“description” content=“general site description” />
</code><br />
and also a form ‘meta-search’ (guess the code…)<br />
On the page template in the head:
<code>
<txp:if_search>
<txp:output_form form=“meta-search” />
<txp:else />
<txp:article limit=“1” form=“meta-article” listform=“meta-site” />
</txp:if_search>
</code><br />
This way articles that have content in those two custom fields are given specific content for the meta keywords and description. If the custom fields are empty, of if you’re on an article list page, general keywords and description are generated.
I’m sure it can be expanded with if_category and if_section.
Offline
Re: Meta description & title
Mmmh don’t think I understand everything because of my poor english :p
On the page template, what is listform ? Guess it’s used if we are on an article list page ? (Don’t know this attribute)
Tell me if I’m right with this tag : <code><txp:article limit=“1” form=“meta-article” listform=“meta-site” /></code> : Means that when it’s an article page, the meta-article form is called and if we are on article list page, the meta-site is called ? Am I right ?
I do something like this for the moment but a little bit complicated because I’m using lot of forms to insert the good description. Seems to be better how u do :)
Offline
#5 2005-10-19 17:45:07
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Meta description & title
Perrine wrote:
On the page template, what is listform ? Guess it’s used if we are on an article list page ? (Don’t know this attribute)
That’s right, look here for all the attributes.
Tell me if I’m right with this tag : <code><txp:article limit=“1” form=“meta-article” listform=“meta-site” /></code> : Means that when it’s an article page, the meta-article form is called and if we are on article list page, the meta-site is called ? Am I right ?
Right again :) And the <txp:if_search>
part is to display the meta-search form if we are on a page with search results (for that one is neither an article page nor an article list).
(I didn’t make this up all by myself, some thread on this forum led me to it, but I can’t find it anymore.)
Offline
#6 2005-10-19 20:33:58
- lee
- Member
- From: Normandy, France
- Registered: 2004-06-17
- Posts: 831
Re: Meta description & title
nicely done.
Offline
#7 2005-10-19 20:56:49
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Meta description & title
Found it: credits go here.
Offline
Re: Meta description & title
Thanks Doggiez for your answers :)
Offline
#9 2006-03-20 16:08:39
- paulp
- New Member
- Registered: 2006-01-23
- Posts: 2
Re: Meta description & title
Hi – I was wondering if any if you guys could help me out with an issue I’m having with this?
I have placed [posted here without the more than less than symbols]: txp:article limit=“1” form=“meta-article” listform=“meta-site”
In the header – on the main page and sections all is fine, but for individual articles the comment box
doubles up and appears at the head of the page.
Any help would sure save my hair :-)
Many thanks,
Paul.
Offline
#10 2006-03-20 17:34:55
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: Meta description & title
You have to go to admin prefs, and turn commenting off, As far as I could conceive this, there’s no other way to circumvent this remmedy without hacking the source,
hmmm, may be conditionals again ? who knows,you never know.
(PS.: I ran into this problem myself, and still am looking for an alternative, I think that the article method is not such a good idea, because I wouldn’t trust too much the output of that title field)
regards
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
#11 2006-03-20 17:40:09
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Meta description & title
To be able to use article tags in the head, you have to turn ‘Automatically append comments to articles’ off (admin > preferences). Then you’ll need to manually include the necessary comment tags in your article form. Read this FAQ about it.
Offline
#12 2006-03-20 17:43:36
- paulp
- New Member
- Registered: 2006-01-23
- Posts: 2
Re: Meta description & title
Thanks Els – I just figuered that on my last trawl through the site a little while ago :)
Cheers,
Paul.
Offline