Lazy Textpattern SEO
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.
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.
<meta name="description" content="<txp:rss_auto_excerpt words="30" overrideexcerpt="1" striptags="1" showlinkwithexcerpt="0" stripbreakstabs="1" excerptwraptag="" ending="…" />" />
<meta name="description" content="Generic site description" />
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.