Building a Glossary-Style View with Drupal

Drupal's powerful Views 2 module comes with a handful of fantastic built-in views that show off just how much Views can do out-of-the-box.

Today, I discovered the glossary view for the first time. Just go to the views listing page, enable the glossary view and you'll find an alphabetized view of all the content on your site. It displays an A-Z pager as a views attachment and the page display takes a single letter as an argument, with the pager providing a link to each version of the view.

You can further configure the view by adding filters and fields that make sense for your content. If you want to include multiple directories or glossaries on one site, you can easily clone the view and change the filters.


So how do you output a A-Z glossary where only letters that have content are links? Basically show all letters, but only link the letters that have content.

I also have a small issue. If you have some nodes that start with numbers, it lists each starting number in my alpha bar. So right now mine looks like:

1 | 4 | 8 | A | B | C | D | E

This could obviously be handled better. I'd prefer it just didn't list numbers for now, or more optimally, have a 0-9 link.

Similarly, people are going to want to know how to insert an "All" link into the bar.

Would love some tips if anyone has time!