Shortcodes

post-thumb

Embedding Rich Content: YouTube Videos

Adding videos to your articles is a great way to engage your readers and convey messages more effectively. Hugo makes it incredibly simple to embed external content like YouTube videos, thanks to built-in shortcodes.

The YouTube Shortcode

You don’t need to copy-paste the complex <iframe> code provided by YouTube. Instead, you can use the youtube shortcode. All you need is the video’s ID.

For example, here is a video about web design principles:

Continue...
post-thumb

Supercharge Your Content with Hugo Shortcodes

Beyond Hugo’s built-in shortcodes, this theme comes with custom shortcodes that add even more functionality to your site. Let’s explore a couple of them.

Optimized Images (optimized-image)

While you can use standard Markdown ![alt](src) for images, this theme provides an optimized-image shortcode that can automatically handle WebP conversion and responsive sizing, optimizing your site’s loading speed.

圖片不存在: images/demo-image.png

Here’s how to use it:

{{< optimized-image src="images/demo-image.png" alt="A Demo Image" >}}

This ensures your images are fast-loading and served in the best format for every device.

Continue...