How to create a Drupal FAQ system using Taxonomy and Views Module

I’ve been looking for an FAQ system for drupal for awhile, but I can’t find any that I like. There is an FAQ module but it only lets you have one global FAQ area for your site. If you are doing multiple applications and want to have an FAQ for each application, the FAQ module can’t do it. I decided to see if I could make something using the Views module and Taxonomy.

Requirements


For this FAQ system to work you will need to have the taxonomy module enabled, you will also need to install the views module (http://drupal.org/project/views). Once both of these modules are enabled we can move onto the actual configuration parts.

 

Create an FAQ content type


Go to Administer -> Content Management -> Content Types (/admin/content/types) and create a new content type called FAQ, this will be used to easily group all of your FAQs together. This is pretty simple, just follow the prompts and fill in the fields.

 

Configure the Taxonomy module


Goto Administer -> Content Management -> Taxonomy (/admin/content/taxonomy) and create a new vocabulary called FAQ. Then under the content types expander, tick the FAQ type, then under settings tick the required option. This will make sure that any FAQ page you add must be linked to a FAQ term.

Once you have created the vocabulary entry, now we need to add terms to it. Click on the “add terms” button beside the entry in the table and create a term that best describes the first FAQ you want to make (to make your life easier, it might be better to pick terms that have no spaces just to make URLs easier to handle). In this example I’ll use “FAQTest”, leave the settings in “advanced options” as they are. Once you have a term entry for FAQTest we can move onto the next part.

 

Create the first FAQ entry so we can text with it


Go to Create Content (/node/add), there should now be an FAQ type in there. Create a new page and after the title you will now see a required field of FAQ, this will have your FAQ term you defined in the taxonomy module in it, select it and make a page like normal.

One page is ok, but if you want to make sure you have the look of the FAQ layout right, add a few more.

 

Configuration of the View Module


Go to Administer -> Site Building -> Views (/admin/build/views) and you should see a list of views. One of them will be called “taxonomy_term” enable that view and edit it. This is where it gets a little confusing because if you haven’t played with views before, what greets you on the edit page can be very confusing. But never fear, I will post heaps of images for you to follow what I’m talking about. You should be looking at something that looks like this:

Now go and edit the “Page” settings for this few. To do this click on the Page tile

Now edit the path that this page will live, Click on the existing path and change it to “FAQ/%”

Now tell it we want to show only certain fields on our page, so with Page selected change the “Row Style:” to be Fields. If you click on the existing type “Node” you can change it to Fields. Tick the boxes to make body and title inline and set the separator to be “<hr />” so that it puts a hard line between the title and the body

Once that is done, we need to add what fields we want to display on the page. Press the + in the fields box to add new fields. You want to add Title and Body, Title will be down the list, you will need to scroll. When you click update it will ask you what label you want to put on the body and title, have a blank label for body and make the title label “Q”, you can come back and change this later to make look better if you like.

Now to put the fields in the right order you need to click on the up and down arrows beside the + that you used to add new fields. In here you can use the left icon on the line to drag the order of the rows to how we want them. We want title, then body.

Now edit the Taxonomy Arguments, Click on the “Taxonomy: Term ID (with depth)” in the Arguments box and tick the box beside the FAQ taxonomy Vocabularies, and change the pull down box for argument type to “Term name/synonym converted to Term ID”.

Now to make all the RSS feeds nice and neat and match up, you need to change to the “Core Feed” page and change the path to be “FAQ/%/%/feed”.

Similarly you also need to change the “Views 1 Feed” page path too. This one changes to “FAQ/%/feed”

You are now done!. If you want to test it you can put your Taxonomy term you originally created and added to your FAQ pages into the Live Preview and hit preview, you should see something like this:

The URL for your new FAQ page is now http://yoursite.com/FAQ/[term] (in the example it’s http://zethos.org/FAQ/FAQTest) you can add a menu entry linking to this URL and it should work. If you need to add another question/answer pair you just create a new content page of type FAQ and assign it to the FAQ term you want and it will appear on your FAQ page.

 

Creating another FAQ page


The hard part is over. Now if you want to create another FAQ page about something esle, you just go into the taxonomy module and add another term to the FAQ vocabulary and you can then create new FAQ content and assign it to the new term. This will then show up under /FAQ/[new term] as a new page with those questions/answers.

 

Hope you find this page useful.

Comments are closed.