Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-06-30 08:37:53

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

SEO advice for new release

Hi folks.

Based on this previous discution , it seems very important for SEO optimisation to place the site name at the end of the title tag sentence.

In this purpose, I’d change the function page_title($atts) in /textpattern/publish/taghandlers.php :

	function page_title($atts)
	{
		global $parentid, $thisarticle, $id, $q, $c, $s, $pg, $sitename;
		extract(lAtts(array(
			'separator' => ': ',
		), $atts));
		$sn = htmlspecialchars($sitename);
		if ($parentid) {
			$parent_id = (int) $parent_id;
			$out = $sn.$separator.gTxt('comments_on').' '.safe_field('Title', 'textpattern', "ID = $parentid");
		} elseif ($thisarticle['title']) {
			$out = $thisarticle['title'].$separator.$sn; // $sn.$separator.$thisarticle['title']
		} elseif ($q) {
			$out = gTxt('search_results')."$separator $q".$separator.$sn; // $sn.$separator.gTxt('search_results')."$separator $q"
		} elseif ($c) {
			$out = fetch_category_title($c).$separator.$sn; // $sn.$separator.fetch_category_title($c)
		} elseif ($s and $s != 'default') {
			$out = fetch_section_title($s).$separator.$sn; // $sn.$separator.fetch_section_title($s)
		} elseif ($pg) {
			$out = gTxt('page')." $pg".$separator.$sn; // $sn.$separator.gTxt('page')." $pg"
		} else {
			$out = $sn;
		}
		return escape_title($out);
	}

Notice: all comments (line start with ‘//’ are in place to show the previous presentation (the site name was the first word)

Hope it’ll be helpfull for the community.

Best regards,


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#2 2008-06-30 19:56:31

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

Re: SEO advice for new release

SEO isn’ t the only thing to consider regarding page titles.

For instance, some high profile brands prefer to have their brand name first with the specific page’s title appended (case in point). We must not ignore this segment of prospect Textpattern users ;-)

See ob1_page_title for the rest of us.

Offline

#3 2008-06-30 21:05:09

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: SEO advice for new release

There’s no need to use <txp:page_title /> for this or a plug-in. Using <txp:site_name /> <txp:title /> <txp:section /> <txp:category /> is far more flexible with a few “if’s” and “else’s” thrown in. The <txp:page_title /> may be useful to some people as it is. Here’s what I currently use at the bombsite for both the <title></title> tag and an h1:-

<txp:if_article_list>
<txp:if_category>
<txp:category title=1 /> category listing. &raquo; <txp:site_name />
<txp:else />
<txp:if_section name="default">Home Page<txp:else /><txp:section title="1" /></txp:if_section> &raquo; <txp:site_name />
</txp:if_category>
</txp:if_article_list>
<txp:if_individual_article>
<txp:title /> &raquo; <txp:section title="1" /> &raquo; <txp:site_name />
</txp:if_individual_article>

Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#4 2008-07-06 17:43:53

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: SEO advice for new release

Oops. I’m late to answer you. I’m so sorry Robert. Tks for your answer.

I understand your answer. But, Aarron Walter, the author of “ Building Findable Websites : Web Standarts, SEO and Beyond “ say in page 21 :

“(…) Here’s an effective approach to buildding <title> tags to satisfy each of the above [Note: the author list different problems before, and the bookmark problem Robert told about above] goals :
<title>page title | organisation or site name | sort keywords-rich phrase</title>

What is the best practice? That’s the question :)

Cheers,

Last edited by Pat64 (2008-07-06 17:58:04)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#5 2008-07-06 22:54:53

Neko
Member
Registered: 2004-03-18
Posts: 458

Re: SEO advice for new release

Could be nice to allow users to choose their own flavor of titles via a Preference, along the lines of what TXP currectly does for date/hour format.

Personally, as a reader, I prefer “Site name: Article’s Title”, especially if it’s something I’d want to bookmark. From a SEO point of view Pat’s idea is very correct. However, I prefer to design for readers than for bots so I’d generally stick with what I, as a reader, find more… readable. :)

My useless 2c.

Offline

#6 2008-07-07 05:52:58

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: SEO advice for new release

Neko wrote:

Could be nice to allow users to choose their own flavor of titles via a Preference, along the lines of what TXP currectly does for date/hour format.

What a good idea!

Cheers,


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#7 2008-07-07 06:02:00

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

Re: SEO advice for new release

Pat64 wrote:

What a good idea!

I’m very much in favour of suggesting to use either above mentioned plugin or the tag-based approach, as I don’t expect to satisfy all title requirements per SEOesque folklore with some prefab patterns from a drop-down.

