Home Q&A Thread

thoughts about announcement banner on bookdown

ajdamico ajdamico 7mo ago

Hi Yihui ! I hope everything's going well with you.

I continue to rely on your work for my own projects [1, 2, 3] and am super grateful for the software that you have built.

I've been organizing in-person workshops at various public libraries [4] and have largely relied on my own readership to find attendees but I'm struggling with how to add a text announcement banner to the top of bookdown-based websites. The best solution I've been able to implement has been to add badges for each new event announcement [5] but I see on gitbook's homepage that they're promoting a new functionality that would be perfect for me [6].

I am curious if you have suggestions about what I ought to try to display a similar site-wide text banner that users could click once and remove - or if you think this might be too knotty to work well with bookdown? I believe the tufte layer used by [2] and also displaying properly on mobile might be additional challenges.

I just wanted to inquire if you have any suggested approach - after failing at this more than once, my sense is that it's not easily done haha I think the badges look OK but just curious if you have other ideas to display announcements on bookdown sites?

Thanks for your time and I hope things are going well with SwissRe and Merck

Best wishes,

-Anthony

[1] http://ehbs.kff.org/
[2] http://convey-r.org/
[3] http://asdfree.com/
[4] http://eventbrite.com/o/anthony-damico-89959629023
[5] https://asdfree.com/national-health-interview-survey-nhis.html
[6] https://gitbook.com/docs/changelog/april-2025/1-april-new-and-improved-tables-announcement-banners-custom-fonts-and-more

2 Replies

yihui yihui 1mo ago

Hi Anthony,

Sorry for the late response (I was on vacation in China when you opened this thread last year and then you know...).

I think you can use the includes option to include a banner at either the beginning or end of a page, like how I added a comment section here: https://bookdown.org/yihui/bookdown/collaboration.html

To be able to close the banner, you'll need a button (e.g., on the right side) and a JS event to get rid of the banner (either remove it from the DOM or set its display style to none). If you are not familiar with JS, I think this task should be trivial for AI to complete.

ajdamico ajdamico 1mo ago

That's amazing! Thanks Yihui, I appreciate your time

Sign in to join the discussion

Sign in with GitHub