Articles about Themes

Doing it the Drupal way...

It is quite common practice to add head elements such as:

  • metatags and links such as webfont links and
  • xmlns namespaces

as text to the html.tpl.php or in template.php in hook_preprocess_html etc and other string based ways of doing things.
The problem with this is that it is hard coded and not the Drupal way. I have cobbled together some examples of how we do this in code (most of which have been gleaned from issue queues, posts and other great sources - credit to many anon contributors! The point here is simply to pull together some examples.

960 Robots theme - unwanted tweets in header

You'll notice that we are using the excellent 960 Robots Drupal theme for this blog. We aim to showcase several contributed modules and themes over time to show how they can be setup and used etc - using this site as a basis for video casts - in case you were wondering why we don't use our own themes... ; )
Great theme and easy to set up with great features out of the box.
One of the features of this theme is the random tweets in the header. Nice example of how to pull an external sites API query into your site - in this case Twitter.

Drupal Blueprint theme playing SEO nicely with other modules

Getting your page title and metatags correct is great for SEO and enables your readers to locate your content by getting it indexed well.
In this post we'll see how to get your modules and theme to play nicley together to ensure that your page structure is optimal for web standards and indexing. In most cases this can be sorted with a simple fix.

Drupal duplicates Content Type metatags

You may have noticed if you have looked at the page source of Drupal sites that they often have two content type metatags

This is a remnant of a security fix to ensure that the page always had a content type. (you can read all about it here