Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-12-03 17:35:06

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

A nice way to format your <title> using textpattern tags

The html element <title> is what appears as the title of your browser window (ex. Textpattern Support Forum – Mozilla Firefox). It is also what you see most prominently when your page comes up in a search engine like Google. The words used in the title are very important for search engines when they try to categorize what a webpage is about. So, you probably want to change the defaults that textpattern has for the <title> on your pages.

I came up with a little bit of html that uses textpattern tags to create a dynamic, eye-pleasing, and informative (for search-engines) <title> for any page you have in textpattern. Here it is:

<title>
<txp:if_section name="">
<txp:sitename />: <txp:site_slogan />
<txp:else />
<txp:if_individual_article>
<txp:section /> &raquo; <txp:title /> | <txp:sitename />
</txp:if_individual_article>
<txp:if_article_list>
<txp:section /> | <txp:sitename />
</txp:if_article_list>
</txp:if_section>
</title>

You can follow what this will do pretty easily, but to clarify, take a look at my website and see it in action.

I would put this in the wiki somewhere but I’m not sure where it would go. I hope this is useful!

Last edited by aswihart (2007-07-28 13:11:40)

Offline

#2 2006-12-03 18:33:18

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: A nice way to format your <title> using textpattern tags

You might add a title for the full text search result list and for the category listings as well.

Offline

#3 2006-12-03 20:32:36

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: A nice way to format your <title> using textpattern tags

I just use sections to organize my site. I realize this is a customized thing, but if you do nothing else, I think adding this in place of the default <title> on your textpattern page will help a lot and will work for almost everyone.

Please feel free to add some code to what I have above if you have something specific in mind. How would you add the things you mentioned?

Last edited by aswihart (2006-12-03 20:42:36)

Offline

#4 2006-12-03 22:41:55

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: A nice way to format your <title> using textpattern tags

This is a nice how-to, aswihart.
You should have posted it in “How-tos and Examples”. I would report it so it’s moved there.

An little bit-saver enhancement

<title><txp:if_section name=”“>
<txp:sitename />: <txp:site_slogan />
<txp:else />
<txp:if_individual_article>
<txp:page_url type=“s”/> &raquo; <txp:title /> | <txp:sitename />
</txp:if_individual_article>
<txp:if_article_list>
<txp:page_url type=“s”/> | <txp:sitename />
</txp:if_article_list>
</txp:if_section></title>

I think it should work exactly the same as yours.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#5 2006-12-03 23:09:54

gaup
Member
Registered: 2006-12-03
Posts: 37

Re: A nice way to format your <title> using textpattern tags

Should I put something between “” here: name=”“
what do this “s” mean (type=“s”)
should I make a form name= sitename? and
a form name= article_list

Offline

#6 2006-12-03 23:39:04

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: A nice way to format your <title> using textpattern tags

maniqui – Yes! I would have if I could. But you closed that forum over a month ago! I wanted to put this up there a while back and realized it was closed, then I looked into the wiki but couldn’t find a suitable place, so I put it here. Go ahead and move it to How-Tos though if you want, haha.

Thanks for the reformatting, that is the best symantic way of doing it, so you don’t repeat <title> twice. I’ll change my first post too.

Offline

#7 2006-12-03 23:50:37

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: A nice way to format your <title> using textpattern tags

gaup – No, you do not need to change that “”. This specifies your default front page (which is not a part of any specific section), and so the code that immediately follows it will only affect your front page’s title. Just paste this on your page html at the top, replacing what you currently have, starting with <title> and and ending with </title>. The “s” stands for section, so it will display the current section name in the title. You can put a “c” here instead and it will show the category name instead.

One other thing, you may have to re-type the quotation marks (“”) because they can be seen as different characters when you paste them from here, where they have a slant to them. In textpattern, they should all be straight up and down, no slant left or right.

Last edited by aswihart (2006-12-03 23:52:35)

Offline

