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
  • unlisted - Unlisted Topics Only
  • deleted - Deleted Topics Only

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
  • normal - Show topics I have set to normal
  • 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.

Solved

(needs Solved plugin)

?solved=yes
?solved=no

Assign

(needs Assign plugin)

?assigned=username - to view all assigned topics for a user
?assigned=* - to view all assigned topics for all users
?assigned=me - to view all assigned to current user
?assigned=nobody - to view all unassigned

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

17 Likes

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

1 Like

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:

3 Likes

If you have the Solved plugin, you can also use:

?solved=yes
?solved=no

3 Likes

I think there are some for Assign too:

I’ll add them in. :+1:

3 Likes

At a guess imagine you could also use this for Tags?

Awesome how to

2 Likes

Yes, you can append ?tags=_ to Discourse URLs use query strings to filter for tags.

For example, https://meta.discourse.org/?tags=how-to would direct you to all of the how-to tags on Meta.

2 Likes