Drupal 6 Sitemap Block Module

Mozilla Footer - Drupal Sitemap Block Module

This module lets you display a Drupal sytem menu as a sitemap (all links are expanded - up to 3 links deep) in a block. The block that can be dropped into any region of your theme using the standard blocks interface within Drupal.

This module was based on the footermap module (which does a similar job and has some good features) however, we found the code to be a little confusing, there were some bugs and it didn't render the menus as we would have wished. All three things meant it was unusable for us or our clients. We've spent a few days developing our own much tidier, slimmer and (in our opinion) much better version.

Using the module

  1. upload to your Drupal site and install
  2. configure it - /admin/settings/sitemapblock
  3. choose a region for the block - /admin/build/block

The Latest Version

Version 1.4

  • Added language support - now only shows menu items that are in the current language or language independant
  • Restricted use to primary-links, secondary-links and nav
  • Restricted menu recurse to 3 levels
  • Fixed bugs to do with dupe/disabled menu items

Version 1.5

  • Added support for custom menus

Version 1.6

Version 2.0

  • Direct port from drupal 7 version.
Spread The Love


Andrei's picture
posted by Andrei on Nov 27 2010

Thanks a lot for the module! Just what was needed.

jack's picture
posted by jack on Nov 27 2010

Glad you found it useful!

Anonymous's picture
posted by Anonymous on Nov 27 2010

this is exactly what i was looking for too! Although I would appreciate having, in addition to classes for first and last list entries, a class for the middle menu entries as well.

jack's picture
posted by jack on Nov 27 2010

Hi - I'm working on this module right now. The plan is to have a unique class for each item e.g. item1, item2 etc. PLUS - first last and middle. I'm fixing a bug which causes disabled views menu items to show up in the list as well. Expect an update before the end of the week.

Matthew's picture
posted by Matthew on Nov 27 2010

where does this module get its list of entries from? I deleted and addded some menu entries and now both the deleted and the added entries are part of the site map block module. How can I make it use only the current menu entries?

jack's picture
posted by jack on Nov 27 2010

