Skip to main content

Use A Canonical URL, With Page URL Conditionals

Not all blog owners can successfully add a conditional display of a template object, to their blog.

Some owners carefully copy the conditional code that I provide, add it to their blogs - and it does not work (for them). In some cases, it may work, for me, when I check their work.

Conditional code, that involves people in countries subject to the country specific domain redirect, won't always be comparing against "blogspot.com". People in the UK may see their blog as "blogspot.co.uk", for instance.

People in the USA, right now, will always see BlogSpot blogs, as "blogspot.com".

This blog, and other blogs published to custom domains, will always be viewed under their domain URLs - so there is no worry about country specific domain redirect.

How do you compare a blog URL, with country specific domain redirects in use?

But what of blogs published to "blogspot.com", outside the USA? How do they conditionally display objects, with the conditional URL varying according to the country specific code of each reader?

When you do a URL comparison, to conditionally display a template object - and the blog is published to "blogspot.com" - check against the canonical URL.

Use the canonical URL, for conditional comparisons in BlogSpot blogs.

Since your blog could be read by readers in any country, if your blog is published to "blogspot.com", you will want to base any URL comparison against the Canonical URL.
  • Compare "data:blog.canonicalUrl" - not "data:blog.url".
  • Compare against the URL, ending in "blogspot.com".

Your readers could be in any country - either the same as you, and subject to your country local domain - if one applies. Or, they could be different from you, and subject to a different country local domain - again, if one applies.

<b:if cond='data:blog.canonicalUrl != "http://mypersonalblog.blogspot.com"'> <style> #Text1 {display: none !important;} </style> </b:if>

or possibly

<b:if cond='data:blog.canonicalUrl != data:blog.homepageUrl'> <style> #Text1 {display: none !important;} </style> </b:if>




Just avoid using

<b:if cond='data:blog.url != "http://mypersonalblog.blogspot.com"'> <style> #Text1 {display: none !important;} </style> </b:if>

and

<b:if cond='data:blog.url != data:blog.homepageUrl'> <style> #Text1 {display: none !important;} </style> </b:if>

This way, everybody in every different country can see the gadgets only when necessary, as you design. And maybe, you can check your blog using a service like GeoPeeker.

---

Blogger blog owners, in some countries outside the USA, occasionally observe that they cannot conditionally display template objects, in BlogSpot published blogs, as people in the USA can do.

Owners who live in the USA may not realise that people outside the USA may not see their blogs properly, with conditionals added. If you want your blog gadgets to display properly, in BlogSpot published blogs, use a canonical URL in the comparisons.

Comments

Popular posts from this blog

Stats Components Are Significant, In Their Own Context

One popular Stats related accessory, which displays pageview information to the public, is the "Popular Posts" gadget.

Popular Posts identifies from 1 to 10 of the most popular posts in the blog, by comparing Stats pageview counts. Optional parts of the display of each post are a snippet of text, and an ever popular thumbnail photo.

Like many Stats features, blog owners have found imaginative uses for "Popular Posts" - and overlook the limitations of the gadget. Both the dynamic nature of Stats, and the timing of the various pageview count recalculations, create confusion, when Popular Posts is examined.

Free Domain Registration By "UNONIC" Is Fraudulent

Blogger blog owners, like everybody else, like to save money.

Some blog owners prefer to save money when registering a custom domain, for their blogs. We've seen several free domain registration services, providing what is claimed to be a two level Top Level Domain "co.xx" (where "xx" == various country codes).

The latest in this ongoing story appears to be "net.tf" - and 13 other "top level domains".There is also an additional free service offering third-level .tf domains, under the name United Names Organisation. They occupy 14 second-level domains, including .eu.tf, .us.tf, .net.tf, and .edu.tf. They are run by the same company as smartdots.com, and are given away as URL redirections.