Journal

Lazy Textpattern SEO

15 April 2007 › 11 comments

Have you ever noticed that Google’s search result excerpts sometimes have seemingly random snippets of text, while at other times there is actually an intelligible description of the page? While you cannot really control the random snippets, as those are determined by specific search terms, you can control that descriptive text with a fairly certain degree of accuracy.

Google examples

While the method of doing so is fairly common knowledge in SEO circles, I am explaining it anyway, in case it is unfamiliar to anyone. Not surprisingly, the description of a page is handled by the a meta tag in the head of a document. Typically, that looks like this…

<meta name="description" content="..." />

The trouble with meta tags is that they are so frequently abused by people trying to fool search engines that they are usually given very little credence. However, they can still be useful, assuming they actually contain text that is relevant to the page. The trouble is, creating a brief summary of every page can be incredibly tedious. If you’re a Textpattern user, you’re in luck.

Robert Sable, co-author of Textpattern Solutions, wrote a TXP plugin called rss_auto_excerpt. It creates automatic article excerpts, but is not mutually exclusive to using txp:excerpt. It can also strip out all HTML tags and allows you to specify the length of the auto excerpt.

After some unscientific research, it seems that Google displays anywhere from 25 to 30 words total for each search result’s description, so any more will be ignored. With that in mind, here’s how to do some really lazy SEO, which will give each article on your site a unique description. This shows Google you are not just spamming one description on every page.

<txp:if_individual_article>
<meta name="description" content="<txp:rss_auto_excerpt words="30" overrideexcerpt="1" striptags="1" showlinkwithexcerpt="0" stripbreakstabs="1" excerptwraptag="" ending="&#8230;" />" />
<txp:else />
<meta name="description" content="Generic site description" />
</txp:if_individual_article>

With the auto excerpt plugin installed, just take that code, put it in the head of your document, and away you go. If you want to know more specifics about the plugin, then of course read the documentation. This is just one of many possible uses. Kudos to Rob for writing such a versatile plugin.

Discussion + Dissension

  1. #1 Nate Klaiber

    I wouldn’t consider this ‘lazy SEO’ – you are just taking the time to pay attention to the little details. For people who don’t change page titles or add unique descriptions, they get grouped together in google (often). Not exactly a result you would want to have.

    I built this into www.barbourbooks.com when we launched last year (for the pages with unique information to use – some simply didn’t have any information). So, all book detail pages pull (extract html/extra whitespage) the first 45 characters of the description, if present. Same is true for some of the section detail pages. If we have copy for sections/subsections – it will use that as a snippet, otherwise it will use a default copy. Again, same is true for author detail pages.

    Another thing in regards to that is reverse sorting the title tag. Instead of putting ‘Barbour Publishing’ before everything, I traverse backwards through the path to show the most recent page first – then down the line (IE: Book Title – Section – Books – Barbour Publishing, Inc.).

    I think these two things coupled together help to give you more informative result listings with the search engines.

    Thats nice that there is something like that for TXP...

  2. #2 Yannick

    I think, though I’m not 100% sure a similar thing can be done in Wordpress with the the_excerpt(); function. The only difference is that you aren’t able to specify how much words it should use. By default if you don’t specify an excerpt, it will take the first 55 words from your article.

    Anyway, thanks for the tip. I really need to fix up a few things with my website.

    Have a great week!

  3. #3 Yannick

    I suppose I should have added that I’m sure there are plugins that members of the WP community have made that can achieve the same thing.

    I know the article is about doing SEO in TXP and for my personal website I use TXP also, so this post will be helpful to me. But I brought up the point about WP being able to do something similar just in case someone wants to do the same in WP (hehe I have to do this on a friends website).

    Peace and God bless.

  4. #4 Nathan Smith

    Yannick: Thanks, I appreciate you explaining it for WP users. Hopefully it didn’t seem like my intent was to say “Textpattern can do this, and WordPress can’t,” simply that there’s a nice way to do it with TXP.

  5. #5 Rob

    Its always nice to see people come up with creative uses for my plugins. Thanks for the writeup Nathan.

    One other thing to note…you can add the use of the excerpt attribute and use any field (like a custom field) for the meta description if you don’t want to rely on the plugin to generate it in all cases.

    For example, create a custom field called MetaDesc and add excerpt=“MetaDesc” to your rss_auto_excerpt plugin call. When you decide to populate that field for an article it will be used for your meta description but when its not populated, your auto-excerpt will still be generated.

    Cheers,
    Rob

  6. #6 Andrew Ingram

    I’m rather pleased with the excerpts for my site given that I put no actual effort into controlling it.

    If you search for my name “Andrew Ingram”, the result for my site has the text in my colophon as the excerpt, this suggests to me that Google probably looks for certain words like “About” and “Colophon”. On my site this text is quite near the end of the document but is the first text that is constant on every page, this also might be the main factor.

    For the individual articles the excerpt is the first 30 words in the abstract which is exactly what I’d hope for.

  7. #7 samalah

    Thanks for the article. I have an unrelated question: I noticed that you have switched to MT from Dreamhost, I was thinking of switching to DH myself, and was wondering if there wa any major reason you moved? Only if you have time to elaborate. Thanks!

  8. #8 Nathan Smith

    Smalah: I will cover the switch from Dreamhost to Media Temple in a later blog post, once I have had enough time to evaluate Media Temple.

  9. #9 Bryan

    This can be done as well with the use of a custom field in wordpress.

    Sure, its a little tedious because then you have to write your own description, but for someone who has a high traffic site with high quality articles, it might be worth it to customize your “description” per article to get the best search result relevancy.

  10. #10 Michael Montgomery

    Excellent!

    Thanks again.

  11. #11 Tim Bednar

    This is awesome.

Comments closed after 2 weeks.

FYI


Member of 9rulesSecure Hosting

Ads by Fusion

Latest Posts: All - RSS

My Book

Textpattern Solutions I had the privilege of co-writing Textpattern Solutions for the web technology publisher Friends of ED. If you want to develop a professional dynamic web site, without the hassle of writing all the server-side code from scratch, then Textpattern could be just the solution you are looking for.