Skip to Main Content

Low Alphabet & Structure - Alpha Filtering for Directories

I recently worked on a site that used Structure and needed two pages that could filter entries by alphabet, i.e. only display those that started with the letter "c". One section was a business directory the other a member listing page. This is easy enough to do by using Low Alphabet which I've used in the past.

I recently worked on a site that used Structure and needed two pages that could filter entries by alphabet, i.e. only display those that started with the letter "c". One section was a business directory the other a member listing page. This is easy enough to do by using Low Alphabet which I've used in the past.

However I ran into issues when using Low Alphabet in combination with Structure. When filtering by letter the url will look like this http://domain.com/members/c where we're looking for all members whose last name starts with c. What happens with structure is that it looks at the "c" and expects an entry in the structure tree. When it doesn't find one it returns a 404 page.

Freebie to the rescue. By adding the alphabet to the Freebie segments in the extension setting, this tells ExpressionEngine to ingore that segment. Now we're no longer getting 404 erros, but the alphabetical filter has stopped workking since alpha_filter="{segment_2}" is being ignored. Fortunately Freebie saves the values it removes as variables we can use in the template. so now I switcht to alpha_filter="{freebie_2}" and the page is filtering as expected.