Skip to content

Hide releases from Downloads page when they have no files to download #2736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2025

Conversation

zooba
Copy link
Member

@zooba zooba commented May 26, 2025

The problem is most obvious on the macOS page, which has a lot of releases listed with no files. For a downloads page, it looks a bit silly.

Most critically, this should hide the Python install manager releases from macOS and Source pages, as it will have no files. An alternative would be to hard-code its ID into the templates, but this way seemed better.

There might be a better way to check if there are no files, I'm not sure. And yes, this makes the {% empty %} blocks redundant, but they're also harmless, and if this check is ever changed at least the page will still work.

Copy link
Member

@JacobCoffee JacobCoffee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Details

before
image

after
image

lgtm

@JacobCoffee JacobCoffee merged commit 142583b into python:main May 26, 2025
3 checks passed
@zooba zooba deleted the emptyfiles branch May 27, 2025 12:01
@zooba
Copy link
Member Author

zooba commented May 27, 2025

I hope those before/after images are swapped, because it looks like it's added empty entries.

Also, should this have deployed yet? I don't see any change on the live site, but maybe I shouldn't expect to - I really don't know.

@ewdurbin
Copy link
Member

Also, should this have deployed yet? I don't see any change on the live site, but maybe I shouldn't expect to - I really don't know.

It has deployed, but everything under /downloads has a massive cache TTL:

add_header Surrogate-Control "max-age=604800, stale-if-error=3600, stale-while-revalidate=300";

You can purge a given URL with curl -X PURGE https://www.python.org/downloads/macos/ to force the page to render sooner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants