Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

GH Pages: fix sorting of previous releases - #1113

Open
yaman-694 wants to merge 1 commit into
WordPress:gh-pagesfrom
yaman-694:fix/886-previous-releases-sorting
Open

yaman-694 wants to merge 1 commit into
WordPress:gh-pagesfrom
yaman-694:fix/886-previous-releases-sorting

Conversation

@yaman-694

@yaman-694 yaman-694 commented Nov 24, 2026 •

Copy link
Copy Markdown

Pull Request Type

  • I have checked there is no other PR open for the same change.

This is a:

  • Bug fix
  • New feature
  • Documentation improvement
  • Code quality improvement

Context

Fixes #886

The "Previous Versions" list on the download page is not in version order.
PR #884 switched the filter from sort to sort_natural, but that did not fix it.

Detailed Description

Liquid's sort_natural filter only makes the comparison case-insensitive.
It still compares the tag names as strings, so v2.0.20 is listed before v2.0.2, and v2.0.9 ends up at the top of the list.

This PR sorts on the release created_at date instead.
That value is an ISO 8601 timestamp, so a plain string sort orders it correctly.

I did not use published_at, as v1.5.0 was created in 2012 but only published in 2021, so it would be listed between v1.8.0 and v2.0.0.
I checked the created_at date of all current releases via the GitHub API and the date order matches the version order for every one of them.

Rendered order before (local jekyll serve):

v2.0.9, v2.0.8, v2.0.7, v2.0.6, v2.0.5, v2.0.4, v2.0.3, v2.0.20, v2.0.2, v2.0.19, v2.0.18, v2.0.17, v2.0.16, v2.0.15, v2.0.14, v2.0.13, v2.0.12, v2.0.11, v2.0.10, v2.0.1, v2.0.0, v1.8.1, v1.8.0, v1.7.0, v1.6.1, v1.6.0, v1.5.0

Rendered order after:

v2.0.20, v2.0.19, v2.0.18, v2.0.17, v2.0.16, v2.0.15, v2.0.14, v2.0.13, v2.0.12, v2.0.11, v2.0.10, v2.0.9, v2.0.8, v2.0.7, v2.0.6, v2.0.5, v2.0.4, v2.0.3, v2.0.2, v2.0.1, v2.0.0, v1.8.1, v1.8.0, v1.7.0, v1.6.1, v1.6.0, v1.5.0

Note: sorting by date assumes releases are tagged in version order.
If a release for an older branch is ever tagged after a newer one, it would be listed by date.

image

Quality assurance

  • This change does NOT contain a breaking change (fix or feature that would cause existing functionality to change).
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added unit tests to accompany this PR.
  • The (new/existing) tests cover this PR 100%.
  • I have (manually) tested this code to the best of my abilities.
  • My code follows the style guidelines of this project.

Liquid's `sort_natural` filter only makes the comparison case-insensitive,
it still compares tag names as strings, so `v2.0.20` was listed before
`v2.0.2` and `v2.0.9` ended up at the top of the list.

Sort on the release `created_at` date instead. This is an ISO 8601
timestamp, so a string sort orders it correctly. The `published_at` date
is not usable as `v1.5.0` was created in 2012, but only published in 2021.

Fixes WordPress#886
@jrfnl

jrfnl commented Nov 24, 2026

Copy link
Copy Markdown
Member

@yaman-694 Thank you for your efforts.

Note: sorting by date assumes releases are tagged in version order.
If a release for an older branch is ever tagged after a newer one, it would be listed by date.

This may well happen in the future if security issues are addressed and fixes would be backported to older Requests versions (before a PHP version drop), so to me, this PR, while a creative solution, does not actually address the described task.

Having said that, I can imagine a discussion could be had about what the sort order should be if releases are tagged in multiple minor/majors, but if so, that discussion should be had in the ticket #886.

@yaman-694

Copy link
Copy Markdown
Author

Thanks @jrfnl, for reviewing. Your point make sense happy to be a part of the discussion

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants