Filtering image lists

Compatible Omni Gallery Image Selectors can be filtered dynamically by extending path segments and by query string parameters. This enables the images shown to be filtered by:

  • Date
  • Tags
  • Topics
  • Search Keywords

Currently compatible Image selectors are:

  • Page List Dynamic
  • Filseset Dynamic
  • Folder Dynamic
  • Express List Dynamic

Other image selectors can potentially be extended to support external filtering and further attributes incorporated into the filter options. Please contact me if you have further image filtering and searching requirements.

Filter basis

Filters are applied to the base list used to provide images, which is not necessarily the actual images.

For Fileset Dynamic and Folder Dynamic image selectors, this means filters work directly on image attributes.

For the Page List Dynamic image selector, the filters work on page attributes (not on the subsequent image attributes)

For the Express List Dynamic image selector, the filters work on the express object attributes (not on the subsequent image attributes)

Filtering by other blocks

External filters respond to path segments as provided by filtering blocks for Page Lists:

  • Date Navigation (*)
  • Topics
  • Tags (*)
  • Search (a no-results template is required)
Page List Dynamic

Date Navigation and Tags blocks can be used easily with Page List Dynamic because they auto-populate options from the corresponding site pages and attributes.

Fileset Dynamic, Folder Dynamic

Files already have Tags. To use Topics you will need to add a Topics attribute to files. To use Tags or Date filtering for lists of files, you will need to either create a Date Navigation or Tags block template populated from files or to assemble a list of filtering links by hand. 

Express List Dynamic

Lists of Express objects have similar considerations, with the additional provision that to filter by Tags you will need to add a Tags attribute to the express objects.

Path and Query formats

The fundamental mechanisms of the blocks discussed above is to append path segments to the URL.

Date filtering

Date filtering appends the URL with a 4 digit year and 2 digit month, so the page path now ends /yyyy/mm/. For example

  • https://mysite.com/my-gallery-page/2025/02/ for a filter to February 2025
  • https://mysite.com/my-gallery-page/2024/11/ for a filter to November 2024

Date filtering can also be specified by query string parameters using the keys y, year, m, month. With this format, you can filter by a year without specifying a month, but you cannot filter by a month without specifying a year. For example

  • https://mysite.com/my-gallery-page?y=2025&m=02 for a filter to February 2025
  • https://mysite.com/my-gallery-page?year=2024&month=02 for a filter to November 2024
  • https://mysite.com/my-gallery-page?year=2024 for a filter to any month in 2024

Tags filtering

Tags filtering similarly appends the path with /tag/tagword/. For example

  • https://mysite.com/my-gallery-page/tag/fish/ for a filter to items tagged 'fish'
  • https://mysite.com/my-gallery-page/tag/coral/ for a filter to items tagged 'coral'

Tags filtering can also be specified by query string parameters using the key tag. For example:

  • https://mysite.com/my-gallery-page?tag=fish for a filter to items tagged 'fish'
  • https://mysite.com/my-gallery-page?tag=coral for a filter to items tagged 'coral'

Topic filtering

Topics filtering appends the path with /topic/topic_id/topic_handle/. The segments /topic/ and /topic_id/ are used, while the final /topic_handle/ segment is only there for making the URL look pretty. With that in mind, and taking topic IDs from a standard Atomik sample content, our examples are:

  • https://mysite.com/my-gallery-page/topic/54/marketing for a filter to items with the topic 'marketing'
  • https://mysite.com/my-gallery-page/topic/58/company-news for a filter to items with the topic 'company-news'

If you prefer to use URL query parameters, the equivalents are:

  • https://mysite.com/my-gallery-page?topic=54 for a filter to items with the topic 'marketing'
  • https://mysite.com/my-gallery-page?topic=58 for a filter to items with the topic 'company-news'

Search or keyword filtering

The magic for keyword filtering uses any of q, query, search, keywords. For path parameters, our examples are now:

  • https://mysite.com/my-gallery-page/search/fish/ for a filter to items with the text 'fish'
  • https://mysite.com/my-gallery-page/query/big%20fish/ for a filter to items with the text 'big fish'

Similar searches by URL get parameters are:

  • https://mysite.com/my-gallery-page?search=fishfor a filter to items with the text 'fish'
  • https://mysite.com/my-gallery-page?query=big%20fish for a filter to items with the text 'big fish'
  • https://mysite.com/my-gallery-page?q=small%20fish for a filter to items with the text 'small fish'

Filtering works on the fields the core lists query using the method filterByKeywords().

Considerations

Core blocks

As already mentioned above, the core Date Filter, Topics and Tags blocks are populated from page attributes and properties. These may not align with file or express attributes and properties.

Pagination

Omni Gallery pagination also uses path segments. It is not advisable to use filtering in association with paginated galleries. 

Display Widgets

Filtering works within image selectors, so as long as you configure a compatible image selector you can use any Display Widget to show the filtered gallery. Just don't configure it to paginate.

Attributes

Date filtering is mapped to the corresponding creation dates for pages, files or express objects. Other filters work with Topics and Tags attributes or properties.

If such attributes are not configured, the filter will be ignored and an error noted in the site Log at /dashboard/reports/logs/.

Filtering by keywords, such as from a search query, uses the core filterByKeywords() method for the respective list class. This knows nothing about Omni Gallery name and description attribute mapping.

Image Selector options and multiple filters

When an Image Selector builds a list of images, external filters are applied last. Where an Image Selector already provides options to filter the list of images, perhaps by attribute or by date, the external filters are applied after the filters configured in the block edit dialogue.

An external filter may compound a configured filter, or it may override it. Behaviour is entirely dependent on how the respective core list class handles multiple filters. Similarly where more than one external filter is applied the filters may compound or override in the order they are specified in the path segments or query string.