Sort Order Parameters

Add the query parameter redirect_to to the URL of your blog. This parameter is mandatory.

Values can be:

  • last or latest – The URL will redirect1 to the latest post.
  • first or oldest – The URL will redirect to the first (oldest) post.
  • random – The URL will redirect to a random post.
  • custom – The post will be determined according to the mandatory parameter orderby and the optional parameter order. Possible values for orderby are listed here. By default, order is “DESC” (descending – starting from the highest value, the later time or the bottom position in alphabetic order). Alternatively you can set it to “ASC” (ascending).

Obviously, the parameter “custom” lets you achieve the same as “latest”, “first” and “random”. These shortcuts exist just for convenience and readability.

Retrieving the 2nd, 3rd, etc. matching post

If you want to show the 2nd, 3rd, etc. matching post, you can use the parameter offset. The offset will be counted additionally. So “offset=1” means the 2nd post. If the offset is too high compared to the amount of matching posts, the procedure for “no posts found” will be run.

Random of a subset

Use the parameter count together with random in order to pick a random post out of a subset. The value of count determines the N most recent posts or the N oldest posts (if N is prepended by a minus).

The parameter count can be combined with offset.

Random with a bias

Use the parameter bias to pick a post from a subset (defined with count and – optionally – offset) with a higher probability than the rest. The value of bias is a percentage (without the % sign).


Redirect to the latest post:

Redirect to the 2nd-latest post:

Redirect to the post with the highest number of comments:

Redirect to a random post. Pick one from the latest 10 with a probability of 80% and from the rest with a probability of 20%:

(Note: Replace everywhere “” with your blog’s URL.)

Show 1 footnote
  1. Technically the URL is rewritten, i.e. the browser address bar will show the new URL.

How do you rate this article?