--- title: 'Shortcodes' date: 2024-02-04T22:22:43+01:00 --- ## Custom shortcodes Hugo provides [built-in shortcodes](https://gohugo.io/content-management/shortcodes/#use-hugos-built-in-shortcodes), Hextra adds [some more](https://imfing.github.io/hextra/docs/guide/shortcodes/). However, I need to embed other media sources and want to migrate some of my own HTML[^1] and CSS[^2] structures. For this purpose there is an official guide on [creating own shortcodes](https://gohugo.io/templates/shortcode-templates/). ### iFrame To embed arbitrary media `layouts/shortcodes/iframe.html` is created containing the following code: ```html {filename="layouts/shortcodes/iframe.html"} {{ $src := .Get "src" -}} {{ $class := .Get "class" -}}