Sunday, November 15, 2009

SEO with liferay - required features

Liferay 5.2 came with a couple of improvements regarding SEO (Search Engine Optimization) For example

  • default friendly URLs
  • automatically generated META tags
  • unique titles
That is really good news. And more importantly: To me it shows, that liferay has understood the the future doesn't only lie in intranet-portals but as well in webpages / business models for the internet.
And well - we all know that SEO is key there.

So here are some additional points that are really required from my point of view to catch up with the other big CMS/Portal solutions:

  1. Themes that are SEO friendly by default. This implies usage of headers (H1, H2 etc) - instead of limited meaningfull elements like "Div"
  2. "Related links" portlet. This would allow smart intra-site linking of pages
  3. Pimping of the "Blog" portlets (better customization possibilites) - as this is one of the main means for user generated content
  4. Default google-friendly 404 handling (Not so critical as it can be fixed as described in this blog entry about the 404 customization)

I'm confident, that liferay will pick up some of these ideas. What do you think?

Talking about catching up with the big cms systems for the internet - like wordpress - a nice "tag cloud" portlet for liferay would be cool. :)

Satisfy google - Create 404 error message to verify page for webmastertools

Now this was a long fight. Pew.

Quite some time ago google changes their rules for page "verification" for their webmastertools which you probably know. Now they ban the usage of redirects when a page is not found - google want's a nice "404" error message.

How does that work with liferay? By default liferay redirects all requested URLs that doen't have a corresponding page to the homepage (e.g. /web/guest/home). That's exactly what google does not like. :o/

There are now two different cases that should be distinguished:

  1. Wrong URLs "behind" the path of the homepage (e.g.
  2. Wrong URLs directly at the root path (e.g. )
(This difference has been pointed out by Chris Kauffman in the liferay forums - thanks!)

For 1) there are seetings within liferay that customize that behaviour. These work fine - but just for this use case:

For 2) This has to be adjusted on the app-server level (for my: tomcat from the bundle)

Two options:
The proper way - change the routing in the web.xml of the liferay application (in tomcat-5.5.27\webapps\ROOT\WEB-INF). There you change the entry for "error-page.

Or you do it quick and dirty :)
The "error-page" tag points to /errors/404.jsp
You can modify this file directly to turn of the redirection. That is you have to remove:
<body onload="javascript: location.replace('<%= homeURL %>')">

and related.

Now you should be friends with google again. :)