mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Merge commit 'a024bc7d76fcc5e49e8210f9b0896db9ef21861a'
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Shortcodes
|
||||
linkTitle: In this section
|
||||
|
||||
description: Insert elements such as videos, images, and social media embeds into your content using Hugo's embedded shortcodes.
|
||||
categories: []
|
||||
keywords: []
|
||||
|
@@ -9,7 +9,7 @@ menu:
|
||||
parent: shortcodes
|
||||
weight:
|
||||
weight:
|
||||
expiryDate: 2025-01-22 # with v0.142.0 and later use HTML comments instead
|
||||
expiryDate: 2025-01-22 # deprecated 2025-02-01 in v0.143.0 and immediately removed from the documentation
|
||||
---
|
||||
|
||||
{{% note %}}
|
||||
@@ -18,7 +18,7 @@ To override Hugo's embedded `comment` shortcode, copy the [source code] to a fil
|
||||
[source code]: {{% eturl comment %}}
|
||||
{{% /note %}}
|
||||
|
||||
{{< new-in "0.137.1" >}}
|
||||
{{< new-in 0.137.1 />}}
|
||||
|
||||
Use the `comment` shortcode to include comments in your content. Hugo will ignore the text within these comments when rendering your site.
|
||||
|
||||
|
@@ -11,7 +11,7 @@ weight:
|
||||
toc: true
|
||||
---
|
||||
|
||||
{{< new-in 0.140.0 >}}
|
||||
{{< new-in 0.140.0 />}}
|
||||
|
||||
{{% note %}}
|
||||
To override Hugo's embedded `details` shortcode, copy the [source code] to a file with the same name in the `layouts/shortcodes` directory.
|
||||
|
@@ -8,13 +8,19 @@ menu:
|
||||
parent: shortcodes
|
||||
weight:
|
||||
weight:
|
||||
expiryDate: 2027-02-01 # deprecated 2025-02-01 in v0.143.0
|
||||
---
|
||||
|
||||
{{% note %}}
|
||||
To override Hugo's embedded `gist` shortcode, copy the [source code] to a file with the same name in the `layouts/shortcodes` directory.
|
||||
{{% deprecated-in 0.143.0 %}}
|
||||
The `gist` shortcode was deprecated in version 0.143.0 and will be removed in a future release. To continue embedding GitHub Gists in your content, you'll need to create a custom shortcode:
|
||||
|
||||
[source code]: {{% eturl gist %}}
|
||||
{{% /note %}}
|
||||
1. Create a new file: Create a file named `gist.html` within the `layouts/shortcodes` directory.
|
||||
2. Copy the source code: Paste the [original source code] of the gist shortcode into the newly created `gist.html` file.
|
||||
|
||||
This will allow you to maintain the functionality of embedding GitHub Gists in your content after the deprecation of the original shortcode.
|
||||
|
||||
[original source code]: {{% eturl gist %}}
|
||||
{{% /deprecated-in %}}
|
||||
|
||||
To display a GitHub gist with this URL:
|
||||
|
||||
@@ -28,14 +34,8 @@ Include this in your Markdown:
|
||||
{{</* gist user 23932424365401ffa5e9d9810102a477 */>}}
|
||||
```
|
||||
|
||||
This will display all files in the gist alphabetically by file name.
|
||||
|
||||
{{< gist jmooring 23932424365401ffa5e9d9810102a477 >}}
|
||||
|
||||
To display a specific file within the gist:
|
||||
|
||||
```text
|
||||
{{</* gist user 23932424365401ffa5e9d9810102a477 list.html */>}}
|
||||
```
|
||||
|
||||
{{< gist jmooring 23932424365401ffa5e9d9810102a477 list.html >}}
|
||||
|
@@ -27,7 +27,7 @@ params:
|
||||
size: medium
|
||||
---
|
||||
|
||||
We found a {{</* param "color" */>}} shirt.
|
||||
We found a {{%/* param "color" */%}} shirt.
|
||||
{{< /code >}}
|
||||
|
||||
Hugo renders this to:
|
||||
@@ -39,5 +39,5 @@ Hugo renders this to:
|
||||
Access nested values by [chaining](g) the [identifiers](g):
|
||||
|
||||
```text
|
||||
{{</* param my.nested.param */>}}
|
||||
{{%/* param my.nested.param */%}}
|
||||
```
|
||||
|
@@ -11,7 +11,7 @@ weight:
|
||||
toc: true
|
||||
---
|
||||
|
||||
{{< new-in 0.141.0 >}}
|
||||
{{< new-in 0.141.0 />}}
|
||||
|
||||
{{% note %}}
|
||||
To override Hugo's embedded `qr` shortcode, copy the [source code] to a file with the same name in the `layouts/shortcodes` directory.
|
||||
@@ -44,7 +44,7 @@ https://gohugo.io
|
||||
|
||||
Both of the above produce this image:
|
||||
|
||||
{{< qr text="https://gohugo.io" class="qrcode" />}}
|
||||
{{< qr text="https://gohugo.io" class="qrcode" targetDir="images/qr" />}}
|
||||
|
||||
To create a QR code for a phone number:
|
||||
|
||||
@@ -52,7 +52,7 @@ To create a QR code for a phone number:
|
||||
{{</* qr text="tel:+12065550101" /*/>}}
|
||||
```
|
||||
|
||||
{{< qr text="tel:+12065550101" class="qrcode" />}}
|
||||
{{< qr text="tel:+12065550101" class="qrcode" targetDir="images/qr" />}}
|
||||
|
||||
To create a QR code containing contact information in the [vCard] format:
|
||||
|
||||
@@ -72,7 +72,7 @@ END:VCARD
|
||||
{{</* /qr */>}}
|
||||
```
|
||||
|
||||
{{< qr level="low" scale=2 alt="QR code of vCard for John Smith" class="qrcode" >}}
|
||||
{{< qr level="low" scale=2 alt="QR code of vCard for John Smith" class="qrcode" targetDir="images/qr" >}}
|
||||
BEGIN:VCARD
|
||||
VERSION:2.1
|
||||
N;CHARSET=UTF-8:Smith;John;R.;Dr.;PhD
|
||||
|
@@ -46,7 +46,7 @@ id
|
||||
title
|
||||
: (`string`) The `title` attribute of the `iframe` element.
|
||||
|
||||
If you proivde a `class` or `title` you must use a named parameter for the `id`.
|
||||
If you provide a `class` or `title` you must use a named parameter for the `id`.
|
||||
|
||||
```text
|
||||
{{</* vimeo id=55073825 class="foo bar" title="My Video" */>}}
|
||||
|
@@ -11,7 +11,7 @@ weight:
|
||||
toc: true
|
||||
---
|
||||
|
||||
{{< new-in 0.141.0 >}}
|
||||
{{< new-in 0.141.0 />}}
|
||||
|
||||
{{% note %}}
|
||||
To override Hugo's embedded `x` shortcode, copy the [source code] to a file with the same name in the `layouts/shortcodes` directory.
|
||||
|
@@ -41,38 +41,38 @@ id
|
||||
: (`string`) The video `id`. Optional if the `id` is provided as a positional argument as shown in the example above.
|
||||
|
||||
allowFullScreen
|
||||
{{< new-in 0.125.0 >}}
|
||||
{{< new-in 0.125.0 />}}
|
||||
: (`bool`) Whether the `iframe` element can activate full screen mode. Default is `true`.
|
||||
|
||||
autoplay
|
||||
{{< new-in 0.125.0 >}}
|
||||
{{< new-in 0.125.0 />}}
|
||||
: (`bool`) Whether to automatically play the video. Forces `mute` to `true`. Default is `false`.
|
||||
|
||||
class
|
||||
: (`string`) The `class` attribute of the wrapping `div` element. When specified, removes the `style` attributes from the `iframe` element and its wrapping `div` element.
|
||||
|
||||
controls
|
||||
{{< new-in 0.125.0 >}}
|
||||
{{< new-in 0.125.0 />}}
|
||||
: (`bool`) Whether to display the video controls. Default is `true`.
|
||||
|
||||
end
|
||||
{{< new-in 0.125.0 >}}
|
||||
{{< new-in 0.125.0 />}}
|
||||
: (`int`) The time, measured in seconds from the start of the video, when the player should stop playing the video.
|
||||
|
||||
loading
|
||||
{{< new-in 0.125.0 >}}
|
||||
{{< new-in 0.125.0 />}}
|
||||
: (`string`) The loading attribute of the `iframe` element, either `eager` or `lazy`. Default is `eager`.
|
||||
|
||||
loop
|
||||
{{< new-in 0.125.0 >}}
|
||||
{{< new-in 0.125.0 />}}
|
||||
: (`bool`) Whether to indefinitely repeat the video. Ignores the `start` and `end` arguments after the first play. Default is `false`.
|
||||
|
||||
mute
|
||||
{{< new-in 0.125.0 >}}
|
||||
{{< new-in 0.125.0 />}}
|
||||
: (`bool`) Whether to mute the video. Always `true` when `autoplay` is `true`. Default is `false`.
|
||||
|
||||
start
|
||||
{{< new-in 0.125.0 >}}
|
||||
{{< new-in 0.125.0 />}}
|
||||
: (`int`) The time, measured in seconds from the start of the video, when the player should start playing the video.
|
||||
|
||||
title
|
||||
|
Reference in New Issue
Block a user