Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2010-07-04 16:37:00
- joel
- Member
- Registered: 2004-11-26
- Posts: 162
Best practises with custom meta information
Hi,
I’ve looked around to get my mind clear about this.
What I need is the possibility to change the Page Title and Meta Description via custom fields for some articles.
If that’s is not possible, Is there a way of doing it “manually” for a number of articles via conditionals in the head-section? For instance <txp:if_article_id….
Please point me in the right direction.
I’ve tride the Rah_metas plugin but I couldn’t make it perform something like this.
Thanks a lot in advance! :)
Offline
Re: Best practises with custom meta information
<title><txp:if_individual_article>
<txp:if_custom_field name="custom_title">
<txp:custom_field name="custom_title" />
<txp:else />
<txp:page_title />
</txp:if_custom_field>
<txp:else />
<txp:page_title />
</txp:if_individual_article></title>
Something similar would work for the meta description.
Code is topiary
Offline
#3 2010-07-04 17:53:53
- joel
- Member
- Registered: 2004-11-26
- Posts: 162
Re: Best practises with custom meta information
Thanks for your instant reply. However, that doesn’t seem to work for me. But that is the kind of solution I’d prefer. I also tried to wrap the title attr in asy_wondertag tags. That didn’t work eiter.
Offline
#4 2010-07-04 18:00:01
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: Best practises with custom meta information
joel
if you are using a recent version of TXP you don’t need asy_wondertags just use single quotes inside the tag attribute you wish to nest. What version of TXP are you using?
— Steve
Offline
#5 2010-07-04 18:14:36
- joel
- Member
- Registered: 2004-11-26
- Posts: 162
Re: Best practises with custom meta information
Ahh that’s good news! It’s the recent 4.2.0
Last edited by joel (2010-07-04 18:15:03)
Offline
Re: Best practises with custom meta information
joel wrote:
Thanks for your instant reply. However, that doesn’t seem to work for me. But that is the kind of solution I’d prefer. I also tried to wrap the title attr in asy_wondertag tags. That didn’t work eiter.
What title attribute? The title
tags I included in my example are just HTML tags, not Txp tags.
Post a tag trace for more help. I haven’t actually tested the code I posted, but I think it should work.
Do you have a custom field named custom_title
?
Hi Steve!
Code is topiary
Offline
#7 2010-07-04 18:41:54
- joel
- Member
- Registered: 2004-11-26
- Posts: 162
Re: Best practises with custom meta information
It was the html-tags I was referring to :)
Yes, I have the custom field name right.
Here is my code (exactly yours except for the field name):
<title><txp:if_individual_article>
<txp:if_custom_field name="meta-titel">
<txp:custom_field name="meta-titel" />
<txp:else />
<txp:page_title />
</txp:if_custom_field>
<txp:else />
<txp:page_title />
</txp:if_individual_article></title>
Last edited by joel (2010-07-04 18:43:07)
Offline
Re: Best practises with custom meta information
Just tested it and it worked as expected. What output are you getting? Can you post a tag trace or a link to one?
Code is topiary
Offline
#9 2010-07-04 18:55:08
- joel
- Member
- Registered: 2004-11-26
- Posts: 162
Re: Best practises with custom meta information
I deactivated some old plugins and than it suddenly works!!!
Thanks so much for your assistance!!! :)))
Last edited by joel (2010-07-04 18:55:22)
Offline
#10 2010-07-04 23:20:46
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: Best practises with custom meta information
I wrote about the same topic in the german forum
Offline
#11 2010-07-05 11:31:24
- joel
- Member
- Registered: 2004-11-26
- Posts: 162
Re: Best practises with custom meta information
Is this possible to assign to a single article on an article list page IE the “landing page”?
I would prefer not using “Sticky” articles
Last edited by joel (2010-07-05 12:12:41)
Offline
Re: Best practises with custom meta information
Create conditional logic for determining whether or not you’re on a landing page. soo_if_frontpage is one solution. Or you could use core tags, combing e.g. if_article_list
, if_search
, etc. as you need.
Not sure what output you’re after, but you can use article_custom
and specify the article ID if you don’t want to use sticky articles.
Code is topiary
Offline