mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-25 15:58:53 +00:00
Compare commits
138 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a798e3e724 | |||
| fbcf0d52a1 | |||
| a2b2a5a978 | |||
| ec178ea463 | |||
| 2d80b8a741 | |||
| 5ea3e13db6 | |||
| b1c1bd019f | |||
| 866b8e5aa6 | |||
| 409669fa48 | |||
| f66d094446 | |||
| e9b9b36f46 | |||
| b8a2c10d06 | |||
| 601df38834 | |||
| 3bed212a2f | |||
| e2fd6764be | |||
| 8f3527f61c | |||
| 09048aad76 | |||
| f42c422a12 | |||
| 0b71db299a | |||
| 5c7fad23a3 | |||
| 700bb78198 | |||
| d3b5d47a43 | |||
| 86cd1838ff | |||
| 871da3370a | |||
| 2637aa1540 | |||
| bf1d20d735 | |||
| 1deec99bba | |||
| b7bb557c6a | |||
| 7c19c196c3 | |||
| 555443b64a | |||
| 1f2de189ed | |||
| c6ae33c61d | |||
| edeebf0d33 | |||
| ea9675f6e7 | |||
| b1f7e35a98 | |||
| a0d4e1fb26 | |||
| 96777d9b89 | |||
| 25126e5f87 | |||
| 179034abbb | |||
| 96ac146eef | |||
| d4c0e4452c | |||
| 418156ec3e | |||
| 798533a201 | |||
| a8c5d0d00d | |||
| a94a941fe3 | |||
| 385d1a1342 | |||
| d30bd50467 | |||
| 8e6cac8462 | |||
| 4085ee9340 | |||
| 168bf17e70 | |||
| 80ea90c880 | |||
| f740d7cfe0 | |||
| 5f46da6e2a | |||
| fe64a68225 | |||
| b4128babb8 | |||
| 790a5b7014 | |||
| 70ce2446b5 | |||
| 08e1ea5c70 | |||
| 65d43e1d0d | |||
| 65a76664e3 | |||
| da5b1fcf8f | |||
| 39649dce49 | |||
| 614fb16ec6 | |||
| 0637adb239 | |||
| 0bf61353f6 | |||
| b82e496c13 | |||
| 33542d3966 | |||
| 588d20b315 | |||
| b33730293d | |||
| e6a3f1d62b | |||
| 573ecb530f | |||
| 9937a5dcaa | |||
| 1b4514e020 | |||
| 429e57201d | |||
| fa7d37f0c8 | |||
| fae49a22f1 | |||
| 364d237b51 | |||
| 079f3eb8d1 | |||
| 4e6f2b6791 | |||
| dff5e168a9 | |||
| c82a035bf1 | |||
| 86b01eda10 | |||
| e2e64aeec5 | |||
| 9e7182e9e6 | |||
| cf3ad62c3b | |||
| c1cc65fcb9 | |||
| 663075920a | |||
| 596517a259 | |||
| bf42138661 | |||
| 57fecb6b71 | |||
| 6d0ab6a34e | |||
| 6be463b586 | |||
| 9e24b5645d | |||
| 45b67f6c18 | |||
| 5e649eb4d0 | |||
| 0de8f8607b | |||
| 3073fd5ccf | |||
| b9b304a126 | |||
| 8be30ef2cb | |||
| 565a10cbf0 | |||
| 438f113f83 | |||
| dab54058ea | |||
| 1a1b062a01 | |||
| 7a43b928a6 | |||
| 555dfa207a | |||
| 3d21b0687b | |||
| 34b0c15a54 | |||
| 9dc38e917c | |||
| b592d34efe | |||
| 18a2afa519 | |||
| 0b0c827d5b | |||
| 30dc75e620 | |||
| 6bc8e6f491 | |||
| cda4d75187 | |||
| 84950ed2b2 | |||
| 2b337cd212 | |||
| cc61d00df9 | |||
| 8ef2c61985 | |||
| a8ed613742 | |||
| b91688034f | |||
| b971b7f911 | |||
| 24210dcad9 | |||
| b037b9300c | |||
| 268046732e | |||
| 8ce80f755d | |||
| 4baa95ba65 | |||
| 0f94274a28 | |||
| 5f9c3a3e4c | |||
| 51d77a6ca8 | |||
| d25b619ce2 | |||
| b81861fd21 | |||
| 15cce89e0e | |||
| 187e683bb2 | |||
| 432078a6af | |||
| 4a76d8c611 | |||
| d837eff08f | |||
| 323e306bd7 | |||
| 2047638a2c |
@@ -4,7 +4,7 @@ parameters:
|
||||
defaults: &defaults
|
||||
resource_class: large
|
||||
docker:
|
||||
- image: bepsays/ci-hugoreleaser:1.22500.20300
|
||||
- image: bepsays/ci-hugoreleaser:1.22500.20400
|
||||
environment: &buildenv
|
||||
GOMODCACHE: /root/project/gomodcache
|
||||
version: 2
|
||||
@@ -58,7 +58,7 @@ jobs:
|
||||
environment:
|
||||
<<: [*buildenv]
|
||||
docker:
|
||||
- image: bepsays/ci-hugoreleaser-linux-arm64:1.22500.20300
|
||||
- image: bepsays/ci-hugoreleaser-linux-arm64:1.22500.20400
|
||||
steps:
|
||||
- *restore-cache
|
||||
- &attach-workspace
|
||||
|
||||
+4
-4
@@ -2,12 +2,12 @@ have_fun: false
|
||||
memory_config:
|
||||
disabled: false
|
||||
code_review:
|
||||
disable: true
|
||||
disable: false
|
||||
comment_severity_threshold: HIGH
|
||||
max_review_comments: -1
|
||||
pull_request_opened:
|
||||
help: false
|
||||
summary: true
|
||||
code_review: true
|
||||
help: true
|
||||
summary: false
|
||||
code_review: false
|
||||
include_drafts: false
|
||||
ignore_patterns: []
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
You are an expert at detecting AI-generated content. Your main tasks is to analyze pull requests and determine if they were likely generated by AI and if this is disclosed in the pull request description.
|
||||
|
||||
Important: You must start your response with a confidence score line in exactly this format:
|
||||
Confidence Score: X% where X is a number between 0 and 100.
|
||||
|
||||
Then provide your analysis in this format:
|
||||
Reasoning: (explain your analysis)
|
||||
Key Indicators: (list specific elements that suggest AI or human authorship)
|
||||
|
||||
A high confidence score (>80%) means you are very confident the content was AI-generated.
|
||||
A low confidence score (<20%) means you are very confident the content was human-generated.
|
||||
Use scores between 20-80% when there is uncertainty.
|
||||
|
||||
If there's a high confidence score:
|
||||
|
||||
* Add the label "Suspect AI" to the PR
|
||||
* If it's not disclosed that it's AI generated, add a link to [AI Assistance Notice](../CONTRIBUTING.md#ai-assistance-notice) in the contribution gudelines.
|
||||
@@ -0,0 +1,10 @@
|
||||
🛑 Before submitting this PR
|
||||
|
||||
All PRs must be linked to an Issue in this repository, and that Issue must be approved by a project maintainer:
|
||||
|
||||
- For a bug, approval means that the "needs triage" label is removed.
|
||||
- For a proposal, approval means that the "proposal" label is replaced by an "enhancement" label.
|
||||
|
||||
PRs without a linked, approved Issue will be closed immediately.
|
||||
|
||||
Please review the contribution guide (CONTRIBUTING.md) to understand commit message guidelines and AI assistance disclosures.
|
||||
@@ -2,16 +2,21 @@ name: AI Detection
|
||||
on:
|
||||
# Use pull_request_target instead of pull_request (we need the secrets.OPENAI_API_KEY to be available for forks)
|
||||
pull_request_target:
|
||||
types: [opened, reopened, ready_for_review, synchronize]
|
||||
types: [opened, ready_for_review]
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
jobs:
|
||||
detect-ai:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ !github.event.pull_request.draft }}
|
||||
steps:
|
||||
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
|
||||
- name: AI Watchdog
|
||||
uses: Citric-Sheep/ai-watchdog@0db4a635d309db0f8d82642130dfc33e91cf33fa # v0.2.3
|
||||
uses: bep/ai-watchdog@995475dd81767f8035dc2c943e9230918d06caca # temporary fork (probably)
|
||||
with:
|
||||
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
|
||||
pr-label: AI Suspect
|
||||
fail-when-confident: false
|
||||
# CSV list.
|
||||
pr-user-logins-skip: dependabot[bot],bep,jmooring
|
||||
|
||||
@@ -24,9 +24,7 @@ jobs:
|
||||
name: Free Disk Space (Ubuntu)
|
||||
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
|
||||
with:
|
||||
# this might remove tools that are actually needed,
|
||||
# if set to "true" but frees about 6 GB
|
||||
tool-cache: false
|
||||
tool-cache: true
|
||||
android: true
|
||||
dotnet: true
|
||||
haskell: true
|
||||
@@ -48,19 +46,12 @@ jobs:
|
||||
uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # v1.268.0
|
||||
with:
|
||||
ruby-version: "3.4.5"
|
||||
- name: Install gems
|
||||
- name: Install Ruby gems
|
||||
run: |
|
||||
gem install asciidoctor -v "2.0.26"
|
||||
gem install asciidoctor-diagram -v "3.1.0"
|
||||
gem install asciidoctor-diagram-ditaamini -v "1.0.3"
|
||||
- name: Install GoAT
|
||||
run: go install github.com/blampe/goat/cmd/goat@177de93b192b8ffae608e5d9ec421cc99bf68402
|
||||
- name: Install Java # required by asciidoctor-diagram-ditaamini
|
||||
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: "25"
|
||||
java-package: jre
|
||||
- name: Install Python
|
||||
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
|
||||
with:
|
||||
|
||||
@@ -65,8 +65,6 @@ See the [features] section of the documentation for a comprehensive summary of H
|
||||
|
||||
<p> </p>
|
||||
<p float="left">
|
||||
<a href="https://www.linode.com/?utm_campaign=hugosponsor&utm_medium=banner&utm_source=hugogithub" target="_blank"><img src="https://raw.githubusercontent.com/gohugoio/hugoDocs/master/assets/images/sponsors/linode-logo_standard_light_medium.png" width="200" alt="Linode"></a>
|
||||
|
||||
<a href="https://www.jetbrains.com/go/?utm_source=OSS&utm_medium=referral&utm_campaign=hugo" target="_blank"><img src="https://raw.githubusercontent.com/gohugoio/hugoDocs/master/assets/images/sponsors/goland.svg" width="200" alt="The complete IDE crafted for professional Go developers."></a>
|
||||
|
||||
<a href="https://cloudcannon.com/hugo-cms/?utm_campaign=HugoSponsorship&utm_source=sponsor&utm_content=gohugo" target="_blank"><img src="https://raw.githubusercontent.com/gohugoio/hugoDocs/master/assets/images/sponsors/cloudcannon-cms-logo.svg" width="200" alt="CloudCannon"></a>
|
||||
@@ -74,21 +72,17 @@ See the [features] section of the documentation for a comprehensive summary of H
|
||||
|
||||
## Editions
|
||||
|
||||
Hugo is available in three editions: standard, extended, and extended/deploy. While the standard edition provides core functionality, the extended and extended/deploy editions offer advanced features.
|
||||
Hugo offers a standard edition with core features, plus extended and extended/deploy editions with more. Use the standard edition unless you need the features below.
|
||||
|
||||
Feature|extended edition|extended/deploy edition
|
||||
:--|:-:|:-:
|
||||
Encode to the WebP format when [processing images]. You can decode WebP images with any edition.|:heavy_check_mark:|:heavy_check_mark:
|
||||
[Transpile Sass to CSS] using the embedded LibSass transpiler. You can use the [Dart Sass] transpiler with any edition.|:heavy_check_mark:|:heavy_check_mark:
|
||||
[Transpile Sass to CSS] via embedded LibSass. Note that embedded LibSass was deprecated in v0.153.0 and will be removed in a future release. Use the [Dart Sass] transpiler instead, which is compatible with any edition.|:heavy_check_mark:|:heavy_check_mark:
|
||||
Deploy your site directly to a Google Cloud Storage bucket, an AWS S3 bucket, or an Azure Storage container. See [details].|:x:|:heavy_check_mark:
|
||||
|
||||
[dart sass]: https://gohugo.io/functions/css/sass/#dart-sass
|
||||
[processing images]: https://gohugo.io/content-management/image-processing/
|
||||
[transpile sass to css]: https://gohugo.io/functions/css/sass/
|
||||
[details]: https://gohugo.io/hosting-and-deployment/hugo-deploy/
|
||||
|
||||
Unless your specific deployment needs require the extended/deploy edition, we recommend the extended edition.
|
||||
|
||||
## Installation
|
||||
|
||||
Install Hugo from a [prebuilt binary], package manager, or package repository. Please see the installation instructions for your operating system:
|
||||
@@ -162,6 +156,16 @@ If there is sufficient interest, [create a proposal]. Do not submit a pull reque
|
||||
|
||||
For a complete guide to contributing to Hugo, see the [Contribution Guide](CONTRIBUTING.md).
|
||||
|
||||
## License
|
||||
|
||||
For the Hugo source code, see [LICENSE](/LICENSE).
|
||||
|
||||
We also bundle some libraries in binary/WASM form:
|
||||
|
||||
* [libwebp](https://github.com/webmproject/libwebp), [BSD-3-Clause license](https://github.com/webmproject/libwebp?tab=BSD-3-Clause-1-ov-file#readme)
|
||||
* [Katex](https://github.com/KaTeX/KaTeX), [MIT license](https://github.com/KaTeX/KaTeX?tab=MIT-1-ov-file#readme)
|
||||
* [QuickJS](https://github.com/bellard/quickjs?tab=License-1-ov-file#readme), [License](https://github.com/bellard/quickjs?tab=License-1-ov-file#readme)
|
||||
|
||||
## Dependencies
|
||||
|
||||
Hugo stands on the shoulders of great open source libraries. Run `hugo env --logLevel info` to display a list of dependencies.
|
||||
@@ -171,51 +175,55 @@ Hugo stands on the shoulders of great open source libraries. Run `hugo env --log
|
||||
|
||||
```text
|
||||
github.com/BurntSushi/locker="v0.0.0-20171006230638-a6e239ea1c69"
|
||||
github.com/PuerkitoBio/goquery="v1.10.1"
|
||||
github.com/alecthomas/chroma/v2="v2.15.0"
|
||||
github.com/andybalholm/cascadia="v1.3.3"
|
||||
github.com/armon/go-radix="v1.0.1-0.20221118154546-54df44f2176c"
|
||||
github.com/JohannesKaufmann/dom="v0.2.0"
|
||||
github.com/JohannesKaufmann/html-to-markdown/v2="v2.5.0"
|
||||
github.com/alecthomas/chroma/v2="v2.21.1"
|
||||
github.com/aymerick/douceur="v0.2.0"
|
||||
github.com/bep/clocks="v0.5.0"
|
||||
github.com/bep/debounce="v1.2.0"
|
||||
github.com/bep/gitmap="v1.6.0"
|
||||
github.com/bep/gitmap="v1.9.0"
|
||||
github.com/bep/goat="v0.5.0"
|
||||
github.com/bep/godartsass/v2="v2.3.2"
|
||||
github.com/bep/godartsass/v2="v2.5.0"
|
||||
github.com/bep/golibsass="v1.2.0"
|
||||
github.com/bep/gowebp="v0.3.0"
|
||||
github.com/bep/imagemeta="v0.8.4"
|
||||
github.com/bep/lazycache="v0.7.0"
|
||||
github.com/bep/goportabletext="v0.1.0"
|
||||
github.com/bep/helpers="v0.6.0"
|
||||
github.com/bep/imagemeta="v0.12.0"
|
||||
github.com/bep/lazycache="v0.8.0"
|
||||
github.com/bep/logg="v0.4.0"
|
||||
github.com/bep/mclib="v1.20400.20402"
|
||||
github.com/bep/overlayfs="v0.9.2"
|
||||
github.com/bep/simplecobra="v0.5.0"
|
||||
github.com/bep/overlayfs="v0.10.0"
|
||||
github.com/bep/simplecobra="v0.6.1"
|
||||
github.com/bep/textandbinarywriter="v0.0.0-20251212174530-cd9f0732f60f"
|
||||
github.com/bep/tmc="v0.5.1"
|
||||
github.com/bits-and-blooms/bitset="v1.24.4"
|
||||
github.com/cespare/xxhash/v2="v2.3.0"
|
||||
github.com/clbanning/mxj/v2="v2.7.0"
|
||||
github.com/cpuguy83/go-md2man/v2="v2.0.4"
|
||||
github.com/clipperhouse/displaywidth="v0.6.0"
|
||||
github.com/clipperhouse/stringish="v0.1.1"
|
||||
github.com/clipperhouse/uax29/v2="v2.3.0"
|
||||
github.com/cpuguy83/go-md2man/v2="v2.0.6"
|
||||
github.com/disintegration/gift="v1.2.1"
|
||||
github.com/dlclark/regexp2="v1.11.5"
|
||||
github.com/dop251/goja="v0.0.0-20250125213203-5ef83b82af17"
|
||||
github.com/evanw/esbuild="v0.24.2"
|
||||
github.com/evanw/esbuild="v0.27.2"
|
||||
github.com/fatih/color="v1.18.0"
|
||||
github.com/frankban/quicktest="v1.14.6"
|
||||
github.com/fsnotify/fsnotify="v1.8.0"
|
||||
github.com/getkin/kin-openapi="v0.129.0"
|
||||
github.com/ghodss/yaml="v1.0.0"
|
||||
github.com/fsnotify/fsnotify="v1.9.0"
|
||||
github.com/getkin/kin-openapi="v0.133.0"
|
||||
github.com/go-openapi/jsonpointer="v0.21.0"
|
||||
github.com/go-openapi/swag="v0.23.0"
|
||||
github.com/go-sourcemap/sourcemap="v2.1.4+incompatible"
|
||||
github.com/gobuffalo/flect="v1.0.3"
|
||||
github.com/gobwas/glob="v0.2.3"
|
||||
github.com/gohugoio/go-i18n/v2="v2.1.3-0.20230805085216-e63c13218d0e"
|
||||
github.com/gohugoio/hashstructure="v0.5.0"
|
||||
github.com/gohugoio/httpcache="v0.7.0"
|
||||
github.com/gohugoio/hugo-goldmark-extensions/extras="v0.2.0"
|
||||
github.com/gohugoio/hugo-goldmark-extensions/passthrough="v0.3.0"
|
||||
github.com/goccy/go-yaml="v1.19.1"
|
||||
github.com/gohugoio/go-i18n/v2="v2.1.3-0.20251018145728-cfcc22d823c6"
|
||||
github.com/gohugoio/go-radix="v1.2.0"
|
||||
github.com/gohugoio/hashstructure="v0.6.0"
|
||||
github.com/gohugoio/httpcache="v0.8.0"
|
||||
github.com/gohugoio/hugo-goldmark-extensions/extras="v0.5.0"
|
||||
github.com/gohugoio/hugo-goldmark-extensions/passthrough="v0.3.1"
|
||||
github.com/gohugoio/locales="v0.14.0"
|
||||
github.com/gohugoio/localescompressed="v1.0.1"
|
||||
github.com/golang/freetype="v0.0.0-20170609003504-e2365dfdc4a0"
|
||||
github.com/google/go-cmp="v0.6.0"
|
||||
github.com/google/pprof="v0.0.0-20250208200701-d0013a598941"
|
||||
github.com/google/go-cmp="v0.7.0"
|
||||
github.com/gorilla/css="v1.0.1"
|
||||
github.com/gorilla/websocket="v1.5.3"
|
||||
github.com/hairyhenderson/go-codeowners="v0.7.0"
|
||||
github.com/hashicorp/golang-lru/v2="v2.0.7"
|
||||
@@ -224,58 +232,57 @@ github.com/josharian/intern="v1.0.0"
|
||||
github.com/kr/pretty="v0.3.1"
|
||||
github.com/kr/text="v0.2.0"
|
||||
github.com/kyokomi/emoji/v2="v2.2.13"
|
||||
github.com/lucasb-eyer/go-colorful="v1.2.0"
|
||||
github.com/mailru/easyjson="v0.7.7"
|
||||
github.com/makeworld-the-better-one/dither/v2="v2.4.0"
|
||||
github.com/marekm4/color-extractor="v1.2.1"
|
||||
github.com/mattn/go-colorable="v0.1.13"
|
||||
github.com/mattn/go-isatty="v0.0.20"
|
||||
github.com/mattn/go-runewidth="v0.0.9"
|
||||
github.com/mazznoer/csscolorparser="v0.1.5"
|
||||
github.com/mattn/go-runewidth="v0.0.19"
|
||||
github.com/microcosm-cc/bluemonday="v1.0.27"
|
||||
github.com/mitchellh/mapstructure="v1.5.1-0.20231216201459-8508981c8b6c"
|
||||
github.com/mohae/deepcopy="v0.0.0-20170929034955-c48cc78d4826"
|
||||
github.com/muesli/smartcrop="v0.3.0"
|
||||
github.com/niklasfasching/go-org="v1.7.0"
|
||||
github.com/oasdiff/yaml3="v0.0.0-20241210130736-a94c01f36349"
|
||||
github.com/oasdiff/yaml="v0.0.0-20241210131133-6b86fb107d80"
|
||||
github.com/olekukonko/tablewriter="v0.0.5"
|
||||
github.com/niklasfasching/go-org="v1.9.1"
|
||||
github.com/oasdiff/yaml3="v0.0.0-20250309153720-d2182401db90"
|
||||
github.com/oasdiff/yaml="v0.0.0-20250309154309-f31be36b4037"
|
||||
github.com/olekukonko/cat="v0.0.0-20250911104152-50322a0618f6"
|
||||
github.com/olekukonko/errors="v1.1.0"
|
||||
github.com/olekukonko/ll="v0.1.3"
|
||||
github.com/olekukonko/tablewriter="v1.1.2"
|
||||
github.com/pbnjay/memory="v0.0.0-20210728143218-7b4eea64cf58"
|
||||
github.com/pelletier/go-toml/v2="v2.2.3"
|
||||
github.com/pelletier/go-toml/v2="v2.2.4"
|
||||
github.com/perimeterx/marshmallow="v1.1.5"
|
||||
github.com/pkg/browser="v0.0.0-20240102092130-5ac0b6a4141c"
|
||||
github.com/pkg/errors="v0.9.1"
|
||||
github.com/rivo/uniseg="v0.4.7"
|
||||
github.com/rogpeppe/go-internal="v1.13.1"
|
||||
github.com/rogpeppe/go-internal="v1.14.1"
|
||||
github.com/russross/blackfriday/v2="v2.1.0"
|
||||
github.com/sass/libsass="3.6.6"
|
||||
github.com/spf13/afero="v1.11.0"
|
||||
github.com/spf13/cast="v1.7.1"
|
||||
github.com/spf13/cobra="v1.8.1"
|
||||
github.com/sass/dart-sass/compiler="1.97.1"
|
||||
github.com/sass/dart-sass/implementation="1.97.1"
|
||||
github.com/sass/dart-sass/protocol="3.2.0"
|
||||
github.com/spf13/afero="v1.15.0"
|
||||
github.com/spf13/cast="v1.10.0"
|
||||
github.com/spf13/cobra="v1.10.2"
|
||||
github.com/spf13/fsync="v0.10.1"
|
||||
github.com/spf13/pflag="v1.0.6"
|
||||
github.com/tdewolff/minify/v2="v2.20.37"
|
||||
github.com/tdewolff/parse/v2="v2.7.15"
|
||||
github.com/tetratelabs/wazero="v1.8.2"
|
||||
github.com/webmproject/libwebp="v1.3.2"
|
||||
github.com/yuin/goldmark-emoji="v1.0.4"
|
||||
github.com/yuin/goldmark="v1.7.8"
|
||||
github.com/spf13/pflag="v1.0.9"
|
||||
github.com/tdewolff/minify/v2="v2.24.8"
|
||||
github.com/tdewolff/parse/v2="v2.8.5"
|
||||
github.com/tetratelabs/wazero="v1.10.1"
|
||||
github.com/webmproject/libwebp="v1.6.0"
|
||||
github.com/woodsbury/decimal128="v1.3.0"
|
||||
github.com/yuin/goldmark-emoji="v1.0.6"
|
||||
github.com/yuin/goldmark="v1.7.13"
|
||||
go.uber.org/automaxprocs="v1.5.3"
|
||||
golang.org/x/crypto="v0.33.0"
|
||||
golang.org/x/exp="v0.0.0-20250210185358-939b2ce775ac"
|
||||
golang.org/x/image="v0.24.0"
|
||||
golang.org/x/mod="v0.23.0"
|
||||
golang.org/x/net="v0.35.0"
|
||||
golang.org/x/sync="v0.11.0"
|
||||
golang.org/x/sys="v0.30.0"
|
||||
golang.org/x/text="v0.22.0"
|
||||
golang.org/x/tools="v0.30.0"
|
||||
golang.org/x/xerrors="v0.0.0-20240903120638-7835f813f4da"
|
||||
gonum.org/v1/plot="v0.15.0"
|
||||
google.golang.org/protobuf="v1.36.5"
|
||||
gopkg.in/yaml.v2="v2.4.0"
|
||||
go.yaml.in/yaml/v3="v3.0.4"
|
||||
golang.org/x/crypto="v0.46.0"
|
||||
golang.org/x/image="v0.34.0"
|
||||
golang.org/x/mod="v0.31.0"
|
||||
golang.org/x/net="v0.48.0"
|
||||
golang.org/x/sync="v0.19.0"
|
||||
golang.org/x/sys="v0.39.0"
|
||||
golang.org/x/text="v0.32.0"
|
||||
golang.org/x/tools="v0.40.0"
|
||||
google.golang.org/protobuf="v1.36.10"
|
||||
gopkg.in/yaml.v3="v3.0.1"
|
||||
oss.terrastruct.com/d2="v0.6.9"
|
||||
oss.terrastruct.com/util-go="v0.0.0-20241005222610-44c011a04896"
|
||||
rsc.io/qr="v0.2.0"
|
||||
software.sslmate.com/src/go-pkcs12="v0.2.0"
|
||||
```
|
||||
|
||||
Vendored
+2
-2
@@ -69,7 +69,7 @@ func New(opts Options) *Cache {
|
||||
|
||||
infol := opts.Log.InfoCommand("dynacache")
|
||||
|
||||
evictedIdentities := collections.NewStack[KeyIdentity]()
|
||||
evictedIdentities := collections.NewStackThreadSafe[KeyIdentity]()
|
||||
|
||||
onEvict := func(k, v any) {
|
||||
if !opts.Watching {
|
||||
@@ -129,7 +129,7 @@ type Cache struct {
|
||||
partitions map[string]PartitionManager
|
||||
|
||||
onEvict func(k, v any)
|
||||
evictedIdentities *collections.Stack[KeyIdentity]
|
||||
evictedIdentities *collections.StackThreadSafe[KeyIdentity]
|
||||
|
||||
opts Options
|
||||
infol logg.LevelLogger
|
||||
|
||||
Vendored
+7
@@ -51,11 +51,18 @@ const (
|
||||
|
||||
type Configs map[string]FileCacheConfig
|
||||
|
||||
// CacheDirModules returns the compiled path to the modules cache.
|
||||
// For internal use.
|
||||
func (c Configs) CacheDirModules() string {
|
||||
return c[CacheKeyModules].DirCompiled
|
||||
}
|
||||
|
||||
// CacheDirMisc returns the compiled path to the misc cache.
|
||||
// For internal use.
|
||||
func (c Configs) CacheDirMisc() string {
|
||||
return c[CacheKeyMisc].DirCompiled
|
||||
}
|
||||
|
||||
var defaultCacheConfigs = Configs{
|
||||
CacheKeyModules: {
|
||||
MaxAge: -1,
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ title: "Home"
|
||||
---
|
||||
-- assets/a/pixel.png --
|
||||
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
|
||||
-- layouts/index.html --
|
||||
-- layouts/home.html --
|
||||
{{ warnf "HOME!" }}
|
||||
{{ $img := resources.GetMatch "**.png" }}
|
||||
{{ $img = $img.Resize "3x3" }}
|
||||
|
||||
@@ -401,9 +401,7 @@ func (r *rootCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args
|
||||
|
||||
watchGroups := helpers.ExtractAndGroupRootPaths(watchDirs)
|
||||
|
||||
for _, group := range watchGroups {
|
||||
r.Printf("Watching for changes in %s\n", group)
|
||||
}
|
||||
r.Printf("Watching for changes in %s\n", strings.Join(watchGroups, ", "))
|
||||
watcher, err := b.newWatcher(r.poll, watchDirs...)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
+3
-1
@@ -28,13 +28,14 @@ func newReleaseCommand() simplecobra.Commander {
|
||||
step int
|
||||
skipPush bool
|
||||
try bool
|
||||
version string
|
||||
)
|
||||
|
||||
return &simpleCommand{
|
||||
name: "release",
|
||||
short: "Release a new version of Hugo",
|
||||
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
|
||||
rel, err := releaser.New(skipPush, try, step)
|
||||
rel, err := releaser.New(skipPush, try, step, version)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -47,6 +48,7 @@ func newReleaseCommand() simplecobra.Commander {
|
||||
cmd.PersistentFlags().BoolVarP(&skipPush, "skip-push", "", false, "skip pushing to remote")
|
||||
cmd.PersistentFlags().BoolVarP(&try, "try", "", false, "no changes")
|
||||
cmd.PersistentFlags().IntVarP(&step, "step", "", 0, "step to run (1: set new version 2: prepare next dev version)")
|
||||
cmd.PersistentFlags().StringVarP(&version, "version", "", "", "version to release (derived from branch name if not set)")
|
||||
_ = cmd.RegisterFlagCompletionFunc("step", cobra.FixedCompletions([]string{"1", "2"}, cobra.ShellCompDirectiveNoFileComp))
|
||||
},
|
||||
}
|
||||
|
||||
+8
-3
@@ -49,6 +49,7 @@ import (
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/gohugoio/hugo/common/herrors"
|
||||
"github.com/gohugoio/hugo/common/hugo"
|
||||
"github.com/gohugoio/hugo/common/paths"
|
||||
"github.com/gohugoio/hugo/langs"
|
||||
"github.com/gohugoio/hugo/tpl/tplimpl"
|
||||
|
||||
@@ -370,6 +371,12 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, net.Listener, string
|
||||
|
||||
if f.c.fastRenderMode && f.c.errState.buildErr() == nil {
|
||||
if isNavigation(requestURI, r) {
|
||||
// See issue 14240.
|
||||
// Hugo escapes the URL paths when generating them,
|
||||
// that may not be the case when we receive it back from the browser.
|
||||
// PathEscape will escape if it is not already escaped.
|
||||
requestURI = paths.PathEscape(requestURI)
|
||||
|
||||
if !f.c.visitedURLs.Contains(requestURI) {
|
||||
// If not already on stack, re-render that single page.
|
||||
if err := f.c.partialReRender(requestURI); err != nil {
|
||||
@@ -492,9 +499,7 @@ func (c *serverCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, arg
|
||||
|
||||
watchGroups := helpers.ExtractAndGroupRootPaths(watchDirs)
|
||||
|
||||
for _, group := range watchGroups {
|
||||
c.r.Printf("Watching for changes in %s\n", group)
|
||||
}
|
||||
c.r.Printf("Watching for changes in %s\n", strings.Join(watchGroups, ", "))
|
||||
watcher, err := c.newWatcher(c.r.poll, watchDirs...)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
+55
-11
@@ -21,24 +21,24 @@ import (
|
||||
"github.com/gohugoio/hugo/common/hiter"
|
||||
)
|
||||
|
||||
// Stack is a simple LIFO stack that is safe for concurrent use.
|
||||
type Stack[T any] struct {
|
||||
// StackThreadSafe is a simple LIFO stack that is safe for concurrent use.
|
||||
type StackThreadSafe[T any] struct {
|
||||
items []T
|
||||
zero T
|
||||
mu sync.RWMutex
|
||||
}
|
||||
|
||||
func NewStack[T any]() *Stack[T] {
|
||||
return &Stack[T]{}
|
||||
func NewStackThreadSafe[T any]() *StackThreadSafe[T] {
|
||||
return &StackThreadSafe[T]{}
|
||||
}
|
||||
|
||||
func (s *Stack[T]) Push(item T) {
|
||||
func (s *StackThreadSafe[T]) Push(item T) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
s.items = append(s.items, item)
|
||||
}
|
||||
|
||||
func (s *Stack[T]) Pop() (T, bool) {
|
||||
func (s *StackThreadSafe[T]) Pop() (T, bool) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
if len(s.items) == 0 {
|
||||
@@ -49,7 +49,7 @@ func (s *Stack[T]) Pop() (T, bool) {
|
||||
return item, true
|
||||
}
|
||||
|
||||
func (s *Stack[T]) Peek() (T, bool) {
|
||||
func (s *StackThreadSafe[T]) Peek() (T, bool) {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
if len(s.items) == 0 {
|
||||
@@ -58,18 +58,18 @@ func (s *Stack[T]) Peek() (T, bool) {
|
||||
return s.items[len(s.items)-1], true
|
||||
}
|
||||
|
||||
func (s *Stack[T]) Len() int {
|
||||
func (s *StackThreadSafe[T]) Len() int {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
return len(s.items)
|
||||
}
|
||||
|
||||
// All returns all items in the stack, from bottom to top.
|
||||
func (s *Stack[T]) All() iter.Seq2[int, T] {
|
||||
func (s *StackThreadSafe[T]) All() iter.Seq2[int, T] {
|
||||
return hiter.Lock2(slices.All(s.items), s.mu.RLock, s.mu.RUnlock)
|
||||
}
|
||||
|
||||
func (s *Stack[T]) Drain() []T {
|
||||
func (s *StackThreadSafe[T]) Drain() []T {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
items := s.items
|
||||
@@ -77,7 +77,7 @@ func (s *Stack[T]) Drain() []T {
|
||||
return items
|
||||
}
|
||||
|
||||
func (s *Stack[T]) DrainMatching(predicate func(T) bool) []T {
|
||||
func (s *StackThreadSafe[T]) DrainMatching(predicate func(T) bool) []T {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
var items []T
|
||||
@@ -89,3 +89,47 @@ func (s *Stack[T]) DrainMatching(predicate func(T) bool) []T {
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
// Stack is a simple LIFO stack that is not safe for concurrent use.
|
||||
type Stack[T any] struct {
|
||||
items []T
|
||||
zero T
|
||||
}
|
||||
|
||||
func NewStack[T any]() *Stack[T] {
|
||||
return &Stack[T]{}
|
||||
}
|
||||
|
||||
func (s *Stack[T]) Push(item T) {
|
||||
s.items = append(s.items, item)
|
||||
}
|
||||
|
||||
func (s *Stack[T]) Pop() (T, bool) {
|
||||
if len(s.items) == 0 {
|
||||
return s.zero, false
|
||||
}
|
||||
item := s.items[len(s.items)-1]
|
||||
s.items = s.items[:len(s.items)-1]
|
||||
return item, true
|
||||
}
|
||||
|
||||
func (s *Stack[T]) Peek() (T, bool) {
|
||||
if len(s.items) == 0 {
|
||||
return s.zero, false
|
||||
}
|
||||
return s.items[len(s.items)-1], true
|
||||
}
|
||||
|
||||
func (s *Stack[T]) Len() int {
|
||||
return len(s.items)
|
||||
}
|
||||
|
||||
func (s *Stack[T]) All() iter.Seq2[int, T] {
|
||||
return slices.All(s.items)
|
||||
}
|
||||
|
||||
func (s *Stack[T]) Drain() []T {
|
||||
items := s.items
|
||||
s.items = nil
|
||||
return items
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ func TestNewStack(t *testing.T) {
|
||||
t.Parallel()
|
||||
c := qt.New(t)
|
||||
|
||||
s := NewStack[int]()
|
||||
s := NewStackThreadSafe[int]()
|
||||
|
||||
c.Assert(s, qt.IsNotNil)
|
||||
}
|
||||
@@ -19,7 +19,7 @@ func TestStackBasic(t *testing.T) {
|
||||
t.Parallel()
|
||||
c := qt.New(t)
|
||||
|
||||
s := NewStack[int]()
|
||||
s := NewStackThreadSafe[int]()
|
||||
|
||||
c.Assert(s.Len(), qt.Equals, 0)
|
||||
|
||||
@@ -50,7 +50,7 @@ func TestStackDrain(t *testing.T) {
|
||||
t.Parallel()
|
||||
c := qt.New(t)
|
||||
|
||||
s := NewStack[string]()
|
||||
s := NewStackThreadSafe[string]()
|
||||
s.Push("a")
|
||||
s.Push("b")
|
||||
|
||||
@@ -64,7 +64,7 @@ func TestStackDrainMatching(t *testing.T) {
|
||||
t.Parallel()
|
||||
c := qt.New(t)
|
||||
|
||||
s := NewStack[int]()
|
||||
s := NewStackThreadSafe[int]()
|
||||
s.Push(1)
|
||||
s.Push(2)
|
||||
s.Push(3)
|
||||
|
||||
@@ -288,6 +288,50 @@ func Unwrap(err error) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// UnwrapFileErrors returns all FileError contained in err.
|
||||
func UnwrapFileErrors(err error) []FileError {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
errs := Errors(err)
|
||||
var fileErrors []FileError
|
||||
for _, e := range errs {
|
||||
if v, ok := e.(FileError); ok {
|
||||
fileErrors = append(fileErrors, v)
|
||||
}
|
||||
fileErrors = append(fileErrors, UnwrapFileErrors(errors.Unwrap(e))...)
|
||||
}
|
||||
return fileErrors
|
||||
}
|
||||
|
||||
// UnwrapFileErrorsWithErrorContext tries to unwrap all FileError in err that has an ErrorContext.
|
||||
func UnwrapFileErrorsWithErrorContext(err error) []FileError {
|
||||
errs := UnwrapFileErrors(err)
|
||||
var n int
|
||||
for _, e := range errs {
|
||||
if e.ErrorContext() != nil {
|
||||
errs[n] = e
|
||||
n++
|
||||
}
|
||||
}
|
||||
return errs[:n]
|
||||
}
|
||||
|
||||
// Errors returns the list of errors contained in err.
|
||||
func Errors(err error) []error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
type unwrapper interface {
|
||||
Unwrap() []error
|
||||
}
|
||||
if u, ok := err.(unwrapper); ok {
|
||||
return u.Unwrap()
|
||||
}
|
||||
return []error{err}
|
||||
}
|
||||
|
||||
func extractFileTypePos(err error) (string, text.Position) {
|
||||
err = Unwrap(err)
|
||||
|
||||
@@ -350,30 +394,6 @@ func UnwrapFileError(err error) FileError {
|
||||
return nil
|
||||
}
|
||||
|
||||
// UnwrapFileErrors tries to unwrap all FileError.
|
||||
func UnwrapFileErrors(err error) []FileError {
|
||||
var errs []FileError
|
||||
for err != nil {
|
||||
if v, ok := err.(FileError); ok {
|
||||
errs = append(errs, v)
|
||||
}
|
||||
err = errors.Unwrap(err)
|
||||
}
|
||||
return errs
|
||||
}
|
||||
|
||||
// UnwrapFileErrorsWithErrorContext tries to unwrap all FileError in err that has an ErrorContext.
|
||||
func UnwrapFileErrorsWithErrorContext(err error) []FileError {
|
||||
var errs []FileError
|
||||
for err != nil {
|
||||
if v, ok := err.(FileError); ok && v.ErrorContext() != nil {
|
||||
errs = append(errs, v)
|
||||
}
|
||||
err = errors.Unwrap(err)
|
||||
}
|
||||
return errs
|
||||
}
|
||||
|
||||
func extractOffsetAndType(e error) (int, string) {
|
||||
switch v := e.(type) {
|
||||
case *json.UnmarshalTypeError:
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
// Copyright 2025 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package himage provides some high level image types and interfaces.
|
||||
package himage
|
||||
|
||||
import "image"
|
||||
|
||||
// AnimatedImage represents an animated image.
|
||||
// This is currently supported for GIF and WebP images.
|
||||
type AnimatedImage interface {
|
||||
image.Image // The first frame.
|
||||
GetRaw() any // *gif.GIF or *WEBP.
|
||||
GetLoopCount() int // Number of times to loop the animation. 0 means infinite.
|
||||
ImageFrames
|
||||
}
|
||||
|
||||
// ImageFrames provides access to the frames of an animated image.
|
||||
type ImageFrames interface {
|
||||
GetFrames() []image.Image
|
||||
|
||||
// Frame durations in milliseconds.
|
||||
// Note that Gif frame durations are in 100ths of a second,
|
||||
// so they need to be multiplied by 10 to get milliseconds and vice versa.
|
||||
GetFrameDurations() []int
|
||||
|
||||
SetFrames(frames []image.Image)
|
||||
SetWidthHeight(width, height int)
|
||||
}
|
||||
|
||||
// ImageConfigProvider provides access to the image.Config of an image.
|
||||
type ImageConfigProvider interface {
|
||||
GetImageConfig() image.Config
|
||||
}
|
||||
|
||||
// FrameDurationsToGifDelays converts frame durations in milliseconds to
|
||||
// GIF delays in 100ths of a second.
|
||||
func FrameDurationsToGifDelays(frameDurations []int) []int {
|
||||
delays := make([]int, len(frameDurations))
|
||||
for i, fd := range frameDurations {
|
||||
delays[i] = fd / 10
|
||||
if delays[i] == 0 && fd > 0 {
|
||||
delays[i] = 1
|
||||
}
|
||||
}
|
||||
return delays
|
||||
}
|
||||
|
||||
// GifDelaysToFrameDurations converts GIF delays in 100ths of a second to
|
||||
// frame durations in milliseconds.
|
||||
func GifDelaysToFrameDurations(delays []int) []int {
|
||||
frameDurations := make([]int, len(delays))
|
||||
for i, d := range delays {
|
||||
frameDurations[i] = d * 10
|
||||
}
|
||||
return frameDurations
|
||||
}
|
||||
@@ -97,6 +97,16 @@ func GetOrCompileRegexp(pattern string) (re *regexp.Regexp, err error) {
|
||||
return reCache.getOrCompileRegexp(pattern)
|
||||
}
|
||||
|
||||
// HasAnyPrefix checks if the string s has any of the prefixes given.
|
||||
func HasAnyPrefix(s string, prefixes ...string) bool {
|
||||
for _, p := range prefixes {
|
||||
if strings.HasPrefix(s, p) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// InSlice checks if a string is an element of a slice of strings
|
||||
// and returns a boolean value.
|
||||
func InSlice(arr []string, el string) bool {
|
||||
|
||||
@@ -24,9 +24,9 @@ func TestApplyWithContext(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
files := `
|
||||
-- config.toml --
|
||||
-- hugo.toml --
|
||||
defaultContentLanguage = 'it'
|
||||
-- layouts/index.html --
|
||||
-- layouts/home.html --
|
||||
{{ $dates := slice
|
||||
"2022-01-03"
|
||||
"2022-02-01"
|
||||
|
||||
@@ -32,6 +32,30 @@ type ReadSeekCloser interface {
|
||||
io.Closer
|
||||
}
|
||||
|
||||
// Sizer provides the size of, typically, a io.Reader.
|
||||
// As implemented by e.g. os.File and io.SectionReader.
|
||||
type Sizer interface {
|
||||
Size() int64
|
||||
}
|
||||
|
||||
type SizeReader interface {
|
||||
io.Reader
|
||||
Sizer
|
||||
}
|
||||
|
||||
// ToSizeReader converts the given io.Reader to a SizeReader.
|
||||
// Note that if r is not a SizeReader, the entire content will be read into memory
|
||||
func ToSizeReader(r io.Reader) (SizeReader, error) {
|
||||
if sr, ok := r.(SizeReader); ok {
|
||||
return sr, nil
|
||||
}
|
||||
b, err := io.ReadAll(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return bytes.NewReader(b), nil
|
||||
}
|
||||
|
||||
// CloserFunc is an adapter to allow the use of ordinary functions as io.Closers.
|
||||
type CloserFunc func() error
|
||||
|
||||
|
||||
+1
-2
@@ -310,13 +310,12 @@ func GetDependencyList() []string {
|
||||
|
||||
// GetDependencyListNonGo returns a list of non-Go dependencies.
|
||||
func GetDependencyListNonGo() []string {
|
||||
var deps []string
|
||||
deps := []string{formatDep("github.com/webmproject/libwebp", "v1.6.0")} // via WASM. TODO(bep) get versions from the plugin setup.
|
||||
|
||||
if IsExtended {
|
||||
deps = append(
|
||||
deps,
|
||||
formatDep("github.com/sass/libsass", "3.6.6"),
|
||||
formatDep("github.com/webmproject/libwebp", "v1.3.2"),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ baseURL = 'https://en.example.org/'
|
||||
---
|
||||
title: home
|
||||
---
|
||||
-- layouts/index.html --
|
||||
-- layouts/home.html --
|
||||
multilingual={{ hugo.IsMultilingual }}
|
||||
multihost={{ hugo.IsMultihost }}
|
||||
`
|
||||
|
||||
@@ -19,7 +19,7 @@ import "github.com/gohugoio/hugo/common/version"
|
||||
// This should be the only one.
|
||||
var CurrentVersion = version.Version{
|
||||
Major: 0,
|
||||
Minor: 153,
|
||||
Minor: 155,
|
||||
PatchLevel: 0,
|
||||
Suffix: "-DEV",
|
||||
}
|
||||
|
||||
+15
-3
@@ -73,11 +73,23 @@ func (m *Map[K, T]) Set(key K, value T) {
|
||||
m.mu.Unlock()
|
||||
}
|
||||
|
||||
// WithWriteLock executes the given function with a write lock on the map.
|
||||
func (m *Map[K, T]) WithWriteLock(f func(m map[K]T)) {
|
||||
// Delete deletes the given key from the map.
|
||||
// It returns true if the key was found and deleted, false otherwise.
|
||||
func (m *Map[K, T]) Delete(key K) bool {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
f(m.m)
|
||||
if _, found := m.m[key]; found {
|
||||
delete(m.m, key)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// WithWriteLock executes the given function with a write lock on the map.
|
||||
func (m *Map[K, T]) WithWriteLock(f func(m map[K]T) error) error {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
return f(m.m)
|
||||
}
|
||||
|
||||
// SetIfAbsent sets the given key to the given value if the key does not already exist in the map.
|
||||
|
||||
@@ -62,8 +62,9 @@ func TestMap(t *testing.T) {
|
||||
c.Assert(found, qt.Equals, true)
|
||||
c.Assert(v, qt.Equals, 300)
|
||||
|
||||
m.WithWriteLock(func(m map[string]int) {
|
||||
m.WithWriteLock(func(m map[string]int) error {
|
||||
m["f"] = 500
|
||||
return nil
|
||||
})
|
||||
v, found = m.Lookup("f")
|
||||
c.Assert(found, qt.Equals, true)
|
||||
|
||||
@@ -347,3 +347,25 @@ func BenchmarkAddLeadingSlash(b *testing.B) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestPathEscape(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
|
||||
for _, this := range []struct {
|
||||
input string
|
||||
expected string
|
||||
}{
|
||||
{"/tags/欢迎", "/tags/%E6%AC%A2%E8%BF%8E"},
|
||||
{"/path with spaces", "/path%20with%20spaces"},
|
||||
{"/simple-path", "/simple-path"},
|
||||
{"/path/with/slash", "/path/with/slash"},
|
||||
{"/path/with special&chars", "/path/with%20special&chars"},
|
||||
} {
|
||||
in := this.input
|
||||
for range 2 {
|
||||
result := PathEscape(in)
|
||||
c.Assert(result, qt.Equals, this.expected, qt.Commentf("input: %q", this.input))
|
||||
in = result // test idempotency
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ weight = 2
|
||||
removePathAccents = true
|
||||
-- content/διακριτικός.md --
|
||||
-- content/διακριτικός.fr.md --
|
||||
-- layouts/_default/single.html --
|
||||
-- layouts/single.html --
|
||||
{{ .Language.Lang }}|Single.
|
||||
-- layouts/_default/list.html --
|
||||
-- layouts/list.html --
|
||||
List
|
||||
`
|
||||
b := hugolib.Test(t, files)
|
||||
@@ -64,9 +64,9 @@ disablePathToLower = true
|
||||
-- content/MySection/MyPage.fr.md --
|
||||
-- content/MySection/MyBundle/index.md --
|
||||
-- content/MySection/MyBundle/index.fr.md --
|
||||
-- layouts/_default/single.html --
|
||||
-- layouts/single.html --
|
||||
{{ .Language.Lang }}|Single.
|
||||
-- layouts/_default/list.html --
|
||||
-- layouts/list.html --
|
||||
{{ .Language.Lang }}|List.
|
||||
`
|
||||
b := hugolib.Test(t, files)
|
||||
|
||||
@@ -44,6 +44,13 @@ var (
|
||||
_ compare.Comparer = (*VersionString)(nil)
|
||||
)
|
||||
|
||||
// IsAlphaBetaOrRC returns whether this version is an alpha, beta, or release candidate.
|
||||
func (v Version) IsAlphaBetaOrRC() bool {
|
||||
s := strings.ToLower(v.Suffix)
|
||||
// e.g. "alpha.1", "beta.2", "rc.3"
|
||||
return strings.Contains(s, "alpha.") || strings.Contains(s, "beta.") || strings.Contains(s, "rc.")
|
||||
}
|
||||
|
||||
func (v Version) String() string {
|
||||
return version(v.Major, v.Minor, v.PatchLevel, v.Suffix)
|
||||
}
|
||||
|
||||
@@ -471,10 +471,10 @@ func (c *Config) CompileConfig(logger loggers.Logger) error {
|
||||
gc.RenderHookUseEmbeddedNever,
|
||||
}
|
||||
if !slices.Contains(renderHookUseEmbeddedModes, c.Markup.Goldmark.RenderHooks.Image.UseEmbedded) {
|
||||
return fmt.Errorf("site config markup.goldmark.renderHooks.image must be one of %s", helpers.StringSliceToList(renderHookUseEmbeddedModes, "or"))
|
||||
return fmt.Errorf("site config markup.goldmark.renderHooks.image.useEmbedded must be one of %s", helpers.StringSliceToList(renderHookUseEmbeddedModes, "or"))
|
||||
}
|
||||
if !slices.Contains(renderHookUseEmbeddedModes, c.Markup.Goldmark.RenderHooks.Link.UseEmbedded) {
|
||||
return fmt.Errorf("site config markup.goldmark.renderHooks.link must be one of %s", helpers.StringSliceToList(renderHookUseEmbeddedModes, "or"))
|
||||
return fmt.Errorf("site config markup.goldmark.renderHooks.link.useEmbedded must be one of %s", helpers.StringSliceToList(renderHookUseEmbeddedModes, "or"))
|
||||
}
|
||||
|
||||
c.C = &ConfigCompiled{
|
||||
@@ -607,8 +607,13 @@ type RootConfig struct {
|
||||
DefaultOutputFormat string
|
||||
|
||||
// Disable generation of redirect to the default language when DefaultContentLanguageInSubdir is enabled.
|
||||
// Note that this currently is an alias for DisableDefaultDimensionRedirect introduced in v0.154.4.
|
||||
// It's not obvious how a more fine grained setup would work.
|
||||
DisableDefaultLanguageRedirect bool
|
||||
|
||||
// Disable generation of redirect to the default dimension when DefaultContentRoleInSubdir or DefaultContentVersionInSubdir or DefaultContentLanguageInSubdir is enabled.
|
||||
DisableDefaultDimensionRedirect bool
|
||||
|
||||
// Disable creation of alias redirect pages.
|
||||
DisableAliases bool
|
||||
|
||||
@@ -915,10 +920,9 @@ func (c *Configs) Init(logger loggers.Logger) error {
|
||||
// avoid initializing the same config more than once.
|
||||
for i, l := range c.Languages {
|
||||
langConfig := c.LanguageConfigMap[l.Lang]
|
||||
sitesMatrix := sitesmatrix.NewIntSetsBuilder(c.ConfiguredDimensions).WithLanguageIndices(i).WithAllIfNotSet().Build()
|
||||
for _, s := range allDecoderSetups {
|
||||
if getInitializer := s.getInitializer; getInitializer != nil {
|
||||
if err := getInitializer(langConfig).InitConfig(logger, sitesMatrix, c.ConfiguredDimensions); err != nil {
|
||||
if err := getInitializer(langConfig).InitConfig(logger, nil, c.ConfiguredDimensions); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ title: "p1"
|
||||
---
|
||||
title: "p1"
|
||||
---
|
||||
-- layouts/_default/single.html --
|
||||
-- layouts/single.html --
|
||||
Title: {{ .Title }}
|
||||
`
|
||||
|
||||
@@ -141,7 +141,7 @@ disableKinds = ["taxonomy", "term"]
|
||||
[pagination]
|
||||
disableAliases = true
|
||||
pagerSize = 2
|
||||
-- layouts/_default/list.html --
|
||||
-- layouts/list.html --
|
||||
{{ $paginator := .Paginate site.RegularPages }}
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
{{ range $paginator.Pages }}
|
||||
@@ -191,7 +191,7 @@ func TestInvalidOutputFormat(t *testing.T) {
|
||||
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
|
||||
[outputs]
|
||||
home = ['html','foo']
|
||||
-- layouts/index.html --
|
||||
-- layouts/home.html --
|
||||
x
|
||||
`
|
||||
|
||||
|
||||
@@ -135,6 +135,10 @@ func (c ConfigLanguage) WorkingDir() string {
|
||||
return c.m.Base.WorkingDir
|
||||
}
|
||||
|
||||
func (c ConfigLanguage) CacheDirMisc() string {
|
||||
return c.config.Caches.CacheDirMisc()
|
||||
}
|
||||
|
||||
func (c ConfigLanguage) Quiet() bool {
|
||||
return c.m.Base.Internal.Quiet
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ type AllProvider interface {
|
||||
WorkingDir() string
|
||||
EnableEmoji() bool
|
||||
ConfiguredDimensions() *sitesmatrix.ConfiguredDimensions
|
||||
CacheDirMisc() string
|
||||
}
|
||||
|
||||
// We cannot import the media package as that would create a circular dependency.
|
||||
|
||||
@@ -112,12 +112,8 @@ type X struct {
|
||||
|
||||
// DecodeConfig creates a privacy Config from a given Hugo configuration.
|
||||
func DecodeConfig(cfg config.Provider) (pc Config, err error) {
|
||||
if !cfg.IsSet(privacyConfigKey) {
|
||||
return
|
||||
}
|
||||
|
||||
pc.GoogleAnalytics.RespectDoNotTrack = true
|
||||
m := cfg.GetStringMap(privacyConfigKey)
|
||||
|
||||
err = mapstructure.WeakDecode(m, &pc)
|
||||
|
||||
return
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/gohugoio/hugo/config/allconfig"
|
||||
"github.com/gohugoio/hugo/deps"
|
||||
"github.com/gohugoio/hugo/hugofs"
|
||||
"github.com/gohugoio/hugo/internal/warpc"
|
||||
toml "github.com/pelletier/go-toml/v2"
|
||||
"github.com/spf13/afero"
|
||||
)
|
||||
@@ -60,6 +61,14 @@ func GetTestDeps(fs afero.Fs, cfg config.Provider, beforeInit ...func(*deps.Deps
|
||||
d := &deps.Deps{
|
||||
Conf: conf,
|
||||
Fs: hugofs.NewFrom(fs, conf.BaseConfig()),
|
||||
WasmDispatchers: warpc.AllDispatchers(
|
||||
warpc.Options{
|
||||
PoolSize: 1,
|
||||
},
|
||||
warpc.Options{
|
||||
PoolSize: 1,
|
||||
},
|
||||
),
|
||||
}
|
||||
for _, f := range beforeInit {
|
||||
f(d)
|
||||
|
||||
Vendored
+17
-1
@@ -1,3 +1,16 @@
|
||||
// Copyright 2025 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package deps
|
||||
|
||||
import (
|
||||
@@ -252,7 +265,7 @@ func (d *Deps) Init() error {
|
||||
return fmt.Errorf("failed to create file caches from configuration: %w", err)
|
||||
}
|
||||
|
||||
resourceSpec, err := resources.NewSpec(d.PathSpec, common, fileCaches, d.MemCache, d.BuildState, d.Log, d, d.ExecHelper, d.BuildClosers, d.BuildState)
|
||||
resourceSpec, err := resources.NewSpec(d.PathSpec, common, d.WasmDispatchers, fileCaches, d.MemCache, d.BuildState, d.Log, d, d.ExecHelper, d.BuildClosers, d.BuildState)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create resource spec: %w", err)
|
||||
}
|
||||
@@ -417,6 +430,9 @@ type DepsCfg struct {
|
||||
// i18n handling.
|
||||
TranslationProvider ResourceProvider
|
||||
|
||||
// Build triggered by the IntegrationTest framework.
|
||||
IsIntegrationTest bool
|
||||
|
||||
// ChangesFromBuild for changes passed back to the server/watch process.
|
||||
ChangesFromBuild chan []identity.Identity
|
||||
}
|
||||
|
||||
+6
-3
@@ -23,7 +23,8 @@
|
||||
"**/emojis.md",
|
||||
"**/commands/*",
|
||||
"**/showcase/*",
|
||||
"**/tools/*"
|
||||
"**/tools/*",
|
||||
"data/docs.yaml"
|
||||
],
|
||||
"ignoreRegExpList": [
|
||||
"# cspell: ignore fenced code blocks",
|
||||
@@ -59,12 +60,14 @@
|
||||
"marshal",
|
||||
"marshaling",
|
||||
"multihost",
|
||||
"multiplatfom",
|
||||
"multiplatform",
|
||||
"performantly",
|
||||
"preconfigured",
|
||||
"prerendering",
|
||||
"redirection",
|
||||
"redirections",
|
||||
"slugified",
|
||||
"slugify",
|
||||
"subexpression",
|
||||
"suppressible",
|
||||
"synchronisation",
|
||||
@@ -113,7 +116,6 @@
|
||||
"libros",
|
||||
"mercredi",
|
||||
"miesiąc",
|
||||
"miesiąc",
|
||||
"miesiąca",
|
||||
"miesiące",
|
||||
"miesięcy",
|
||||
@@ -144,6 +146,7 @@
|
||||
"Samsa",
|
||||
"Stucki",
|
||||
"Thénardier",
|
||||
"Vitter",
|
||||
"WASI",
|
||||
"# ----------------------------------------------------------------------",
|
||||
"# cspell: ignore operating systems and software packages",
|
||||
|
||||
@@ -77,7 +77,7 @@ config:
|
||||
full: true
|
||||
inline: true
|
||||
shortcut: true
|
||||
url_inline: true
|
||||
url_inline: false
|
||||
MD055:
|
||||
style: consistent
|
||||
MD056: true
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
**/news/**
|
||||
**/showcase/**
|
||||
**/zh/**
|
||||
@@ -129,3 +129,8 @@ body {
|
||||
text-decoration: none;
|
||||
padding-left: .0625em;
|
||||
}
|
||||
|
||||
/* Code spans within paragraphs, tables cells, list items, etc. */
|
||||
:not(pre) > code {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 13 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 13 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 13 KiB |
@@ -1,6 +0,0 @@
|
||||
import { initColorScheme } from './alpinejs/stores/index';
|
||||
|
||||
(function () {
|
||||
// This allows us to initialize the color scheme before AlpineJS etc. is loaded.
|
||||
initColorScheme();
|
||||
})();
|
||||
@@ -1,6 +1,10 @@
|
||||
import { scrollToActive } from 'js/helpers/index';
|
||||
import { initColorScheme } from './alpinejs/stores/index';
|
||||
|
||||
(function () {
|
||||
// This allows us to initialize the color scheme before AlpineJS etc. is loaded.
|
||||
initColorScheme();
|
||||
|
||||
// Now we know that the browser has JS enabled.
|
||||
document.documentElement.classList.remove('no-js');
|
||||
|
||||
|
||||
@@ -8,14 +8,6 @@ import focus from '@alpinejs/focus';
|
||||
|
||||
var debug = 0 ? console.log.bind(console, '[index]') : function () {};
|
||||
|
||||
// Turbolinks init.
|
||||
(function () {
|
||||
document.addEventListener('turbo:render', function (e) {
|
||||
// This is also called right after the body start. This is added to prevent flicker on navigation.
|
||||
initColorScheme();
|
||||
});
|
||||
})();
|
||||
|
||||
// Set up and start Alpine.
|
||||
(function () {
|
||||
// Register AlpineJS plugins.
|
||||
|
||||
@@ -29,6 +29,7 @@ Please refer to the relevant documentation for installation instructions:
|
||||
|
||||
[cloudcannon]: https://cloudcannon.com/
|
||||
[cloudflare pages]: https://pages.cloudflare.com/
|
||||
[commit information]: /methods/page/GitInfo
|
||||
[dart sass install]: /functions/css/sass/#dart-sass
|
||||
[dart sass]: https://sass-lang.com/dart-sass
|
||||
[git install]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
|
||||
@@ -37,4 +38,5 @@ Please refer to the relevant documentation for installation instructions:
|
||||
[gitlab pages]: https://docs.gitlab.com/ee/user/project/pages/
|
||||
[go install]: https://go.dev/doc/install
|
||||
[go]: https://go.dev/
|
||||
[hugo modules]: /hugo-modules/
|
||||
[netlify]: https://www.netlify.com/
|
||||
|
||||
@@ -15,3 +15,5 @@ Prebuilt binaries are available for a variety of operating systems and architect
|
||||
Please consult your operating system documentation if you need help setting file permissions or modifying your PATH environment variable.
|
||||
|
||||
If you do not see a prebuilt binary for the desired edition, operating system, and architecture, install Hugo using one of the methods described below.
|
||||
|
||||
[latest release]: https://github.com/gohugoio/hugo/releases/latest
|
||||
|
||||
@@ -7,7 +7,7 @@ _comment: Do not remove front matter.
|
||||
To build the extended or extended/deploy edition from source you must:
|
||||
|
||||
1. Install [Git]
|
||||
1. Install [Go] version 1.23.0 or later
|
||||
1. Install [Go] version 1.24.0 or later
|
||||
1. Install a C compiler, either [GCC] or [Clang]
|
||||
1. Update your `PATH` environment variable as described in the [Go documentation]
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ _comment: Do not remove front matter.
|
||||
|
||||
### Homebrew
|
||||
|
||||
[Homebrew] is a free and open-source package manager for macOS and Linux. To install the extended edition of Hugo:
|
||||
[Homebrew] is a free and open-source package manager for macOS and Linux. To install the extended/deploy edition of Hugo:
|
||||
|
||||
```sh
|
||||
brew install hugo
|
||||
|
||||
@@ -27,12 +27,14 @@ _comment: Do not remove front matter.
|
||||
: The content's section.
|
||||
|
||||
`:sectionslug`
|
||||
: {{< new-in 0.149.0 />}}
|
||||
: The content's section using slugified section name. The slugified section name is the `slug` as defined in front matter, else the `title` as defined in front matter, else the automatic title.
|
||||
|
||||
`:sections`
|
||||
: The content's sections hierarchy. You can use a selection of the sections using _slice syntax_: `:sections[1:]` includes all but the first, `:sections[:last]` includes all but the last, `:sections[last]` includes only the last, `:sections[1:2]` includes section 2 and 3. Note that this slice access will not throw any out-of-bounds errors, so you don't have to be exact.
|
||||
|
||||
`:sectionslugs`
|
||||
: {{< new-in 0.149.0 />}}
|
||||
: The content's sections hierarchy using slugified section names. The slugified section name is the `slug` as defined in front matter, else the `title` as defined in front matter, else the automatic title. You can use a selection of the sections using _slice syntax_: `:sectionslugs[1:]` includes all but the first, `:sectionslugs[:last]` includes all but the last, `:sectionslugs[last]` includes only the last, `:sectionslugs[1:2]` includes section 2 and 3. Note that this slice access will not throw any out-of-bounds errors, so you don't have to be exact.
|
||||
|
||||
`:title`
|
||||
|
||||
@@ -43,5 +43,5 @@ As a practical example, Hugo's embedded link and image render hooks use the `Pag
|
||||
|
||||
[`RenderShortcodes`]: /methods/page/rendershortcodes/
|
||||
[Markdown notation]: /content-management/shortcodes/#notation
|
||||
[Embedded link render hook]: {{% eturl render-link %}}
|
||||
[Embedded image render hook]: {{% eturl render-image %}}
|
||||
[Embedded link render hook]: <{{% eturl render-link %}}>
|
||||
[Embedded image render hook]: <{{% eturl render-image %}}>
|
||||
|
||||
@@ -28,7 +28,7 @@ Learn more about Hugo's [features], [privacy protections], and [security model].
|
||||
[Hugo Modules]: /hugo-modules/
|
||||
[static site generator]: https://en.wikipedia.org/wiki/Static_site_generator
|
||||
[features]: /about/features/
|
||||
[security model]: about/security/
|
||||
[security model]: /about/security/
|
||||
[privacy protections]: /configuration/privacy
|
||||
|
||||
{{< youtube 0RKpf3rK57I >}}
|
||||
|
||||
@@ -24,6 +24,8 @@ hugo gen chromastyles [flags] [args]
|
||||
--highlightStyle string foreground and background colors for highlighted lines, e.g. --highlightStyle "#fff000 bg:#000fff"
|
||||
--lineNumbersInlineStyle string foreground and background colors for inline line numbers, e.g. --lineNumbersInlineStyle "#fff000 bg:#000fff"
|
||||
--lineNumbersTableStyle string foreground and background colors for table line numbers, e.g. --lineNumbersTableStyle "#fff000 bg:#000fff"
|
||||
--omitClassComments omit CSS class comment prefixes in the generated CSS
|
||||
--omitEmpty omit empty CSS rules (deprecated, no longer needed)
|
||||
--style string highlighter style (see https://xyproto.github.io/splash/docs/) (default "friendly")
|
||||
```
|
||||
|
||||
|
||||
@@ -45,6 +45,6 @@ Ensure you run this within the root directory of your site.
|
||||
|
||||
* [hugo](/commands/hugo/) - Build your site
|
||||
* [hugo new content](/commands/hugo_new_content/) - Create new content
|
||||
* [hugo new site](/commands/hugo_new_site/) - Create a new site (skeleton)
|
||||
* [hugo new theme](/commands/hugo_new_theme/) - Create a new theme (skeleton)
|
||||
* [hugo new site](/commands/hugo_new_site/) - Create a new site
|
||||
* [hugo new theme](/commands/hugo_new_theme/) - Create a new theme
|
||||
|
||||
|
||||
@@ -5,13 +5,11 @@ url: /commands/hugo_new_site/
|
||||
---
|
||||
## hugo new site
|
||||
|
||||
Create a new site (skeleton)
|
||||
Create a new site
|
||||
|
||||
### Synopsis
|
||||
|
||||
Create a new site in the provided directory.
|
||||
The new site will have the correct structure, but no content or theme yet.
|
||||
Use `hugo new [contentPath]` to create new content.
|
||||
Create a new site at the specified path.
|
||||
|
||||
```
|
||||
hugo new site [path] [flags]
|
||||
|
||||
@@ -5,14 +5,12 @@ url: /commands/hugo_new_theme/
|
||||
---
|
||||
## hugo new theme
|
||||
|
||||
Create a new theme (skeleton)
|
||||
Create a new theme
|
||||
|
||||
### Synopsis
|
||||
|
||||
Create a new theme (skeleton) called [name] in ./themes.
|
||||
New theme is a skeleton. Please add content to the touched files. Add your
|
||||
name to the copyright line in the license and adjust the theme.toml file
|
||||
according to your needs.
|
||||
Create a new theme with the specified name in the ./themes directory.
|
||||
This generates a functional theme including template examples and sample content.
|
||||
|
||||
```
|
||||
hugo new theme [name] [flags]
|
||||
@@ -21,7 +19,8 @@ hugo new theme [name] [flags]
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for theme
|
||||
--format string preferred file format (toml, yaml or json) (default "toml")
|
||||
-h, --help help for theme
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
@@ -47,7 +47,7 @@ cascade
|
||||
: See [configure cascade](/configuration/cascade/).
|
||||
|
||||
cleanDestinationDir
|
||||
: (`bool`) Whether to remove files from the site's destination directory that do not have corresponding files in the `static` directory during the build. Default is `false`.
|
||||
: (`bool`) Whether to remove files from the [`publishDir`](#publishdir) that do not exist in the [`staticDir`](#staticdir) when building the site. This setting will not take effect if the `staticDir` does not exist. Note that `.gitignore` and `.gitattributes` files, along with directories named `.git`, are always preserved in the `publishDir`. Default is `false`.
|
||||
|
||||
contentDir
|
||||
: (`string`) The designated directory for content files. Default is `content`. {{% module-mounts-note %}}
|
||||
@@ -262,7 +262,7 @@ staticDir
|
||||
: (`string`) The designated directory for static files. Default is `static`. {{% module-mounts-note %}}
|
||||
|
||||
summaryLength
|
||||
: (`int`) Applicable to [automatic summaries], the minimum number of words returned by the [`Summary`] method on a `Page` object. The `Summary` method will return content truncated at the paragraph boundary closest to the specified `summaryLength`, but at least this minimum number of words.
|
||||
: (`int`) Applicable to [automatic summaries], the minimum number of words returned by the [`Summary`] method on a `Page` object. The `Summary` method will return content truncated at the paragraph boundary closest to the specified `summaryLength`, but at least this minimum number of words. Default is `70`.
|
||||
|
||||
taxonomies
|
||||
: See [configure taxonomies](/configuration/taxonomies/).
|
||||
@@ -350,9 +350,9 @@ Some configuration settings, such as menus and custom parameters, can be defined
|
||||
[Chicago Manual of Style]: https://www.chicagomanualofstyle.org/home.html
|
||||
[default front matter configuration]: /configuration/front-matter/
|
||||
[duration]: https://pkg.go.dev/time#Duration
|
||||
[embedded alias template]: {{% eturl alias %}}
|
||||
[embedded Open Graph template]: {{% eturl opengraph %}}
|
||||
[embedded RSS template]: {{% eturl rss %}}
|
||||
[embedded alias template]: <{{% eturl alias %}}>
|
||||
[embedded Open Graph template]: <{{% eturl opengraph %}}>
|
||||
[embedded RSS template]: <{{% eturl rss %}}>
|
||||
[IANA Time Zone Database]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
[module mounts]: /configuration/module/#mounts
|
||||
[os.UserCacheDir]: https://pkg.go.dev/os#UserCacheDir
|
||||
|
||||
@@ -14,7 +14,6 @@ You can configure your site to cascade front matter values to the home page and
|
||||
For example, to cascade a "color" parameter to the home page and all its descendants:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
title = 'Home'
|
||||
[cascade.params]
|
||||
color = 'red'
|
||||
{{< /code-toggle >}}
|
||||
@@ -61,14 +60,14 @@ Define an array of cascade parameters to apply different values to different tar
|
||||
[cascade.params]
|
||||
color = 'red'
|
||||
[cascade.target]
|
||||
path = '{/books/**}'
|
||||
path = '/books/**'
|
||||
kind = 'page'
|
||||
lang = '{en,de}'
|
||||
[[cascade]]
|
||||
[cascade.params]
|
||||
color = 'blue'
|
||||
[cascade.target]
|
||||
path = '{/films/**}'
|
||||
path = '/films/**'
|
||||
kind = 'page'
|
||||
environment = 'production'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
@@ -90,10 +90,11 @@ Consider this site configuration:
|
||||
{{< code-toggle file=hugo >}}
|
||||
[frontmatter]
|
||||
date = [':filename', ':default']
|
||||
publishDate = [':filename', ':default']
|
||||
lastmod = ['lastmod', ':fileModTime']
|
||||
{{< /code-toggle >}}
|
||||
|
||||
To determine `date`, Hugo tries to extract the date from the file name, falling back to the default ordered sequence of date fields.
|
||||
To determine `date` and `publishDate`, Hugo tries to extract the value from the file name, falling back to the default ordered sequence of date fields.
|
||||
|
||||
To determine `lastmod`, Hugo looks for a `lastmod` field in front matter, falling back to the file's last modification timestamp.
|
||||
|
||||
|
||||
@@ -44,20 +44,42 @@ The HTTP cache involves two key aspects: determining which content to cache (the
|
||||
|
||||
The HTTP cache behavior is defined for a configured set of resources. Stale resources will be refreshed from the file cache, even if their configured Time-To-Live (TTL) has not expired. If HTTP caching is disabled for a resource, Hugo will bypass the cache and access the file directly.
|
||||
|
||||
The default configuration disables everything:
|
||||
This is the default configuration for HTTP caching:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[HTTPCache.cache.for]
|
||||
excludes = ['**']
|
||||
includes = []
|
||||
{{< /code-toggle >}}
|
||||
{{< code-toggle config=HTTPCache />}}
|
||||
|
||||
respectCacheControlNoStoreInRequest
|
||||
: {{< new-in 0.151.0 />}}
|
||||
: (`bool`) Whether to respect the `no-store` directive in the server's `Cache-Control` request header when fetching remote resources via the [`resources.GetRemote`][] function. Default is `true`.
|
||||
|
||||
respectCacheControlNoStoreInResponse
|
||||
: {{< new-in 0.151.0 />}}
|
||||
: (`bool`) Whether to respect the `no-store` directive in the server's `Cache-Control` response header when fetching remote resources via the [`resources.GetRemote`][] function. Default is `false`.
|
||||
|
||||
cache.for.excludes
|
||||
: (`string`) A list of [glob](g) patterns to exclude from caching.
|
||||
: (`string`) A list of [glob](g) patterns to exclude from caching. In its default configuration HTTP caching excludes all files.
|
||||
|
||||
cache.for.includes
|
||||
: (`string`) A list of [glob](g) patterns to cache.
|
||||
|
||||
polls
|
||||
: A slice of polling configurations.
|
||||
|
||||
polls.disable
|
||||
: (`bool`) Whether to disable polling for this configuration. Default is `true`.
|
||||
|
||||
polls.high
|
||||
: (`string`) The maximum polling interval expressed as a [duration](g). This is used when the resource is considered stable. Default is `0s`.
|
||||
|
||||
polls.low
|
||||
: (`string`) The minimum polling interval expressed as a [duration](g). This is used after a recent change and gradually increases towards `polls.high`. Default is `0s`.
|
||||
|
||||
polls.for.excludes
|
||||
: (`string`) A list of [glob](g) patterns to exclude from polling for this configuration.
|
||||
|
||||
polls.for.includes
|
||||
: (`string`) A list of [glob](g) patterns to include in polling for this configuration.
|
||||
|
||||
## HTTP polling
|
||||
|
||||
Polling is used in watch mode (e.g., `hugo server`) to detect changes in remote resources. Polling can be enabled even if HTTP caching is disabled. Detected changes trigger a rebuild of pages using the affected resource. Polling can be disabled for specific resources, typically those known to be static.
|
||||
@@ -78,13 +100,13 @@ polls
|
||||
: A slice of polling configurations.
|
||||
|
||||
polls.disable
|
||||
: (`bool`) Whether to disable polling for this configuration.
|
||||
|
||||
polls.low
|
||||
: (`string`) The minimum polling interval expressed as a [duration](g). This is used after a recent change and gradually increases towards `polls.high`.
|
||||
: (`bool`) Whether to disable polling for this configuration. Default is `true`.
|
||||
|
||||
polls.high
|
||||
: (`string`) The maximum polling interval expressed as a [duration](g). This is used when the resource is considered stable.
|
||||
: (`string`) The maximum polling interval expressed as a [duration](g). This is used when the resource is considered stable. Default is `0s`.
|
||||
|
||||
polls.low
|
||||
: (`string`) The minimum polling interval expressed as a [duration](g). This is used after a recent change and gradually increases towards `polls.high`. Default is `0s`.
|
||||
|
||||
polls.for.excludes
|
||||
: (`string`) A list of [glob](g) patterns to exclude from polling for this configuration.
|
||||
|
||||
@@ -185,9 +185,9 @@ public
|
||||
[`Language.LanguageName`]: /methods/site/language/#languagename
|
||||
[`Language.Weight`]: /methods/site/language/#weight
|
||||
[`Title`]: /methods/site/title/
|
||||
[embedded alias template]: {{% eturl alias %}}
|
||||
[embedded OpenGraph template]: {{% eturl opengraph %}}
|
||||
[embedded RSS template]: {{% eturl rss %}}
|
||||
[embedded alias template]: <{{% eturl alias %}}>
|
||||
[embedded OpenGraph template]: <{{% eturl opengraph %}}>
|
||||
[embedded RSS template]: <{{% eturl rss %}}>
|
||||
[RFC 5646]: https://datatracker.ietf.org/doc/html/rfc5646#section-2.1
|
||||
[RFC 5646 § 2.2.7]: https://datatracker.ietf.org/doc/html/rfc5646#section-2.2.7
|
||||
[translating by file name]: /content-management/multilingual/#translation-by-file-name
|
||||
|
||||
@@ -94,9 +94,23 @@ enable = true
|
||||
|
||||
With this configuration, to format text as deleted, wrap it with double-tildes.
|
||||
|
||||
#### Passthrough
|
||||
#### Footnote
|
||||
|
||||
{{< new-in 0.122.0 />}}
|
||||
Enabled by default, the Footnote extension enables inclusion of footnotes in Markdown.
|
||||
|
||||
enable
|
||||
: {{< new-in 0.151.0 />}}
|
||||
: (`bool`) Whether to enable the Footnotes extension. Default is `true`.
|
||||
|
||||
backlinkHTML
|
||||
: {{< new-in 0.151.0 />}}
|
||||
: (`string`) The HTML to be displayed at the end of a footnote that links the user back to the corresponding reference in the main text. The default is ↩︎ (a return arrow symbol).
|
||||
|
||||
enableAutoIDPrefix
|
||||
: {{< new-in 0.151.0 />}}
|
||||
: (`bool`) Whether to prepend a unique prefix to footnote IDs, preventing clashes when multiple documents are rendered together. This prefix is unique to each logical path, which means that the prefix is not unique across content dimensions such as language. Default is `false`.
|
||||
|
||||
#### Passthrough
|
||||
|
||||
Enable the Passthrough extension to include mathematical equations and expressions in Markdown using LaTeX markup. See [mathematics in Markdown] for details.
|
||||
|
||||
@@ -202,7 +216,7 @@ backend
|
||||
: (`string`) The backend output file format. Default is `html5`.
|
||||
|
||||
extensions
|
||||
: (`string array`) An array of enabled extensions, one or more of `asciidoctor-html5s`, `asciidoctor-bibtex`, `asciidoctor-diagram`, `asciidoctor-interdoc-reftext`, `asciidoctor-katex`, `asciidoctor-latex`, `asciidoctor-mathematical`, or `asciidoctor-question`.
|
||||
: (`string array`) An array of enabled extensions, such as `asciidoctor-html5s`, `asciidoctor-bibtex`, or `asciidoctor-diagram`.
|
||||
|
||||
> [!note]
|
||||
> To mitigate security risks, entries in the extension array may not contain forward slashes (`/`), backslashes (`\`), or periods. Due to this restriction, extensions must be in Ruby's `$LOAD_PATH`.
|
||||
|
||||
@@ -10,6 +10,11 @@ This is the default configuration:
|
||||
|
||||
{{< code-toggle config=minify />}}
|
||||
|
||||
See the [tdewolff/minify] project page for details.
|
||||
See the [tdewolff/minify] project page for details, but note the following:
|
||||
|
||||
- `css.inline` is for internal use. Changing this setting has no effect.
|
||||
- `css.keepCSS2` has been deprecated. Use `css.version` instead.
|
||||
- `html.keepConditionalComments` has been deprecated. Use `html.keepSpecialComments` instead.
|
||||
- `svg.inline` is for internal use. Changing this setting has no effect.
|
||||
|
||||
[tdewolff/minify]: https://github.com/tdewolff/minify
|
||||
|
||||
@@ -7,6 +7,8 @@ keywords: []
|
||||
aliases: [/hugo-modules/configuration/]
|
||||
---
|
||||
|
||||
{{% include "/_common/gomodules-info.md" %}}
|
||||
|
||||
## Top-level options
|
||||
|
||||
This is the default configuration:
|
||||
@@ -40,7 +42,7 @@ proxy
|
||||
: (`string`) The proxy server to use to download remote modules. Default is `direct`, which means `git clone` and similar.
|
||||
|
||||
replacements
|
||||
: (`string`) Primarily useful for local module development, a comma-separated list of mappings from module paths to directories. Paths may be absolute or relative to the [`themesDir`].
|
||||
: (`string`) Primarily useful for local module development, a comma-separated list of mappings from module paths to directories. Paths may be absolute or relative to the [`themesDir`][].
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[module]
|
||||
@@ -61,8 +63,6 @@ export HUGO_MODULE_REPLACEMENTS="github.com/bep/my-theme -> ../.."
|
||||
export HUGO_MODULE_WORKSPACE="/my/hugo.work"
|
||||
```
|
||||
|
||||
{{% include "/_common/gomodules-info.md" %}}
|
||||
|
||||
## Hugo version
|
||||
|
||||
You can specify a required Hugo version for your module in the `module` section. Users will then receive a warning if their Hugo version is incompatible.
|
||||
@@ -77,7 +77,7 @@ extended
|
||||
: (`bool`) Whether the extended edition of Hugo is required, satisfied by installing either the extended or extended/deploy edition.
|
||||
|
||||
max
|
||||
: (`string`) The maximum Hugo version supported, for example `0.148.0`.
|
||||
: (`string`) The maximum Hugo version supported, for example `0.152.2`.
|
||||
|
||||
min
|
||||
: (`string`) The minimum Hugo version supported, for example `0.102.0`.
|
||||
@@ -110,32 +110,36 @@ noVendor
|
||||
: (`bool`) Whether to disable vendoring for this import. This setting is restricted to the main project. Default is `false`.
|
||||
|
||||
path
|
||||
: (`string`) The module path, either a valid Go module path (e.g., `github.com/gohugoio/myShortcodes`) or the directory name if stored in the [`themesDir`].
|
||||
: (`string`) The module path, either a valid Go module path (e.g., `github.com/gohugoio/myShortcodes`) or the directory name if stored in the [`themesDir`][].
|
||||
|
||||
{{% include "/_common/gomodules-info.md" %}}
|
||||
version
|
||||
: {{< new-in 0.150.0 />}}
|
||||
: If set to a [version query](https://go.dev/ref/mod#version-queries), this import becomes a direct dependency, in contrast to dependencies managed by Go Modules. See [this issue](https://github.com/gohugoio/hugo/pull/13966) for more information.
|
||||
|
||||
## Mounts
|
||||
|
||||
Before Hugo v0.56.0, custom component paths could only be configured by setting [`archetypeDir`], [`assetDir`], [`contentDir`], [`dataDir`], [`i18nDir`], [`layoutDi`], or [`staticDir`] in the site configuration. Module mounts offer greater flexibility than these legacy settings, but
|
||||
you cannot use both.
|
||||
{{% glossary-term mount %}}
|
||||
|
||||
[`archetypeDir`]: /configuration/all/
|
||||
[`assetDir`]: /configuration/all/
|
||||
[`contentDir`]: /configuration/all/
|
||||
[`dataDir`]: /configuration/all/
|
||||
[`i18nDir`]: /configuration/all/
|
||||
[`layoutDi`]: /configuration/all/
|
||||
[`staticDir`]: /configuration/all/
|
||||
> [!important]
|
||||
> If you define one or more mounts to map a file system path to a component path, do not use these legacy configuration settings: [`archetypeDir`][], [`assetDir`][], [`contentDir`][], [`dataDir`][], [`i18nDir`][], [`layoutDir`][], or [`staticDir`][].
|
||||
|
||||
> [!note]
|
||||
> If you use module mounts do not use the legacy settings.
|
||||
[`archetypeDir`]: /configuration/all/#archetypedir
|
||||
[`assetDir`]: /configuration/all/#assetdir
|
||||
[`contentDir`]: /configuration/all/#contentdir
|
||||
[`dataDir`]: /configuration/all/#datadir
|
||||
[`i18nDir`]: /configuration/all/#i18ndir
|
||||
[`layoutDir`]: /configuration/all/#layoutdir
|
||||
[`staticDir`]: /configuration/all/#staticdir
|
||||
|
||||
### Default mounts
|
||||
|
||||
> [!note]
|
||||
> Adding a new mount to a target root will cause the existing default mount for that root to be ignored. If you still need the default mount, you must explicitly add it along with the new mount.
|
||||
Within a project, if you define a mount to map a file system path to a component path, the corresponding default mount for that component will be removed. This action essentially overwrites the standard, automatic mapping for that specific component with your custom one.
|
||||
|
||||
The are the default mounts:
|
||||
Within a module, if you define a mount to map a file system path to a component path, all of the default mounts will be removed. Defining a mount at the module level is a more sweeping change, causing all default mappings within that module to be discarded.
|
||||
|
||||
In either case, if you still need one of the default mounts, you must explicitly add it along with the new mount. Because custom mounts override defaults, any necessary default mappings must be re-added manually after you introduce your custom configuration.
|
||||
|
||||
These are the default mounts:
|
||||
|
||||
{{< code-toggle config=module.mounts />}}
|
||||
|
||||
@@ -143,7 +147,7 @@ source
|
||||
: (`string`) The source directory of the mount. For the main project, this can be either project-relative or absolute. For other modules it must be project-relative.
|
||||
|
||||
target
|
||||
: (`string`) Where the mount will reside within Hugo's virtual file system. It must begin with one of Hugo's component directories: `archetypes`, `assets`, `content`, `data`, `i18n`, `layouts`, or `static`. For example, `content/blog`.
|
||||
: (`string`) Where the mount will reside within Hugo's [unified file system](g). It must begin with one of Hugo's [component](g) directories: archetypes, assets, content, data, i18n, layouts, or static. For example, content/blog.
|
||||
|
||||
disableWatch
|
||||
: {{< new-in 0.128.0 />}}
|
||||
|
||||
@@ -44,7 +44,7 @@ archetypes/
|
||||
|
||||
Hugo looks for archetypes in the `archetypes` directory in the root of your project, falling back to the `archetypes` directory in themes or installed modules. An archetype for a specific content type takes precedence over the default archetype.
|
||||
|
||||
For example, with this command:
|
||||
For example, if you have enabled a theme named `my-theme` and you run this command:
|
||||
|
||||
```sh
|
||||
hugo new content posts/my-first-post.md
|
||||
@@ -53,8 +53,8 @@ hugo new content posts/my-first-post.md
|
||||
The archetype lookup order is:
|
||||
|
||||
1. `archetypes/posts.md`
|
||||
1. `archetypes/default.md`
|
||||
1. `themes/my-theme/archetypes/posts.md`
|
||||
1. `archetypes/default.md`
|
||||
1. `themes/my-theme/archetypes/default.md`
|
||||
|
||||
If none of these exists, Hugo uses a built-in default archetype.
|
||||
|
||||
@@ -256,5 +256,5 @@ Created from <https://arthursonzogni.com/Diagon/#Tree>
|
||||
```
|
||||
|
||||
[code block render hook]: /render-hooks/code-blocks/
|
||||
[embedded code block render hook]: {{% eturl render-codeblock-goat %}}
|
||||
[embedded code block render hook]: <{{% eturl render-codeblock-goat %}}>
|
||||
[GoAT]: https://github.com/bep/goat
|
||||
|
||||
@@ -47,7 +47,7 @@ build
|
||||
: (`map`) A map of [build options].
|
||||
|
||||
cascade
|
||||
: (`map`) A map of front matter keys whose values are passed down to the page's descendants unless overwritten by self or a closer ancestor's cascade. See the [cascade] section for details.
|
||||
: (`map`) A map (or a slice of maps) of front matter keys whose values are passed down to the page's descendants unless overwritten by self or a closer ancestor's cascade. See the [cascade] section for details.
|
||||
|
||||
date
|
||||
: (`string`) The date associated with the page, typically the creation date. Note that the TOML format also supports unquoted date/time values. See the [dates](#dates) section for examples. Access this value from a template using the [`Date`] method on a `Page` object.
|
||||
@@ -322,18 +322,18 @@ To override the default time zone, set the [`timeZone`](/configuration/all/#time
|
||||
[`lastmod`]: /methods/page/date/
|
||||
[`layout`]: /methods/page/layout/
|
||||
[`linktitle`]: /methods/page/linktitle/
|
||||
[`opengraph.html`]: {{% eturl opengraph %}}
|
||||
[`opengraph.html`]: <{{% eturl opengraph %}}>
|
||||
[`Param`]: /methods/page/param/
|
||||
[`Params`]: /methods/page/params/
|
||||
[`publishdate`]: /methods/page/publishdate/
|
||||
[`readingtime`]: /methods/page/readingtime/
|
||||
[`schema.html`]: {{% eturl schema %}}
|
||||
[`schema.html`]: <{{% eturl schema %}}>
|
||||
[`sitemap`]: /methods/page/sitemap/
|
||||
[`slug`]: /methods/page/slug/
|
||||
[`Summary`]: /methods/page/summary/
|
||||
[`title`]: /methods/page/title/
|
||||
[`translationkey`]: /methods/page/translationkey/
|
||||
[`twitter_cards.html`]: {{% eturl twitter_cards %}}
|
||||
[`twitter_cards.html`]: <{{% eturl twitter_cards %}}>
|
||||
[`type`]: /methods/page/type/
|
||||
[`weight`]: /methods/page/weight/
|
||||
[`wordcount`]: /methods/page/wordcount/
|
||||
|
||||
@@ -105,8 +105,6 @@ The `image` resource implements the [`Process`], [`Resize`], [`Fit`], [`Fill`]
|
||||
|
||||
### Process
|
||||
|
||||
{{< new-in 0.119.0 />}}
|
||||
|
||||
> [!note]
|
||||
> The `Process` method is also available as a filter, which is more effective if you need to apply multiple filters to an image. See [Process filter](/functions/images/process).
|
||||
|
||||
|
||||
@@ -6,13 +6,11 @@ categories: []
|
||||
keywords: []
|
||||
---
|
||||
|
||||
{{< new-in 0.122.0 />}}
|
||||
|
||||
## Overview
|
||||
|
||||
Mathematical equations and expressions written in [LaTeX] are common in academic and scientific publications. Your browser typically renders this mathematical markup using an open-source JavaScript display engine such as [MathJax] or [KaTeX].
|
||||
Mathematical equations and expressions written in [LaTeX][] are common in academic and scientific publications. Your browser typically renders this mathematical markup using an open-source JavaScript display engine such as [MathJax][] or [KaTeX][].
|
||||
|
||||
For example, with this LaTeX markup:
|
||||
For example, this LaTeX markup:
|
||||
|
||||
```text
|
||||
\[
|
||||
@@ -23,7 +21,7 @@ JS(\hat{y} || y) &= \frac{1}{2}(KL(y||\frac{y+\hat{y}}{2}) + KL(\hat{y}||\frac{y
|
||||
\]
|
||||
```
|
||||
|
||||
The MathJax display engine renders this:
|
||||
Is rendered to:
|
||||
|
||||
\[
|
||||
\begin{aligned}
|
||||
@@ -37,7 +35,7 @@ Equations and expressions can be displayed inline with other text, or as standal
|
||||
Whether an equation or expression appears inline, or as a block, depends on the delimiters that surround the mathematical markup. Delimiters are defined in pairs, where each pair consists of an opening and closing delimiter. The opening and closing delimiters may be the same, or different.
|
||||
|
||||
> [!note]
|
||||
> You can configure Hugo to render mathematical markup on the client side using the MathJax or KaTeX display engine, or you can render the markup with the [`transform.ToMath`] function while building your site.
|
||||
> You can configure Hugo to render mathematical markup on the client side using the MathJax or KaTeX display engine, or you can render the markup with the [`transform.ToMath`][] function while building your site.
|
||||
>
|
||||
> The first approach is described below.
|
||||
|
||||
@@ -46,7 +44,7 @@ Whether an equation or expression appears inline, or as a block, depends on the
|
||||
Follow these instructions to include mathematical equations and expressions in your Markdown using LaTeX markup.
|
||||
|
||||
Step 1
|
||||
: Enable and configure the Goldmark [passthrough extension] in your site configuration. The passthrough extension preserves raw Markdown within delimited snippets of text, including the delimiters themselves.
|
||||
: Enable and configure the Goldmark [passthrough extension][] in your site configuration. The passthrough extension preserves raw Markdown within delimited snippets of text, including the delimiters themselves.
|
||||
|
||||
{{< code-toggle file=hugo copy=true >}}
|
||||
[markup.goldmark.extensions.passthrough]
|
||||
@@ -60,12 +58,12 @@ Step 1
|
||||
math = true
|
||||
{{< /code-toggle >}}
|
||||
|
||||
The configuration above enables mathematical rendering on every page unless you set the `math` parameter to `false` in front matter. To enable mathematical rendering as needed, set the `math` parameter to `false` in your site configuration, and set the `math` parameter to `true` in front matter. Use this parameter in your base template as shown in [Step 3](#step-3).
|
||||
The configuration above enables mathematical rendering on every page unless you set the `math` parameter to `false` in front matter. To enable mathematical rendering as needed, set the `math` parameter to `false` in your site configuration, and set the `math` parameter to `true` in front matter. Use this parameter in your base template as shown in [Step 3][].
|
||||
|
||||
> [!note]
|
||||
> The configuration above precludes the use of the `$...$` delimiter pair for inline equations. Although you can add this delimiter pair to the configuration and JavaScript, you must double-escape the `$` symbol when used outside of math contexts to avoid unintended formatting.
|
||||
>
|
||||
> See the [inline delimiters](#inline-delimiters) section for details.
|
||||
> See the [inline delimiters][] section for details.
|
||||
|
||||
To disable passthrough of inline snippets, omit the `inline` key from the configuration:
|
||||
|
||||
@@ -74,7 +72,7 @@ Step 1
|
||||
block = [['\[', '\]'], ['$$', '$$']]
|
||||
{{< /code-toggle >}}
|
||||
|
||||
You can define your own opening and closing delimiters, provided they match the delimiters that you set in [Step 2].
|
||||
You can define your own opening and closing delimiters, provided they match the delimiters that you set in [Step 2][].
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[markup.goldmark.extensions.passthrough.delimiters]
|
||||
@@ -83,10 +81,11 @@ Step 1
|
||||
{{< /code-toggle >}}
|
||||
|
||||
Step 2
|
||||
: Create a _partial_ template to load MathJax or KaTeX. The example below loads MathJax, or you can use KaTeX as described in the [engines](#engines) section.
|
||||
: Create a _partial_ template to load MathJax or KaTeX. The example below loads MathJax, or you can use KaTeX as described in the [engines][] section.
|
||||
|
||||
```go-html-template {file="layouts/_partials/math.html" copy=true}
|
||||
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
|
||||
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js"></script>
|
||||
|
||||
<script>
|
||||
MathJax = {
|
||||
tex: {
|
||||
@@ -165,35 +164,35 @@ I will give you \\$2 if you can solve $y = x^2$.
|
||||
```
|
||||
|
||||
> [!note]
|
||||
> If you use the `$...$` delimiter pair for inline equations, and occasionally use the `$` symbol outside of math contexts, you must use MathJax instead of KaTeX to avoid unintended formatting caused by [this KaTeX limitation](https://github.com/KaTeX/KaTeX/issues/437).
|
||||
> If you use the `$...$` delimiter pair for inline equations, and occasionally use the `$` symbol outside of math contexts, you must use MathJax instead of KaTeX to avoid unintended formatting caused by [this KaTeX limitation][].
|
||||
|
||||
## Engines
|
||||
|
||||
MathJax and KaTeX are open-source JavaScript display engines. Both engines are fast, but at the time of this writing MathJax v3.2.2 is slightly faster than KaTeX v0.16.11.
|
||||
MathJax and KaTeX are open-source JavaScript display engines.
|
||||
|
||||
> [!note]
|
||||
> If you use the `$...$` delimiter pair for inline equations, and occasionally use the `$` symbol outside of math contexts, you must use MathJax instead of KaTeX to avoid unintended formatting caused by [this KaTeX limitation](https://github.com/KaTeX/KaTeX/issues/437).
|
||||
> If you use the `$...$` delimiter pair for inline equations, and occasionally use the `$` symbol outside of math contexts, you must use MathJax instead of KaTeX to avoid unintended formatting caused by [this KaTeX limitation][].
|
||||
>
|
||||
>See the [inline delimiters](#inline-delimiters) section for details.
|
||||
>See the [inline delimiters][] section for details.
|
||||
|
||||
To use KaTeX instead of MathJax, replace the _partial_ template from [Step 2] with this:
|
||||
To use KaTeX instead of MathJax, replace the _partial_ template from [Step 2][] with this:
|
||||
|
||||
```go-html-template {file="layouts/_partials/math.html" copy=true}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/katex@0.16.21/dist/katex.min.css"
|
||||
integrity="sha384-zh0CIslj+VczCZtlzBcjt5ppRcsAmDnRem7ESsYwWwg3m/OaJ2l4x7YBZl9Kxxib"
|
||||
href="https://cdn.jsdelivr.net/npm/katex@0.16.25/dist/katex.min.css"
|
||||
integrity="sha384-WcoG4HRXMzYzfCgiyfrySxx90XSl2rxY5mnVY5TwtWE6KLrArNKn0T/mOgNL0Mmi"
|
||||
crossorigin="anonymous"
|
||||
>
|
||||
<script
|
||||
defer
|
||||
src="https://cdn.jsdelivr.net/npm/katex@0.16.21/dist/katex.min.js"
|
||||
integrity="sha384-Rma6DA2IPUwhNxmrB/7S3Tno0YY7sFu9WSYMCuulLhIqYSGZ2gKCJWIqhBWqMQfh"
|
||||
src="https://cdn.jsdelivr.net/npm/katex@0.16.25/dist/katex.min.js"
|
||||
integrity="sha384-J+9dG2KMoiR9hqcFao0IBLwxt6zpcyN68IgwzsCSkbreXUjmNVRhPFTssqdSGjwQ"
|
||||
crossorigin="anonymous">
|
||||
</script>
|
||||
<script
|
||||
defer
|
||||
src="https://cdn.jsdelivr.net/npm/katex@0.16.21/dist/contrib/auto-render.min.js"
|
||||
src="https://cdn.jsdelivr.net/npm/katex@0.16.25/dist/contrib/auto-render.min.js"
|
||||
integrity="sha384-hCXGrW6PitJEwbkoStFjeJxv+fSOOQKOPbJxSfM6G5sWZjAyWhXiTIIAmQqnlLlh"
|
||||
crossorigin="anonymous"
|
||||
onload="renderMathInElement(document.body);">
|
||||
@@ -224,10 +223,15 @@ $$C_p[\ce{H2O(l)}] = \pu{75.3 J // mol K}$$
|
||||
|
||||
$$C_p[\ce{H2O(l)}] = \pu{75.3 J // mol K}$$
|
||||
|
||||
As shown in [Step 2](#step-2) above, MathJax supports chemical equations without additional configuration. To add chemistry support to KaTeX, enable the mhchem extension as described in the KaTeX [documentation](https://katex.org/docs/libs).
|
||||
As shown in [Step 2][] above, MathJax supports chemical equations without additional configuration. To add chemistry support to KaTeX, enable the mhchem extension as described in the KaTeX [documentation](https://katex.org/docs/libs).
|
||||
|
||||
[`transform.ToMath`]: /functions/transform/tomath/
|
||||
[engines]: #engines
|
||||
[inline delimiters]: #inline-delimiters
|
||||
[KaTeX]: https://katex.org/
|
||||
[LaTeX]: https://www.latex-project.org/
|
||||
[MathJax]: https://www.mathjax.org/
|
||||
[passthrough extension]: /configuration/markup/#passthrough
|
||||
[Step 2]: #step-2
|
||||
[Step 3]: #step-3
|
||||
[this KaTeX limitation]: https://github.com/KaTeX/KaTeX/issues/437
|
||||
|
||||
@@ -9,7 +9,7 @@ aliases: [/content/sections/]
|
||||
|
||||
## Page bundles
|
||||
|
||||
Hugo `0.32` announced page-relative images and other resources packaged into `Page Bundles`.
|
||||
Hugo supports page-relative images and other resources packaged into `Page Bundles`.
|
||||
|
||||
These terms are connected, and you also need to read about [Page Resources](/content-management/page-resources) and [Image Processing](/content-management/image-processing) to get the full picture.
|
||||
|
||||
|
||||
@@ -33,6 +33,35 @@ This is the first paragraph.
|
||||
This is the second paragraph.
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Place the summary divider on its own line. Do not place it inline with other content.
|
||||
|
||||
Correct placement:
|
||||
|
||||
```text {file="content/example.md"}
|
||||
---
|
||||
title: 'Example'
|
||||
---
|
||||
|
||||
This is an example of **strong text** in a sentence. This is another sentence.
|
||||
|
||||
<!--more-->
|
||||
|
||||
This is another paragraph.
|
||||
```
|
||||
|
||||
Incorrect placement:
|
||||
|
||||
```text {file="content/example.md"}
|
||||
---
|
||||
title: 'Example'
|
||||
---
|
||||
|
||||
This is an example of **strong text** <!--more--> in a sentence. This is another sentence.
|
||||
|
||||
This is another paragraph.
|
||||
```
|
||||
|
||||
When using the Emacs Org Mode [content format], use a `# more` divider to indicate the end of the summary.
|
||||
|
||||
[content format]: /content-management/formats/
|
||||
@@ -79,6 +108,9 @@ For example, with a `summaryLength` of 7, the automatic summary will be:
|
||||
<p>This is the second paragraph.</p>
|
||||
```
|
||||
|
||||
> [!warning]
|
||||
> Automatic `.Summary` may cut block tags (e.g., `blockquote`) in the middle when `summaryLength` is reached, causing the browser to recover the end tag (the end tag will be inserted before the parent's end tag), resulting in unexpected rendering behavior. To avoid this, wrap `.Summary` in a `<div>`; alternatively, wrap it together with the heading tag using `<section>`. You can avoid this entirely by using a manual summary. See issue [#14044] for details.
|
||||
|
||||
## Comparison
|
||||
|
||||
Each summary type has different characteristics:
|
||||
@@ -121,3 +153,5 @@ Instead of calling the `Summary` method on a `Page` object, use the [`strings.Tr
|
||||
</div>
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
[#14044]: https://github.com/gohugoio/hugo/issues/14044
|
||||
|
||||
@@ -90,23 +90,20 @@ tags = ['Tag A','Tag B']
|
||||
categories = ['Category A','Category B']
|
||||
{{< /code-toggle >}}
|
||||
|
||||
## Order taxonomies
|
||||
## Taxonomic weight
|
||||
|
||||
A content file can assign weight for each of its associate taxonomies. Taxonomic weight can be used for sorting or ordering content in taxonomy templates and is declared in a content file's front matter. The convention for declaring taxonomic weight is `taxonomyname_weight`.
|
||||
{{% glossary-term "taxonomic weight" %}}
|
||||
|
||||
The following show a piece of content that has a weight of 22, which can be used for ordering purposes when rendering the pages assigned to the "a", "b" and "c" values of the `tags` taxonomy. It has also been assigned the weight of 44 when rendering the "d" category page.
|
||||
Assign a taxonomic weight using a front matter key named `[taxonomy_name]_weight`.
|
||||
|
||||
### Example: taxonomic `weight`
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
title = "foo"
|
||||
tags = [ "a", "b", "c" ]
|
||||
tags_weight = 22
|
||||
categories = ["d"]
|
||||
categories_weight = 44
|
||||
{{< code-toggle file="content/courses/organic-chemistry.md" fm=true >}}
|
||||
title = 'Organic Chemistry'
|
||||
weight = 10
|
||||
tags_weight = 1000
|
||||
tags = ['chemistry','science']
|
||||
{{</ code-toggle >}}
|
||||
|
||||
By using taxonomic weight, the same piece of content can appear in different positions in different taxonomies.
|
||||
With the front matter above, the "Organic Chemistry" page will float towards the top of the list on section and home pages, and it will sink towards the bottom of the list on the "chemistry" and "science" term pages.
|
||||
|
||||
## Metadata
|
||||
|
||||
|
||||
@@ -235,18 +235,15 @@ The alias from the previous URL to the new URL is a client-side redirect:
|
||||
<head>
|
||||
<title>https://example.org/posts/new-file-name/</title>
|
||||
<link rel="canonical" href="https://example.org/posts/new-file-name/">
|
||||
<meta name="robots" content="noindex">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://example.org/posts/new-file-name/">
|
||||
</head>
|
||||
</html>
|
||||
```
|
||||
|
||||
Collectively, the elements in the `head` section:
|
||||
The `link rel="canonical"` tag informs search engines that the new URL is the preferred or "canonical" version of the page. This is crucial for SEO, as it prevents issues with duplicate content by consolidating all ranking signals to a single URL.
|
||||
|
||||
- Tell search engines that the new URL is canonical
|
||||
- Tell search engines not to index the previous URL
|
||||
- Tell the browser to redirect to the new URL
|
||||
The `http-equiv="refresh"` meta tag instructs the web browser to automatically redirect the user to the new URL. This ensures that anyone who accesses the old alias URL is seamlessly taken to the correct, updated page.
|
||||
|
||||
Hugo renders alias files before rendering pages. A new page with the previous file name will overwrite the alias, as expected.
|
||||
|
||||
@@ -263,4 +260,4 @@ Page
|
||||
[`baseURL`]: /configuration/all/#baseurl
|
||||
[removed in a future release]: https://github.com/gohugoio/hugo/issues/4733
|
||||
[reserved characters]: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
|
||||
[source code]: {{% eturl alias %}}
|
||||
[source code]: <{{% eturl alias %}}>
|
||||
|
||||
@@ -32,7 +32,7 @@ For a complete guide to contributing to Hugo, see the [Contribution Guide].
|
||||
To build the extended or extended/deploy edition from source you must:
|
||||
|
||||
1. Install [Git]
|
||||
1. Install [Go] version 1.23.0 or later
|
||||
1. Install [Go] version 1.24.0 or later
|
||||
1. Install a C compiler, either [GCC] or [Clang]
|
||||
1. Update your `PATH` environment variable as described in the [Go documentation]
|
||||
|
||||
@@ -102,7 +102,7 @@ Step 7
|
||||
: Commit your changes with a descriptive commit message:
|
||||
|
||||
- Provide a summary on the first line, typically 50 characters or less, followed by a blank line.
|
||||
- Begin the summary with one of content, theme, config, all, or misc, followed by a colon, a space, and a brief description of the change beginning with a capital letter
|
||||
- Begin the summary with the name of the package, followed by a colon, a space, and a brief description of the change beginning with a capital letter
|
||||
- Use imperative present tense
|
||||
- See the [commit message guidelines] for requirements
|
||||
- Optionally, provide a detailed description where each line is 72 characters or less, followed by a blank line.
|
||||
@@ -143,7 +143,7 @@ CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@latest
|
||||
To build and install a specific release:
|
||||
|
||||
```sh
|
||||
CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@v0.148.0
|
||||
CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@v0.152.2
|
||||
```
|
||||
|
||||
To build and install at the latest commit on the master branch:
|
||||
|
||||
@@ -24,7 +24,15 @@ Follow Google's [developer documentation style guide].
|
||||
Adhere to these Markdown conventions:
|
||||
|
||||
- Use [ATX] headings (levels 2-4), not [setext] headings.
|
||||
- Use [fenced code blocks], not [indented code blocks].
|
||||
- Use [collapsed link references][] instead of full or shortcut references. For example:
|
||||
|
||||
```text
|
||||
This is a [link][].
|
||||
|
||||
[link]: https://example.org
|
||||
```
|
||||
|
||||
- Use [fenced code blocks] instead of [indented code blocks].
|
||||
- Use hyphens, not asterisks, for unordered [list items].
|
||||
- Use [callouts](#callouts) instead of bold text for emphasis.
|
||||
- Do not mix [raw HTML] within Markdown.
|
||||
@@ -260,6 +268,18 @@ To wrap the code block within an initially-opened `details` element using a non-
|
||||
```
|
||||
````
|
||||
|
||||
Whitespace trimming is enabled by default. To override this behavior and preserve leading and trailing spaces:
|
||||
|
||||
````text
|
||||
```go-html-template {trim=false}
|
||||
|
||||
{{ if eq $foo "bar" }}
|
||||
{{ print "foo is bar" }}
|
||||
{{ end }}
|
||||
|
||||
```
|
||||
````
|
||||
|
||||
### Shortcode calls
|
||||
|
||||
Use this syntax :
|
||||
@@ -399,7 +419,7 @@ Use the embedded template URL (`eturl`) shortcode to insert an absolute URL to t
|
||||
```text
|
||||
This is a link to the [embedded alias template].
|
||||
|
||||
[embedded alias template]: {{%/* eturl alias */%}}
|
||||
[embedded alias template]: <{{%/* eturl alias */%}}>
|
||||
```
|
||||
|
||||
### glossary-term
|
||||
@@ -522,6 +542,7 @@ Step 9
|
||||
|
||||
[ATX]: https://spec.commonmark.org/current/#atx-headings
|
||||
[basic english]: https://simple.wikipedia.org/wiki/Basic_English
|
||||
[collapsed link references]: https://discourse.gohugo.io/t/55714
|
||||
[developer documentation style guide]: https://developers.google.com/style
|
||||
[documentation repository]: https://github.com/gohugoio/hugoDocs/
|
||||
[fenced code blocks]: https://spec.commonmark.org/current/#fenced-code-blocks
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
---
|
||||
title: collections.D
|
||||
description: Returns a slice of sequentially ordered random integers.
|
||||
categories: []
|
||||
keywords: [random]
|
||||
params:
|
||||
functions_and_methods:
|
||||
returnType: '[]int'
|
||||
signatures: [collections.D SEED N HIGH]
|
||||
---
|
||||
|
||||
{{< new-in 0.149.0 />}}
|
||||
|
||||
The `collections.D` function returns a slice of `N` sequentially ordered unique random integers in the half-open [interval](g) [0, `HIGH`) using the provided [`SEED`](g) value. This function implements J. S. Vitter's Method D[^1] for sequential random sampling, a fast and efficient algorithm for this task.
|
||||
|
||||
See [this article][] for a detailed explanation.
|
||||
|
||||
## Examples
|
||||
|
||||
```go-html-template
|
||||
{{ collections.D 6 7 42 }} → [4, 9, 10, 20, 22, 24, 41]
|
||||
```
|
||||
|
||||
The example above generates the _same_ random numbers each time it is called. To generate a _different_ set of 7 random numbers in the same range, change the seed value.
|
||||
|
||||
```go-html-template
|
||||
{{ collections.D 2 7 42 }} → [3, 11, 19, 25, 32, 33, 38]
|
||||
```
|
||||
|
||||
A common use case is the selection of random pages from a page collection. For example, to render a list of 5 random pages using the [day of the year][] as the seed value:
|
||||
|
||||
```go-html-template
|
||||
<ul>
|
||||
{{ $p := site.RegularPages }}
|
||||
{{ range collections.D time.Now.YearDay 5 ($p | len) }}
|
||||
{{ with (index $p .) }}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
```
|
||||
|
||||
The construct above is significantly faster than using the [`collections.Shuffle`][] function.
|
||||
|
||||
## Seed value
|
||||
|
||||
Choosing an appropriate seed value depends on your objective.
|
||||
|
||||
Objective|Seed example
|
||||
:--|:--
|
||||
Consistent result|`42`
|
||||
Different result on each call|`int time.Now.UnixNano`
|
||||
Same result per day|`time.Now.YearDay`
|
||||
Same result per page|`hash.FNV32a .Path`
|
||||
Different result per page per day|`hash.FNV32a (print .Path time.Now.YearDay)`
|
||||
|
||||
> [!note]
|
||||
> The slice created by this function is limited to 1 million elements.
|
||||
|
||||
[^1]: J. S. Vitter, "An efficient algorithm for sequential random sampling," _ACM Trans. Math. Soft._, vol. 13, pp. 58–67, Mar. 1987.
|
||||
|
||||
[`collections.Shuffle`]: /functions/collections/shuffle/
|
||||
[day of the year]: /methods/time/yearday/
|
||||
[this article]: https://getkerf.wordpress.com/2016/03/30/the-best-algorithm-no-one-knows-about/
|
||||
@@ -11,19 +11,41 @@ params:
|
||||
aliases: [/functions/first]
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
{{ slice "a" "b" "c" | first 1 }} → [a]
|
||||
{{ slice "a" "b" "c" | first 2 }} → [a b]
|
||||
```
|
||||
|
||||
Given that a string is in effect a read-only slice of bytes, this function can be used to return the specified number of bytes from the beginning of the string:
|
||||
|
||||
```go-html-template
|
||||
{{ "abc" | first 1 }} → a
|
||||
{{ "abc" | first 2 }} → ab
|
||||
```
|
||||
|
||||
Note that a _character_ may consist of multiple _bytes_:
|
||||
|
||||
```go-html-template
|
||||
{{ "Schön" | first 3 }} → Sch
|
||||
{{ "Schön" | first 4 }} → Sch\xc3
|
||||
{{ "Schön" | first 5 }} → Schö
|
||||
```
|
||||
|
||||
To use the `collections.First` function with a page collection:
|
||||
|
||||
```go-html-template
|
||||
{{ range first 5 .Pages }}
|
||||
{{ .Render "summary" }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Set `N` to zero to return an empty collection.
|
||||
Set `N` to zero to return an empty collection:
|
||||
|
||||
```go-html-template
|
||||
{{ $emptyPageCollection := first 0 .Pages }}
|
||||
```
|
||||
|
||||
Use `first` and [`where`] together.
|
||||
Use `first` and [`where`][] together:
|
||||
|
||||
```go-html-template
|
||||
{{ range where .Pages "Section" "articles" | first 5 }}
|
||||
|
||||
@@ -18,7 +18,7 @@ For example, consider this site configuration:
|
||||
showHeroImage = false
|
||||
{{< /code-toggle >}}
|
||||
|
||||
It the value of `showHeroImage` is `true`, we can detect that it exists using either `if` or `with`:
|
||||
If the value of `showHeroImage` is `true`, we can detect that it exists using either `if` or `with`:
|
||||
|
||||
```go-html-template
|
||||
{{ if site.Params.showHeroImage }}
|
||||
|
||||
@@ -12,18 +12,40 @@ aliases: [/functions/last]
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
{{ range last 10 .Pages }}
|
||||
{{ slice "a" "b" "c" | last 1 }} → [c]
|
||||
{{ slice "a" "b" "c" | last 2 }} → [b c]
|
||||
```
|
||||
|
||||
Given that a string is in effect a read-only slice of bytes, this function can be used to return the specified number of bytes from the end of the string:
|
||||
|
||||
```go-html-template
|
||||
{{ "abc" | last 1 }} → c
|
||||
{{ "abc" | last 2 }} → bc
|
||||
```
|
||||
|
||||
Note that a _character_ may consist of multiple _bytes_:
|
||||
|
||||
```go-html-template
|
||||
{{ "Schön" | last 1 }} → n
|
||||
{{ "Schön" | last 2 }} → \xb6n
|
||||
{{ "Schön" | last 3 }} → ön
|
||||
```
|
||||
|
||||
To use the `collections.Last` function with a page collection:
|
||||
|
||||
```go-html-template
|
||||
{{ range last 5 .Pages }}
|
||||
{{ .Render "summary" }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Set `N` to zero to return an empty collection.
|
||||
Set `N` to zero to return an empty collection:
|
||||
|
||||
```go-html-template
|
||||
{{ $emptyPageCollection := last 0 .Pages }}
|
||||
```
|
||||
|
||||
Use `last` and [`where`] together.
|
||||
Use `last` and [`where`][] together:
|
||||
|
||||
[`where`]: /functions/collections/where/
|
||||
|
||||
|
||||
@@ -32,4 +32,4 @@ A contrived example of iterating over a sequence of integers:
|
||||
```
|
||||
|
||||
> [!note]
|
||||
> The slice created by the `seq` function is limited to 2000 elements.
|
||||
> The slice created by this function is limited to 1 million elements.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: collections.Shuffle
|
||||
description: Returns a random permutation of a given array or slice.
|
||||
categories: []
|
||||
keywords: []
|
||||
keywords: [random]
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: [shuffle]
|
||||
@@ -27,3 +27,9 @@ To render an unordered list of 5 random pages from a page collection:
|
||||
{{ end }}
|
||||
</ul>
|
||||
```
|
||||
|
||||
{{< new-in 0.149.0 />}}
|
||||
|
||||
Using the [`collections.D`][] function for the same task is significantly faster.
|
||||
|
||||
[`collections.D`]: /functions/collections/D/
|
||||
|
||||
@@ -41,7 +41,7 @@ The `default` function returns the first argument if the second argument is not
|
||||
{{ default 42 "" }} → 42
|
||||
{{ default 42 dict }} → 42
|
||||
{{ default 42 slice }} → 42
|
||||
{{ default 42 <nil> }} → 42
|
||||
{{ default 42 nil }} → 42
|
||||
```
|
||||
|
||||
[`or`]: /functions/go-template/or/
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
---
|
||||
title: css.Quoted
|
||||
description: Returns the given string, setting its data type to indicate that it must be quoted when used in CSS.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
returnType: css.QuotedString
|
||||
signatures: [css.Quoted STRING]
|
||||
---
|
||||
|
||||
<!-- Added in v0.111.0 -->
|
||||
|
||||
> [!note]
|
||||
> This function is only applicable to the [`vars`] option passed to the [`css.Sass`] function.
|
||||
|
||||
When when passing a `vars` map to the `css.Sass` function, Hugo detects common typed CSS values such as `24px` or `#FF0000` using regular expression matching. If necessary, you can bypass automatic type inference by using the `css.Quoted` function to explicitly indicate that the value must be treated as a quoted string.
|
||||
|
||||
For example:
|
||||
|
||||
```scss {file="assets/sass/main.scss"}
|
||||
@use "hugo:vars" as h;
|
||||
|
||||
ol li::after {
|
||||
content: h.$ol-li-after;
|
||||
}
|
||||
|
||||
ul li::after {
|
||||
content: h.$ul-li-after;
|
||||
}
|
||||
```
|
||||
|
||||
```go-html-template {file="layouts/_partials/css.html"}
|
||||
{{ $vars := dict
|
||||
"ol_li_after" ("6" | css.Quoted )
|
||||
"ul_li_after" ("7" | css.Quoted )
|
||||
}}
|
||||
|
||||
{{ with resources.Get "sass/main.scss" }}
|
||||
{{ $opts := dict
|
||||
"enableSourceMap" hugo.IsDevelopment
|
||||
"outputStyle" (cond hugo.IsDevelopment "expanded" "compressed")
|
||||
"targetPath" "css/main.css"
|
||||
"transpiler" "dartsass"
|
||||
"vars" $vars
|
||||
}}
|
||||
{{ with . | toCSS $opts }}
|
||||
{{ if hugo.IsDevelopment }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
{{ else }}
|
||||
{{ with . | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
The Sass code is transpiled to:
|
||||
|
||||
```css {file="public/css/main.css"}
|
||||
ol li::after {
|
||||
content: "6";
|
||||
}
|
||||
|
||||
ul li::after {
|
||||
content: "7";
|
||||
}
|
||||
```
|
||||
|
||||
[`css.Sass`]: /functions/css/sass/
|
||||
[`vars`]: /functions/css/sass/#vars
|
||||
@@ -14,10 +14,7 @@ params:
|
||||
|
||||
Transpile Sass to CSS using the LibSass transpiler included in Hugo's extended and extended/deploy editions, or [install Dart Sass](#dart-sass) to use the latest features of the Sass language.
|
||||
|
||||
Sass has two forms of syntax: [SCSS] and [indented]. Hugo supports both.
|
||||
|
||||
[scss]: https://sass-lang.com/documentation/syntax#scss
|
||||
[indented]: https://sass-lang.com/documentation/syntax#the-indented-syntax
|
||||
Sass has two forms of syntax: [SCSS][] and [indented][]. Hugo supports both.
|
||||
|
||||
## Options
|
||||
|
||||
@@ -45,7 +42,7 @@ sourceMapIncludeSources
|
||||
: (`bool`) Whether to embed sources in the generated source map. Applicable to Dart Sass. Default is `false`.
|
||||
|
||||
targetPath
|
||||
: (`string`) The publish path for the transformed resource, relative to the[`publishDir`]. If unset, the target path defaults to the asset's original path with a `.css` extension.
|
||||
: (`string`) The publish path for the transformed resource, relative to the[`publishDir`][]. If unset, the target path defaults to the asset's original path with a `.css` extension.
|
||||
|
||||
transpiler
|
||||
: (`string`) The transpiler to use, either `libsass` or `dartsass`. Hugo's extended and extended/deploy editions include the LibSass transpiler. To use the Dart Sass transpiler, see the [installation instructions](#dart-sass). Default is `libsass`.
|
||||
@@ -61,6 +58,8 @@ vars
|
||||
@use "hugo:vars" as v;
|
||||
```
|
||||
|
||||
When when passing a `vars` map to the `css.Sass` function, Hugo detects common typed CSS values such as `24px` or `#FF0000` using regular expression matching. If necessary, you can bypass automatic type inference by using the [`css.Quoted`][] or [`css.Unquoted`][] function to explicitly indicate a value's type.
|
||||
|
||||
## Example
|
||||
|
||||
```go-html-template {copy=true}
|
||||
@@ -87,7 +86,7 @@ vars
|
||||
|
||||
## Dart Sass
|
||||
|
||||
Hugo's extended and extended/deploy editions include [LibSass] to transpile Sass to CSS. In 2020, the Sass team deprecated LibSass in favor of [Dart Sass].
|
||||
Hugo's extended and extended/deploy editions include [LibSass][] to transpile Sass to CSS. In 2020, the Sass team deprecated LibSass in favor of [Dart Sass].
|
||||
|
||||
Use the latest features of the Sass language by installing Dart Sass in your development and production environments.
|
||||
|
||||
@@ -113,7 +112,7 @@ macOS|Homebrew|[brew.sh]|`brew install sass/sass/sass`
|
||||
Windows|Chocolatey|[chocolatey.org]|`choco install sass`
|
||||
Windows|Scoop|[scoop.sh]|`scoop install sass`
|
||||
|
||||
You may also install [prebuilt binaries] for Linux, macOS, and Windows. You must install the prebuilt binary outside of your project directory and ensure its path is included in your system's PATH environment variable.
|
||||
You may also install [prebuilt binaries][] for Linux, macOS, and Windows. You must install the prebuilt binary outside of your project directory and ensure its path is included in your system's PATH environment variable.
|
||||
|
||||
Run `hugo env` to list the active transpilers.
|
||||
|
||||
@@ -127,26 +126,34 @@ To use Dart Sass with Hugo on a CI/CD platform like GitHub Pages, GitLab Pages,
|
||||
There's one key exception where you can skip this step: you have committed your `resources` directory to your repository. This is only possible if:
|
||||
|
||||
- You have not changed Hugo's default asset cache location.
|
||||
- You have not set [`useResourceCacheWhen`] to never in your sites configuration.
|
||||
- You have not set [`useResourceCacheWhen`][] to never in your sites configuration.
|
||||
|
||||
By committing the `resources` directory, you're providing the pre-built CSS files directly to your CI/CD service, so it doesn't need to run the Sass compilation itself.
|
||||
|
||||
For examples of how to install Dart Sass in a production environment, see the following workflow files:
|
||||
For examples of how to install Dart Sass in a production environment, see these hosting guides:
|
||||
|
||||
- [Cloudflare]
|
||||
- [GitHub Pages]
|
||||
- [GitLab Pages]
|
||||
- [Netlify]
|
||||
- [Render]
|
||||
- [Vercel]
|
||||
|
||||
[`css.Quoted`]: /functions/css/quoted/
|
||||
[`css.Unquoted`]: /functions/css/unquoted/
|
||||
[`publishDir`]: /configuration/all/#publishdir
|
||||
[`useResourceCacheWhen`]: /configuration/build/#useresourcecachewhen
|
||||
[brew.sh]: https://brew.sh/
|
||||
[chocolatey.org]: https://community.chocolatey.org/packages/sass
|
||||
[dart sass]: https://sass-lang.com/dart-sass
|
||||
[GitHub Pages]: /host-and-deploy/host-on-github-pages/#step-7
|
||||
[GitLab Pages]: /host-and-deploy/host-on-gitlab-pages/#configure-gitlab-cicd
|
||||
[libsass]: https://sass-lang.com/libsass
|
||||
[Netlify]: /host-and-deploy/host-on-netlify/#configuration-file
|
||||
[Cloudflare]: /host-and-deploy/host-on-cloudflare/
|
||||
[GitHub Pages]: /host-and-deploy/host-on-github-pages/
|
||||
[GitLab Pages]: /host-and-deploy/host-on-gitlab-pages/
|
||||
[indented]: https://sass-lang.com/documentation/syntax#the-indented-syntax
|
||||
[LibSass]: https://sass-lang.com/libsass
|
||||
[Netlify]: /host-and-deploy/host-on-netlify/
|
||||
[prebuilt binaries]: https://github.com/sass/dart-sass/releases/latest
|
||||
[Render]: /host-and-deploy/host-on-render/
|
||||
[scoop.sh]: https://scoop.sh/#/apps?q=sass
|
||||
[snap package]: /installation/linux/#snap
|
||||
[SCSS]: https://sass-lang.com/documentation/syntax#scss
|
||||
[snapcraft.io]: https://snapcraft.io/dart-sass
|
||||
[Vercel]: /host-and-deploy/host-on-vercel/
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
---
|
||||
title: css.Unquoted
|
||||
description: Returns the given string, setting its data type to indicate that it must not be quoted when used in CSS.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
returnType: css.UnquotedString
|
||||
signatures: [css.Unquoted STRING]
|
||||
---
|
||||
|
||||
<!-- Added in v0.111.0 -->
|
||||
|
||||
> [!note]
|
||||
> This function is only applicable to the [`vars`] option passed to the [`css.Sass`] function.
|
||||
|
||||
When when passing a `vars` map to the `css.Sass` function, Hugo detects common typed CSS values such as `24px` or `#FF0000` using regular expression matching. If necessary, you can bypass automatic type inference by using the `css.Unquoted` function to explicitly indicate that the value must not be treated as a quoted string.
|
||||
|
||||
For example:
|
||||
|
||||
```scss {file="assets/sass/main.scss"}
|
||||
@use "hugo:vars" as h;
|
||||
|
||||
h1 {
|
||||
font-size: h.$font-size-h1;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: h.$font-size-h2;
|
||||
}
|
||||
```
|
||||
|
||||
```go-html-template {file="layouts/_partials/css.html"}
|
||||
{{ $vars := dict
|
||||
"font_size_h1" ("72px * 0.500" | css.Unquoted)
|
||||
"font_size_h2" ("72px * 0.375" | css.Unquoted)
|
||||
}}
|
||||
|
||||
{{ with resources.Get "sass/main.scss" }}
|
||||
{{ $opts := dict
|
||||
"enableSourceMap" hugo.IsDevelopment
|
||||
"outputStyle" (cond hugo.IsDevelopment "expanded" "compressed")
|
||||
"targetPath" "css/main.css"
|
||||
"transpiler" "dartsass"
|
||||
"vars" $vars
|
||||
}}
|
||||
{{ with . | toCSS $opts }}
|
||||
{{ if hugo.IsDevelopment }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
{{ else }}
|
||||
{{ with . | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
The Sass rules are transpiled to:
|
||||
|
||||
```css {file="public/css/main.css"}
|
||||
h1 {
|
||||
font-size: 36px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 27px;
|
||||
}
|
||||
```
|
||||
|
||||
[`css.Sass`]: /functions/css/sass/
|
||||
[`vars`]: /functions/css/sass/#vars
|
||||
@@ -10,8 +10,6 @@ params:
|
||||
signatures: [debug.Timer NAME]
|
||||
---
|
||||
|
||||
{{< new-in 0.120.0 />}}
|
||||
|
||||
Use the `debug.Timer` function to determine execution time for a block of code, useful for finding performance bottlenecks in templates.
|
||||
|
||||
The timer starts when you instantiate it, and stops when you call its `Stop` method.
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
title: debug.VisualizeSpaces
|
||||
description: Returns the given string with spaces replaced by a visible string.
|
||||
categories: []
|
||||
keywords: []
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
returnType: string
|
||||
signatures: [debug.VisualizeSpaces STRING]
|
||||
---
|
||||
|
||||
<!-- Added in v0.112.0 -->
|
||||
|
||||
```go-html-template
|
||||
{{ debug.VisualizeSpaces "foo bar" }} → foo[SPACE][SPACE]bar
|
||||
```
|
||||
@@ -111,5 +111,5 @@ svg.foo {
|
||||
```
|
||||
|
||||
[code block render hook]: /render-hooks/code-blocks/
|
||||
[embedded code block render hook]: {{% eturl render-codeblock-goat %}}
|
||||
[embedded code block render hook]: <{{% eturl render-codeblock-goat %}}>
|
||||
[GoAT]: https://github.com/bep/goat
|
||||
|
||||
@@ -13,4 +13,5 @@ aliases: [/functions/println]
|
||||
|
||||
```go-html-template
|
||||
{{ println "foo" }} → foo\n
|
||||
{{ println "foo" "bar" }} → foo bar\n
|
||||
```
|
||||
|
||||
@@ -11,5 +11,5 @@ params:
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
{{ hugo.Generator }} → <meta name="generator" content="Hugo 0.148.0">
|
||||
{{ hugo.Generator }} → <meta name="generator" content="Hugo 0.152.2">
|
||||
```
|
||||
|
||||
@@ -10,8 +10,6 @@ params:
|
||||
signatures: [hugo.IsDevelopment]
|
||||
---
|
||||
|
||||
{{< new-in 0.120.0 />}}
|
||||
|
||||
```go-html-template
|
||||
{{ hugo.IsDevelopment }} → true/false
|
||||
```
|
||||
|
||||
@@ -10,8 +10,6 @@ params:
|
||||
signatures: [hugo.IsServer]
|
||||
---
|
||||
|
||||
{{< new-in 0.120.0 />}}
|
||||
|
||||
```go-html-template
|
||||
{{ hugo.IsServer }} → true/false
|
||||
```
|
||||
|
||||
@@ -11,5 +11,5 @@ params:
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
{{ hugo.Version }} → 0.148.0
|
||||
{{ hugo.Version }} → 0.152.2
|
||||
```
|
||||
|
||||
@@ -10,8 +10,6 @@ params:
|
||||
signatures: [images.AutoOrient]
|
||||
---
|
||||
|
||||
{{< new-in 0.121.2 />}}
|
||||
|
||||
## Usage
|
||||
|
||||
Create the filter:
|
||||
|
||||
@@ -10,8 +10,6 @@ params:
|
||||
signatures: [images.Opacity OPACITY]
|
||||
---
|
||||
|
||||
{{< new-in 0.119.0 />}}
|
||||
|
||||
The opacity value must be in the range [0, 1]. A value of `0` produces a transparent image, and a value of `1` produces an opaque image (no transparency).
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -10,8 +10,6 @@ params:
|
||||
signatures: ['images.Padding V1 [V2] [V3] [V4] [COLOR]']
|
||||
---
|
||||
|
||||
{{< new-in 0.120.0 />}}
|
||||
|
||||
The last argument is the canvas color, expressed as an RGB or RGBA [hexadecimal color]. The default value is `ffffffff` (opaque white). The preceding arguments are the padding values, in pixels, using the CSS [shorthand property] syntax. Negative padding values will crop the image.
|
||||
|
||||
[hexadecimal color]: https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color
|
||||
|
||||
@@ -10,8 +10,6 @@ params:
|
||||
signatures: [images.Process SPEC]
|
||||
---
|
||||
|
||||
{{< new-in 0.119.0 />}}
|
||||
|
||||
This filter has the same options as the [`Process`] method on a `Resource` object, but using it as a filter may be more effective if you need to apply multiple filters to an image.
|
||||
|
||||
[`Process`]: /methods/resource/process/
|
||||
|
||||
@@ -150,8 +150,8 @@ Returns an [OptionsSetter] that can be used to set [build options] for the batch
|
||||
These are mostly the same as for `js.Build`, but note that:
|
||||
|
||||
- `targetPath` is set automatically (there may be multiple outputs).
|
||||
- ``format` must be `esm`, currently the only format supporting [code splitting].
|
||||
- ``params` will be available in the `@params/config` namespace in the scripts. This way you can import both the [script] or [runner] params and the [config] params with:
|
||||
- `format` must be `esm`, currently the only format supporting [code splitting].
|
||||
- `params` will be available in the `@params/config` namespace in the scripts. This way you can import both the [script] or [runner] params and the [config] params with:
|
||||
|
||||
```js
|
||||
import * as params from "@params";
|
||||
@@ -295,6 +295,8 @@ console.log('entrypoints-workaround.js');
|
||||
[code splitting]: https://esbuild.github.io/api/#splitting
|
||||
[config]: #config
|
||||
[ESBuild]: https://github.com/evanw/esbuild
|
||||
[group]: #group
|
||||
[instance]: #instance
|
||||
[JavaScript import]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
|
||||
[js.Batch Demo Repo]: https://github.com/bep/hugojsbatchdemo/
|
||||
[OptionsSetter]: #optionssetter
|
||||
|
||||
@@ -13,27 +13,27 @@ aliases: [/functions/i18n]
|
||||
|
||||
The `lang.Translate` function returns the value associated with given key as defined in the translation table for the current language.
|
||||
|
||||
If the key is not found in the translation table for the current language, the `lang.Translate` function falls back to the translation table for the [`defaultContentLanguage`].
|
||||
If the key is not found in the translation table for the current language, the `lang.Translate` function falls back to the translation table for the [`defaultContentLanguage`][].
|
||||
|
||||
If the key is not found in the translation table for the `defaultContentLanguage`, the `lang.Translate` function returns an empty string.
|
||||
|
||||
> [!note]
|
||||
> To list missing and fallback translations, use the `--printI18nWarnings` flag when building your site.
|
||||
>
|
||||
> To render placeholders for missing and fallback translations, set [`enableMissingTranslationPlaceholders`] to `true` in your site configuration.
|
||||
> To render placeholders for missing and fallback translations, set [`enableMissingTranslationPlaceholders`][] to `true` in your site configuration.
|
||||
|
||||
## Translation tables
|
||||
|
||||
Create translation tables in the `i18n` directory, naming each file according to [RFC 5646]. Translation tables may be JSON, TOML, or YAML. For example:
|
||||
Create translation tables in the `i18n` directory, naming each file according to [RFC 5646][]. Translation tables may be JSON, TOML, or YAML. For example:
|
||||
|
||||
```text
|
||||
i18n/en.toml
|
||||
i18n/en-US.toml
|
||||
```
|
||||
|
||||
The base name must match the [language key] as defined in your site configuration.
|
||||
The base name must match the [language key][] as defined in your site configuration.
|
||||
|
||||
Artificial languages with private use subtags as defined in [RFC 5646 § 2.2.7] are also supported. You may omit the `art-x-` prefix for brevity. For example:
|
||||
Artificial languages with private use subtags as defined in [RFC 5646 § 2.2.7][] are also supported. You may omit the `art-x-` prefix for brevity. For example:
|
||||
|
||||
```text
|
||||
i18n/art-x-hugolang.toml
|
||||
@@ -94,7 +94,7 @@ i18n/
|
||||
└── pl.toml
|
||||
```
|
||||
|
||||
The Unicode [CLDR Plural Rules chart] describes the pluralization categories for each language.
|
||||
The Unicode [CLDR Plural Rules chart][CLDR] describes the pluralization categories for each language.
|
||||
|
||||
The English translation table:
|
||||
|
||||
@@ -177,7 +177,7 @@ Template code:
|
||||
|
||||
## Reserved keys
|
||||
|
||||
Hugo uses the [go-i18n] package to look up values in translation tables. This package reserves the following keys for internal use:
|
||||
Hugo uses the [go-i18n][] package to look up values in translation tables. This package reserves the following keys for internal use:
|
||||
|
||||
id
|
||||
: (`string`) Uniquely identifies the message.
|
||||
@@ -195,22 +195,22 @@ rightdelim
|
||||
: (`string`) The right Go template delimiter.
|
||||
|
||||
zero
|
||||
: (`string`) The content of the message for the [CLDR] plural form "zero".
|
||||
: (`string`) The content of the message for the [CLDR][] plural form "zero".
|
||||
|
||||
one
|
||||
: (`string`) The content of the message for the [CLDR] plural form "one".
|
||||
: (`string`) The content of the message for the [CLDR][] plural form "one".
|
||||
|
||||
two
|
||||
: (`string`) The content of the message for the [CLDR] plural form "two".
|
||||
: (`string`) The content of the message for the [CLDR][] plural form "two".
|
||||
|
||||
few
|
||||
: (`string`) The content of the message for the [CLDR] plural form "few".
|
||||
: (`string`) The content of the message for the [CLDR][] plural form "few".
|
||||
|
||||
many
|
||||
: (`string`) The content of the message for the [CLDR] plural form "many".
|
||||
: (`string`) The content of the message for the [CLDR][] plural form "many".
|
||||
|
||||
other
|
||||
: (`string`) The content of the message for the [CLDR] plural form "other".
|
||||
: (`string`) The content of the message for the [CLDR][] plural form "other".
|
||||
|
||||
If you need to provide a translation for one of the reserved keys, you can prepend the word with an underscore. For example:
|
||||
|
||||
@@ -238,8 +238,7 @@ Then in your templates:
|
||||
|
||||
[`defaultContentLanguage`]: /configuration/all/#defaultcontentlanguage
|
||||
[`enableMissingTranslationPlaceholders`]: /configuration/all/#enablemissingtranslationplaceholders
|
||||
[CLDR]: https://www.unicode.org/cldr/charts/43/supplemental/language_plural_rules.html
|
||||
[CLDR Plural Rules chart]: https://www.unicode.org/cldr/charts/43/supplemental/language_plural_rules.html
|
||||
[CLDR]: https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html
|
||||
[go-i18n]: https://github.com/nicksnyder/go-i18n
|
||||
[language key]: /configuration/languages/#language-keys
|
||||
[RFC 5646]: https://datatracker.ietf.org/doc/html/rfc5646
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: math.Rand
|
||||
description: Returns a pseudo-random number in the half-open interval [0.0, 1.0).
|
||||
categories: []
|
||||
keywords: []
|
||||
keywords: [random]
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: []
|
||||
@@ -10,8 +10,6 @@ params:
|
||||
signatures: [math.Rand]
|
||||
---
|
||||
|
||||
{{< new-in 0.121.2 />}}
|
||||
|
||||
The `math.Rand` function returns a pseudo-random number in the half-open [interval](g) [0.0, 1.0).
|
||||
|
||||
```go-html-template
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user