Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
How to make the Page Title show properly
Hello,
I use the code below on section (Page) templates to control what post are to be shown.
<code>
<txp:if_article_list>
<txp:article status=“sticky” form=“site_form_article” />
<txp:else />
<txp:article form=“site_form_article” limit=“1” />
</txp:if_article_list>
</code>
It’s made so that the “sticky” post is used as a section-homepage, while still being able to load a single post, as seen on:
http://feline.no/about/ (sub-posts are under the “Om oss” heading on the left)
The problem with this method is that the <txp:page_title /> tag doesn’t seem to return the correct page title. The sticky pages will return sitename, whereas normal posts will return the correct “SiteName: PageName”.
Is there any better way of solving this?
Thanks in advance, and sorry about the design – I’m working on a new one.
Offline
#2 2006-08-10 13:49:40
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: How to make the Page Title show properly
It’s because you’re not actually visiting the sticky article, you’re looking at the section page.
Offline
Re: How to make the Page Title show properly
So, only way of getting the right page_title would to check what section I’m in and if I’m in artcile_list mode or not, then supply my own title, right?
Are there any other ways of solving the default section page without hard-coding the page into the actual template? I ended up doing that on the front page.
Offline
#4 2006-08-10 17:31:33
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: How to make the Page Title show properly
I’m not understanding why you can’t enter the section title you want for your section and leave it at that? Can you show what you’re trying to acheive?
Offline
Re: How to make the Page Title show properly
I have put the header in it’s own Form so that it’s easier to update stuff when things changes. Sure, there aren’t that many sections, but I prefer not typing the same things over and over again.
I want <txp:page_title /> to show either the section name or the specific post that I am reading.
http://feline.no/about/ should say “Feline Studios: Om oss”, not “Feline Studios” (aka Site name)
http://feline.no/services/pricing shows “Feline Studios: Våre priser”, which is correct.
Offline
#6 2006-08-11 21:07:07
- NyteOwl
- Member

- From: Nova Scotia, Canada
- Registered: 2005-09-24
- Posts: 539
Re: How to make the Page Title show properly
I used to use something such as this if it may help …
<code>
<title>
<txp:if_category>
<txp:sitename /> – <txp:site_slogan /> : <txp:category title=“1” />
<txp:else />
<txp:if_individual_article>
<txp:page_title separator=” : “ />
<txp:else />
<txp:if_section name=”“>
<txp:sitename /> – <txp:site_slogan />
<txp:else />
<txp:sitename /> – <txp:site_slogan /> : <txp:section title=“1” />
</txp:if_section>
</txp:if_individual_article>
</txp:if_category>
</title>
</code>
Last edited by NyteOwl (2006-08-11 21:08:34)
Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;
Offline
#7 2006-08-11 22:58:29
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: How to make the Page Title show properly
The page_title tag has been fixed in svn too (shows the section title if you’re in a section). :)
Offline
Re: How to make the Page Title show properly
Thank you Mary and Nyte.
I’ll look into how to get my paws on the SVN version.
Offline
Re: How to make the Page Title show properly
I think I’m going to go with NyteOwl’s example and create a form out of it.
I’ve read in a few places that the article’s title should go first and then the site name. Their thinking is that the search engines like it better and it’s easier for the user to pick your link out from a search results page.
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline