Posts Tagged ‘Drupal’
Cheat sheet is a quick reference guide to get the work done quickly. Here is my collection.
PHP cheat sheet Get It
MySQL cheat sheet Get It
Python cheat sheet Get It
Jquery cheat sheet Get It
CSS cheat sheet Get It
Subversion(SVN) cheat sheet Get It
Drupal 6 API cheat sheet Get It
Drupal core template cheat sheet Get It
Drupal Form API cheat sheet Get It
Drupal Hooks cheat sheet Get It
Duplicate content penalty by Google
Recently I read an article about the “duplicate content penalty” and how Drupal deals with it. Duplicate content penalty is a system designed to keep spammers from flooding Google with the same content with different URLs. With drupal we know we can have at least 3 urls for a single content even without an intension of spamming!!
When we talk about SEO, the url we generate for our content plays an important role. Drupal provides the path module to generate user-friendly URLs and the pathauto module that automates this process.
Code that doesn’t use the l() function is considered buggy
Even if we enable these modules and still hard code our urls like <a href=”" ….. > link </a> , then our code is buggy. Until we use l() function , drupal can’t choose the best URL for us.
Before outputting any link to the browser we should ensure that it’s passed through the l() function which creates the best possible version of a node(a simple page in drupal) and keeps the default ones available as well. Here is the priority list with which the function chooses a URL.
1. http://mydruplasite.com/content/faq (if a friendly url is available)
2. http://mydruplasite.com/node/1 (if clean url is enabled)
The HTTP 301 redirects
With drupal’s l() fuction , google will never get a chance to see the ugly urls of our site. But , in case someone else points to the ugly url of your site and that gets itself indexed at google, then google may follow through that url to your site.
Google recommends using HTTP 301 redirects to solve this problem: they tell web browsers that the requested content actually lives at another URL. Web browsers will automatically jump to the correct URL, and search engine web-crawlers respect these redirects as well.
In Drupal, the Global Redirect module generates 301 redirects whenever a user visits a standard URL when a friendly path alias has been defined. It also generates a 301 redirect if someone visits an old-style “ugly” url like
http://www.example.com/index.php?q=node/1. The end result? No more duplicate content, period. Google will always see your content at the best possible URL, regardless of how users link to it.
This module uses hook_init() to interrupt page load and action the alias look up. But do read the ‘Known Bugs’ list before using the Global Redirect module. In case of Multilingual sites, you may need to observe it from close quarters after implementing.
You may like to see the original article which made me dig into reading more about this issue.