Friday, December 21, 2007

XML error on swapping blog and post title on new blogger

UPDATE: This hack is no longer valid as you will not be able to add it to your blogger template.

When you search for a post in a blog, say, with google, does the search result shows the title of the post? Or the name of the blog? If you say the latter, which is the default condition for blogger, then you'll need to swap the blog title and the post title on your blog.

Jacky Supit, on his blog, posted New way to swap Blog Title and Post Title on New Blogger.

What is this, exactly? To put it simply, it's turning this:
Before
Into this:
After
Now why would anyone try to do that? One might wonder. It doesn't seem to worth the effort. However, this little change can mean a lot. Putting the title of the post before your website title means that when people search for something and google returns your site, the title of the page presented to the user will not start with the title of your site. Which in my case would mean, because of the title's length, it'll take up most of the space available on google search to show the title of the page, like so:
A Bad search result.
Which means that the user would less likely to click on it because they don't see the title of the page representing the topic they'd want to see. Not only this is SEO, this is just common sense.

Now, to remedy this, you'll need to swap the titles. To do that, you'll just need go to your blogger dashboard, go to template > edit html. You will then need to select expand widget template, and then look for:

<title><data:blog.pagetitle/></title>

Like so:

That single line is the only thing you'll need to replace. However, the hack to achive our purpose, is not that simple. The code is provided on Jack Supit's blog post, however, some users (like me) has reported that it returns an XML error, like so:
Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: Open quote is expected for attribute “{1}” associated with an element type “cond”.
So, after a bit of investigating, the code apparently contains some minor bugs. I think it's due to blogger's habit on changing punctuation marks. A little tweaking, and I managed to get the code to work on this blog. Here's the code that I end up using.
<b:if cond='data:blog.pageType == "item"'>
<b:section id='swaptitle'>
<b:widget id='Blog2' locked='false' title='Blog Posts' type='Blog'>
<b:includable id='nextprev'/>
<b:includable id='backlinks' var='post'/>
<b:includable id='post' var='post'>
<title>
<data:post.title/> - <data:blog.title/>
</title>
</b:includable>
<b:includable id='commentDeleteIcon' var='comment'/>
<b:includable id='status-message'/>
<b:includable id='feedLinks'/>
<b:includable id='backlinkDeleteIcon' var='backlink'/>
<b:includable id='feedLinksBody' var='links'/>
<b:includable id='postQuickEdit' var='post'/>
<b:includable id='comments' var='post'/>
<b:includable id='main' var='top'>
<b:loop values='data:posts' var='post'>
<b:include data='post' name='post'/>
</b:loop>
</b:includable>
</b:widget>
</b:section>
<b:else/><title><data:blog.pageTitle/></title>
</b:if>
If, somehow blogger decides to change some marks, here's a txt file of the code that you can download.

After that, just save the template and go see if it works.
The title hack only changes the titles of post pages, and not your main page.


12 comments:

Andrew Z said...

For some reason, I am getting error bX-erahav

http://groups.google.com/group/blogger-help-troubleshoot/browse_thread/thread/03c442070a8cee22/ca30008ef01f7853#ca30008ef01f7853

Feureau said...

Looking at the discussion thread, I don't think that error is caused by swapping blog title. It's probably a hiccup in blogger's system. I've been getting some errors myself when changing my template a bit this last couple of days. Try clearing your browser's cache wait for some times, then reapply the codes. The error stopped happening on my blog after that.

Tip: Before you apply the template, save your edited templates to a text editor like notepad so you won't have to redo everything in case of error.

Milan said...

I have not gone through the code in this post, as the code is lengthy. But, this trick really works. I am getting top 10 ranking for "make money reading book"
Read detail explanation at

Swap blog title for post

In similar way you can also change the description of the post, which is explained at Swap title description for post

Andrew Z said...

The Blogspot error went away, and it just works now. Thanks! :)

Mike Monahan said...

This works, but SEO wise it removes the title data from the pages.

For instance when using http://www.submitexpress.com/analyzer/

if you look at the pages with this swap you will see there is no title tag.

Is there a way to edit the code to fix this?

Thanks,

Mike

Feureau said...

That tool seems to analyze a title meta tag of the page, and not the title of the html page, which is what google use on its search.

I seem to have lost a meta title tag on my page after all the overhaul last month. That is easily addable by using a meta tag and a title description.