#8 2006-12-04 02:11:02

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: A nice way to format your <title> using textpattern tags

I am working on this technique for quite some time now.
You can take that even further, using UNICODE Glyph Symbols to prettify the titles.
Go past a front page on my blog, or take a look at this page

regards, marios

Last edited by marios (2006-12-04 02:12:19)


⌃ ⇧ < ⌃ ⇧ >

Offline

#9 2006-12-04 02:33:18

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: A nice way to format your <title> using textpattern tags

That’s an interesting take on a front page title, a list of your most recent posts. You are basically making your own version of a full search engine excerpt in your <title> element! I see the extra square character you have, is that done with the syntax I have above for the right double-arrows (&raquo;), or is it something else?

I read somewhere you should limit your title’s length, as extra words just dilute the importance any of them has in describing the page you are on. But that is more of a SEO (Search Engine Optimization) type of concern. I think its more in reference to blatantly putting a bunch of synonyms and words in the title for the sole purpose of generating search engine hits.

Last edited by aswihart (2006-12-04 02:39:57)

Offline

#10 2006-12-04 14:27:24

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: A nice way to format your <title> using textpattern tags

@aswihart, the Square charracter is due to the fact, that either/and Browser/OS can not display the Unicode Glyph. Most of them will not work on all combinations, and also it is dependent on what fonts someone would have installed on his OS/Platform/Browser.
(You would also notice, that in some instances the Symbol changes shape, if you would change the Font settings on your Browser.)

For example, the Apple Glyphs for displaying the modifier keys are not all displayable on windows.
Safari on MAC OS, is capable to display most of them.

The “ Hot Springs Symbol “, that I have chosen, to put in the title tag is part of the Miscellaneous Symbols Block of the Basic Multiligual Plane and encoded as a decimal HTML entity.

& # x 2 6 6 8; 

The right double-arrows, that you have and denoted as ( & r a q u o ; )
is the same as ( & # 1 8 7 ; ) but here decimal encoded

The former is valid HTML and XHTML, but not XML compliant, and will most likely cause some Feed-Reeders to fail, if found in the message body.

The latter is fully XML compliant.

The most Ideal Case, would be first to set up some Test Pages, may be with a Poll plugin or something, and then go around and view those from as many different offices, Internat Cafes, platforms or whatever, and then poll the results from each place, so you could get an efficient pick.

However, I have left it intentionally like that, sometimes poeple would ask themselves, why their Browser can not display these things, sometimes not.

If you are interested to play with these, then my advice is, get Unicode-checker.
Also, here is an article how you can do the same using CSS

I’m not sure, if the latter is true since the articles are all related to each other, allthough yes I’ve seen quite some irrelavant search strings in comparison to the content returned.

(But only in a couple of instances)

BTW.: It would be interesting to find out also, if Vista, with IE7 can display these things, and ships at least with one UNICODE compatible Font, that has at least all of the basic Symbol Glyphs available.
(Apple and such)

regards, marios

Last edited by marios (2006-12-04 14:48:25)


⌃ ⇧ < ⌃ ⇧ >

Offline

#11 2006-12-19 00:03:49

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: A nice way to format your <title> using textpattern tags

I think its more in reference to blatantly putting a bunch of synonyms and words in the title for the sole purpose of generating search engine hits.

Consider, that this is exactly not the case. Take notice of the content. No Google adds, no syndication plans, no click-through madness, no comercialized nonsense.
Just content and links only to valuable resourses.

(As far as my experience with Google: Google returns me exactly what I’m looking for, and it does this very well, and this is because the resources that I’m looking for are written in good proper XHTML anyway)

That’s about all there is to it.
(I forgot to mention that the previous time)

regards, marios


⌃ ⇧ < ⌃ ⇧ >

Offline

#12 2006-12-19 01:11:40

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: A nice way to format your <title> using textpattern tags

I don’t think we are in disagreement about anything :)

Offline

Board footer

Powered by FluxBB