Embed Imgur Images into Hugo blog posts Automagically.
Using this imgur shortcode, this markdown post is rendered like this.
Shortcodes provide a way to maintain the simplicity of your Hugo blog posts in Markdown, while allowing you to insert ugly-but-necessary HTML snippets into your pages. While there are many shortcodes already available in Hugo by default, there are none to embed Imgur posts.
- Copy the
imgur.htmlfile into your/layouts/shortcodesfolder (create this, if you don't already have it). - In your Markdown post, simply insert
{{< imgur id=" ... " >}}. - In your favourite browser, navigate to the Imgur post you want to embed, and find its ID (the code at the end of the URL). As you can see in the demo, for https://imgur.com/a/vRbDiHJ, this ID is
vRbDiHJ. - Replace
...in step 2 with this ID.
Please submit an Issue via GitHub if you encounter any errors using this shortcode. Additionally, you may fork the project and submit a Pull Request too.
This project is protected by the MIT License.