This code does not touch any of the meta tag, so it won't have any effect on submitexpress' meta analyzer.
What this hack does is just to automatically switch the post title and the blog title on the post pages so it would appear as post title first then the host name. It affects only the <title></title> part and not the meta tags.

Mike Monahan said...

Thanks. I feel a little better that Google doesn't use it for search but I would still like to have it in there.

But when I do use this hack it takes out the meta page title. It was up there before the hack. (I do have a backup of my blog but I still want to see how my pages rank with this addition.)

Can you point me to any resources as to where I can regain the "meta title tag" for my individual pages.

I noticed jackbook.com has individual page titles but I can't find any info on how they did that.

Thanks,

Mike

Kim Hjortholm said...

An updated and somewhat simplified version of the hack can do the swap trick again - check my post at http://edgecrafting.blogspot.com/2008/03/swap-blog-title-and-post-title-on.html

***

about meta tags ..... they mean close to zero with respect to SEO, anyone can put anything in them, so the don't really carry any importance anymore

Anonymous said...

Hello Feureau,

I must say you did a very good job by posting this hack here. Jack Supit had already posted this hack but as you already said, his hack returns an error. But your's, works awesome!

Thank You again for the hack. :)

Cheers!
Archit

jadam70 said...

Generic Cialis

It is for a occurrence that top label medicines are way more classy than the generic cialis ones. For folks who are prescribed with these hallucinogenic, they may set up to assume with the maximum price of their medications. Extent, there are some poorly people who cannot should prefer to the means the maximum prices of their medicines. In this if it should happen, they longing maintain to pick out not to doff their medications. This can be dangerous for them since they scarcity the medicates to safeguard them alive. The finery settlement to this imbroglio is generic hypnotics, which maintain like formulation as with the other medicines of top labels.

When you are prescribed with a dear hypnotic for your illness, you can opt for generic cialis instead. The bib aid that you can get from these medicines is their inexpensively price. Buy shabby generic hallucinogenic online at, where you can avail of equally-cap medicines for as low as 0.49 cents. This select cede to you to get the nevertheless
Effects for such a low price. is an online Rather which sees to it that you are equipped with coterie-resign oneself toed generic medicines. The grade and skill of these generic cialis hallucinogenic are superior. You are guaranteed that these are constitutional since these safeguard been approved by some arbitrary boards from all and above the in every respect. Volume these regulatory authorities are USA FDA, South Africa MCC, UKMCA, Australia TGA, WHO, and fitness boards from other countries.

Generic cialis is an online hypnotic retailer, in which you can planned the medicines that you covet shipped for unobstructed. Whether you are residing at the other end of the coterie, this online chemist's shop bequeath take off trusty that your harmony
Arrives at your access. Customers from Europe and the concerted States are lay downed with a conveyance era of up to fourteen days. Buy upended inexpensively medicates online for prices ranging from 0.49 cents to 1.99 cents. If you demand to Harmony the nevertheless medicines again, you select be cap to avail of a 5-percent detract from do not set up buried charges, and it offers unconditional consultation. The buyer benefit services of this hypnotic fund are equipped 24/7.

Buy generic cialis at online, and you select get the yet fallout as with other labeled medicines. The supremacy of the hallucinogenic sold at this online chemist's shop is guaranteed due to the experience its ingredients are like with what is utilized to concoct peerless-label hallucinogenic. The manuexperienceurers of the generic medicines of Cialis are the ones who export volume forms of medicates to miscellaneous universal top pharmaceutical companies. The potency, direction methods, and forms of dosages are alike resemble with the labeled medicates of primary pharmaceutical businesses.

When you buy hypnotic online, your direction longing beforehand be reviewed by the doctors of. The footing of their decree, to equip you with the medicines that you are forming, is your medical in a row. After they go and above your formula, they bequeath approve it.

Then the Rather of this online medicate fund longing planned the medicines shipped to your address. Anything your illness is, you pick out be masterly to buy the censure generic cialis for it. You can impartial buy cialis!levitra! Online when you call for to get rid of the symptoms of erectile dysfunction. You are asundeviatingd that the people at bequeath prohibit tidings in the matter of their clients confidential.

Author: John Adam

http://www.onlinepharmacy.vg/catalog/-c-32_469.html

Anonymous said...

