pydata / pydata-sphinx-theme

A clean, three-column Sphinx theme with Bootstrap for the PyData community
https://pydata-sphinx-theme.readthedocs.io
BSD 3-Clause "New" or "Revised" License
565 stars 304 forks source link

Do not show announcement banner if contents are empty #1695

Closed melissawm closed 5 months ago

melissawm commented 5 months ago

Hello folks!

Over at https://github.com/napari/docs we would like to use a temporary announcement banner on our website. We are pointing to a remote announcement-banner.html file. But in the future, instead of turning temporary announcements on or off on the conf.py file, we would like to not show the announcement space at the top of the page if the contents of the announcement-banner.html file are empty.

I tried poking around and found that it could work if we do the following:

https://github.com/melissawm/pydata-sphinx-theme/compare/master...empty-announcement

Is this an acceptable feature request? If so, I can submit a pull request with the suggestion above. Thanks!

cc @jni

jni commented 5 months ago

Yeah, so the rationale is: updating the conf.py for already deployed sites (such as project.org/stable) is tricky. It's easier if the conf points to (say) project.org/dev/_static/announcement.html, that gets deployed in the conf, and then the banner can be updated by changing the text in that file (simple PR to main) or removed by removing the text altogether (again by a simple PR to main).

Does that make sense to folks?

Thanks @melissawm for getting the ball rolling here!

Charlie-XIAO commented 5 months ago

+1 on this. I am also looking for this feature when switching to pydata-sphinx-theme for scikit-learn.

drammock commented 5 months ago

Is this an acceptable feature request? If so, I can submit a pull request with the suggestion above.

LGTM. In the PR, can you add a bit to the docs about this feature? Probably in this section: https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/announcements.html#insert-remote-html-with-javascript

melissawm commented 5 months ago

Will do, thanks!

jni commented 5 months ago

Incredible! ❤️ 🚀