Hi Matthew, Sounds like the bug I mentioned in my previous comment. I am working on a fix for this right now... if you can hang on `til tomorrow I will post an update.

Yoh's picture
posted by Yoh on Oct 19 2011

Hi all,

With 6.x-1.6 version, i modify the query in sitemap_block.module line 76
Only publish node is now showing.

$result = db_query("SELECT ml.* FROM {menu_links} as ml, {menu_router} as m WHERE (m.path = ml.router_path OR ml.router_path = '') AND ml.menu_name = '%s' AND ml.depth = %d AND ml.hidden = 0 ORDER BY ml.weight ASC", $activeMenu, $count);

$result = db_query("SELECT ml.* FROM {menu_links} as ml, {menu_router} as m, {menu_node} as mn, {node} as n WHERE (m.path = ml.router_path OR ml.router_path = '') AND ml.menu_name = '%s' AND ml.depth = %d AND ml.hidden = 0 AND ml.mlid = mn.mlid AND mn.nid = n.nid AND n.status = 1 ORDER BY ml.weight ASC", $activeMenu, $count);

James's picture
posted by James on Nov 27 2010
I used your module, and it worked perfectly! I sat down thinking I'd have to delve into PHP and smoke a bunch of cigarettes to stay awake. Your module saved me.
jack's picture
posted by jack on Nov 27 2010

haha great! I'm glad it was useful!

Joao Ramos's picture
posted by Joao Ramos on Nov 27 2010

Very nice module, but I think you are missing one thing.

The links should link to the url_alia's node and not directly to the node path.

Example: domain.com/about and not domain.com/node/10.

jack's picture
posted by jack on Nov 27 2010

Hi Joao - good point will post an update in a day or two.

Dan's picture
posted by Dan on Nov 27 2010

This looks like an improvement on the footermap module. Any idea on how to theme this as i would like to display at the bottom of the page using three or four columns?

jack's picture
posted by jack on Nov 27 2010

Hi Dan, you should be able to style each <ul> as a "column"... the css below should get you started...

.block-sitemap_block ul { display:block; float:left; width:*enter the width of your column here in px*; }

that should get each ul floating next to each other... for more info on floats check out this link http://www.w3schools.com/css/pr_class_float.asp

I recently styled it on this site... you can copy some CSS from there if you need. http://ctfmontreal.com/

David's picture
posted by David on Nov 27 2010

Thanks a lot !!! juste what i wanted.

Dan's picture
posted by Dan on Nov 27 2010

Feature request. How about the ability to display more than one menu in the site map. for example I would like to display a site map to include both the primary and secondary menus. (similar to footermap module)

jack's picture
posted by jack on Nov 27 2010

Hi Dan, how should this be rendered? one < ul > after the other?

Dan's picture
posted by Dan on Nov 27 2010

Yes, that would probably work. As long as they can be styled so that they look as one. At the moment I have created a separate menu to be used as a site map and have incorporated 'Multiple Node Menu' but I think your module would be a more elegant solution if it had support for multiple menus.

jack's picture
posted by jack on Dec 11 2010

Just posted a drupal 7 version of this module - http://beacon9.ca/labs/drupal-7-sitemap-block-module

sam's picture
posted by sam on Jan 27 2011

Are you guys planning on contributing this back on drupal.org? Would be nice so I can get updates and whatnot through drush.

jack's picture
posted by jack on Jan 28 2011

Hi Sam - Yes, we will eventually contribute this on drupal.org.

jack's picture
posted by jack on Feb 27 2011

Version 2.0 is released. Its a direct port of 7.1.2 version of the module. Much cleaner code and allows us to recurse deeper into menus.

T's picture
posted by T on Aug 31 2011

This worked for me except not all the primary links showed up or were expanded. Any idea why this would happen? Thanks!

jack's picture
posted by jack on Oct 19 2011

you have to set how deep the menus should go, check out the module settings.

it's possible to disable menu items.. check none of your menu items are accidentally disabled.

Phil's picture
posted by Phil on Oct 06 2011

great module, but i have tio ask a (probably kind of stupid) question. I checked out your implementation on http://ctfmontreal.com/ and it looks like exactly what i'm after. But how did you get drupal to output each 'primary menu' item in its own <ul>? What am i missing here please?

jack's picture
posted by jack on Oct 13 2011

Hey, drupal "nests" the <ul> elements for you when you add a new menu item as a child to an existing item.

Phil's picture
posted by Phil on Oct 14 2011

thanks so much for the response. I may be doing something wrong here, I'm not super drupal-literate yet. In Drupal 6 my output from ur module has the entire menu in one <ul>, like this:

<ul id='sitemap_block_parent'>
<li class='first'>link1</li>
<ul id='sitemap_block_295'>
<li class='first'>link2a</li>
<li class='last'>link2b</li>
<li class='last'>link4</li>

I fiddled your code to output the following:

<ul class='first'>link1</ul>

which appears to be what's on ctfmontreal.com. It allows me to sstyle the <ul>'s next to each other now. if theres a better way, PLEASE let me know. I'm not sure this is valid html :(

thanks again

jack's picture
posted by jack on Oct 19 2011

mmm it might be valid... not exactly standard practice though... with the right CSS, you should be able to get the menus next to each other like on ctfmontreal.com. check out the css I used on that site/feel free to copy it if you need.

Erin's picture
posted by Erin on Jan 28 2012

This is a great module...the only thing I'm having trouble with is the recursive settings.

I have a menu that is two levels deep. Only two of the first level links are drop downs. Oddly enough, when I set the sitemap module recursive limit to "2", it doesn't show all my menu links. However, when I set the limit to "3" then all of them show.

The settings for my second level links are the same. Is this how the recursive limit setting is supposed to work, or is there a reason why I can't get all of my second level links to show when the recursive limit is set to "2"?

Bric's picture
posted by Bric on Apr 01 2012

I think it's a great module. Why don't publish it on drupal.org ? Drupal modules lacks in modules for sitemaps and your module fits perfectly. And so, you'll get some advertising :) (you can write on module presentation that is supported by you, with link )

Good luck!

Rank Us

Rank BEACON9 with a tweet...

Got Skillz?

If you've got ninja web skillz and are interested in working with us, get in touch!

Ready to rock? Get in touch for a free consultation & quote.Get in touch

Copyright © 2012 BEACON9 Media Ltd. All Rights Reserved.

Powered by Drupal A BEACON9 Creation