Offline

#8 2008-07-07 09:34:49

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: SEO advice for new release

^^ I agree with Robert.

Offline

#9 2008-07-07 16:02:12

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: SEO advice for new release

Since it’s so easily adaptable, I agree with wet and ruud :)

Offline

#10 2010-05-09 04:50:53

laptophobo
Member
Registered: 2010-03-01
Posts: 216
Website

Re: SEO advice for new release

Hi Stuart,

I’m wondering if you can enlighten me. I’m trying to add a Meta Title to my Meta Data form, building on the attributes below. I’d like to have the option to make very specific Meta Titles from the Article Custom field (without the Site Name being automatically added by Textpattern). The title tag I’m using now is:

<title><txp:page_title /></title>

<txp:if_article_list>
   <meta name="description" content="<txp:variable name='meta_<txp:section />' />" />
   <meta name="keywords" content="<txp:variable name='keyword_<txp:section />' />" />
<txp:else />
   <meta name="description" content="<txp:custom_field name="meta_desc" />" />
   <meta name="keywords" content="<txp:keywords />" />
</txp:if_article_list>

Thanks much.


Living the Location-Independent Life: www.NuNomad.com

Offline

#11 2010-05-09 10:47:22

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: SEO advice for new release

I use 3 separate form templates and call them to the <head> with the usual <txp:output_form form="formName" /> tag.

Meta Title Form

<title><txp:if_status><txp:if_article_list><txp:if_category><txp:category title="1" /> category listing <txp:page_url type="pg" /> &shy; <txp:site_name /><txp:else /><txp:if_section name=",default"><txp:site_name /> &shy; <txp:site_slogan /><txp:else /><txp:section title="1" /> <txp:page_url type="pg" /> &shy; <txp:site_name /></txp:if_section></txp:if_category></txp:if_article_list><txp:if_individual_article><txp:title /> &shy; <txp:section title="1" /> &shy; <txp:site_name /></txp:if_individual_article><txp:else /><txp:site_name />: <txp:error_status /></txp:if_status></title>

Meta Description Form

<txp:if_section name="default"><meta name="description" content="My Textpattern experiences, Textpattern code and Textpattern themes (styles, templates, admin themes) plus a blog about anything that catches my attention." /></txp:if_section><txp:if_section name="about,archive,contact,privacy,resume"><meta name="description" content="The Bombsite - <txp:section title="1" />." /></txp:if_section><txp:if_section name="articles"><txp:if_article_list><meta name="description" content="My weblog about anything that catches my attention." /><txp:else /><meta name="description" content="<txp:title /><txp:if_keywords>,<txp:keywords />.<txp:else />.</txp:if_keywords>" /></txp:if_article_list></txp:if_section><txp:if_section name="coding"><txp:if_article_list><meta name="description" content="Textpattern code examples, XHTML, HTML, CSS, PHP." /><txp:else /><meta name="description" content="Textpattern code examples, XHTML, HTML, CSS, PHP, <txp:title /><txp:if_keywords>,<txp:keywords />.<txp:else />.</txp:if_keywords>" /></txp:if_article_list></txp:if_section><txp:if_section name="themes"><txp:if_article_list><meta name="description" content="Textpattern themes,Textpattern styles,Textpattern templates,admin themes." /><txp:else /><meta name="description" content="<txp:title />,a theme for Textpattern." /></txp:if_article_list></txp:if_section>

Meta Keywords Form

<txp:if_section name="file_download"><txp:else /><txp:if_individual_article><txp:if_keywords><meta name="keywords" content="<txp:keywords />" /></txp:if_keywords></txp:if_individual_article></txp:if_section>

You may need to copy paste the above somewhere and add line breaks to understand what is going on. I remove them to avoid loads of white-space. Once you have done that you will see that the code is extremely flexible so you can output just about anything you want in any way you want. It’s really down to preference.

I also have a form for an h1 which is identical to the meta title form except that it is wrapped in <h1></h1> tags and is placed immediately after the opening <body> tag. Remember though that if you use this your page content must not use anything higher than <h2></h2> tags as there should only be one h1 on a page. This is then set to h1 {display: none; visibility: hidden;} in the CSS.

Once you understand what is going on you can pull in your custom_field data anywhere you want it.

Last edited by thebombsite (2010-05-09 10:51:34)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#12 2010-05-10 02:53:07

laptophobo
Member
Registered: 2010-03-01
Posts: 216
Website

Re: SEO advice for new release

Stuart,

That is cool. Thanks so much for this.


Living the Location-Independent Life: www.NuNomad.com

Offline

Board footer

Powered by FluxBB