+++ date = 2021-05-15T15:00:00Z description = "A brief description of custom Shortcodes for Zola that implement modern html elements: video, image, gif, audio." draft = false title = "Rich Content" [extra] keywords = "Images, Videos, Audio, Gif, Rich Content, Shortcodes" series = "Features" toc = true [taxonomies] tags = [ "Features", "Video", "Audio", "Images", "Shortcodes", ] +++ Several custom shortcodes are included to augment CommonMark. `video`, `image`, `gif`, and `audio` were created to help you take advantage of modern HTML elements in your writing. ## Video - `sources` is an array of video file paths. (mandatory) - `class` sets a class for the video. - `caption` sets the caption text below the video. - `w` sets the width of the video. - `h` sets the height of the video. - `autoplay` when set, autoplays the video on load. - `loop` when set, plays the video on a loop. - `muted` when set, sets the audio muted initially. - `playsinline` when set, plays the video embeded instead of fullscreen on mobile browsers. *sources can be same path, relative path, or root path, like the [img shortcode](https://abridge.pages.dev/overview-images/#img-shortcode)* **Optional Classes:** - `ci` can be used to center the image. - `fr` can be used to float the image right. - `fl` can be used to float the image left. - `b1` can be used to add a 1px border. ### Usage ```rs {{/* video(sources=["over9000_av1.mp4", "over9000_vp9.webm"]) */}} ``` ### Output ```html {{ video(sources=["over9000_av1.mp4", "over9000_vp9.webm"]) }} ``` {{ video(sources=["over9000_av1.mp4", "over9000_vp9.webm"]) }} ### Usage ```rs {{/* video(sources=["over9000_av1.mp4", "over9000_vp9.webm"] muted="true" class="ci b1" caption="It's Over 9000!!") */}} ``` ### Output ```html {{ video(sources=["over9000_av1.mp4", "over9000_vp9.webm"] muted="true" class="ci b1" caption="It's Over 9000!!") }} ``` {{ video(sources=["over9000_av1.mp4", "over9000_vp9.webm"] muted="true" class="ci b1" caption="It's Over 9000!!") }} ## Image The `image` shortcode returns a `` tag with multiple sources. Each string in the `sources` array should be a path to an image file of a different type (`avif`, `webp`, `png`, `jpg`, etc). The last image in the `sources` array is used to create an `` tag for the browser to fall back on if the other formats are not yet supported. - `sources` is an array of image file paths. (mandatory) - `class` sets a class for the image. - `caption` sets the caption text below the image. - `w` sets the width of the image. - `h` sets the height of the image. *sources can be same path, relative path, or root path, like the [img shortcode](https://abridge.pages.dev/overview-images/#img-shortcode)* **Optional Classes:** - `ci` can be used to center the image. - `fr` can be used to float the image right. - `fl` can be used to float the image left. - `b1` can be used to add a 1px border. ### Usage ```rs {{/* image(sources=["over9000-960.avif", "over9000-640.avif", "over9000-400.avif", "over9000-640.webp"] w=640 h=480 alt="ITS OVER 9000!") */}} ``` ### Output ```html {{ image(sources=["over9000-960.avif", "over9000-640.avif", "over9000-400.avif", "over9000-640.webp"] w=640 h=480 alt="ITS OVER 9000!") }} ``` {{ image(sources=["over9000-960.avif", "over9000-640.avif", "over9000-400.avif", "over9000-640.webp"] w=640 h=480 alt="ITS OVER 9000!") }} ## GIF The `gif` shortcode is exactly the same as the [video shortcode](#video). The only difference is it automatically has the additional properties: `autoplay`, `loop`, `muted`, `playsinline`. Using the `