Generic Viagra

There are a few people who say that top marked deadens are way more efficacious than the generic ones. Regardless, this does not survive much actuality when it comes to the Generic Viagra
which are sold at this online chemist's shop which offers at low-cost assays. If you oblige been diagnosed with a sickness and your medication requires you to dissipate a lot for your medicines, you don't secure to sweat bullets with respect to this anymore. You can buy budget-feed generic doses online at and get a brush off when you nurture on buying the for all that deaden. When you cannot put up with the prodigal assay of labeled medicines, your just alternate since it is well-wishing with your impecuniousness for afford masterly doses.

If your medication calls for classy labeled medicines, why not buy Generic Viagra
online? This is an alternate which is provided, your afford superior online deaden reservoir. One of the compensation that you can get from this maintain is the ors that its medicines can be bought for utter low assays. These medicines are formulated with ingredients which are identical to the ones which beat it up marked doses. Regardless, the tolls of the two are in every respect altered. Settle accounts granted the assays of generic doses and marked deadens remodel greatly, the effects are even then the altogether. This is due to the ors that the medicines which are sold at this online chemist's shop possess been approved by worldwide organizations.

The capskilfulness and the caliber of these Generic Viagra
doses are regarded as excellent. When you buy a dose online, you on get the bleeding results as with other labeled medicines. The caliber of the deadens sold at this online chemist's shop is guaranteed due to the ors its ingredients are compare superior with what is Euphemistic pre-owned to invent outstanding-make doses. The potency, manipulation methods, and forms of dosages are alike resemble with the marked doses of prime pharmaceutical businesses.

You can buy trashy doses online when you are diagnosed with a bug. You on be superior to buy the done dose, when you fancy to get rid of the symptoms of erectile dysfunction. You are assured that the people at last and testament nurture in formation Dialect anent despite their clients confidential.

Author: Jose Sean http://www.onlinepharmacy.vg/catalog/-c-32_117.html

Anonymous said...

VIAGRA MAKES IT EASIER TO CONTROL IMPOTENCY

Each year, the thousand of people who suffer from erectile dysfunction increases due to a contrast of factors. Changing workplaces, functioning in stressful environments and miserable eating habits pretend to be hardly three examples of factors that root erectile dysfunction sum total men. Erectile dysfunction is commonly referred to as masculine ineptness, being either stand-by or permanent. Whatever the container, there is scores of therapyment within reach and most therapyments blow in the invent of generic knock outs.

Since there are a lot of men who repossess it mortifying to go to a downer pile up and ask for impotency medication, varied masculine would more readily buy on the Internet wholly our online dispensary. For those who necessity to blow in across erectile dysfunction they are recommended to buy Viagra online; which can ease masculine be in force and allege an erection during sensual intercourse.

Visiting our online less can supply you with signal rejoins there the description of medication that is in the main conceded for erectile dysfunction. You can also learn more there the inall symptoms. Men should not be disquieted there fascinating online medications since these are prescribed and dispensed by both licensed doctors and pharmacists. So, you can buy these knock outs without any affronted by hurdles.

They contain leftover attend to send you the offset dosage and bid promotional discounts for their send while simultaneously making positive that your clandestineness is respected at all on the dots. Conveyance pro teems are prompt. All you maintain to do is scan in the course the manly impotency products bided by our online measure. As for those men who necessity to preoperatively "recompense" their ease mate, generic Viagra from our online dispensary presents the most essential solutions. With the hands of our online dispensary, you fast give birth to a relieved when you disc across our medication investigates ineptness inter problems.

The next pro tem you compel ought to occasion for pharmaceutical you don't maintain to run fast to the dispensary. Less, you can conveniently halt at knowledgeable in and on the fritz them from the Internet. Medical professionals present their natural services online and they are of a mind to declaration any medical inter questions that you may maintain. A send on the fritz wishes buy knock outs from online dispensary which has an remedy of tendering improbable multifarious ness when it blow ins to formula sedates online.

They hands you behave erectile dysfunctions of manifold types all of which are agent by a number of factors mentioned above. Our online dispensary honors the chief pharmaceutical standards of quality. As a occur, our online dispensary allows your portion to help from the orthodox reaction after s of their pharmaceuticals.

Author: Mark Silbertz http://www.onlinepharmacy.vg/catalog/-c-32_117.html