Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2005-11-29 20:56:07
- kmcshane
- New Member
- Registered: 2005-11-29
- Posts: 2
Section and Title tags won't output in HTML title tags?
To whomever can help:
I’m trying to output a custom HTML title tag for each part of my site. In one of three different formats:
For the front page:
Sitename : Slogan
For section lists:
Sitename : Section Title
And for individual articles:
Sitename : Section Title : Article Title
So my code looks like this:
<code>
<title><txp:sitename /> : <txp:if_section name=”“><txp:site_slogan /><txp:else /><txp:section link=“0” title=“1” /></txp:if_section><txp:if_individual_article> : <txp:title /></txp:if_individual_article></title>
</code>
The front page works just fine. But the section lists and individual articles don’t output the section title or the article title.
The conditionals are working (i.e. I get the separating semicolons based on the page type, but nothing else). Am I doing something wrong or is this a limitation of Textpattern (i.e. section and title tags won’t output before the article is output).
Thanks in advance,
-K
Offline
Re: Section and Title tags won't output in HTML title tags?
I am experiencing the same thing after trying out what Stuart pointed out.
<code><title><txp:ob1_title order=”%article,%section,%sitename” separator=” :: “ /></title><code>
and
<code><title><txp:title /> :: <txp:section title=“1” /> :: <txp:sitename /></title><code>
should output the exact same on an individual article page but the title tag in the second example doesn’t output anything.
Last edited by michaelkpate (2005-11-29 21:03:11)
Offline
#3 2005-11-29 21:04:45
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Section and Title tags won't output in HTML title tags?
…and title tags won’t output before the article is output
That’s right. It’s because of how that particular tag looks for it. You can use the the ob1 page title plugin (search the resources site for “ob1” and you should find it) to get the article title working.
The section tag should indeed work though, I use that within page titles myself.
Edit: not fast enough. :)
Last edited by Mary (2005-11-29 21:05:32)
Offline
#4 2005-11-29 21:23:25
- kmcshane
- New Member
- Registered: 2005-11-29
- Posts: 2
Re: Section and Title tags won't output in HTML title tags?
You’re right. ob1_title is the way to go. Now my code looks like this:
<code>
<title><txp:sitename /> : <txp:if_section name=”“><txp:site_slogan /><txp:else /><txp:ob1_title order=”%section,%article” separator=” : “ /></txp:if_section></title>
</code>
And everything works perfectly. Thanks guys.
-K
Offline
#5 2005-11-29 22:05:10
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Section and Title tags won't output in HTML title tags?
All mentioned txp tags are working for me in the title tags. This is my code:
<code>
<title><txp:sitename /> -<txp:if_section name=”“><txp:if_category> <txp:category title=“y” /><txp:else /> <txp:site_slogan /></txp:if_category></txp:if_section><txp:if_section name=”,artikelen”><txp:else /> <txp:section title=“y” /></txp:if_section><txp:if_section name=“artikelen”><txp:if_article_list> Inhoudsopgave<txp:else /> <txp:category title=“y” />: <txp:article form=“page-title” /></txp:if_section><txp:if_search> voor “<txp:q />”</txp:if_search></title>
</code>
working like this:
Frontpage: Site name – site slogan
Section page: Site name – section title
Specific section page: Site name – specific text
Category list: Site name – category title
Individual article: Site name – category title: article title
Search page: Site name – Search results for “query”
You’ll have to put <txp:title />
in an article form and call that form with the article tag, otherwise it won’t display.
So you don’t really need ob1_title.
Offline
#6 2005-11-29 22:49:30
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Section and Title tags won't output in HTML title tags?
You can’t do that if you have autoappend turned on.
Offline
#7 2005-11-29 23:19:55
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Section and Title tags won't output in HTML title tags?
Oh yes, forgot about that, sorry.
Offline