| Drupal

Building-a-Business-Directory-With-DrupalOver the last couple of weeks, several different OSTraining members have asked me about creating a directory in Drupal.

I'm going to recommend a 4-step process for creating a basic directory.

Using default Drupal, plus the Display Suite and the Search API modules, we can create almost any type of directory.

Step 1: Create the Content type

First we need to set up our content type for the directory.

In this example, I'm going to build a business directory.

I'm going to create one content type for all our businesses. However, if the different items in your directory require radically different fields, you might consider creating multiple content types.

media_1403020599813.png

The image below is an example of the fields added to this content type:

media_1403021295428.png

The final field, "Type of Business" is a taxonomy. I've set this up as a Taxonomy to give me maximum flexibility in the future:

media_1403020812525.png

If you're taking submissions from the public, read our article "Clean Up the Drupal Content Form" which shows you how to make it easier for new Drupal users.

Step 2. Import Data

You will need to get some data into your site so that you can build the directory. You have at least three options here:

  1. Manually enter the business data
  2. Use the Devel module to generate dummy data
  3. Import data from a CSV file using the Feeds module

In this example, I used the Devel module to create some "Lore Ipsum Dolor" businesses:

media_1403021328644.png

Step 3. Improve the Directory Pages

Once we have content loaded into our site, we can browse and see our directory starting to take shape.

However, by default, all of the individual pages will look fairly plain. For example, here is the page listing all the bakers in our directory:

media_1403021493870.png

One way to improve the display of these pages is with the Display Suite module. You can watch our full class on Display Suite by clicking here.

With Display Suite, you can control the layout of the page seen above by controlling the Teaser format.

media_1403021569709.png

In the example below, I used Display Suite to change the layout to a 3-column design:

media_1403021792667.png

Step 4. Filters with FacetAPI

One final step towards creating a good directory is adding powerful search features.

We recommend using the Search API and Facet API modules. Click here to see our full class on creating powerful search with these modules.

Here's an image from Wunderkraut of a faceted search created with the FacetAPI module:

media_1403025998761.png

And here's a video from our Search class illustrating how to use the Facet API module:


About the author

Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.