Building A Stack Overflow Clone With Drupal - Part 4

Stack Overflow has dozens of little features that add little magical touches around the site. They help you find things, they help you display things, and they make using the site fairly intuitive. Let’s explore how to add a couple of these features to a Drupal site.

Code Highlighting

With Drupal there are a few ways to do code syntax highlighing. The Code filter module lets you highlight PHP. But, who only wants PHP syntax highlighting? There's the Syntax Highlighter module that uses JavaScript. But, that means RSS and browsers with JavaScript turned off can't view the highlighting. And, from a purely performance standpoint, this uses more resources worldwide than the third possible solution.

There is the Geshi Filter Module. This module supports syntax highlight for numerous languages, even some I think of as dead ones. The formatting it produces can be seen in RSS readers and it takes advantage of Drupals filter caching system which is good for performance.

Installing the Geshi Filter module is fairly straight forward. Install the module and follow its instructions on installing the 3rd party Geshi library. Without the library it wont work.

After installing the module go to Administer > Site configuration > GeSHi Filter where you can configure the settings. You can configure the languages to highlight, the HTML tags to enclose the code in, and a bunch of other options.

Then go to Administer > Site configuration > Input formats, select the Input format you want to add it to, and add the Geshi filter.


Tags provide a simple way to navigate the site. Unlike a forum with a set architecture there isn't a set architecture in a Stack Overflow like setup. This is where tags come it. They provide a way to navigate the site and find what you're looking for.

Tagging in Drupal is there out of the box with the Taxonomy module. Set it up with free tagging on the Question content type. Free tagging is nice but its not always easy to find tags others are using. This is where the Suggested Terms module comes in handy. It suggests popular terms to use.

Both Drupal and Stack Overflow have loads of little niceties. At this point we’ve built out all the complex parts that aren’t intuitive with core or other popular modules.