Improve your SEO

In this tutorial, we’ll see how to add some link tags within the head part of your home page to improve your SEO.

You have a blog. You offer daily TXP tips to your visitors. Great! Now follow these steps to improve your SEO (note that we assume your blog section is named blog).

Within the <head> tag of your home page add this line:

<txp:article_custom section="blog" listform="chapter_links" limit="999999" />

Create a new form (article type) called chapter_links and add this to it:

<txp:if_different><link rel="chapter" title="<txp:title />" href="<txp:permlink />" /></txp:if_different>

Fine. The html source of your home page now contains:

<link rel="chapter" title="My First Post" href="http://yourdomain.com/blog/my-first-post" />
<link rel="chapter" title="My Second Post" href="http://yourdomain.com/blog/my-second-post" />
(...) and so on for each blog post (...)

If you have an achives page, you can add this rule as above.

In the following example, we assume your achives are organized by month. Visitors access each one with this url scheme http://yourdomain.com/monthly-archives?a=2009-07.

Adapt the code below for your purpose depending on your website structure.

Within your <head> part of your home page add this :

<txp:article_custom section="blog" listform="archives_links" limit="999999" />

Create a form (article type) called archive_links with this:

<txp:if_different><link rel="archives" href="<txp:site_url />monthly-archives?a=<txp:php> global $locale; setlocale(LC_ALL, 'en_US.UTF-8'); echo posted(array('format' => '%Y-%m')); echo '" title="'; echo posted(array('format' => '%m/%Y')); setlocale(LC_ALL, $locale); </txp:php>" /></txp:if_different>

Finished! Look at your html page source now. You have a rel="archive" link in it :

<link rel="archives" href="http://yourdomain.com/monthly-archives?a=2009-07" title="07/2008" />
<link rel="archives" href="http://yourdomain.com/monthly-archives?a=2008-06" title="06/2009" />
(...) on so on for each monthly archive (...)

Advanced tip. The rel tag accept a section attribute. Feel free to imagine how to use it to refer to your website sections ;)

comments powered by Disqus