Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Your favorite method for "Writing useful page titles"
I will admit it, I have always dislikes the output of <txp:page_title /> as have others (see example). While there are various methods we have come up with for combating it through native code or plugins, I was just curious to see if there is really cool modern way to do it that I am missing.
From one of my sites (I am not even sure if this will work/is still necessary in 4.0.3.):
<txp:if_individual_article>
<title><txp:mkp_title /> :: <txp:section title="1" /> :: <txp:sitename /></title>
<txp:else />
<txp:if_section name="">
<title><txp:sitename /></title>
<txp:else />
<title><txp:section title="1" /> :: <txp:sitename /></title>
</txp:if_section>
</txp:if_individual_article>
function mkp_title()
{
global $thisarticle, $id;
$out = (isset($thisarticle)) ? $thisarticle['title'] : safe_field('Title','textpattern',"ID = $id");
return escape_title($out);
}
Last edited by michaelkpate (2011-02-18 01:44:17)
Offline
Re: Your favorite method for "Writing useful page titles"
Michael
Please forgive me if I’m missing something that should be obvious. Why use <txp:mkp_title /> instead of <txp:title /> ?
Mike
Offline
Re: Your favorite method for "Writing useful page titles"
Older but related
Offline
Re: Your favorite method for "Writing useful page titles"
maverick wrote:
Thanks for the link. That is exactly the sort of thing I was looking for, although it is an example of textpattern code stability.
Please forgive me if I’m missing something that should be obvious. Why use <txp:mkp_title /> instead of <txp:title /> ?
Apparently between this November 2005 thread and your December 2006 citation <txp:title /> gained the ability to be used outside an article form. My code sample is from the earlier era. I may have known that at the time, but just never bothered to update the template – which I am working on now.
Last edited by michaelkpate (2011-02-18 02:12:31)
Offline
Re: Your favorite method for "Writing useful page titles"
michaelkpate wrote:
Apparently between this November 2005 thread and your December 2006 citation <txp:title /> gained the ability to be used outside an article form.
Ah – that makes sense. I had forgotten all about that issue/thread.
Offline