Web Design

Drupal: Placement of the search box makes a huge difference

I am continually making striving to improve the design of our community site, Unreality Shout. I'm quite fond of the grid-based design, but there's usually something that needs refined or improved.

A couple of days ago, I decided to move the search box to a more prominent place on the page. When I designed the site, I hastily threw in a search form as a sidebar block...right down around the bottom. I was never 100% happy about this arrangement, but my Drupal skills were weaker then.

However, I've been using Shout a lot more recently. And it started to bug me that I had to scroll to the bottom of the page to search for content. So I decided to bite the bullet and hard-code a search box into the top right-hand side of the header.

Tip for newbies: I thought I had all the code in place. But the search box failed to appear. Turns out that although I'd enabled the Search Box option in the global settings, it was switched off in my theme-specific settings. Whoops! Hopefully that's a time-saver for somebody else!

Nofollow List - An alternative to Drupal's spam link deterrent

Something I've hated about running community sites on Drupal is the cursed Spam Link Deterrent filter.

The idea behind this filter is that it applies rel="nofollow" to any links in user-generated content. And the reason this is necessary is that when you have a membership site and you allow users to create content on it, you inadvertently attract spammers who want to drop links back to their own site.

By applying the nofollow attribute, you are telling search engines not to count that link as 'editorially approved' - therefore, the spammer doesn't derive any value from the link. The problem with the Spam Link Deterrent is that it's an all or nothing solution - even internal links to other content on the site get this added to them. This means that your site loses a lot of value from natural internal links.

Drupal: Get a comma-separated list of categories (taxonomy)

Drupal's default way of displaying categories really bugs me. They compile all the categories into an unordered list, which adds a lot of pointless complexity to the theme.

Coming from the WordPress school, I'd much prefer to have a comma-separated list of categories. Well, after an epic battle with my node.tpl.php file and much searching on the Interwebs, I've come up with a solution. It's based heavily on a code snippet used in this Lullabot article.

Essentially, what we need to do is parse through all the terms, build a link for each taxonomy term and then use the implode function to build the comma separated list. Here's a sample of the code I'm using:

Design: Implement tags for web usability?

When I set this blog up, my intention was not to go overboard on SEO or anything like that, so I created a basic set of categories, none of which were particularly keyword-rich. The list of categories stands at:

  • At Home - Seldom used, was originally intended for personal stories, but I realise I rarely post those (here, anyway)
  • At Work - Originally intended as somewhere for posts about work and things I was doing in professional life. I've used this as a home for my tech tutorials as well though.
  • In My Head - A category for philosophical flights of fancy. Ironically, or fittingly, it's become a dumping ground for random posts rather than anything poignant.
  • On Blogging - Contains some good tutorials and posts about blogging.
  • On Web Design - Another favourite category containin my notes and thoughts on web design. Has some good Drupal discoveries I've made recently.
  • Unreality TV - Used for the odd update on what we're doing over at Unreality TV. Includes a good post from the Leon Jackson year of X Factor.

A minimalist Drupal theme, anyone?

If you were reading a couple of weeks back, I was musing about the effectiveness of minimalist blog designs and their impact on search engine optimisation.

The basic notion was that by eradicating all the extra stuff on the page and just displaying the page and the bare minimum of navigational links, you could improve search engine relevance and as a result, rank higher for any given search term. Why? Because, providing that the content is well written and follows the principles of good titling and semantic markup, there will be less irrelevant garbage on the page to confuse a search engine.

This follows on from the current discussion surrounding Twitter's value in terms of SEO - literally just the title and the content are displayed, along with a handful of navigational links back to the member profile.

My Experiment

I've decided to create a standard, one-column Drupal theme that only displays the content and not much else. I've left interlinking to the standard Drupal categories, but removed sidebars, Twitter statuses and anything else not relevant to the content.

Drupal Theming Tip: Show messages depending on whether the user is logged in or not.

I'm working on a Drupal theme at the minute where I need to work out whether a user is is logged in (or not) and show them a message accordingly. One such scenario is user invitations:

  1. I want to build in an invitation to become a member. If someone is already logged in, they don't ned to see this message. If they're not a user (or not logged in), I want them to see a message saying "Join our community" and providing a sign-up link.
  2. Certain pages have a wiki functionality. I want non-users to see an invitation to join up and edit, while existing members will see a message encouraging them to get involved. Slightly different messages, but both hopefully effective.

So, how does one do this in a Drupal theme? It's actually quite easy.

For older versions of Drupal, they used to recommend the following code:

<?php
global $user;
if ($user->uid) {
// User is logged in.
}
?>

But in Drupal 6 there's a tidy little function you can use: user_is_logged_in()

Contributing to Drupal: The Freelinking Module

At the current time, I've been a member of the Drupal.org website for 4 weeks shy of 3 years. I mention this because I had an awkward moment on the Drupal forum when an (obviously long-term) Drupaller showed his disdain for me for not contributing in all the time I'd been using Drupal.

Well, naturally said person was a bit of an asshole. One of those blinkered types who believes that everybody has the time or ability to contibute equally to the Drupal project. I'm not a PHP programmer, I've only just managed to work out how to theme in Drupal 6. I run a small ship of a few websites, and running them takes up all my time.

I mention this because I was quite annoyed at the implication that by not contributing, I was somehow a leech. Where was the legendary friendly Drupal community I heard so much about? While not able to contribute a hell of a lot, I was at least evangelising the product, writing how-to's and sharing interesting Drupal Planet articles via social media websites.

Drupal: How to increase the default font size in TinyMCE

If you've ever installed the TinyMCE module for Drupal (or indeed the WYSIWYG module which seems to be the preferred way forward), you'll have noticed that the default font size is miniscule. My first concern as a web designer is usability. How hard is it to read and edit?

Should I SEO my website?

About two years ago, I decided that I wasn't going to SEO this site. Admittedly, I've deviated from this strategy subtly in the intervening time.

For a start, I ditched the Garland theme in preference of my own design, which uses XHTML, is easily crawlable and very semantically correct. I noticed the other day that somewhere along the line, I installed the nodewords module for Drupal - possibly in testing for another site - but I'm not complaining about the individualised meta tags it creates.

Consolidating Blogs & Domains

I’m doing a little blog consolidation work at the moment. Maybe I mentioned in the last post that when I started blogging, I went to town registering domains and starting random blogs.

That’s a rookie mistake that I don’t intend to make again. For a start, maintaining all those separate WordPress installs at once, is a lot of work. Even with a dormant WP site, I still feel compelled to apply security updates in case there’s a chance the site gets hacked.

Plus, I can’t stand owning so many ghost town blogs. So, I’m working on a masterplan to consolidate all those blogs and domains into a manageable block of 3-4. For example, I’ve migrated all the posts from an old tech blog of mine to this one, and then finally redirected the domain so that all the traffic comes to this site.

Syndicate content