content: Publish QR code examples to the images/qr directory

This commit is contained in:
Joe Mooring 2025-02-12 09:43:02 -08:00 committed by GitHub
parent ef1ce3498b
commit 0874b03e94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 9 deletions

View File

@ -54,7 +54,7 @@ To create a QR code using the default values for `level` and `scale`:
{{ end }} {{ end }}
``` ```
{{< qr text="https://gohugo.io" class="qrcode" />}} {{< qr text="https://gohugo.io" class="qrcode" targetDir="images/qr" />}}
Specify `level`, `scale`, and `targetDir` as needed to achieve the desired result: Specify `level`, `scale`, and `targetDir` as needed to achieve the desired result:
@ -63,14 +63,14 @@ Specify `level`, `scale`, and `targetDir` as needed to achieve the desired resul
{{ $opts := dict {{ $opts := dict
"level" "high" "level" "high"
"scale" 3 "scale" 3
"targetDir" "codes" "targetDir" "images/qr"
}} }}
{{ with images.QR $text $opts }} {{ with images.QR $text $opts }}
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt=""> <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
{{ end }} {{ end }}
``` ```
{{< qr text="https://gohugo.io" level="high" scale=3 targetDir="codes" class="qrcode" />}} {{< qr text="https://gohugo.io" level="high" scale=3 targetDir="codes" class="qrcode" targetDir="images/qr" />}}
To include a QR code that points to the `Permalink` of the current page: To include a QR code that points to the `Permalink` of the current page:
@ -103,9 +103,6 @@ Then hide the QR code with CSS unless printing the page:
} }
``` ```
## Scale ## Scale
As you decrease the size of a QR code, the maximum distance at which it can be reliably scanned by a device also decreases. As you decrease the size of a QR code, the maximum distance at which it can be reliably scanned by a device also decreases.

View File

@ -44,7 +44,7 @@ https://gohugo.io
Both of the above produce this image: 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: 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" /*/>}}
``` ```
{{< 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: To create a QR code containing contact information in the [vCard] format:
@ -72,7 +72,7 @@ END:VCARD
{{</* /qr */>}} {{</* /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 BEGIN:VCARD
VERSION:2.1 VERSION:2.1
N;CHARSET=UTF-8:Smith;John;R.;Dr.;PhD N;CHARSET=UTF-8:Smith;John;R.;Dr.;PhD