mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'
This commit is contained in:
@@ -1,31 +1,20 @@
|
||||
---
|
||||
title: QR
|
||||
title: QR shortcode
|
||||
linkTitle: QR
|
||||
description: Insert a QR code into your content using the qr shortcode.
|
||||
categories: [shortcodes]
|
||||
categories: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: shortcodes
|
||||
weight:
|
||||
weight:
|
||||
toc: true
|
||||
---
|
||||
|
||||
{{< 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.
|
||||
|
||||
[source code]: {{% eturl qr %}}
|
||||
{{% /note %}}
|
||||
> [!note]
|
||||
> To override Hugo's embedded `qr` shortcode, copy the [source code] to a file with the same name in the `layouts/shortcodes` directory.
|
||||
|
||||
The `qr` shortcode encodes the given text into a [QR code] using the specified options and renders the resulting image.
|
||||
|
||||
Internally this shortcode calls the `images.QR` function. Please read the [related documentation] for implementation details and guidance.
|
||||
|
||||
[QR code]: https://en.wikipedia.org/wiki/QR_code
|
||||
[related documentation]: /functions/images/qr/
|
||||
|
||||
## Examples
|
||||
|
||||
Use the self-closing syntax to pass the text as an argument:
|
||||
@@ -56,8 +45,6 @@ To create a QR code for a phone number:
|
||||
|
||||
To create a QR code containing contact information in the [vCard] format:
|
||||
|
||||
[vCard]: https://en.wikipedia.org/wiki/VCard
|
||||
|
||||
```text
|
||||
{{</* qr level="low" scale=2 alt="QR code of vCard for John Smith" */>}}
|
||||
BEGIN:VCARD
|
||||
@@ -84,7 +71,7 @@ EMAIL;TYPE=WORK:jsmith@example.org
|
||||
END:VCARD
|
||||
{{< /qr >}}
|
||||
|
||||
## Parameters
|
||||
## Arguments
|
||||
|
||||
text
|
||||
: (`string`) The text to encode, falling back to the text between the opening and closing shortcode tags.
|
||||
@@ -98,8 +85,6 @@ scale
|
||||
targetDir
|
||||
: (`string`) The subdirectory within the [`publishDir`] where Hugo will place the generated image.
|
||||
|
||||
[`publishDir`]: /getting-started/configuration/#publishdir
|
||||
|
||||
alt
|
||||
: (`string`) The `alt` attribute of the `img` element.
|
||||
|
||||
@@ -109,5 +94,14 @@ class
|
||||
id
|
||||
: (`string`) The `id` attribute of the `img` element.
|
||||
|
||||
loading
|
||||
: (`string`) The `loading` attribute of the `img` element, either `eager` or `lazy`.
|
||||
|
||||
title
|
||||
: (`string`) The `title` attribute of the `img` element.
|
||||
|
||||
[`publishDir`]: /configuration/all/#publishdir
|
||||
[QR code]: https://en.wikipedia.org/wiki/QR_code
|
||||
[related documentation]: /functions/images/qr/
|
||||
[source code]: {{% eturl qr %}}
|
||||
[vCard]: https://en.wikipedia.org/wiki/VCard
|
||||
|
Reference in New Issue
Block a user