In this post, I explain how to easily embed one or more D3 visualizations directly into Hugo page content. Embedding D3 content Hugo posts with Shortcodes Using D3 on any page requires loading the D3 library and a script containing the D3 code you want to run. Both of those tasks require adding <script> tags to the page, so you’ll need some way to add a pair of script tags. Additionally, you probably don’t want the D3 code to mount its visualization directly to the page’s body, so you’ll need a target element somewhere in the DOM.