Effective SEO & Web Studio
SEO friendly titles in Textpattern

Custom Section Meta Titles in Textpattern

Jul 21, 03:32 AM in

In the article SEO friendly titles in Textpattern we learned how to edit section Meta titles in a site powered by Textpattern through rah_output_section_form plug-in.

This is a great asset especially if a section articles list or a sticky article page serves as a landing page. In this case section page may need a little more than a Textpattern default meta title that is the same as section title. Flexible sections / categories’ meta titles are very important CMS feature for SEO. The more such capacities CMS has the more SEO friendly it will be in the long run.

Knowing the importance of meta title for SEO and how to use the wonderful plug-in, here comes the next question “Now, can I do something like that without any plug-ins?” Yes, owing to Textpattern’s nature it is possible. What we need is to make the CMS understand what we want from it.

For this purpose we are going to use <txp:variable><txp:variable> .

For example, we have sections “products”, “about” whose meta titles we need to extend.

First, we will create a misc form “section-desc”. In this form we will put the following tags:

<txp:variable name="desc-products">Cheapest cell phones buy on-line!</txp:variable>
<txp:variable name="desc-about">Our company sells cheapest cell phones on-line!</txp:variable>

These silly slogans are going to be meta titles of sections “products”, “about” .

Now we will put the following code (used in a client’s site) between tags <head></head>.

<title>
<txp:if_section name=" , products, about">
<txp:if_individual_article>
<txp:if_custom_field name="SEOtitle"><txp:custom_field name="SEOtitle" /><txp:else /><txp:title /></txp:if_custom_field>
</txp:if_individual_article>
<txp:if_category>
<txp:output_form form="category-desc" />
<txp:variable name='desc-<txp:category />' />
<txp:else />
<txp:if_article_list>
<txp:output_form form="section-desc" />
<txp:variable name='desc-<txp:section />' />
</txp:if_article_list>
</txp:if_category>
<txp:else />
<txp:if_individual_article>
<txp:section title="1" />  
</txp:if_individual_article>
<txp:if_article_list>
<txp:section title="1" /> | <txp:site_name />
</txp:if_article_list>
</txp:if_section>
</title>

It means that individual articles meta titles will be what we will write in a custom field SEO_title. Needless to say, the name of the custom field can be anything you name it. (Meta titles for individual articles are not the topic of the article so we are not going to focus on the issue.)

If section name is “about” or “products” meta title will be what we assign to the variables in the form section-desc.

In the same way you can customize category meta title. Just create a misc form category-desc and replace sections with categories. Example:

<txp:variable name="desc-nokia">Category Nokia meta title</txp:variable>
<txp:variable name="desc-samsung">Category Samsung  meta title</txp:variable>

The rest of sections will have the following meta title:

<txp:section title="1" /> | <txp:site_name />

Needless to say, it can be edited as you like.

This code is just an example of what can be achieved through variables. It can be edited and improved according to one’s needs. Also the code above does not affect the home page meta title for there is a separate form created for this purpose in our case.

Although this method is not a universal solution for all types of Textpattern sites, nevertheless with the above variables it can make SEO for TXP more effective.