Search code examples
rr-markdownhtmlwidgetsblogdown

Which Hugo themes support unaided htmlwidgets when using blogdown?


I'm trying to know which Hugo themes support htmlwidgets without further tinkering. I've consulted the latest blogdown documentation, the blogdown questions on StackOverflow and joined the RStudio webcast in the last week to answer my question, but without success.

The reason I ask is that, at first glance, Hugo themes seem richer than bootstrap-themed Rmarkdown websites. However, having tried two of the more sophisticated themes (i.e. Creative Portfolio and Tranquilpeak), I only seem to be able to get either a sophisticated Hugo theme or a functioning htmlwidget but not both. This matters because the trial and error associated with these efforts isn't small.

For reference, the blogdown documentation says:

If you theme uses the jQuery library, it is also likely that the theme’s jQuery library will conflict with the jQuery library used by a certain HTML widget.

I was therefore wondering: Have any of you successfully used an htmlwidget in a Hugo theme with blogdown? If so, which theme did you use? If you have tried and failed, an answer would still be useful, so that I can avoid that theme for now.

I realise that blogdown is still a work in progress, and am excited about where it is headed, but assumed that it would benefit many to get a sense of the themes that would currently work best with htmlwidgets.

As always, many thanks to you all for your generous assistance.


Solution

  • I have updated the section in the blogdown book you referred to. In short, there are two ways:

    1. Provide a way to suppress the theme's jQuery;

    2. Or use the widgetframe package (requires this pull request to be merged before it works with blogdown).