Use Query Strings to Filter Topic Views

:notebook_with_decorative_cover: This is a how-to guide explaining how to use query strings to get custom filtered topic views on any Discourse site.

Query Strings

Query strings are text that you can append to the end of most Discourse URLs to get a custom filtered view of topics.

Ex: https://meta.discourse.org/?status=open where ?status=open is the query string.

These can be useful for viewing a specific list of topics, creating custom links to unique topic lists, and searching for topics that meet a specific set of criteria.

Query strings can be used by all users, however, the list of topics that you will see when appending query strings to a URL will still be limited to the topics accessible by your user account.

You do not need to enable any settings to use query strings.

You can append the following query strings to URLs on all Discourse sites.

Status

?status=_

Displays topics with the following status:

  • open - Open Topics Only
  • closed - Closed Topics Only
  • archived - Archived Topics Only
  • visible - Visible Topics Only
  • invisible - Invisible Topics Only
  • deleted - Deleted Topics Only (this is available as of 1.2.0 beta3)

Search

?search=_

Creates a full page of search results instead of the limited search view using the search icon. Replace the _ with your search terms.

State

?state=_

Displays topics with the following state:

  • muted - Show topics I’ve muted
  • regular - Show topics I have set to regular
  • tracking - Show topics I’m tracking
  • watching - Show topics I’m watching

Ascending

?ascending=true

Show the topics by date in ascending order (value must be “true”, default is descending order)

Order

?order=_

Displays topics in descending order by:

  • likes - by like count
  • op_likes - by likes on the Original Post
  • views - by views
  • posts - by post count (replies)
  • activity - by last activity date (includes bumped_at date)
  • posters - by the number of participants
  • category - by category name (Z-A)
  • created - by topic creation date (newest topics first)

Max Posts

?max_posts=_

Returns topics with post counts of _ or lower.

Min Posts

?min_posts=_

Returns topics with post counts of _ or greater.

Topic IDs

?topic_ids=_

Displays a list of topics with the specified IDs.

Accepts a comma delimited string of topic_ids.

Category

?category=_

Displays a list of topics for the specified categories.

Accepts a comma delimited string of category ID numbers.

Combining Query Strings

You can also combine multiple query strings together using & to create additional filtered topic views. With multiple query strings, the ? icon is only needed at the beginning of the first query string.

Ex: ?max_posts=1&status=closed

7 Likes

Can’t you use the advanced search page to build these urls with the gui and then just copy the url?

It seems they are the same parameters (we just need to replace : from the search filter to = in the query string), but some search filter doesn’t work when used as a query string parameter outside search.

So I believe the full list is in this documentation. I’d be curious to see in which Discourse file they are referenced to be sure, though.

Edit : there is now a /filter route with way more filter criteria:

1 Like