Skip to main content

Media and Content Embeddings

Published:

Series: Shortcodes

  1. 1. Writing
  2. 2. Media and Content Embeddings
  3. 3. Math
  4. 4. Chart
  5. 5. Mermaid

Article Card

The article shortcode generates a visual preview card for a specified internal page.

ParameterDescription
linkRequired. The relative permalink of the target internal page.
showSummaryOptional. Whether the page summary is displayed. Default: true

Example: Internal page link

{{< article link="/docs/getting-started/" showSummary="true" >}}

Col

col shortcode allows you to create flexible multi-column layouts with custom widths and optional responsive behaviors. Note that it uses markdown notation ({{% %}}).

ParameterDescription
widthsOptional. Comma-separated list of column widths (e.g., 30%,70%). If not specified, columns are evenly distributed.
rwdOptional. Responsive web design (rwd) controls responsive behavior. When true, columns stack vertically on small screens and display horizontally on larger screens. Default: true
{{% cols widths="70%,30%" rwd=false %}}

![qwe](img/01.jpg)

+++

Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit.

{{% /cols %}}
qwe

Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit.

See more examples in rich-content.

Code Importer

The codeimporter shortcode fetches source code from a remote URL and renders it as a highlighted code block.

ParameterDescription
urlRequired. The absolute URL of the remote source file.
typeOptional. The programming language for syntax highlighting.
startLineOptional. The starting line number. Default: 1
endLineOptional. The ending line number. Default: -1

Example: Fetching specific lines from GitHub

{{< codeimporter url="https://raw.githubusercontent.com/githubtraining/hellogitworld/refs/heads/master/src/main/java/com/github/App.java" type="java" startLine="3" endLine="7" >}}
/**
 * Hello again
 * Hello world!
 * Hello
 */

Gist

The gist shortcode embeds a GitHub Gist into the page.

ParameterDescription
0Required. GitHub username.
1Required. Gist ID.
2Optional. Specific filename.

Example: Embedding a specific file

{{< gist mudge 3064 "count_benchmark.rb" >}}

GitHub

The github shortcode creates a dynamic preview card for a GitHub repository.

ParameterDescription
repoRequired. Format owner/repo.
showThumbnailOptional. Display Open Graph image. Default: true

Example: Repository preview with thumbnail

{{< github repo="gohugoio/hugo" >}}

Md Importer

The mdimporter shortcode fetches and renders remote Markdown content.

ParameterDescription
urlRequired. The absolute URL of the Markdown file.

Example: Remote documentation import

{{< mdimporter url="https://github.com/githubtraining/hellogitworld/raw/refs/heads/master/README.txt" >}}

Result:

This is a sample project students can use during Matthew's Git class.

Here is an addition by me

We can have a bit of fun with this repo, knowing that we can always reset it to a known good state. We can apply labels, and branch, then add new code and merge it in to the master branch.

As a quick reminder, this came from one of three locations in either SSH, Git, or HTTPS format:

We can, as an example effort, even modify this README and change it as if it were source code for the purposes of the class.

This demo also includes an image with changes on a branch for examination of image diff on GitHub.

Video

The video shortcode embeds a HTML5 video player.

ParameterDescription
srcRequired. Video URL or local path. Local lookup order: page resource → assets/static/.
posterOptional. Poster image URL or local path. If omitted, the shortcode attempts a same-name image in the page bundle.
captionOptional. Markdown caption shown below the video.
autoplayOptional. Enables autoplay when true. Default: false
loopOptional. Loops when true. Default: false
mutedOptional. Mutes when true. Default: false
controlsOptional. Shows the browser’s default playback controls when true. Default: true
playsinlineOptional. Inline playback on mobile when true. Default: true
preloadOptional. metadata (load info), none (save bandwidth), or auto (preload more). Default: metadata
startOptional. Start time in seconds.
endOptional. End time in seconds.
ratioOptional. Reserved aspect ratio for the player. Supports 16/9, 4/3, 1/1, or custom W/H. Default: 16/9
fitOptional. How the video fits the ratio: contain (no crop), cover (crop to fill), fill (stretch). Default: contain

Example: Autoplay muted video

{{< video
    src="https://upload.wikimedia.org/wikipedia/commons/5/5a/CC0_-_Public_Domain_Dedication_video_bumper.webm"
    poster="https://upload.wikimedia.org/wikipedia/commons/e/e0/CC0.jpg"
    caption="**Public domain demo** — CC0 video and poster."
    loop=true
    muted=true
>}}
Public domain demo — CC0 video and poster.

YouTube

The youtubeLite shortcode embeds an optimized YouTube video player.

ParameterDescription
idOptional. YouTube video ID. Default: SgXhGb-7QbU
paramsOptional. URL parameters.

Example: Specific video with start time

{{< youtubeLite id="SgXhGb-7QbU" params="start=30" >}}

TypeIt

The typeit shortcode creates dynamic typewriter animations.

ParameterDescription
initialStringOptional. Text shown before animation.
speedOptional. Typing speed in ms. Default: 100
loopOptional. Whether to restart. Default: false
tagOptional. HTML tag for wrapping. Default: div

Example: Looping animation with custom speed

{{< typeit speed="50" loop="true" tag="h2" >}}
Yore - A Simple Yet Powerful Hugo Theme
{{< /typeit >}}

Series: Shortcodes

  1. 1. Writing
  2. 2. Media and Content Embeddings
  3. 3. Math
  4. 4. Chart
  5. 5. Mermaid