diff --git a/.cspell.json b/.cspell.json
index 0958b7645..13865a83c 100644
--- a/.cspell.json
+++ b/.cspell.json
@@ -335,7 +335,7 @@
"مدونتي"
],
"language": "en,en-US,de,fr",
- "allowCompoundWords": true,
+ "allowCompoundWords": false,
"files": [
"**/*.md"
],
@@ -354,7 +354,8 @@
"**/node_modules/**",
"*.min.*",
"**/news/*",
- "**/showcase/*"
+ "**/showcase/*",
+ "**/content-management/emoji-shortcodes.md"
],
"useGitignore": true,
"enabled": true
diff --git a/LICENSE.md b/LICENSE.md
index b62a9b5ff..b09cd7856 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,194 +1,201 @@
Apache License
-==============
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
-_Version 2.0, January 2004_
-_<>_
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-### Terms and Conditions for use, reproduction, and distribution
+ 1. Definitions.
-#### 1. Definitions
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
-“License” shall mean the terms and conditions for use, reproduction, and
-distribution as defined by Sections 1 through 9 of this document.
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
-“Licensor” shall mean the copyright owner or entity authorized by the copyright
-owner that is granting the License.
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
-“Legal Entity” shall mean the union of the acting entity and all other entities
-that control, are controlled by, or are under common control with that entity.
-For the purposes of this definition, “control” means **(i)** the power, direct or
-indirect, to cause the direction or management of such entity, whether by
-contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
-outstanding shares, or **(iii)** beneficial ownership of such entity.
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
-“You” (or “Your”) shall mean an individual or Legal Entity exercising
-permissions granted by this License.
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
-“Source” form shall mean the preferred form for making modifications, including
-but not limited to software source code, documentation source, and configuration
-files.
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
-“Object” form shall mean any form resulting from mechanical transformation or
-translation of a Source form, including but not limited to compiled object code,
-generated documentation, and conversions to other media types.
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
-“Work” shall mean the work of authorship, whether in Source or Object form, made
-available under the License, as indicated by a copyright notice that is included
-in or attached to the work (an example is provided in the Appendix below).
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
-“Derivative Works” shall mean any work, whether in Source or Object form, that
-is based on (or derived from) the Work and for which the editorial revisions,
-annotations, elaborations, or other modifications represent, as a whole, an
-original work of authorship. For the purposes of this License, Derivative Works
-shall not include works that remain separable from, or merely link (or bind by
-name) to the interfaces of, the Work and Derivative Works thereof.
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
-“Contribution” shall mean any work of authorship, including the original version
-of the Work and any modifications or additions to that Work or Derivative Works
-thereof, that is intentionally submitted to Licensor for inclusion in the Work
-by the copyright owner or by an individual or Legal Entity authorized to submit
-on behalf of the copyright owner. For the purposes of this definition,
-“submitted” means any form of electronic, verbal, or written communication sent
-to the Licensor or its representatives, including but not limited to
-communication on electronic mailing lists, source code control systems, and
-issue tracking systems that are managed by, or on behalf of, the Licensor for
-the purpose of discussing and improving the Work, but excluding communication
-that is conspicuously marked or otherwise designated in writing by the copyright
-owner as “Not a Contribution.”
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
-“Contributor” shall mean Licensor and any individual or Legal Entity on behalf
-of whom a Contribution has been received by Licensor and subsequently
-incorporated within the Work.
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
-#### 2. Grant of Copyright License
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable copyright license to reproduce, prepare Derivative Works of,
-publicly display, publicly perform, sublicense, and distribute the Work and such
-Derivative Works in Source or Object form.
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
-#### 3. Grant of Patent License
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable (except as stated in this section) patent license to make, have
-made, use, offer to sell, sell, import, and otherwise transfer the Work, where
-such license applies only to those patent claims licensable by such Contributor
-that are necessarily infringed by their Contribution(s) alone or by combination
-of their Contribution(s) with the Work to which such Contribution(s) was
-submitted. If You institute patent litigation against any entity (including a
-cross-claim or counterclaim in a lawsuit) alleging that the Work or a
-Contribution incorporated within the Work constitutes direct or contributory
-patent infringement, then any patent licenses granted to You under this License
-for that Work shall terminate as of the date such litigation is filed.
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
-#### 4. Redistribution
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
-You may reproduce and distribute copies of the Work or Derivative Works thereof
-in any medium, with or without modifications, and in Source or Object form,
-provided that You meet the following conditions:
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
-* **(a)** You must give any other recipients of the Work or Derivative Works a copy of
-this License; and
-* **(b)** You must cause any modified files to carry prominent notices stating that You
-changed the files; and
-* **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
-all copyright, patent, trademark, and attribution notices from the Source form
-of the Work, excluding those notices that do not pertain to any part of the
-Derivative Works; and
-* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
-Derivative Works that You distribute must include a readable copy of the
-attribution notices contained within such NOTICE file, excluding those notices
-that do not pertain to any part of the Derivative Works, in at least one of the
-following places: within a NOTICE text file distributed as part of the
-Derivative Works; within the Source form or documentation, if provided along
-with the Derivative Works; or, within a display generated by the Derivative
-Works, if and wherever such third-party notices normally appear. The contents of
-the NOTICE file are for informational purposes only and do not modify the
-License. You may add Your own attribution notices within Derivative Works that
-You distribute, alongside or as an addendum to the NOTICE text from the Work,
-provided that such additional attribution notices cannot be construed as
-modifying the License.
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
-You may add Your own copyright statement to Your modifications and may provide
-additional or different license terms and conditions for use, reproduction, or
-distribution of Your modifications, or for any such Derivative Works as a whole,
-provided Your use, reproduction, and distribution of the Work otherwise complies
-with the conditions stated in this License.
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
-#### 5. Submission of Contributions
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
-Unless You explicitly state otherwise, any Contribution intentionally submitted
-for inclusion in the Work by You to the Licensor shall be under the terms and
-conditions of this License, without any additional terms or conditions.
-Notwithstanding the above, nothing herein shall supersede or modify the terms of
-any separate license agreement you may have executed with Licensor regarding
-such Contributions.
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
-#### 6. Trademarks
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
-This License does not grant permission to use the trade names, trademarks,
-service marks, or product names of the Licensor, except as required for
-reasonable and customary use in describing the origin of the Work and
-reproducing the content of the NOTICE file.
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
-#### 7. Disclaimer of Warranty
+ END OF TERMS AND CONDITIONS
-Unless required by applicable law or agreed to in writing, Licensor provides the
-Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
-including, without limitation, any warranties or conditions of TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
-solely responsible for determining the appropriateness of using or
-redistributing the Work and assume any risks associated with Your exercise of
-permissions under this License.
+ APPENDIX: How to apply the Apache License to your work.
-#### 8. Limitation of Liability
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
-In no event and under no legal theory, whether in tort (including negligence),
-contract, or otherwise, unless required by applicable law (such as deliberate
-and grossly negligent acts) or agreed to in writing, shall any Contributor be
-liable to You for damages, including any direct, indirect, special, incidental,
-or consequential damages of any character arising as a result of this License or
-out of the use or inability to use the Work (including but not limited to
-damages for loss of goodwill, work stoppage, computer failure or malfunction, or
-any and all other commercial damages or losses), even if such Contributor has
-been advised of the possibility of such damages.
+ Copyright [yyyy] [name of copyright owner]
-#### 9. Accepting Warranty or Additional Liability
+ 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
-While redistributing the Work or Derivative Works thereof, You may choose to
-offer, and charge a fee for, acceptance of support, warranty, indemnity, or
-other liability obligations and/or rights consistent with this License. However,
-in accepting such obligations, You may act only on Your own behalf and on Your
-sole responsibility, not on behalf of any other Contributor, and only if You
-agree to indemnify, defend, and hold each Contributor harmless for any liability
-incurred by, or claims asserted against, such Contributor by reason of your
-accepting any such warranty or additional liability.
+ http://www.apache.org/licenses/LICENSE-2.0
-_END OF TERMS AND CONDITIONS_
-
-### APPENDIX: How to apply the Apache License to your work
-
-To apply the Apache License to your work, attach the following boilerplate
-notice, with the fields enclosed by brackets `[]` replaced with your own
-identifying information. (Don't include the brackets!) The text should be
-enclosed in the appropriate comment syntax for the file format. We also
-recommend that a file or class name and description of purpose be included on
-the same “printed page” as the copyright notice for easier identification within
-third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
+ 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.
diff --git a/README.md b/README.md
index 730ad5fc8..bf5d9402c 100644
--- a/README.md
+++ b/README.md
@@ -19,12 +19,11 @@ Spelling fixes are most welcomed, and if you want to contribute longer sections
* For example, try to find short snippets that teaches people about the concept. If the example is also useful as-is (copy and paste), then great. Don't list long and similar examples just so people can use them on their sites.
* Hugo has users from all over the world, so easy to understand and [simple English](https://simple.wikipedia.org/wiki/Basic_English) is good.
-
## Edit the theme
If you want to do docs-related theme changes, the simplest way is to have both `hugoDocs` and `gohugoioTheme` cloned as sibling directories, and then run:
-```
+```sh
HUGO_MODULE_WORKSPACE=hugo.work hugo server --ignoreVendorPaths "**"
```
@@ -37,7 +36,7 @@ HUGO_MODULE_WORKSPACE=hugo.work hugo server --ignoreVendorPaths "**"
To view the documentation site locally, you need to clone this repository:
-```bash
+```sh
git clone https://github.com/gohugoio/hugoDocs.git
```
@@ -45,7 +44,7 @@ Also note that the documentation version for a given version of Hugo can also be
Then to view the docs in your browser, run Hugo and open up the link:
-```bash
+```sh
▶ hugo server
Started building sites ...
diff --git a/archetypes/functions.md b/archetypes/functions.md
index cb0e7c930..44a2a5635 100644
--- a/archetypes/functions.md
+++ b/archetypes/functions.md
@@ -1,14 +1,11 @@
---
title: {{ replace .File.ContentBaseName "-" " " | title }}
description:
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
+ related: []
returnType:
signatures: []
-relatedFunctions: []
---
diff --git a/archetypes/methods.md b/archetypes/methods.md
new file mode 100644
index 000000000..2c415547d
--- /dev/null
+++ b/archetypes/methods.md
@@ -0,0 +1,10 @@
+---
+title: {{ replace .File.ContentBaseName "-" " " | title }}
+description:
+categories: []
+keywords: []
+action:
+ related: []
+ returnType:
+ signatures: []
+---
diff --git a/archetypes/showcase/bio.md b/archetypes/showcase/bio.md
index 2443c2f35..5d1708978 100644
--- a/archetypes/showcase/bio.md
+++ b/archetypes/showcase/bio.md
@@ -3,6 +3,5 @@ Add some **general info** about {{ replace .Name "-" " " | title }} here.
The site is built by:
-* [Person 1](https://example.com)
-* [Person 1](https://example.com)
-
+* [Person 1](https://example.org)
+* [Person 1](https://example.org)
diff --git a/assets/images/examples/zion-national-park-grayscale.jpg b/assets/images/examples/zion-national-park-grayscale.jpg
new file mode 100644
index 000000000..908bd88c6
Binary files /dev/null and b/assets/images/examples/zion-national-park-grayscale.jpg differ
diff --git a/assets/images/examples/zion-national-park.jpg b/assets/images/examples/zion-national-park.jpg
new file mode 100644
index 000000000..7980abccb
Binary files /dev/null and b/assets/images/examples/zion-national-park.jpg differ
diff --git a/assets/images/logos/logo-128x128.png b/assets/images/logos/logo-128x128.png
new file mode 100644
index 000000000..ec1a2d6e1
Binary files /dev/null and b/assets/images/logos/logo-128x128.png differ
diff --git a/assets/images/logos/logo-256x256.png b/assets/images/logos/logo-256x256.png
new file mode 100644
index 000000000..d9fdb888a
Binary files /dev/null and b/assets/images/logos/logo-256x256.png differ
diff --git a/assets/images/logos/logo-512x512.png b/assets/images/logos/logo-512x512.png
new file mode 100644
index 000000000..76d463600
Binary files /dev/null and b/assets/images/logos/logo-512x512.png differ
diff --git a/assets/images/logos/logo-64x64.png b/assets/images/logos/logo-64x64.png
new file mode 100644
index 000000000..9857bcea1
Binary files /dev/null and b/assets/images/logos/logo-64x64.png differ
diff --git a/assets/images/logos/logo-96x96.png b/assets/images/logos/logo-96x96.png
new file mode 100644
index 000000000..48d0cb98e
Binary files /dev/null and b/assets/images/logos/logo-96x96.png differ
diff --git a/config/_default/menus/menus.en.toml b/config/_default/menus/menus.en.toml
index 327a5777b..1ea37f443 100644
--- a/config/_default/menus/menus.en.toml
+++ b/config/_default/menus/menus.en.toml
@@ -1,142 +1,152 @@
[[docs]]
- name = "About Hugo"
- weight = 10
- identifier = "about"
- url = "/about/"
+identifier = 'about'
+name = 'About Hugo'
+pageRef = '/about/'
+weight = 10
[[docs]]
- name = "Installation"
- weight = 20
- identifier = "installation"
- url = "/installation/"
+name = 'Installation'
+weight = 20
+identifier = 'installation'
+pageRef = '/installation/'
[[docs]]
- name = "Getting started"
- weight = 30
- identifier = "getting-started"
- url = "/getting-started/"
+name = 'Getting started'
+weight = 30
+identifier = 'getting-started'
+pageRef = '/getting-started/'
[[docs]]
- name = "Hugo Modules"
- weight = 40
- identifier = "modules"
- post = "break"
- url = "/hugo-modules/"
-
-# Core menus
+name = 'Hugo Modules'
+weight = 40
+identifier = 'modules'
+post = 'break'
+pageRef = '/hugo-modules/'
[[docs]]
- name = "Content management"
- weight = 50
- identifier = "content-management"
- post = "expanded"
- url = "/content-management/"
+name = 'Content management'
+weight = 50
+identifier = 'content-management'
+post = 'expanded'
+pageRef = '/content-management/'
[[docs]]
- name = "Templates"
- weight = 60
- identifier = "templates"
- url = "/templates/"
+name = 'Templates'
+weight = 60
+identifier = 'templates'
+pageRef = '/templates/'
[[docs]]
- name = "Functions"
- weight = 70
- identifier = "functions"
- url = "/functions/"
+name = 'Functions'
+weight = 70
+identifier = 'functions'
+pageRef = '/functions/'
[[docs]]
- name = "Variables"
- weight = 80
- identifier = "variables"
- url = "/variables/"
+name = 'Methods'
+weight = 80
+identifier = 'methods'
+pageRef = '/methods/'
[[docs]]
- name = "Hugo Pipes"
- weight = 90
- identifier = "hugo-pipes"
- url = "/hugo-pipes/"
+name = 'Quick reference'
+weight = 90
+identifier = 'quick-reference'
+pageRef = '/quick-reference/'
[[docs]]
- name = "CLI"
- weight = 100
- post = "break"
- identifier = "commands"
- url = "/commands/"
+name = 'Variables'
+weight = 95
+identifier = 'variables'
+pageRef = '/variables/'
+
+[[docs]]
+name = 'Hugo Pipes'
+weight = 100
+identifier = 'hugo-pipes'
+pageRef = '/hugo-pipes/'
+
+[[docs]]
+name = 'CLI'
+weight = 110
+post = 'break'
+identifier = 'commands'
+pageRef = '/commands/'
# Low level items
[[docs]]
- name = "Troubleshooting"
- weight = 110
- identifier = "troubleshooting"
- url = "/troubleshooting/"
+name = 'Troubleshooting'
+weight = 120
+identifier = 'troubleshooting'
+pageRef = '/troubleshooting/'
[[docs]]
- name = "Developer tools"
- weight = 120
- identifier = "developer-tools"
- url = "/tools/"
+name = 'Developer tools'
+weight = 130
+identifier = 'developer-tools'
+pageRef = '/tools/'
[[docs]]
- name = "Hosting and deployment"
- weight = 130
- identifier = "hosting-and-deployment"
- url = "/hosting-and-deployment/"
+name = 'Hosting and deployment'
+weight = 140
+identifier = 'hosting-and-deployment'
+pageRef = '/hosting-and-deployment/'
[[docs]]
- name = "Contribute"
- weight = 140
- post = "break"
- identifier = "contribute"
- url = "/contribute/"
+name = 'Contribute'
+weight = 150
+post = 'break'
+identifier = 'contribute'
+pageRef = '/contribute/'
######## QUICKLINKS
[[quicklinks]]
- name = "Fundamentals"
- weight = 1
- identifier = "fundamentals"
- url = "/tags/fundamentals/"
+identifier = 'fundamentals'
+name = 'Fundamentals'
+pageRef = '/tags/fundamentals/'
+weight = 1
######## GLOBAL ITEMS TO BE SHARED WITH THE HUGO SITES
[[global]]
- name = "News"
- weight = 1
- identifier = "news"
- url = "/news/"
+name = 'News'
+weight = 1
+identifier = 'news'
+pageRef = '/news/'
[[global]]
- name = "Docs"
- weight = 5
- identifier = "docs"
- url = "/documentation/"
+name = 'Docs'
+weight = 5
+identifier = 'docs'
+url = '/documentation/'
[[global]]
- name = "Themes"
- weight = 10
- identifier = "themes"
- url = "https://themes.gohugo.io/"
+name = 'Themes'
+weight = 10
+identifier = 'themes'
+url = 'https://themes.gohugo.io/'
[[global]]
- name = "Showcase"
- weight = 20
- identifier = "showcase"
- url = "/showcase/"
+name = 'Showcase'
+weight = 20
+identifier = 'showcase'
+pageRef = '/showcase/'
# Anything with a weight > 100 gets an external icon
[[global]]
- name = "Community"
- weight = 150
- icon = true
- identifier = "community"
- post = "external"
- url = "https://discourse.gohugo.io/"
+name = 'Community'
+weight = 150
+icon = true
+identifier = 'community'
+post = 'external'
+url = 'https://discourse.gohugo.io/'
[[global]]
- name = "GitHub"
- weight = 200
- identifier = "github"
- post = "external"
- url = "https://github.com/gohugoio/hugo"
+name = 'GitHub'
+weight = 200
+identifier = 'github'
+post = 'external'
+url = 'https://github.com/gohugoio/hugo'
diff --git a/config/_default/params.toml b/config/_default/params.toml
index 3fddf9dbc..b41679c61 100644
--- a/config/_default/params.toml
+++ b/config/_default/params.toml
@@ -22,3 +22,6 @@ flex_box_interior_classes = "flex-auto w-100 w-40-l mr3 mb3 bg-white ba b--moon-
[social]
twitter = "GoHugoIO"
+
+[render_hooks.link]
+errorLevel = 'warning' # ignore (default), warning, or error (fails the build)
diff --git a/content/en/about/hugo-and-gdpr.md b/content/en/about/hugo-and-gdpr.md
index 85e996f59..ea588fb31 100644
--- a/content/en/about/hugo-and-gdpr.md
+++ b/content/en/about/hugo-and-gdpr.md
@@ -29,7 +29,7 @@ toc: true
Below are all privacy settings and their default value. These settings need to be put in your site configuration (e.g. `hugo.toml`).
-{{< code-toggle file="hugo" >}}
+{{< code-toggle file=hugo >}}
[privacy]
[privacy.disqus]
disable = false
@@ -58,7 +58,7 @@ privacyEnhanced = false
An example privacy configuration that disables all the relevant services in Hugo. With this configuration, the other settings will not matter.
-{{< code-toggle file="hugo" >}}
+{{< code-toggle file=hugo >}}
[privacy]
[privacy.disqus]
disable = true
@@ -98,7 +98,7 @@ simple
**Note:** If you use the _simple mode_ for Instagram and a site styled with Bootstrap 4, you may want to disable the inline styles provided by Hugo:
- {{< code-toggle file="hugo" >}}
+{{< code-toggle file=hugo >}}
[services]
[services.instagram]
disableInlineCSS = true
@@ -114,7 +114,7 @@ simple
**Note:** If you use the _simple mode_ for Twitter, you may want to disable the inline styles provided by Hugo:
- {{< code-toggle file="hugo" >}}
+{{< code-toggle file=hugo >}}
[services]
[services.twitter]
disableInlineCSS = true
diff --git a/content/en/about/license.md b/content/en/about/license.md
index dc560b33f..6e9d2ea19 100644
--- a/content/en/about/license.md
+++ b/content/en/about/license.md
@@ -1,160 +1,80 @@
---
title: License
-description: Hugo v0.15 and later are released under the Apache 2.0 license.
+description: Hugo is released under the Apache 2.0 license.
categories: ["about hugo"]
-keywords: ["License","apache"]
+keywords: ["license","apache"]
menu:
docs:
parent: about
weight: 70
weight: 70
-aliases: [/meta/license]
-toc: true
---
-{{% note %}}
-Hugo v0.15 and later are released under the Apache 2.0 license.
-Earlier versions of Hugo were released under the [Simple Public License](https://opensource.org/license/simpl-2-0-html/).
-{{% /note %}}
+## Apache License
-_Version 2.0, January 2004_
-
-*Terms and Conditions for use, reproduction, and distribution*
+_Version 2.0, January 2004_
+__
-## 1. Definitions
+### Terms and Conditions for use, reproduction, and distribution
-“License” shall mean the terms and conditions for use, reproduction, and
-distribution as defined by Sections 1 through 9 of this document.
+#### 1. Definitions
-“Licensor” shall mean the copyright owner or entity authorized by the copyright
-owner that is granting the License.
+“License” shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
-“Legal Entity” shall mean the union of the acting entity and all other entities
-that control, are controlled by, or are under common control with that entity.
-For the purposes of this definition, “control” means **(i)** the power, direct or
-indirect, to cause the direction or management of such entity, whether by
-contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
-outstanding shares, or **(iii)** beneficial ownership of such entity.
+“Licensor” shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
-“You” (or “Your”) shall mean an individual or Legal Entity exercising
-permissions granted by this License.
+“Legal Entity” shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, “control” means **(i)** the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the outstanding shares, or **(iii)** beneficial ownership of such entity.
-“Source” form shall mean the preferred form for making modifications, including
-but not limited to software source code, documentation source, and configuration
-files.
+“You” (or “Your”) shall mean an individual or Legal Entity exercising permissions granted by this License.
-“Object” form shall mean any form resulting from mechanical transformation or
-translation of a Source form, including but not limited to compiled object code,
-generated documentation, and conversions to other media types.
+“Source” form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
-“Work” shall mean the work of authorship, whether in Source or Object form, made
-available under the License, as indicated by a copyright notice that is included
-in or attached to the work (an example is provided in the Appendix below).
+“Object” form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
-“Derivative Works” shall mean any work, whether in Source or Object form, that
-is based on (or derived from) the Work and for which the editorial revisions,
-annotations, elaborations, or other modifications represent, as a whole, an
-original work of authorship. For the purposes of this License, Derivative Works
-shall not include works that remain separable from, or merely link (or bind by
-name) to the interfaces of, the Work and Derivative Works thereof.
+“Work” shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
-“Contribution” shall mean any work of authorship, including the original version
-of the Work and any modifications or additions to that Work or Derivative Works
-thereof, that is intentionally submitted to Licensor for inclusion in the Work
-by the copyright owner or by an individual or Legal Entity authorized to submit
-on behalf of the copyright owner. For the purposes of this definition,
-“submitted” means any form of electronic, verbal, or written communication sent
-to the Licensor or its representatives, including but not limited to
-communication on electronic mailing lists, source code control systems, and
-issue tracking systems that are managed by, or on behalf of, the Licensor for
-the purpose of discussing and improving the Work, but excluding communication
-that is conspicuously marked or otherwise designated in writing by the copyright
-owner as “Not a Contribution.”
+“Derivative Works” shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
-“Contributor” shall mean Licensor and any individual or Legal Entity on behalf
-of whom a Contribution has been received by Licensor and subsequently
-incorporated within the Work.
+“Contribution” shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, “submitted” means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as “Not a Contribution.”
-## 2. Grant of Copyright License
+“Contributor” shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable copyright license to reproduce, prepare Derivative Works of,
-publicly display, publicly perform, sublicense, and distribute the Work and such
-Derivative Works in Source or Object form.
+#### 2. Grant of Copyright License
-## 3. Grant of Patent License
+Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable (except as stated in this section) patent license to make, have
-made, use, offer to sell, sell, import, and otherwise transfer the Work, where
-such license applies only to those patent claims licensable by such Contributor
-that are necessarily infringed by their Contribution(s) alone or by combination
-of their Contribution(s) with the Work to which such Contribution(s) was
-submitted. If You institute patent litigation against any entity (including a
-cross-claim or counterclaim in a lawsuit) alleging that the Work or a
-Contribution incorporated within the Work constitutes direct or contributory
-patent infringement, then any patent licenses granted to You under this License
-for that Work shall terminate as of the date such litigation is filed.
+#### 3. Grant of Patent License
-## 4. Redistribution
+Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
-You may reproduce and distribute copies of the Work or Derivative Works thereof
-in any medium, with or without modifications, and in Source or Object form,
-provided that You meet the following conditions:
+#### 4. Redistribution
-* **(a)** You must give any other recipients of the Work or Derivative Works a copy of
-this License; and
-* **(b)** You must cause any modified files to carry prominent notices stating that You
-changed the files; and
-* **\(c)** You must retain, in the Source form of any Derivative Works that You distribute,
-all copyright, patent, trademark, and attribution notices from the Source form
-of the Work, excluding those notices that do not pertain to any part of the
-Derivative Works; and
+You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+* **(a)** You must give any other recipients of the Work or Derivative Works a copy of this License; and
+* **(b)** You must cause any modified files to carry prominent notices stating that You changed the files; and
+* **(c)** You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
-## 5. Submission of Contributions
+#### 5. Submission of Contributions
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
-## 6. Trademarks
+#### 6. Trademarks
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
-## 7. Disclaimer of Warranty
+#### 7. Disclaimer of Warranty
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
-## 8. Limitation of Liability
+#### 8. Limitation of Liability
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
-## 9. Accepting Warranty or Additional Liability
+#### 9. Accepting Warranty or Additional Liability
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
-
-_END OF TERMS AND CONDITIONS_
-
-## APPENDIX: How to apply the Apache License to your work
-
-To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets `[]` replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same “printed page” as the copyright notice for easier identification within third-party archives.
-
-{{< code file="apache-notice.txt" >}}
-Copyright [yyyy] [name of copyright owner]
-
-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
-
- https://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.
-{{< /code >}}
diff --git a/content/en/content-management/_common/_index.md b/content/en/content-management/_common/_index.md
new file mode 100644
index 000000000..47d5812fb
--- /dev/null
+++ b/content/en/content-management/_common/_index.md
@@ -0,0 +1,13 @@
+---
+cascade:
+ _build:
+ list: never
+ publishResources: false
+ render: never
+---
+
+
diff --git a/layouts/shortcodes/page-kinds.html b/content/en/content-management/_common/page-kinds.md
similarity index 65%
rename from layouts/shortcodes/page-kinds.html
rename to content/en/content-management/_common/page-kinds.md
index 968a7a5fb..07a53e8e6 100644
--- a/layouts/shortcodes/page-kinds.html
+++ b/content/en/content-management/_common/page-kinds.md
@@ -1,3 +1,7 @@
+---
+# Do not remove front matter.
+---
+
| Kind | Description | Example |
|----------------|--------------------------------------------------------------------|-------------------------------------------------------------------------------|
| `home` | The landing page for the home page | `/index.html` |
@@ -5,3 +9,9 @@
| `section` | The landing page of a given section | `posts` section (`/posts/index.html`) |
| `taxonomy` | The landing page for a taxonomy | `tags` taxonomy (`/tags/index.html`) |
| `term` | The landing page for one taxonomy's term | term `awesome` in `tags` taxonomy (`/tags/awesome/index.html`) |
+
+Four other page kinds unrelated to content are `robotsTXT`, `RSS`, `sitemap`, and `404`. Although primarily for internal use, you can specify the name when disabling one or more page kinds on your site. For example:
+
+{{< code-toggle file=hugo >}}
+disableKinds = ['robotsTXT','404']
+{{< /code-toggle >}}
diff --git a/content/en/content-management/archetypes.md b/content/en/content-management/archetypes.md
index fe460f91f..0a33c9da6 100644
--- a/content/en/content-management/archetypes.md
+++ b/content/en/content-management/archetypes.md
@@ -19,7 +19,7 @@ A content file consists of [front matter] and markup. The markup is typically ma
The `hugo new content` command creates a new file in the `content` directory, using an archetype as a template. This is the default archetype:
-{{< code-toggle file="archetypes/default.md" copy=false fm=true >}}
+{{< code-toggle file="archetypes/default.md" fm=true >}}
title = '{{ replace .File.ContentBaseName `-` ` ` | title }}'
date = '{{ .Date }}'
draft = true
@@ -27,13 +27,13 @@ draft = true
When you create new content, Hugo evaluates the [template actions] within the archetype. For example:
-```text
+```sh
hugo new content posts/my-first-post.md
```
With the default archetype shown above, Hugo creates this content file:
-{{< code-toggle file="content/posts/my-first-post.md" copy=false fm=true >}}
+{{< code-toggle file="content/posts/my-first-post.md" fm=true >}}
title = 'My First Post'
date = '2023-08-24T11:49:46-07:00'
draft = true
@@ -53,7 +53,7 @@ Hugo looks for archetypes in the `archetypes` directory in the root of your proj
For example, with this command:
-```text
+```sh
hugo new content posts/my-first-post.md
```
@@ -75,7 +75,7 @@ Archetypes receive the following objects and values in [context]:
- `.Date`
- `.Type`
- `.Site` (see [details](/variables/site/))
-- `.File` (see [details](/variables/files/))
+- `.File` (see [details](/variables/file/))
As shown above, the default archetype passes `.File.ContentBaseName` as the argument to the `replace` function when populating the title in front matter.
@@ -85,8 +85,7 @@ Although typically used as a front matter template, you can also use an archetyp
For example, in a documentation site you might have a section (content type) for functions. Every page within this section should follow the same format: a brief description, the function signature, examples, and notes. We can pre-populate the page to remind content authors of the standard format.
-
-{{< code file="archetypes/functions.md" copy=false >}}
+{{< code file="archetypes/functions.md" >}}
---
date: '{{ .Date }}'
draft: true
@@ -125,17 +124,17 @@ Create an archetype for galleries:
```text
archetypes/
├── galleries/
-│ ├── images/
-│ │ └── .gitkeep
-│ └── index.md <-- same format as default.md
+│ ├── images/
+│ │ └── .gitkeep
+│ └── index.md <-- same format as default.md
└── default.md
```
Subdirectories within an archetype must contain at least one file. Without a file, Hugo will not create the subdirectory when you create new content. The name and size of the file are irrelevant. The example above includes a `.gitkeep` file, an empty file commonly used to preserve otherwise empty directories in a Git repository.
-
To create a new gallery:
-```text
+
+```sh
hugo new galleries/bryce-canyon
```
@@ -166,13 +165,13 @@ archetypes/
To create an article using the articles archetype:
-```text
+```sh
hugo new content articles/something.md
```
To create an article using the tutorials archetype:
-```text
+```sh
hugo new content --kind tutorials articles/something.md
```
diff --git a/content/en/content-management/build-options.md b/content/en/content-management/build-options.md
index 378a31144..fb3cca7cb 100644
--- a/content/en/content-management/build-options.md
+++ b/content/en/content-management/build-options.md
@@ -51,7 +51,7 @@ If set to `true` (default) the [Bundle's Resources](/content-management/page-bun
Setting this to `false` will still publish Resources on demand (when a resource's `.Permalink` or `.RelPermalink` is invoked from the templates) but will skip the others.
{{% note %}}
-Any page, regardless of their build options, will always be available using the [`.GetPage`](/functions/getpage) methods.
+Any page, regardless of their build options, will always be available using the [`.GetPage`](/methods/page/getpage) methods.
{{% /note %}}
### Illustrative use cases
@@ -60,14 +60,14 @@ Any page, regardless of their build options, will always be available using the
Project needs a "Who We Are" content file for front matter and body to be used by the homepage but nowhere else.
-{{< code-toggle file="content/who-we-are.md" fm=true copy=false >}}
+{{< code-toggle file="content/who-we-are.md" fm=true >}}
title: Who we are
_build:
list: false
render: false
{{< /code-toggle >}}
-{{< code file="layouts/index.html" copy=false >}}
+{{< code file="layouts/index.html" >}}
{{ with site.GetPage "who-we-are" }}
{{ .Content }}
@@ -91,7 +91,7 @@ cascade:
list: true # default
{{< /code-toggle >}}
-{{< code file="layouts/_defaults/testimonials.html" copy=false >}}
+{{< code file="layouts/_defaults/testimonials.html" >}}
{{ range first 5 .Pages }}
diff --git a/content/en/content-management/comments.md b/content/en/content-management/comments.md
index 39663013b..e85ea5a78 100644
--- a/content/en/content-management/comments.md
+++ b/content/en/content-management/comments.md
@@ -24,9 +24,8 @@ Hugo comes with all the code you need to load Disqus into your templates. Before
Disqus comments require you set a single value in your [site's configuration file][configuration] like so:
-{{< code-toggle file="hugo" >}}
-[services.disqus]
-shortname = 'your-disqus-shortname'
+{{< code-toggle file=hugo >}}
+disqusShortname = "yourDisqusShortname"
{{ code-toggle >}}
For many websites, this is enough configuration. However, you also have the option to set the following in the [front matter] of a single content file:
diff --git a/content/en/content-management/cross-references.md b/content/en/content-management/cross-references.md
index c989cc560..32e1d96ed 100644
--- a/content/en/content-management/cross-references.md
+++ b/content/en/content-management/cross-references.md
@@ -35,7 +35,6 @@ The `ref` and `relref` shortcodes require a single parameter: the path to a cont
The pages can be referenced as follows:
-
```text
{{* ref "document2" */>}} // <- From pages/document1.md, relative path
{{* ref "document2#anchor" */>}}
@@ -138,7 +137,7 @@ produces this HTML:
## Ref and RelRef Configuration
-The behavior can, since Hugo 0.45, be configured in `hugo.toml`:
+The behavior can be configured in `hugo.toml`:
refLinksErrorLevel ("ERROR")
: When using `ref` or `relref` to resolve page links and a link cannot resolved, it will be logged with this log level. Valid values are `ERROR` (default) or `WARNING`. Any `ERROR` will fail the build (`exit -1`).
@@ -146,7 +145,6 @@ refLinksErrorLevel ("ERROR")
refLinksNotFoundURL
: URL to be used as a placeholder when a page reference cannot be found in `ref` or `relref`. Is used as-is.
-
[lists]: /templates/lists/
[output formats]: /templates/output-formats/
[shortcode]: /content-management/shortcodes/
diff --git a/content/en/content-management/diagrams.md b/content/en/content-management/diagrams.md
index c0b2349b0..886b4c298 100644
--- a/content/en/content-management/diagrams.md
+++ b/content/en/content-management/diagrams.md
@@ -165,7 +165,6 @@ Created from
└─Fedora
```
-
### Sequence diagram
@@ -186,7 +185,6 @@ Created from
```
-
### Flowchart
@@ -232,7 +230,6 @@ Created from
```
-
### Table
diff --git a/content/en/content-management/formats.md b/content/en/content-management/formats.md
index ccc45b943..85ca55ba7 100644
--- a/content/en/content-management/formats.md
+++ b/content/en/content-management/formats.md
@@ -24,7 +24,7 @@ The current list of content formats in Hugo:
| Name | Markup identifiers | Comment |
| ------------- | ------------- |-------------|
-| Goldmark | md, markdown, goldmark |Note that you can set the default handler of `md` and `markdown` to something else, see [Configure Markup](/getting-started/configuration-markup/).|
+| Goldmark | markdown, goldmark |Note that you can set the default handler of `md` and `markdown` to something else, see [Configure Markup](/getting-started/configuration-markup/).|
|Emacs Org-Mode|org|See [go-org](https://github.com/niklasfasching/go-org).|
|AsciiDoc|asciidocext, adoc, ad|Needs [Asciidoctor][ascii] installed.|
|RST|rst|Needs [RST](https://docutils.sourceforge.io/rst.html) installed.|
@@ -59,7 +59,7 @@ optional extensions like `asciidoctor-diagram` or `asciidoctor-html5s` are insta
External `asciidoctor` command requires Hugo rendering to _disk_ to a specific destination directory. It is required to run Hugo with the command option `--destination`.
{{% /note %}}
-Some Asciidoctor parameters can be customized in Hugo. See [details].
+Some Asciidoctor parameters can be customized in Hugo. See [details].
[details]: /getting-started/configuration-markup/#asciidoc
@@ -75,7 +75,6 @@ Markdown syntax is simple enough to learn in a single sitting. The following are
[ascii]: https://asciidoctor.org/
[config]: /getting-started/configuration/
[developer tools]: /tools/
-[emojis]: https://www.webpagefx.com/tools/emoji-cheat-sheet/
[fireball]: https://daringfireball.net/projects/markdown/
[gfmtasks]: https://guides.github.com/features/mastering-markdown/#syntax
[helperssource]: https://github.com/gohugoio/hugo/blob/77c60a3440806067109347d04eb5368b65ea0fe8/helpers/general.go#L65
diff --git a/content/en/content-management/front-matter.md b/content/en/content-management/front-matter.md
index 10317e805..a23905df8 100644
--- a/content/en/content-management/front-matter.md
+++ b/content/en/content-management/front-matter.md
@@ -93,7 +93,7 @@ lastmod
: The datetime at which the content was last modified.
linkTitle
-: Used for creating links to content; if set, Hugo defaults to using the `linkTitle` before the `title`. Hugo can also [order lists of content by `linkTitle`][bylinktitle].
+: Used for creating links to content; if set, Hugo defaults to using the `linkTitle` before the `title`.
markup
: **experimental**; specify `"rst"` for reStructuredText (requires`rst2html`) or `"md"` (default) for Markdown.
@@ -144,7 +144,7 @@ You can add fields to your front matter arbitrarily to meet your needs. These us
The following fields can be accessed via `.Params.include_toc` and `.Params.show_comments`, respectively. The [Variables] section provides more information on using Hugo's page- and site-level variables in your templates.
-{{< code-toggle copy=false >}}
+{{< code-toggle >}}
include_toc: true
show_comments: false
{{ code-toggle >}}
@@ -157,7 +157,7 @@ Any node or section can pass down to descendants a set of front matter values as
The `cascade` block can be a slice with a optional `_target` keyword, allowing for multiple `cascade` values targeting different page sets.
-{{< code-toggle copy=false >}}
+{{< code-toggle >}}
title ="Blog"
[[cascade]]
background = "yosemite.jpg"
@@ -191,7 +191,7 @@ Any of the above can be omitted.
In `content/blog/_index.md`
-{{< code-toggle copy=false >}}
+{{< code-toggle >}}
title: Blog
cascade:
banner: images/typewriter.jpg
@@ -219,13 +219,12 @@ It's possible to set some options for Markdown rendering in a content's front ma
[variables]: /variables/
[aliases]: /content-management/urls/#aliases
[archetype]: /content-management/archetypes/
-[bylinktitle]: /templates/lists/#by-link-title
[config]: /getting-started/configuration/
[content type]: /content-management/types/
[contentorg]: /content-management/organization/
[headless-bundle]: /content-management/page-bundles/#headless-bundle
[json]: https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf
-[lists]: /templates/lists/#order-content
+[lists]: /templates/lists/#sort-content
[lookup]: /templates/lookup-order/
[ordering]: /templates/lists/
[outputs]: /templates/output-formats/
diff --git a/content/en/content-management/image-processing/index.md b/content/en/content-management/image-processing/index.md
index 9cce9070a..9ac1d5c43 100644
--- a/content/en/content-management/image-processing/index.md
+++ b/content/en/content-management/image-processing/index.md
@@ -10,6 +10,7 @@ menu:
toc: true
weight: 90
---
+
## Image resources
To process an image you must access the file as a page resource, global resource, or remote resource.
@@ -50,7 +51,7 @@ To access an image as a global resource:
### Remote resource
-A remote resource is a file on a remote server, accessible via http or https. To access an image as a remote resource:
+A remote resource is a file on a remote server, accessible via HTTP or HTTPS. To access an image as a remote resource:
```go-html-template
{{ $image := resources.GetRemote "https://gohugo.io/img/hugo-logo.png" }}
@@ -112,7 +113,7 @@ Metadata (EXIF, IPTC, XMP, etc.) is not preserved during image transformation. U
{{< new-in "0.119.0" >}}
{{% note %}}
-The `Process` method is also available as a filter, which is more effective if need to apply multiple filters to an image. See [Process filter](/functions/images/#process).
+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).
{{% /note %}}
Process processes the image with the given specification. The specification can contain an optional action, one of `resize`, `crop`, `fit` or `fill`. This means that you can use this method instead of [`Resize`], [`Fit`], [`Fill`], or [`Crop`].
@@ -139,10 +140,9 @@ Some more examples:
{{ $image := $image.Process "fill 600x400" }}
```
-
### Resize
-Resize an image to the specified width and/or height.
+Resize an image to the given width and/or height.
If you specify both width and height, the resulting image will be disproportionally scaled unless the original image has the same aspect ratio.
@@ -215,7 +215,6 @@ Sometimes it can be useful to create the filter chain once and then reuse it.
This method is fast, but if you also scale down your images, it would be good for performance to extract the colors from the scaled down image.
-
### EXIF
Provides an [EXIF] object containing image metadata.
@@ -266,7 +265,7 @@ You may also access EXIF fields individually, using the [`lang.FormatNumber`] fu
## Image processing options
-The [`Resize`], [`Fit`], [`Fill`], and [`Crop`] methods accept a space-separated, case-insensitive list of options. The order of the options within the list is irrelevant.
+The [`Resize`], [`Fit`], [`Fill`], and [`Crop`] methods accept a space-delimited, case-insensitive list of options. The order of the options within the list is irrelevant.
### Dimensions
@@ -369,7 +368,7 @@ The default value is `photo`. You may override the default value in the [site co
When converting an image from a format that supports transparency (e.g., PNG) to a format that does _not_ support transparency (e.g., JPEG), you may specify the background color of the resulting image.
-Use either a 3-digit or a 6-digit hexadecimal color code (e.g., `#00f` or `#0000ff`).
+Use either a 3-digit or 6-digit hexadecimal color code (e.g., `#00f` or `#0000ff`).
The default value is `#ffffff` (white). You may override the default value in the [site configuration].
@@ -402,28 +401,26 @@ See [github.com/disintegration/imaging] for the complete list of resampling filt
_The photo of the sunset used in the examples below is Copyright [Bjørn Erik Pedersen](https://commons.wikimedia.org/wiki/User:Bep) (Creative Commons Attribution-Share Alike 4.0 International license)_
-{{< imgproc sunset Resize "300x" />}}
+{{< imgproc "sunset.jpg" "resize 300x" />}}
-{{< imgproc sunset Fill "90x120 left" />}}
+{{< imgproc "sunset.jpg" "fill 90x120 left" />}}
-{{< imgproc sunset Fill "90x120 right" />}}
+{{< imgproc "sunset.jpg" "fill 90x120 right" />}}
-{{< imgproc sunset Fit "90x90" />}}
+{{< imgproc "sunset.jpg" "fit 90x90" />}}
-{{< imgproc sunset Crop "250x250 center" />}}
+{{< imgproc "sunset.jpg" "crop 250x250 center" />}}
-{{< imgproc sunset Resize "300x q10" />}}
+{{< imgproc "sunset.jpg" "resize 300x q10" />}}
This is the shortcode used to generate the examples above:
-{{< code file="layouts/shortcodes/imgproc.html" >}}
-{{< readfile file="layouts/shortcodes/imgproc.html" >}}
-{{< /code >}}
+{{< readfile file="layouts/shortcodes/imgproc.html" highlight="go-html-template" >}}
Call the shortcode from your Markdown like this:
```go-html-template
-{{* imgproc sunset Resize "300x" /*/>}}
+{{* imgproc "sunset.jpg" "resize 300x" /*/>}}
```
{{% note %}}
@@ -457,7 +454,7 @@ resampleFilter
Define an `imaging.exif` section in your site configuration to control the availability of EXIF data.
-{{< code-toggle file="hugo" copy=true >}}
+{{< code-toggle file=hugo >}}
[imaging.exif]
includeFields = ""
excludeFields = ""
@@ -487,9 +484,9 @@ By default, Hugo uses the [Smartcrop] library when cropping images with the `Cro
Examples using the sunset image from above:
-{{< imgproc sunset Fill "200x200 smart" />}}
+{{< imgproc "sunset.jpg" "fill 200x200 smart" />}}
-{{< imgproc sunset Crop "200x200 smart" />}}
+{{< imgproc "sunset.jpg" "crop 200x200 smart" />}}
## Image processing performance consideration
@@ -497,7 +494,7 @@ Hugo caches processed images in the `resources` directory. If you include this d
If you change image processing methods or options, or if you rename or remove images, the `resources` directory will contain unused images. To remove the unused images, perform garbage collection with:
-```bash
+```sh
hugo --gc
```
diff --git a/content/en/content-management/menus.md b/content/en/content-management/menus.md
index 07bf41669..f7f7cec4c 100644
--- a/content/en/content-management/menus.md
+++ b/content/en/content-management/menus.md
@@ -36,7 +36,7 @@ Although you can use these methods in combination when defining a menu, the menu
To automatically define menu entries for each top-level section of your site, enable the section pages menu in your site configuration.
-{{< code-toggle file="hugo" copy=false >}}
+{{< code-toggle file=hugo >}}
sectionPagesMenu = "main"
{{< /code-toggle >}}
@@ -46,7 +46,7 @@ This creates a menu structure that you can access with `site.Menus.main` in your
To add a page to the "main" menu:
-{{< code-toggle file="content/about.md" copy=false fm=true >}}
+{{< code-toggle file="content/about.md" fm=true >}}
title = 'About'
menu = 'main'
{{< /code-toggle >}}
@@ -55,7 +55,7 @@ Access the entry with `site.Menus.main` in your templates. See [menu templates]
To add a page to the "main" and "footer" menus:
-{{< code-toggle file="content/contact.md" copy=false fm=true >}}
+{{< code-toggle file="content/contact.md" fm=true >}}
title = 'Contact'
menu = ['main','footer']
{{< /code-toggle >}}
@@ -94,7 +94,7 @@ weight
This front matter menu entry demonstrates some of the available properties:
-{{< code-toggle file="content/products/software.md" copy=false fm=true >}}
+{{< code-toggle file="content/products/software.md" fm=true >}}
title = 'Software'
[menu.main]
parent = 'Products'
@@ -106,12 +106,11 @@ class = 'center'
Access the entry with `site.Menus.main` in your templates. See [menu templates] for details.
-
## Define in site configuration
To define entries for the "main" menu:
-{{< code-toggle file="hugo" copy=false >}}
+{{< code-toggle file=hugo >}}
[[menu.main]]
name = 'Home'
pageRef = '/'
@@ -132,7 +131,7 @@ This creates a menu structure that you can access with `site.Menus.main` in your
To define entries for the "footer" menu:
-{{< code-toggle file="hugo" copy=false >}}
+{{< code-toggle file=hugo >}}
[[menu.footer]]
name = 'Terms'
pageRef = '/terms'
@@ -177,7 +176,7 @@ url
This nested menu demonstrates some of the available properties:
-{{< code-toggle file="hugo" copy=false >}}
+{{< code-toggle file=hugo >}}
[[menu.main]]
name = 'Products'
pageRef = '/products'
diff --git a/content/en/content-management/multilingual.md b/content/en/content-management/multilingual.md
index 6e787c526..910af91ce 100644
--- a/content/en/content-management/multilingual.md
+++ b/content/en/content-management/multilingual.md
@@ -25,7 +25,7 @@ This is the default language configuration:
This is an example of a site configuration for a multilingual project. Any key not defined in a `languages` object will fall back to the global value in the root of your site configuration.
-{{< code-toggle file="hugo" >}}
+{{< code-toggle file=hugo >}}
defaultContentLanguage = 'de'
defaultContentLanguageInSubdir = true
@@ -104,7 +104,7 @@ In Hugo `v0.112.0` we consolidated all configuration options, and improved how t
1. `site.Language.Params` is deprecated. Use `site.Params` directly.
1. Adding custom parameters to the top level language configuration is deprecated. Define custom parameters within `languages.xx.params`. See `color` in the example below.
-{{< code-toggle file=hugo copy=false >}}
+{{< code-toggle file=hugo >}}
title = "My blog"
languageCode = "en-us"
@@ -129,20 +129,20 @@ In the example above, all settings except `color` below `params` map to predefin
To disable a language within a `languages` object in your site configuration:
-{{< code-toggle file="hugo" copy=false >}}
+{{< code-toggle file=hugo >}}
[languages.es]
disabled = true
{{< /code-toggle >}}
To disable one or more languages in the root of your site configuration:
-{{< code-toggle file="hugo" copy=false >}}
+{{< code-toggle file=hugo >}}
disableLanguages = ["es", "fr"]
{{< /code-toggle >}}
To disable one or more languages using an environment variable:
-```bash
+```sh
HUGO_DISABLELANGUAGES="es fr" hugo
```
@@ -160,7 +160,7 @@ If a `baseURL` is set on the `language` level, then all languages must have one
Example:
-{{< code-toggle file="hugo" >}}
+{{< code-toggle file=hugo >}}
[languages]
[languages.fr]
baseURL = "https://example.fr"
@@ -169,7 +169,7 @@ weight = 1
title = "En Français"
[languages.en]
-baseURL = "https://example.com"
+baseURL = "https://example.org/"
languageName = "English"
weight = 2
title = "In English"
@@ -183,7 +183,7 @@ public
└── fr
```
-**All URLs (i.e `.Permalink` etc.) will be generated from that root. So the English home page above will have its `.Permalink` set to `https://example.com/`.**
+**All URLs (i.e `.Permalink` etc.) will be generated from that root. So the English home page above will have its `.Permalink` set to `https://example.org/`.**
When you run `hugo server` we will start multiple HTTP servers. You will typically see something like this in the console:
@@ -221,7 +221,7 @@ If a file has no language code, it will be assigned the default language.
This system uses different content directories for each of the languages. Each language's content directory is set using the `contentDir` parameter.
-{{< code-toggle file="hugo" >}}
+{{< code-toggle file=hugo >}}
languages:
en:
weight: 10
@@ -277,7 +277,7 @@ To localize URLs:
For example, a French translation can have its own localized slug.
-{{< code-toggle file="content/about.fr.md" fm=true copy=false >}}
+{{< code-toggle file="content/about.fr.md" fm=true >}}
title: A Propos
slug: "a-propos"
{{< /code-toggle >}}
@@ -427,7 +427,7 @@ In case you need to pass a custom data: (`(dict "Count" numeric_value_only)` is
The following localization examples assume your site's primary language is English, with translations to French and German.
-{{< code-toggle file="hugo" >}}
+{{< code-toggle file=hugo >}}
defaultContentLanguage = 'en'
[languages]
@@ -530,7 +530,7 @@ Localization of menu entries depends on how you define them:
- When you define menu entries [automatically] using the section pages menu, you must use translation tables to localize each entry.
- When you define menu entries [in front matter], they are already localized based on the front matter itself. If the front matter values are insufficient, use translation tables to localize each entry.
-- When you define menu entries [in site configuration], you must create language-specific menu entries under each language key. If the names of the menu entries are insufficent, use translation tables to localize each entry.
+- When you define menu entries [in site configuration], you must create language-specific menu entries under each language key. If the names of the menu entries are insufficient, use translation tables to localize each entry.
### Create language-specific menu entries
@@ -538,7 +538,7 @@ Localization of menu entries depends on how you define them:
For a simple menu with a small number of entries, use a single configuration file. For example:
-{{< code-toggle file="hugo" copy=false >}}
+{{< code-toggle file=hugo >}}
[languages.de]
languageCode = 'de-DE'
languageName = 'Deutsch'
@@ -583,7 +583,7 @@ config/
└── hugo.toml
```
-{{< code-toggle file="config/_default/menus/menu.de" copy=false >}}
+{{< code-toggle file="config/_default/menus/menu.de" >}}
[[main]]
name = 'Produkte'
pageRef = '/products'
@@ -594,7 +594,7 @@ pageRef = '/services'
weight = 20
{{< /code-toggle >}}
-{{< code-toggle file="config/_default/menus/menu.en" copy=false >}}
+{{< code-toggle file="config/_default/menus/menu.en" >}}
[[main]]
name = 'Products'
pageRef = '/products'
@@ -624,7 +624,7 @@ The `identifier` depends on how you define menu entries:
For example, if you define menu entries in site configuration:
-{{< code-toggle file="hugo" copy=false >}}
+{{< code-toggle file=hugo >}}
[[menu.main]]
identifier = 'products'
name = 'Products'
@@ -639,7 +639,7 @@ For example, if you define menu entries in site configuration:
Create corresponding entries in the translation tables:
-{{< code-toggle file="i18n/de" copy=false >}}
+{{< code-toggle file="i18n/de" >}}
products = 'Produkte'
services = 'Leistungen'
{{< / code-toggle >}}
@@ -663,7 +663,7 @@ For merging of content from other languages (i.e. missing content translations),
To track down missing translation strings, run Hugo with the `--printI18nWarnings` flag:
-```bash
+```sh
hugo --printI18nWarnings | grep i18n
i18n|MISSING_TRANSLATION|en|wordCount
```
@@ -677,19 +677,18 @@ To support Multilingual mode in your themes, some considerations must be taken f
If there is more than one language defined, the `LanguagePrefix` variable will equal `/en` (or whatever your `CurrentLanguage` is). If not enabled, it will be an empty string (and is therefore harmless for single-language Hugo websites).
-
## Generate multilingual content with `hugo new content`
If you organize content with translations in the same directory:
-```text
+```sh
hugo new content post/test.en.md
hugo new content post/test.de.md
```
If you organize content with translations in different directories:
-```text
+```sh
hugo new content content/en/post/test.md
hugo new content content/de/post/test.md
```
diff --git a/content/en/content-management/organization/index.md b/content/en/content-management/organization/index.md
index 2c0d2e604..250e51460 100644
--- a/content/en/content-management/organization/index.md
+++ b/content/en/content-management/organization/index.md
@@ -19,16 +19,14 @@ Hugo `0.32` announced page-relative images and other resources packaged into `Pa
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.
-{{< imgproc 1-featured Resize "300x" >}}
+{{< imgproc "1-featured-content-bundles.png" "resize 300x" >}}
The illustration shows three bundles. Note that the home page bundle cannot contain other content pages, although other files (images etc.) are allowed.
{{< /imgproc >}}
-
{{% note %}}
The bundle documentation is a **work in progress**. We will publish more comprehensive docs about this soon.
{{% /note %}}
-
## Organization of content source
In Hugo, your content should be organized in a manner that reflects the rendered website.
@@ -41,33 +39,31 @@ Without any additional configuration, the following will automatically work:
.
└── content
└── about
- | └── index.md // <- https://example.com/about/
+ | └── index.md // <- https://example.org/about/
├── posts
- | ├── firstpost.md // <- https://example.com/posts/firstpost/
+ | ├── firstpost.md // <- https://example.org/posts/firstpost/
| ├── happy
- | | └── ness.md // <- https://example.com/posts/happy/ness/
- | └── secondpost.md // <- https://example.com/posts/secondpost/
+ | | └── ness.md // <- https://example.org/posts/happy/ness/
+ | └── secondpost.md // <- https://example.org/posts/secondpost/
└── quote
- ├── first.md // <- https://example.com/quote/first/
- └── second.md // <- https://example.com/quote/second/
+ ├── first.md // <- https://example.org/quote/first/
+ └── second.md // <- https://example.org/quote/second/
```
## Path breakdown in Hugo
-
-The following demonstrates the relationships between your content organization and the output URL structure for your Hugo website when it renders. These examples assume you are [using pretty URLs][pretty], which is the default behavior for Hugo. The examples also assume a key-value of `baseURL = "https://example.com"` in your [site's configuration file][config].
+The following demonstrates the relationships between your content organization and the output URL structure for your Hugo website when it renders. These examples assume you are [using pretty URLs][pretty], which is the default behavior for Hugo. The examples also assume a key-value of `baseURL = "https://example.org"` in your [site's configuration file][config].
### Index pages: `_index.md`
`_index.md` has a special role in Hugo. It allows you to add front matter and content to your [list templates][lists]. These templates include those for [section templates], [taxonomy templates], [taxonomy terms templates], and your [homepage template].
{{% note %}}
-**Tip:** You can get a reference to the content and metadata in `_index.md` using the [`.Site.GetPage` function](/functions/getpage/).
+**Tip:** You can get a reference to the content and metadata in `_index.md` using the [`.Site.GetPage` function](/methods/page/getpage).
{{% /note %}}
You can create one `_index.md` for your homepage and one in each of your content sections, taxonomies, and taxonomy terms. The following shows typical placement of an `_index.md` that would contain content and front matter for a `posts` section list page on a Hugo website:
-
```txt
. url
. ⊢--^-⊣
@@ -88,17 +84,15 @@ At build, this will output to the following destination with the associated valu
⊢--------^---------⊣⊢-^-⊣
permalink
⊢----------^-------------⊣
-https://example.com/posts/index.html
+https://example.org/posts/index.html
```
The [sections] can be nested as deeply as you want. The important thing to understand is that to make the section tree fully navigational, at least the lower-most section must include a content file. (i.e. `_index.md`).
-
### Single pages in sections
Single content files in each of your sections will be rendered as [single page templates][singles]. Here is an example of a single `post` within `posts`:
-
```txt
path ("posts/my-first-hugo-post.md")
. ⊢-----------^------------⊣
@@ -117,10 +111,9 @@ When Hugo builds your site, the content will be output to the following destinat
⊢--------^--------⊣⊢-^--⊣⊢-------^---------⊣
permalink
⊢--------------------^---------------------⊣
-https://example.com/posts/my-first-hugo-post/index.html
+https://example.org/posts/my-first-hugo-post/index.html
```
-
## Paths explained
The following concepts provide more insight into the relationship between your project's organization and the default Hugo behavior when building output for the website.
@@ -147,7 +140,7 @@ The `url` is the entire URL path, defined by the file path and optionally overri
[config]: /getting-started/configuration/
[formats]: /content-management/formats/
[front matter]: /content-management/front-matter/
-[getpage]: /functions/getpage/
+[getpage]: /methods/page/getpage
[homepage template]: /templates/homepage/
[homepage]: /templates/homepage/
[lists]: /templates/lists/
diff --git a/content/en/content-management/page-bundles.md b/content/en/content-management/page-bundles.md
index c4ce69f5f..91ed0d5df 100644
--- a/content/en/content-management/page-bundles.md
+++ b/content/en/content-management/page-bundles.md
@@ -48,14 +48,14 @@ content/
│ │ ├── image2.png
│ │ └── index.md
│ └── my-other-post
-│ └── index.md
+│ └── index.md
│
└── another-section
├── ..
- └── not-a-leaf-bundle
+ └── not-a-leaf-bundle
├── ..
- └── another-leaf-bundle
- └── index.md
+ └── another-leaf-bundle
+ └── index.md
```
In the above example `content/` directory, there are four leaf
@@ -90,7 +90,6 @@ The hierarchy depth at which a leaf bundle is created does not matter,
as long as it is not inside another **leaf** bundle.
{{% /note %}}
-
### Headless bundle
A headless bundle is a bundle that is configured to not get published
@@ -128,7 +127,7 @@ Explanation of the above example:
A leaf bundle can be made headless by adding below in the front matter
(in the `index.md`):
-{{< code-toggle file="content/headless/index.md" fm=true copy=false >}}
+{{< code-toggle file="content/headless/index.md" fm=true >}}
headless = true
{{< /code-toggle >}}
@@ -149,17 +148,16 @@ Here `md` (markdown) is used just as an example. You can use any file
type as a content resource as long as it is a content type recognized by Hugo.
{{% /note %}}
-
### Examples of branch bundle organization
```text
content/
├── branch-bundle-1
-│ ├── branch-content1.md
-│ ├── branch-content2.md
-│ ├── image1.jpg
-│ ├── image2.png
-│ └── _index.md
+│ ├── branch-content1.md
+│ ├── branch-content2.md
+│ ├── image1.jpg
+│ ├── image2.png
+│ └── _index.md
└── branch-bundle-2
├── _index.md
└── a-leaf-bundle
diff --git a/content/en/content-management/page-resources.md b/content/en/content-management/page-resources.md
index bbf288459..bcff98118 100644
--- a/content/en/content-management/page-resources.md
+++ b/content/en/content-management/page-resources.md
@@ -112,7 +112,6 @@ GetMatch
.Resources.Match "*" 🚫
.Resources.Match "sunset.jpg" 🚫
.Resources.Match "*sunset.jpg" 🚫
-
```
## Page resources metadata
@@ -138,7 +137,7 @@ params
### Resources metadata example
-{{< code-toggle copy=false >}}
+{{< code-toggle >}}
title: Application
date : 2018-01-25
resources :
@@ -184,7 +183,8 @@ The counter starts at 1 the first time they are used in either `name` or `title`
For example, if a bundle has the resources `photo_specs.pdf`, `other_specs.pdf`, `guide.pdf` and `checklist.pdf`, and the front matter has specified the `resources` as:
-{{< code-toggle copy=false >}}
+{{< code-toggle file="content/inspections/engine/index.md" fm=true >}}
+title = 'Engine inspections'
[[resources]]
src = "*specs.pdf"
title = "Specification #:counter"
diff --git a/content/en/content-management/related.md b/content/en/content-management/related.md
index 410e183b7..996831349 100644
--- a/content/en/content-management/related.md
+++ b/content/en/content-management/related.md
@@ -33,16 +33,19 @@ To list up to 5 related pages (which share the same _date_ or _keyword_ paramete
The `Related` method takes one argument which may be a `Page` or a options map. The options map have these options:
indices
-: The indices to search in.
+: (`slice`) The indices to search within.
document
-: The document to search for related content for.
+: (`page`) The page for which to find related content. Required when specifying an options map.
namedSlices
-: The keywords to search for.
+: (`slice`) The keywords to search for, expressed as a slice of `KeyValues` using the [`keyVals`] function.
fragments
-: Fragments holds a a list of special keywords that is used for indices configured as type "fragments". This will match the fragment identifiers of the documents.
+: (`slice`) A list of special keywords that is used for indices configured as type "fragments". This will match the [fragment] identifiers of the documents.
+
+[fragment]: /getting-started/glossary/#fragment
+[`keyVals`]: /functions/collections/keyvals/
A fictional example using all of the above options:
@@ -57,7 +60,7 @@ A fictional example using all of the above options:
```
{{% note %}}
-We improved and simplified this feature in Hugo 0.111.0. Before this we had 3 different methods: `Related`, `RelatedTo` and `RelatedIndicies`. Now we have only one method: `Related`. The old methods are still available but deprecated. Also see [this blog article](https://regisphilibert.com/blog/2018/04/hugo-optmized-relashionships-with-related-content/) for a great explanation of more advanced usage of this feature.
+We improved and simplified this feature in Hugo 0.111.0. Before this we had 3 different methods: `Related`, `RelatedTo` and `RelatedIndices`. Now we have only one method: `Related`. The old methods are still available but deprecated. Also see [this blog article](https://regisphilibert.com/blog/2018/04/hugo-optmized-relashionships-with-related-content/) for a great explanation of more advanced usage of this feature.
{{% /note %}}
## Index content headings in related content
@@ -66,7 +69,7 @@ We improved and simplified this feature in Hugo 0.111.0. Before this we had 3 di
Hugo can index the headings in your content and use this to find related content. You can enable this by adding a index of type `fragments` to your `related` configuration:
-{{< code-toggle file="hugo" copy=false >}}
+{{< code-toggle file=hugo >}}
[related]
threshold = 20
includeNewer = true
@@ -74,7 +77,7 @@ toLower = false
[[related.indices]]
name = "fragmentrefs"
type = "fragments"
-applyFilter = false
+applyFilter = true
weight = 80
{{< /code-toggle >}}
@@ -146,7 +149,6 @@ applyFilter
weight
: An integer weight that indicates _how important_ this parameter is relative to the other parameters. It can be 0, which has the effect of turning this index off, or even negative. Test with different values to see what fits your content best.
-
cardinalityThreshold (default 0)
: {{< new-in "0.111.0" >}}. A percentage (0-100) used to remove common keywords from the index. As an example, setting this to 50 will remove all keywords that are used in more than 50% of the documents in the index.
diff --git a/content/en/content-management/sections.md b/content/en/content-management/sections.md
index a3e4397f3..8ee5c0d52 100644
--- a/content/en/content-management/sections.md
+++ b/content/en/content-management/sections.md
@@ -26,35 +26,35 @@ A typical site consists of one or more sections. For example:
```text
content/
├── articles/ <-- section (top-level directory)
-│ ├── 2022/
-│ │ ├── article-1/
-│ │ │ ├── cover.jpg
-│ │ │ └── index.md
-│ │ └── article-2.md
-│ └── 2023/
-│ ├── article-3.md
-│ └── article-4.md
+│ ├── 2022/
+│ │ ├── article-1/
+│ │ │ ├── cover.jpg
+│ │ │ └── index.md
+│ │ └── article-2.md
+│ └── 2023/
+│ ├── article-3.md
+│ └── article-4.md
├── products/ <-- section (top-level directory)
-│ ├── product-1/ <-- section (has _index.md file)
-│ │ ├── benefits/ <-- section (has _index.md file)
-│ │ │ ├── _index.md
-│ │ │ ├── benefit-1.md
-│ │ │ └── benefit-2.md
-│ │ ├── features/ <-- section (has _index.md file)
-│ │ │ ├── _index.md
-│ │ │ ├── feature-1.md
-│ │ │ └── feature-2.md
-│ │ └── _index.md
-│ └── product-2/ <-- section (has _index.md file)
-│ ├── benefits/ <-- section (has _index.md file)
-│ │ ├── _index.md
-│ │ ├── benefit-1.md
-│ │ └── benefit-2.md
-│ ├── features/ <-- section (has _index.md file)
-│ │ ├── _index.md
-│ │ ├── feature-1.md
-│ │ └── feature-2.md
-│ └── _index.md
+│ ├── product-1/ <-- section (has _index.md file)
+│ │ ├── benefits/ <-- section (has _index.md file)
+│ │ │ ├── _index.md
+│ │ │ ├── benefit-1.md
+│ │ │ └── benefit-2.md
+│ │ ├── features/ <-- section (has _index.md file)
+│ │ │ ├── _index.md
+│ │ │ ├── feature-1.md
+│ │ │ └── feature-2.md
+│ │ └── _index.md
+│ └── product-2/ <-- section (has _index.md file)
+│ ├── benefits/ <-- section (has _index.md file)
+│ │ ├── _index.md
+│ │ ├── benefit-1.md
+│ │ └── benefit-2.md
+│ ├── features/ <-- section (has _index.md file)
+│ │ ├── _index.md
+│ │ ├── feature-1.md
+│ │ └── feature-2.md
+│ └── _index.md
├── _index.md
└── about.md
```
@@ -77,7 +77,7 @@ With the file structure from the [example above](#overview):
1. The articles/2022 and articles/2023 directories do not have list pages; they are not sections.
-1. The list page for the products section, by default, includes product-1 and product-2, but not their descendant pages. To include descendant pages, use the `.RegularPagesRecursive` collection instead of the `.Pages` collection in the list template. See [details](/variables/page/#page-collections).
+1. The list page for the products section, by default, includes product-1 and product-2, but not their descendant pages. To include descendant pages, use the `.RegularPagesRecursive` collection instead of the `.Pages` collection in the list template. See [details](/variables/page/#page-collections).
1. All directories in the products section have list pages; each directory is a section.
@@ -108,7 +108,6 @@ If you need to use a different template for a subsection, specify `type` and/or
A section has one or more ancestors (including the home page), and zero or more descendants. With the file structure from the [example above](#overview):
-
```text
content/products/product-1/benefits/benefit-1.md
```
@@ -122,11 +121,11 @@ For example, use the `.Ancestors` method to render breadcrumb navigation.
{{ range .Ancestors.Reverse }}
@@ -154,7 +153,6 @@ Hugo renders this, where each breadcrumb is a link to the corresponding page:
Home » Products » Product 1 » Benefits » Benefit 1
```
-
[archetype]: /content-management/archetypes/
[content type]: /content-management/types/
[directory structure]: /getting-started/directory-structure/
diff --git a/content/en/content-management/shortcodes.md b/content/en/content-management/shortcodes.md
index b1e32d902..29274486f 100644
--- a/content/en/content-management/shortcodes.md
+++ b/content/en/content-management/shortcodes.md
@@ -58,7 +58,6 @@ and a new line with a "quoted string".` */>}}
Shortcodes using the `%` as the outer-most delimiter will be fully rendered when sent to the content renderer. This means that the rendered output from a shortcode can be part of the page's table of contents, footnotes, etc.
-
### Shortcodes without markdown
The `<` character indicates that the shortcode's inner content does *not* need further rendering. Often shortcodes without Markdown include internal HTML:
@@ -172,7 +171,7 @@ To display a highlighted code sample:
```text
{{* highlight go-html-template */>}}
{{ range .Pages }}
-
{{ end }}
{{< /highlight >}}
@@ -192,7 +191,7 @@ To specify one or more [highlighting options], include a quotation-encapsulated,
```text
{{* highlight go-html-template "lineNos=inline, lineNoStart=42" */>}}
{{ range .Pages }}
-
{{ end }}
diff --git a/content/en/functions/collections/Apply.md b/content/en/functions/collections/Apply.md
index 4d972b853..abd6fca77 100644
--- a/content/en/functions/collections/Apply.md
+++ b/content/en/functions/collections/Apply.md
@@ -1,18 +1,13 @@
---
title: collections.Apply
-linkTitle: apply
description: Returns a new collection with each element transformed by the given function.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [apply]
returnType: '[]any'
signatures: [collections.Apply COLLECTION FUNCTION PARAM...]
relatedFunctions:
- - collections.Apply
- collections.Delimit
- collections.In
- collections.Reverse
@@ -25,7 +20,6 @@ The `apply` function takes three or more arguments, depending on the function be
The first argument is the collection itself, the second argument is the function name, and the remaining arguments are passed to the function, with the string `"."` representing the collection element.
-
```go-html-template
{{ $s := slice "hello" "world" }}
diff --git a/content/en/functions/collections/Complement.md b/content/en/functions/collections/Complement.md
index 28b7ded3d..773323b38 100644
--- a/content/en/functions/collections/Complement.md
+++ b/content/en/functions/collections/Complement.md
@@ -1,21 +1,16 @@
---
title: collections.Complement
-linkTitle: complement
description: Returns the elements of the last collection that are not in any of the others.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [complement]
+ related:
+ - functions/collections/Intersect
+ - functions/collections/SymDiff
+ - functions/collections/Union
returnType: any
- signatures: ['collections.Complement COLLECTION [COLLECTION]...']
-relatedFunctions:
- - collections.Complement
- - collections.Intersect
- - collections.SymDiff
- - collections.Union
+ signatures: ['collections.Complement COLLECTION [COLLECTION...]']
aliases: [/functions/complement]
---
@@ -35,7 +30,6 @@ Make your code simpler to understand by using a [chained pipeline]:
[chained pipeline]: https://pkg.go.dev/text/template#hdr-Pipelines
{{% /note %}}
-
```go-html-template
{{ $c3 | complement $c1 $c2 }} → [1 2]
```
@@ -57,7 +51,7 @@ To list everything except blog articles (`blog`) and frequently asked questions
{{ $blog := where site.RegularPages "Type" "blog" }}
{{ $faqs := where site.RegularPages "Type" "faqs" }}
{{ range site.RegularPages | complement $blog $faqs }}
- {{ .LinkTitle }}
+ {{ .Title }}
{{ end }}
```
@@ -65,11 +59,11 @@ To list everything except blog articles (`blog`) and frequently asked questions
Although the example above demonstrates the `complement` function, you could use the [`where`] function as well:
[`where`]: /functions/collections/where
-{{% /note %}}
+{{% /note %}}
```go-html-template
{{ range where site.RegularPages "Type" "not in" (slice "blog" "faqs") }}
- {{ .LinkTitle }}
+ {{ .Title }}
{{ end }}
```
diff --git a/content/en/functions/collections/Delimit.md b/content/en/functions/collections/Delimit.md
index 0fc3ef537..6aea467ee 100644
--- a/content/en/functions/collections/Delimit.md
+++ b/content/en/functions/collections/Delimit.md
@@ -1,24 +1,19 @@
---
title: collections.Delimit
-linkTitle: delimit
description: Loops through any array, slice, or map and returns a string of all the values separated by a delimiter.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [delimit]
- returnType: template.HTML
+ related:
+ - functions/collections/Apply
+ - functions/collections/In
+ - functions/collections/Reverse
+ - functions/collections/Seq
+ - functions/collections/Slice
+ - functions/strings/Split
+ returnType: string
signatures: ['collections.Delimit COLLECTION DELIMITER [LAST]']
-relatedFunctions:
- - collections.Apply
- - collections.Delimit
- - collections.In
- - collections.Reverse
- - collections.Seq
- - collections.Slice
- - strings.Split
aliases: [/functions/delimit]
---
@@ -26,8 +21,8 @@ Delimit a slice:
```go-html-template
{{ $s := slice "b" "a" "c" }}
-{{ delimit $s ", " }} → "b, a, c"
-{{ delimit $s ", " " and "}} → "b, a and c"
+{{ delimit $s ", " }} → b, a, c
+{{ delimit $s ", " " and "}} → b, a and c
```
Delimit a map:
@@ -38,6 +33,6 @@ The `delimit` function sorts maps by key, returning the values.
```go-html-template
{{ $m := dict "b" 2 "a" 1 "c" 3 }}
-{{ delimit $m ", " }} → "1, 2, 3"
-{{ delimit $m ", " " and "}} → "1, 2 and 3"
+{{ delimit $m ", " }} → 1, 2, 3
+{{ delimit $m ", " " and "}} → 1, 2 and 3
```
diff --git a/content/en/functions/collections/Dictionary.md b/content/en/functions/collections/Dictionary.md
index 28c387726..a90c9e590 100644
--- a/content/en/functions/collections/Dictionary.md
+++ b/content/en/functions/collections/Dictionary.md
@@ -1,22 +1,17 @@
---
title: collections.Dictionary
-linkTitle: dict
description: Creates a map from a list of key and value pairs.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [dict]
+ related:
+ - functions/collections/Group
+ - functions/collections/IndexFunction
+ - functions/collections/IsSet
+ - functions/collections/Where
returnType: mapany
- signatures: ['collections.Dictionary KEY VALUE [KEY VALUE]...']
-relatedFunctions:
- - collections.Dictionary
- - collections.Group
- - collections.Index
- - collections.IsSet
- - collections.Where
+ signatures: ['collections.Dictionary KEY VALUE [VALUE...]']
aliases: [/functions/dict]
---
@@ -24,10 +19,23 @@ aliases: [/functions/dict]
Note that the `key` can be either a `string` or a `string slice`. The latter is useful to create a deeply nested structure, e.g.:
-```go-text-template
+```go-html-template
{{ $m := dict (slice "a" "b" "c") "value" }}
```
+The above produces this data structure:
+
+
+```json
+{
+ "a": {
+ "b": {
+ "c": "value"
+ }
+ }
+}
+```
+
## Example: using `dict` to pass multiple values to a `partial`
The partial below creates an SVG and expects `fill`, `height` and `width` from the caller:
diff --git a/content/en/functions/collections/EchoParam.md b/content/en/functions/collections/EchoParam.md
deleted file mode 100644
index 7617eedd9..000000000
--- a/content/en/functions/collections/EchoParam.md
+++ /dev/null
@@ -1,40 +0,0 @@
----
-title: collections.EchoParam
-linkTitle: echoParam
-description: Prints a parameter if it is set.
-categories: [functions]
-keywords: []
-menu:
- docs:
- parent: functions
-function:
- aliases: [echoParam]
- returnType: any
- signatures: [collections.EchoParam COLLECTION KEY]
-relatedFunctions: []
-aliases: [/functions/echoparam]
----
-
-For example, consider this site configuration:
-
-{{< code-toggle file=hugo copy=false >}}
-[params.footer]
-poweredBy = 'Hugo'
-{{< /code-toggle >}}
-
-To print the value of `poweredBy`:
-
-```go-html-template
-{{ echoParam site.Params.footer "poweredby" }} → Hugo
-```
-
-{{% note %}}
-When using the `echoParam` function you must reference the key using lower case. See the previous example.
-
-The `echoParam` function will be deprecated in a future release. Instead, use either of the constructs below.
-{{% /note %}}
-
-```go-html-template
-{{ site.Params.footer.poweredBy }} → Hugo
-{{ index site.Params.footer "poweredBy" }} → Hugo
-```
diff --git a/content/en/functions/collections/First.md b/content/en/functions/collections/First.md
index ddb045382..ab7ea0b72 100644
--- a/content/en/functions/collections/First.md
+++ b/content/en/functions/collections/First.md
@@ -1,34 +1,28 @@
---
title: collections.First
-linkTitle: first
description: Slices an array to the first N elements.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [first]
+ related:
+ - functions/collections/After
+ - functions/collections/Last
returnType: any
signatures: [collections.First LIMIT COLLECTION]
-relatedFunctions:
- - collections.After
- - collections.First
- - collections.Last
aliases: [/functions/first]
---
-`first` works in a similar manner to the [`limit` keyword in
-SQL][limitkeyword]. It reduces the array to only the `first N`
-elements. It takes the array and number of elements as input.
+`first` works in a similar manner to the [`limit` keyword in SQL][limitkeyword]. It reduces the array to only the `first N` elements. It takes the array and number of elements as input.
`first` takes two arguments:
+
1. `number of elements`
2. `array` *or* `slice of maps or structs`
{{< code file="layout/_default/section.html" >}}
{{ range first 10 .Pages }}
- {{ .Render "summary" }}
+ {{ .Render "summary" }}
{{ end }}
{{< /code >}}
@@ -43,11 +37,10 @@ ranges through only the first 5 posts in that list:
{{< code file="first-and-where-together.html" >}}
{{ range first 5 (where site.RegularPages "Type" "in" site.Params.mainSections).ByTitle }}
- {{ .Content }}
+ {{ .Content }}
{{ end }}
{{< /code >}}
-
[limitkeyword]: https://www.techonthenet.com/sql/select_limit.php
[`where`]: /functions/collections/where
[main sections]: /functions/collections/where#mainsections
diff --git a/content/en/functions/collections/Group.md b/content/en/functions/collections/Group.md
index 29220f1f7..cc919ca2a 100644
--- a/content/en/functions/collections/Group.md
+++ b/content/en/functions/collections/Group.md
@@ -1,26 +1,21 @@
---
title: collections.Group
-linkTitle: group
description: Groups a list of pages.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [group]
+ related:
+ - functions/collections/Dictionary
+ - functions/collections/IndexFunction
+ - functions/collections/IsSet
+ - functions/collections/Where
returnType: any
signatures: [PAGES | collections.Group KEY]
-relatedFunctions:
- - collections.Dictionary
- - collections.Group
- - collections.Index
- - collections.IsSet
- - collections.Where
aliases: [/functions/group]
---
-{{< code file="layouts/partials/groups.html" >}}
+```go-html-template
{{ $new := .Site.RegularPages | first 10 | group "New" }}
{{ $old := .Site.RegularPages | last 10 | group "Old" }}
{{ $groups := slice $new $old }}
@@ -35,6 +30,6 @@ aliases: [/functions/group]
{{ end }}
{{ end }}
-{{< /code >}}
+```
The page group you get from `group` is of the same type you get from the built-in [group methods](/templates/lists#group-content) in Hugo. The above example can be [paginated](/templates/pagination/#list-paginator-pages).
diff --git a/content/en/functions/collections/In.md b/content/en/functions/collections/In.md
index 57ffbd653..8a3d31d0e 100644
--- a/content/en/functions/collections/In.md
+++ b/content/en/functions/collections/In.md
@@ -1,22 +1,22 @@
---
title: collections.In
-linkTitle: in
description: Reports whether an element is in an array or slice, or if a substring is in a string.
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [in]
+ related:
+ - functions/collections/Slice
+ - functions/strings/Contains
+ - functions/strings/ContainsAny
+ - functions/strings/ContainsNonSpace
+ - functions/strings/HasPrefix
+ - functions/strings/HasSuffix
returnType: bool
signatures: [collections.In SET ITEM]
-relatedFunctions:
- - collections.Slice
aliases: [/functions/in]
---
-
-
```go-html-template
{{ $s := slice "a" "b" "c" }}
{{ in $s "b" }} → true
diff --git a/content/en/functions/collections/IndexFunction.md b/content/en/functions/collections/IndexFunction.md
index cd063f36e..5bd189d9f 100644
--- a/content/en/functions/collections/IndexFunction.md
+++ b/content/en/functions/collections/IndexFunction.md
@@ -1,71 +1,66 @@
---
title: collections.Index
-linkTitle: index
description: Looks up the index(es) or key(s) of the data structure passed into it.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [index]
+ related:
+ - functions/collections/Dictionary
+ - functions/collections/Group
+ - functions/collections/IsSet
+ - functions/collections/Where
returnType: any
signatures:
- collections.Index COLLECTION INDEXES
- collections.Index COLLECTION KEYS
-relatedFunctions:
- - collections.Dictionary
- - collections.EchoParam
- - collections.Group
- - collections.Index
- - collections.IsSet
- - collections.Where
aliases: [/functions/index,/functions/index-function]
---
The `index` functions returns the result of indexing its first argument by the following arguments. Each indexed item must be a map or a slice, e.g.:
-```go-text-template
+```go-html-template
{{ $slice := slice "a" "b" "c" }}
-{{ index $slice 1 }} => b
+{{ index $slice 0 }} → a
+{{ index $slice 1 }} → b
+
{{ $map := dict "a" 100 "b" 200 }}
-{{ index $map "b" }} => 200
+{{ index $map "b" }} → 200
```
The function takes multiple indices as arguments, and this can be used to get nested values, e.g.:
-```go-text-template
+```go-html-template
{{ $map := dict "a" 100 "b" 200 "c" (slice 10 20 30) }}
-{{ index $map "c" 1 }} => 20
+{{ index $map "c" 1 }} → 20
{{ $map := dict "a" 100 "b" 200 "c" (dict "d" 10 "e" 20) }}
-{{ index $map "c" "e" }} => 20
+{{ index $map "c" "e" }} → 20
```
You may write multiple indices as a slice:
-```go-text-template
+```go-html-template
{{ $map := dict "a" 100 "b" 200 "c" (dict "d" 10 "e" 20) }}
{{ $slice := slice "c" "e" }}
-{{ index $map $slice }} => 20
+{{ index $map $slice }} → 20
```
## Example: load data from a path based on front matter parameters
Assume you want to add a `location = ""` field to your front matter for every article written in `content/vacations/`. You want to use this field to populate information about the location at the bottom of the article in your `single.html` template. You also have a directory in `data/locations/` that looks like the following:
-```
-.
-└── data
- └── locations
- ├── abilene.toml
- ├── chicago.toml
- ├── oslo.toml
- └── provo.toml
+```text
+data/
+ └── locations/
+ ├── abilene.toml
+ ├── chicago.toml
+ ├── oslo.toml
+ └── provo.toml
```
Here is an example:
-{{< code-toggle file="data/locations/oslo" copy=false >}}
+{{< code-toggle file="data/locations/oslo" >}}
website = "https://www.oslo.kommune.no"
pop_city = 658390
pop_metro = 1717900
@@ -73,7 +68,7 @@ pop_metro = 1717900
The example we will use will be an article on Oslo, whose front matter should be set to exactly the same name as the corresponding file name in `data/locations/`:
-{{< code-toggle file="content/articles/oslo.md" fm=true copy=false >}}
+{{< code-toggle file="content/articles/oslo.md" fm=true >}}
title = "My Norwegian Vacation"
location = "oslo"
{{< /code-toggle >}}
diff --git a/content/en/functions/collections/Intersect.md b/content/en/functions/collections/Intersect.md
index 6a2c131b4..efcbbf470 100644
--- a/content/en/functions/collections/Intersect.md
+++ b/content/en/functions/collections/Intersect.md
@@ -1,21 +1,16 @@
---
title: collections.Intersect
-linkTitle: intersect
description: Returns the common elements of two arrays or slices, in the same order as the first array.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [intersect]
+ related:
+ - functions/collections/Complement
+ - functions/collections/SymDiff
+ - functions/collections/Union
returnType: any
signatures: [collections.Intersect SET1 SET2]
-relatedFunctions:
- - collections.Complement
- - collections.Intersect
- - collections.SymDiff
- - collections.Union
aliases: [/functions/intersect]
---
A useful example is to use it as `AND` filters when combined with where:
@@ -32,6 +27,5 @@ The above fetches regular pages not of `page` or `about` type unless they are pi
See [union](/functions/collections/union) for `OR`.
-
[partials]: /templates/partials/
[single]: /templates/single-page-templates/
diff --git a/content/en/functions/collections/IsSet.md b/content/en/functions/collections/IsSet.md
index 93fb9f8f6..76b336ae3 100644
--- a/content/en/functions/collections/IsSet.md
+++ b/content/en/functions/collections/IsSet.md
@@ -1,28 +1,25 @@
---
title: collections.IsSet
-linkTitle: isset
description: Reports whether the key exists within the collection.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [isset]
+ related:
+ - functions/collections/Dictionary
+ - functions/collections/Group
+ - functions/collections/IndexFunction
+ - functions/collections/Where
+ - functions/go-template/if
+ - functions/go-template/with
returnType: bool
signatures: [collections.IsSet COLLECTION KEY]
-relatedFunctions:
- - collections.Dictionary
- - collections.Group
- - collections.Index
- - collections.IsSet
- - collections.Where
aliases: [/functions/isset]
---
For example, consider this site configuration:
-{{< code-toggle file=hugo copy=false >}}
+{{< code-toggle file=hugo >}}
[params]
showHeroImage = false
{{< /code-toggle >}}
diff --git a/content/en/functions/collections/KeyVals.md b/content/en/functions/collections/KeyVals.md
index f3e0c559d..6019ede51 100644
--- a/content/en/functions/collections/KeyVals.md
+++ b/content/en/functions/collections/KeyVals.md
@@ -1,21 +1,20 @@
---
title: collections.KeyVals
-linkTitle: keyVals
description: Returns a KeyVals struct.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [keyVals]
- returnType: KeyValues
+ related:
+ - methods/pages/Related
+ returnType: types.KeyValues
signatures: [collections.KeyVals KEY VALUES...]
-relatedFunctions: []
aliases: [/functions/keyvals]
---
-The primary application for this function is the definition of the `namedSlices` parameter in the options map passed to the `.Related` method on the `Page` object.
+The primary application for this function is the definition of the `namedSlices` parameter in the options map passed to the [`Related`] method on the `Pages` object.
+
+[`Related`]: /methods/pages/related
See [related content](/content-management/related).
diff --git a/content/en/functions/collections/Last.md b/content/en/functions/collections/Last.md
index 3f8496354..4eda570ff 100644
--- a/content/en/functions/collections/Last.md
+++ b/content/en/functions/collections/Last.md
@@ -1,20 +1,15 @@
---
title: collections.Last
-linkTitle: last
description: Slices an array to the last N elements.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [last]
+ related:
+ - functions/collections/After
+ - functions/collections/First
returnType: any
signatures: [collections.Last INDEX COLLECTION]
-relatedFunctions:
- - collections.After
- - collections.First
- - collections.Last
aliases: [/functions/last]
---
diff --git a/content/en/functions/collections/Merge.md b/content/en/functions/collections/Merge.md
index 908f1738a..3f5208cfc 100644
--- a/content/en/functions/collections/Merge.md
+++ b/content/en/functions/collections/Merge.md
@@ -1,19 +1,14 @@
---
title: collections.Merge
-linkTitle: merge
description: Returns the result of merging two or more maps.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [merge]
+ related:
+ - functions/collections/Append
returnType: any
signatures: [collections.Merge MAP MAP...]
-relatedFunctions:
- - collections.Append
- - collections.Merge
aliases: [/functions/merge]
---
diff --git a/content/en/functions/collections/NewScratch.md b/content/en/functions/collections/NewScratch.md
index 0df90bb96..1cfc2dc4b 100644
--- a/content/en/functions/collections/NewScratch.md
+++ b/content/en/functions/collections/NewScratch.md
@@ -1,22 +1,107 @@
---
title: collections.NewScratch
-linkTitle: newScratch
-description: Creates a new Scratch which can be used to store values in a thread safe way.
-categories: [functions]
+description: Returns a locally scoped "scratch pad" to store and manipulate data.
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [newScratch]
- returnType: Scratch
+ related:
+ - methods/page/scratch
+ - methods/page/store
+ returnType: maps.Scratch
signatures: [collections.NewScratch ]
-relatedFunctions: []
---
+The `collections.NewScratch` function creates a locally scoped [scratch pad] to store and manipulate data. To create a scratch pad that is attached to a `Page` object, use the [`Scratch`] or [`Store`] method.
+
+[`Scratch`]: /methods/page/scratch
+[`Store`]: /methods/page/store
+[scratch pad]: /getting-started/glossary/#scratch-pad
+
+## Methods
+
+Set
+: Sets the value of a given key.
+
```go-html-template
-{{ $scratch := newScratch }}
-{{ $scratch.Add "b" 2 }}
-{{ $scratch.Add "b" 2 }}
-{{ $scratch.Get "b" }} → 4
+{{ $s := newScratch }}
+{{ $s.Set "greeting" "Hello" }}
```
+
+Get
+: Gets the value of a given key.
+
+```go-html-template
+{{ $s := newScratch }}
+{{ $s.Set "greeting" "Hello" }}
+{{ $s.Get "greeting" }} → Hello
+```
+
+Add
+: Adds a given value to existing value(s) of the given key.
+
+: For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the following adds will be appended to that list.
+
+```go-html-template
+{{ $s := newScratch }}
+{{ $s.Set "greeting" "Hello" }}
+{{ $s.Add "greeting" "Welcome" }}
+{{ $s.Get "greeting" }} → HelloWelcome
+```
+
+```go-html-template
+{{ $s := newScratch }}
+{{ $s.Set "total" 3 }}
+{{ $s.Add "total" 7 }}
+{{ $s.Get "total" }} → 10
+```
+
+```go-html-template
+{{ $s := newScratch }}
+{{ $s.Set "greetings" (slice "Hello") }}
+{{ $s.Add "greetings" (slice "Welcome" "Cheers") }}
+{{ $s.Get "greetings" }} → [Hello Welcome Cheers]
+```
+
+SetInMap
+: Takes a `key`, `mapKey` and `value` and adds a map of `mapKey` and `value` to the given `key`.
+
+```go-html-template
+{{ $s := newScratch }}
+{{ $s.SetInMap "greetings" "english" "Hello" }}
+{{ $s.SetInMap "greetings" "french" "Bonjour" }}
+{{ $s.Get "greetings" }} → map[english:Hello french:Bonjour]
+```
+
+DeleteInMap
+: Takes a `key` and `mapKey` and removes the map of `mapKey` from the given `key`.
+
+```go-html-template
+{{ $s := newScratch }}
+{{ $s.SetInMap "greetings" "english" "Hello" }}
+{{ $s.SetInMap "greetings" "french" "Bonjour" }}
+{{ $s.DeleteInMap "greetings" "english" }}
+{{ $s.Get "greetings" }} → map[french:Bonjour]
+```
+
+GetSortedMapValues
+: Returns an array of values from `key` sorted by `mapKey`.
+
+```go-html-template
+{{ $s := newScratch }}
+{{ $s.SetInMap "greetings" "english" "Hello" }}
+{{ $s.SetInMap "greetings" "french" "Bonjour" }}
+{{ $s.GetSortedMapValues "greetings" }} → [Hello Bonjour]
+```
+
+Delete
+: Removes the given key.
+
+```go-html-template
+{{ $s := newScratch }}
+{{ $s.Set "greeting" "Hello" }}
+{{ $s.Delete "greeting" }}
+```
+
+Values
+: Returns the raw backing map. Do not use with `Scratch` or `Store` methods on a `Page` object due to concurrency issues.
diff --git a/content/en/functions/collections/Querify.md b/content/en/functions/collections/Querify.md
index c94d51133..e195c417f 100644
--- a/content/en/functions/collections/Querify.md
+++ b/content/en/functions/collections/Querify.md
@@ -1,19 +1,15 @@
---
title: collections.Querify
-linkTitle: querify
description: Takes a set or slice of key-value pairs and returns a query string to be appended to URLs.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [querify]
returnType: string
signatures:
- - collections.Querify KEY VALUE [KEY VALUE]...
+ - collections.Querify VALUE [VALUE...]
- collections.Querify COLLECTION
-relatedFunctions:
+related:
- collections.Querify
- urlquery
aliases: [/functions/querify]
diff --git a/content/en/functions/collections/Reverse.md b/content/en/functions/collections/Reverse.md
index 521adc6f2..12c964c76 100644
--- a/content/en/functions/collections/Reverse.md
+++ b/content/en/functions/collections/Reverse.md
@@ -1,16 +1,13 @@
---
title: collections.Reverse
description: Reverses the order of a collection.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
returnType: any
signatures: [collections.Reverse COLLECTION]
-relatedFunctions:
+related:
- collections.Apply
- collections.Delimit
- collections.In
@@ -20,7 +17,6 @@ relatedFunctions:
aliases: [/functions/collections.reverse]
---
-
```go-html-template
{{ slice 2 1 3 | collections.Reverse }} → [3 1 2]
```
diff --git a/content/en/functions/collections/Seq.md b/content/en/functions/collections/Seq.md
index 65ff1432f..fca3e92d7 100644
--- a/content/en/functions/collections/Seq.md
+++ b/content/en/functions/collections/Seq.md
@@ -1,20 +1,16 @@
---
title: collections.Seq
-linkTitle: seq
description: Returns a slice of integers.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [seq]
returnType: '[]int'
signatures:
- collections.Seq LAST
- collections.Seq FIRST LAST
- collections.Seq FIRST INCREMENT LAST
-relatedFunctions:
+related:
- collections.Apply
- collections.Delimit
- collections.In
diff --git a/content/en/functions/collections/Shuffle.md b/content/en/functions/collections/Shuffle.md
index 8388d5332..18b8cc664 100644
--- a/content/en/functions/collections/Shuffle.md
+++ b/content/en/functions/collections/Shuffle.md
@@ -1,18 +1,13 @@
---
title: collections.Shuffle
-linkTitle: shuffle
description: Returns a random permutation of a given array or slice.
-keywords: [ordering]
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [shuffle]
returnType: any
signatures: [collections.Shuffle COLLECTION]
-relatedFunctions:
+related:
- collections.Reverse
- collections.Shuffle
- collections.Sort
diff --git a/content/en/functions/collections/Slice.md b/content/en/functions/collections/Slice.md
index a30800ed3..1e372ce44 100644
--- a/content/en/functions/collections/Slice.md
+++ b/content/en/functions/collections/Slice.md
@@ -1,17 +1,13 @@
---
title: collections.Slice
-linkTitle: slice
description: Creates a slice (array) of all passed arguments.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [slice]
returnType: any
signatures: [collections.Slice ITEM...]
-relatedFunctions:
+related:
- collections.Append
- collections.Apply
- collections.Delimit
@@ -22,8 +18,6 @@ relatedFunctions:
aliases: [/functions/slice]
---
-One use case is the concatenation of elements in combination with the [`delimit` function]:
-
```go-html-template
{{ $s := slice "a" "b" "c" }}
{{ $s }} → [a b c]
diff --git a/content/en/functions/collections/Sort.md b/content/en/functions/collections/Sort.md
index bb0f82cde..90fbc7591 100644
--- a/content/en/functions/collections/Sort.md
+++ b/content/en/functions/collections/Sort.md
@@ -1,17 +1,13 @@
---
title: collections.Sort
-linkTitle: sort
description: Sorts slices, maps, and page collections.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [sort]
returnType: any
signatures: ['collections.Sort COLLECTION [KEY] [ORDER]']
-relatedFunctions:
+related:
- collections.Reverse
- collections.Shuffle
- collections.Sort
@@ -27,7 +23,7 @@ The `ORDER` may be either `asc` (ascending) or `desc` (descending). The default
The examples below assume this site configuration:
-{{< code-toggle file="hugo" copy=false >}}
+{{< code-toggle file=hugo >}}
[params]
grades = ['b','a','c']
{{< /code-toggle >}}
@@ -36,10 +32,10 @@ grades = ['b','a','c']
Sort slice elements in ascending order using either of these constructs:
-{{< code file="layouts/_default/single.html" copy=false >}}
+```go-html-template
{{ sort site.Params.grades }} → [a b c]
{{ sort site.Params.grades "value" "asc" }} → [a b c]
-{{< /code >}}
+```
In the examples above, `value` is the `KEY` representing the value of the slice element.
@@ -47,9 +43,9 @@ In the examples above, `value` is the `KEY` representing the value of the slice
Sort slice elements in descending order:
-{{< code file="layouts/_default/single.html" copy=false >}}
+```go-html-template
{{ sort site.Params.grades "value" "desc" }} → [c b a]
-{{< /code >}}
+```
In the example above, `value` is the `KEY` representing the value of the slice element.
@@ -57,7 +53,7 @@ In the example above, `value` is the `KEY` representing the value of the slice e
The examples below assume this site configuration:
-{{< code-toggle file="hugo" copy=false >}}
+{{< code-toggle file=hugo >}}
[params.authors.a]
firstName = "Marius"
lastName = "Pontmercy"
@@ -77,7 +73,7 @@ When sorting maps, the `KEY` argument must be lowercase.
Sort map objects in ascending order using either of these constructs:
-{{< code file="layouts/_default/single.html" copy=false >}}
+```go-html-template
{{ range sort site.Params.authors "firstname" }}
{{ .firstName }}
{{ end }}
@@ -85,7 +81,7 @@ Sort map objects in ascending order using either of these constructs:
{{ range sort site.Params.authors "firstname" "asc" }}
{{ .firstName }}
{{ end }}
-{{< /code >}}
+```
These produce:
@@ -97,11 +93,11 @@ Jean Marius Victor
Sort map objects in descending order:
-{{< code file="layouts/_default/single.html" copy=false >}}
+```go-html-template
{{ range sort site.Params.authors "firstname" "desc" }}
{{ .firstName }}
{{ end }}
-{{< /code >}}
+```
This produces:
@@ -125,11 +121,10 @@ Although you can use the `sort` function to sort a page collection, Hugo provide
In this contrived example, sort the site's regular pages by `.Type` in descending order:
-{{< code file="layouts/_default/home.html" copy=false >}}
+```go-html-template
{{ range sort site.RegularPages "Type" "desc" }}
{{ end }}
```
-{{% readfile file="/functions/_common/regular-expressions.md" %}}
+{{% include "functions/_common/regular-expressions.md" %}}
## Use `where` with `first`
@@ -134,11 +130,11 @@ sections**](#mainsections), sorts it using the [default
ordering](/templates/lists/) for lists (i.e., `weight => date`), and
then ranges through only the first 5 posts in that list:
-{{< code file="first-and-where-together.html" >}}
+```go-html-template
{{ range first 5 (where site.RegularPages "Type" "in" site.Params.mainSections) }}
{{ .Content }}
{{ end }}
-{{< /code >}}
+```
## Nest `where` clauses
@@ -181,7 +177,7 @@ If the user has not set this configuration parameter in their site configuration
The user can override the default:
-{{< code-toggle file="hugo" >}}
+{{< code-toggle file=hugo >}}
[params]
mainSections = ["blog", "docs"]
{{< /code-toggle >}}
diff --git a/content/en/functions/collections/_index.md b/content/en/functions/collections/_index.md
new file mode 100644
index 000000000..51981f79b
--- /dev/null
+++ b/content/en/functions/collections/_index.md
@@ -0,0 +1,12 @@
+---
+title: Collections functions
+linkTitle: collections
+description: Template functions to work with arrays, slices, maps, and page collections.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: functions
+---
+
+Use these functions to work with arrays, slices, maps, and page collections.
diff --git a/content/en/functions/compare/Cond.md b/content/en/functions/compare/Conditional.md
similarity index 79%
rename from content/en/functions/compare/Cond.md
rename to content/en/functions/compare/Conditional.md
index 4b92a893c..6d693770d 100644
--- a/content/en/functions/compare/Cond.md
+++ b/content/en/functions/compare/Conditional.md
@@ -1,19 +1,14 @@
---
title: compare.Conditional
-linkTitle: cond
description: Returns one of two arguments depending on the value of the control argument.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [cond]
+ related:
+ - functions/compare/Default
returnType: any
signatures: [compare.Conditional CONTROL ARG1 ARG2]
-relatedFunctions:
- - compare.Conditional
- - compare.Default
aliases: [/functions/cond]
---
@@ -21,14 +16,14 @@ The CONTROL argument is a boolean value that indicates whether the function shou
```go-html-template
{{ $qty := 42 }}
-{{ cond (le $qty 3) "few" "many" }} → "many"
+{{ cond (le $qty 3) "few" "many" }} → many
```
The CONTROL argument must be either `true` or `false`. To cast a non-boolean value to boolean, pass it through the `not` operator twice.
```go-html-template
-{{ cond (42 | not | not) "truthy" "falsy" }} → "truthy"
-{{ cond ("" | not | not) "truthy" "falsy" }} → "falsy"
+{{ cond (42 | not | not) "truthy" "falsy" }} → truthy
+{{ cond ("" | not | not) "truthy" "falsy" }} → falsy
```
{{% note %}}
@@ -38,7 +33,6 @@ Unlike [ternary operators] in other languages, the `cond` function does not perf
[ternary operators]: https://en.wikipedia.org/wiki/Ternary_conditional_operator
{{% /note %}}
-
Due to the absence of short-circuit evaluation, these examples throw an error:
```go-html-template
diff --git a/content/en/functions/compare/Default.md b/content/en/functions/compare/Default.md
index 24ad37ef2..1e6bd7968 100644
--- a/content/en/functions/compare/Default.md
+++ b/content/en/functions/compare/Default.md
@@ -1,88 +1,48 @@
---
title: compare.Default
-linkTitle: default
-description: Allows setting a default value that can be returned if a first value is not set.
-categories: [functions]
+description: Returns the second argument if set, else the first argument.
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [default]
+ related:
+ - functions/compare/Conditional
+ - functions/go-template/Or
returnType: any
signatures: [compare.Default DEFAULT INPUT]
-relatedFunctions:
- - compare.Conditional
- - compare.Default
aliases: [/functions/default]
---
-`default` checks whether a given value is set and returns a default value if it is not. *Set* in this context means different things depending on the data type:
+The `default` function returns the second argument if set, else the first argument.
-* non-zero for numeric types and times
-* non-zero length for strings, arrays, slices, and maps
-* any boolean or struct value
-* non-nil for any other types
+{{% note %}}
+When the second argument is the boolean `false` value, the `default` function returns `false`. All _other_ falsy values are considered unset.
-`default` function examples reference the following content page:
+{{% include "functions/go-template/_common/truthy-falsy.md" %}}
-{{< code file="content/posts/default-function-example.md" >}}
----
-title: Sane Defaults
-seo_title:
-date: 2017-02-18
-font:
-oldparam: The default function helps make your templating DRYer.
-newparam:
----
-{{< /code >}}
+To set a default value based on truthiness, use the [`or`] operator instead.
-`default` can be written in more than one way:
+[`or`]: /functions/go-template/or
+{{% /note %}}
+
+The `default` function returns the second argument if set:
```go-html-template
-{{ .Params.font | default "Roboto" }}
-{{ default "Roboto" .Params.font }}
+{{ default 42 1 }} → 1
+{{ default 42 "foo" }} → foo
+{{ default 42 (dict "k" "v") }} → map[k:v]
+{{ default 42 (slice "a" "b") }} → [a b]
+{{ default 42 true }} → true
+
+
+{{ default 42 false }} → false
```
-Both of the above `default` function calls return `Roboto`.
-
-A `default` value, however, does not need to be hard coded like the previous example. The `default` value can be a variable or pulled directly from the front matter using dot notation:
+The `default` function returns the first argument if the second argument is not set:
```go-html-template
-{{ $old := .Params.oldparam }}
-
{{ .Params.newparam | default $old }}
-```
-
-Which would return:
-
-```html
-
The default function helps make your templating DRYer.
-```
-
-And then using dot notation
-
-```go-html-template
-{{ .Params.seo_title | default .Title }}
-```
-
-Which would return
-
-```html
-Sane Defaults
-```
-
-The following have equivalent return values but are far less terse. This demonstrates the utility of `default`:
-
-Using `if`:
-
-```go-html-template
-{{ if .Params.seo_title }}{{ .Params.seo_title }}{{ else }}{{ .Title }}{{ end }}
-=> Sane Defaults
-```
-
-Using `with`:
-
-```go-html-template
-{{ with .Params.seo_title }}{{ . }}{{ else }}{{ .Title }}{{ end }}
-=> Sane Defaults
+{{ default 42 0 }} → 42
+{{ default 42 "" }} → 42
+{{ default 42 dict }} → 42
+{{ default 42 slice }} → 42
+{{ default 42 }} → 42
```
diff --git a/content/en/functions/compare/Eq.md b/content/en/functions/compare/Eq.md
index 010fc51b3..49350e676 100644
--- a/content/en/functions/compare/Eq.md
+++ b/content/en/functions/compare/Eq.md
@@ -1,23 +1,18 @@
---
title: compare.Eq
-linkTitle: eq
description: Returns the boolean truth of arg1 == arg2 || arg1 == arg3.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [eq]
+ related:
+ - functions/compare/Ge
+ - functions/compare/Gt
+ - functions/compare/Le
+ - functions/compare/Lt
+ - functions/compare/Ne
returnType: bool
signatures: ['compare.Eq ARG1 ARG2 [ARG...]']
-relatedFunctions:
- - compare.Eq
- - compare.Ge
- - compare.Gt
- - compare.Le
- - compare.Lt
- - compare.Ne
aliases: [/functions/eq]
---
diff --git a/content/en/functions/compare/Ge.md b/content/en/functions/compare/Ge.md
index 6bb48dd00..479ecf990 100644
--- a/content/en/functions/compare/Ge.md
+++ b/content/en/functions/compare/Ge.md
@@ -1,23 +1,18 @@
---
title: compare.Ge
-linkTitle: ge
description: Returns the boolean truth of arg1 >= arg2 && arg1 >= arg3.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [ge]
+ related:
+ - functions/compare/Eq
+ - functions/compare/Gt
+ - functions/compare/Le
+ - functions/compare/Lt
+ - functions/compare/Ne
returnType: bool
signatures: ['compare.Ge ARG1 ARG2 [ARG...]']
-relatedFunctions:
- - compare.Eq
- - compare.Ge
- - compare.Gt
- - compare.Le
- - compare.Lt
- - compare.Ne
aliases: [/functions/ge]
---
diff --git a/content/en/functions/compare/Gt.md b/content/en/functions/compare/Gt.md
index 4691718ef..0af289ce2 100644
--- a/content/en/functions/compare/Gt.md
+++ b/content/en/functions/compare/Gt.md
@@ -1,23 +1,18 @@
---
title: compare.Gt
-linkTitle: gt
description: Returns the boolean truth of arg1 > arg2 && arg1 > arg3.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [gt]
+ related:
+ - functions/compare/Eq
+ - functions/compare/Ge
+ - functions/compare/Le
+ - functions/compare/Lt
+ - functions/compare/Ne
returnType: bool
signatures: ['compare.Gt ARG1 ARG2 [ARG...]']
-relatedFunctions:
- - compare.Eq
- - compare.Ge
- - compare.Gt
- - compare.Le
- - compare.Lt
- - compare.Ne
aliases: [/functions/gt]
---
diff --git a/content/en/functions/compare/Le.md b/content/en/functions/compare/Le.md
index 792ea6ce6..319d376f6 100644
--- a/content/en/functions/compare/Le.md
+++ b/content/en/functions/compare/Le.md
@@ -1,23 +1,18 @@
---
title: compare.Le
-linkTitle: le
description: Returns the boolean truth of arg1 <= arg2 && arg1 <= arg3.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [le]
+ related:
+ - functions/compare/Eq
+ - functions/compare/Ge
+ - functions/compare/Gt
+ - functions/compare/Lt
+ - functions/compare/Ne
returnType: bool
signatures: ['compare.Le ARG1 ARG2 [ARG...]']
-relatedFunctions:
- - compare.Eq
- - compare.Ge
- - compare.Gt
- - compare.Le
- - compare.Lt
- - compare.Ne
aliases: [/functions/le]
---
diff --git a/content/en/functions/compare/Lt.md b/content/en/functions/compare/Lt.md
index 537c23b6f..3fe8f1d2c 100644
--- a/content/en/functions/compare/Lt.md
+++ b/content/en/functions/compare/Lt.md
@@ -1,23 +1,18 @@
---
title: compare.Lt
-linkTitle: lt
description: Returns the boolean truth of arg1 < arg2 && arg1 < arg3.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [lt]
+ related:
+ - functions/compare/Eq
+ - functions/compare/Ge
+ - functions/compare/Gt
+ - functions/compare/Le
+ - functions/compare/Ne
returnType: bool
signatures: ['compare.Lt ARG1 ARG2 [ARG...]']
-relatedFunctions:
- - compare.Eq
- - compare.Ge
- - compare.Gt
- - compare.Le
- - compare.Lt
- - compare.Ne
aliases: [/functions/lt]
---
diff --git a/content/en/functions/compare/Ne.md b/content/en/functions/compare/Ne.md
index 412f43d49..2d9f826fc 100644
--- a/content/en/functions/compare/Ne.md
+++ b/content/en/functions/compare/Ne.md
@@ -1,23 +1,18 @@
---
title: compare.Ne
-linkTitle: ne
description: Returns the boolean truth of arg1 != arg2 && arg1 != arg3.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [ne]
+ related:
+ - functions/compare/Eq
+ - functions/compare/Ge
+ - functions/compare/Gt
+ - functions/compare/Le
+ - functions/compare/Lt
returnType: bool
signatures: ['compare.Ne ARG1 ARG2 [ARG...]']
-relatedFunctions:
- - compare.Eq
- - compare.Ge
- - compare.Gt
- - compare.Le
- - compare.Lt
- - compare.Ne
aliases: [/functions/ne]
---
diff --git a/content/en/functions/compare/_index.md b/content/en/functions/compare/_index.md
new file mode 100644
index 000000000..a9b3a7b27
--- /dev/null
+++ b/content/en/functions/compare/_index.md
@@ -0,0 +1,12 @@
+---
+title: Compare functions
+linkTitle: compare
+description: Template functions to compare two or more values.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: functions
+---
+
+Use these functions to compare two or more values.
diff --git a/content/en/functions/crypto/FNV32a.md b/content/en/functions/crypto/FNV32a.md
index 7a7fe303e..5c091ebee 100644
--- a/content/en/functions/crypto/FNV32a.md
+++ b/content/en/functions/crypto/FNV32a.md
@@ -1,21 +1,17 @@
---
title: crypto.FNV32a
description: Returns the FNV (Fowler–Noll–Vo) 32 bit hash of a given string.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
+ related:
+ - functions/crypto/HMAC
+ - functions/crypto/MD5
+ - functions/crypto/SHA1
+ - functions/crypto/SHA256
returnType: int
signatures: [crypto.FNV32a STRING]
-relatedFunctions:
- - crypto.FNV32a
- - crypto.HMAC
- - crypto.MD5
- - crypto.SHA1
- - crypto.SHA256
aliases: [/functions/crypto.fnv32a]
---
diff --git a/content/en/functions/crypto/HMAC.md b/content/en/functions/crypto/HMAC.md
index e58619b38..1906689a2 100644
--- a/content/en/functions/crypto/HMAC.md
+++ b/content/en/functions/crypto/HMAC.md
@@ -1,22 +1,17 @@
---
title: crypto.HMAC
-linkTitle: hmac
description: Returns a cryptographic hash that uses a key to sign a message.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [hmac]
+ related:
+ - functions/crypto/FNV32a
+ - functions/crypto/MD5
+ - functions/crypto/SHA1
+ - functions/crypto/SHA256
returnType: string
signatures: ['crypto.HMAC HASH_TYPE KEY MESSAGE [ENCODING]']
-relatedFunctions:
- - crypto.FNV32a
- - crypto.HMAC
- - crypto.MD5
- - crypto.SHA1
- - crypto.SHA256
aliases: [/functions/hmac]
---
diff --git a/content/en/functions/crypto/MD5.md b/content/en/functions/crypto/MD5.md
index 9415e015c..6c78ae55f 100644
--- a/content/en/functions/crypto/MD5.md
+++ b/content/en/functions/crypto/MD5.md
@@ -1,28 +1,22 @@
---
title: crypto.MD5
-linkTitle: md5
-description: hashes the given input and returns its MD5 checksum.
-categories: [functions]
+description: Hashes the given input and returns its MD5 checksum.
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [md5]
+ related:
+ - functions/crypto/FNV32a
+ - functions/crypto/HMAC
+ - functions/crypto/SHA1
+ - functions/crypto/SHA256
returnType: string
signatures: [crypto.MD5 INPUT]
-relatedFunctions:
- - crypto.FNV32a
- - crypto.HMAC
- - crypto.MD5
- - crypto.SHA1
- - crypto.SHA256
aliases: [/functions/md5]
---
```go-html-template
{{ md5 "Hello world" }} → 3e25960a79dbc69b674cd4ec67a72c62
-
```
This can be useful if you want to use [Gravatar](https://en.gravatar.com/) for generating a unique avatar:
diff --git a/content/en/functions/crypto/SHA1.md b/content/en/functions/crypto/SHA1.md
index 6269efe38..247c9842a 100644
--- a/content/en/functions/crypto/SHA1.md
+++ b/content/en/functions/crypto/SHA1.md
@@ -1,22 +1,17 @@
---
title: crypto.SHA1
-linkTitle: sha1
description: Hashes the given input and returns its SHA1 checksum.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [sha1]
+ related:
+ - functions/crypto/FNV32a
+ - functions/crypto/HMAC
+ - functions/crypto/MD5
+ - functions/crypto/SHA256
returnType: string
signatures: [crypto.SHA1 INPUT]
-relatedFunctions:
- - crypto.FNV32a
- - crypto.HMAC
- - crypto.MD5
- - crypto.SHA1
- - crypto.SHA256
aliases: [/functions/sha,/functions/sha1]
---
diff --git a/content/en/functions/crypto/SHA256.md b/content/en/functions/crypto/SHA256.md
index 3019432d2..279cec35c 100644
--- a/content/en/functions/crypto/SHA256.md
+++ b/content/en/functions/crypto/SHA256.md
@@ -1,22 +1,17 @@
---
title: crypto.SHA256
-linkTitle: sha256
description: Hashes the given input and returns its SHA256 checksum.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [sha256]
+ related:
+ - functions/crypto/FNV32a
+ - functions/crypto/HMAC
+ - functions/crypto/MD5
+ - functions/crypto/SHA1
returnType: string
signatures: [crypto.SHA256 INPUT]
-relatedFunctions:
- - crypto.FNV32a
- - crypto.HMAC
- - crypto.MD5
- - crypto.SHA1
- - crypto.SHA256
aliases: [/functions/sha256]
---
diff --git a/content/en/functions/crypto/_index.md b/content/en/functions/crypto/_index.md
new file mode 100644
index 000000000..5c95aab6e
--- /dev/null
+++ b/content/en/functions/crypto/_index.md
@@ -0,0 +1,12 @@
+---
+title: Crypto functions
+linkTitle: crypto
+description: Template functions to create cryptographic hashes.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: functions
+---
+
+Use these functions to create cryptographic hashes.
diff --git a/content/en/functions/data/GetCSV.md b/content/en/functions/data/GetCSV.md
index e02c1588c..b49f190e3 100644
--- a/content/en/functions/data/GetCSV.md
+++ b/content/en/functions/data/GetCSV.md
@@ -1,19 +1,17 @@
---
title: data.GetCSV
-linkTitle: getCSV
description: Returns an array of arrays from a local or remote CSV file, or an error if the file does not exist.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [getCSV]
- returnType: '[]string'
- signatures: [data.GetCSV SEPARATOR PATHPART...]
-relatedFunctions:
- - data.GetCSV
- - data.GetJSON
+ related:
+ - functions/data/GetJSON
+ - functions/resources/Get
+ - functions/resources/GetRemote
+ - methods/page/Resources
+ returnType: '[][]string'
+ signatures: ['data.GetCSV SEPARATOR INPUT... [OPTIONS]']
toc: true
---
@@ -32,6 +30,12 @@ Access the data with either of the following:
{{ $data := getCSV "," "other-files/" "pets.csv" }}
```
+{{% note %}}
+When working with local data, the filepath is relative to the working directory.
+
+You must not place CSV files in the project's data directory.
+{{% /note %}}
+
Access remote data with either of the following:
```go-html-template
@@ -49,9 +53,25 @@ The resulting data structure is an array of arrays:
]
```
+## Options
+
+Add headers to the request by providing an options map:
+
+```go-html-template
+{{ $opts := dict "Authorization" "Bearer abcd" }}
+{{ $data := getCSV "," "https://example.org/pets.csv" $opts }}
+```
+
+Add multiple headers using a slice:
+
+```go-html-template
+{{ $opts := dict "X-List" (slice "a" "b" "c") }}
+{{ $data := getCSV "," "https://example.org/pets.csv" $opts }}
+```
+
## Global resource alternative
-Consider using `resources.Get` with [`transform.Unmarshal`] when accessing a global resource.
+Consider using the [`resources.Get`] function with [`transform.Unmarshal`] when accessing a global resource.
```text
my-project/
@@ -73,7 +93,9 @@ my-project/
## Page resource alternative
-Consider using `.Resources.Get` with [`transform.Unmarshal`] when accessing a page resource.
+Consider using the [`Resources.Get`] method with [`transform.Unmarshal`] when accessing a page resource.
+
+
```text
my-project/
@@ -97,7 +119,7 @@ my-project/
## Remote resource alternative
-Consider using `resources.GetRemote` with [`transform.Unmarshal`] for improved error handling when accessing a remote resource.
+Consider using the [`resources.GetRemote`] function with [`transform.Unmarshal`] when accessing a remote resource to improve error handling and cache control.
```go-html-template
{{ $data := "" }}
@@ -114,4 +136,7 @@ Consider using `resources.GetRemote` with [`transform.Unmarshal`] for improved e
{{ end }}
```
+[`Resources.Get`]: methods/page/Resources
+[`resources.GetRemote`]: /functions/resources/getremote
+[`resources.Get`]: /functions/resources/get
[`transform.Unmarshal`]: /functions/transform/unmarshal
diff --git a/content/en/functions/data/GetJSON.md b/content/en/functions/data/GetJSON.md
index 37ee8e9a1..96812e7c0 100644
--- a/content/en/functions/data/GetJSON.md
+++ b/content/en/functions/data/GetJSON.md
@@ -1,19 +1,17 @@
---
title: data.GetJSON
-linkTitle: getJSON
description: Returns a JSON object from a local or remote JSON file, or an error if the file does not exist.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [getJSON]
+ related:
+ - functions/data/GetCSV
+ - functions/resources/Get
+ - functions/resources/GetRemote
+ - methods/page/Resources
returnType: any
- signatures: [data.GetJSON PATHPART...]
-relatedFunctions:
- - data.GetCSV
- - data.GetJSON
+ signatures: ['data.GetJSON INPUT... [OPTIONS]']
toc: true
---
@@ -28,15 +26,19 @@ my-project/
Access the data with either of the following:
```go-html-template
-{{ $data := getCSV "," "other-files/books.json" }}
-{{ $data := getCSV "," "other-files/" "books.json" }}
+{{ $data := getJSON "other-files/books.json" }}
+{{ $data := getJSON "other-files/" "books.json" }}
```
+{{% note %}}
+When working with local data, the filepath is relative to the working directory.
+{{% /note %}}
+
Access remote data with either of the following:
```go-html-template
-{{ $data := getCSV "," "https://example.org/books.json" }}
-{{ $data := getCSV "," "https://example.org/" "books.json" }}
+{{ $data := getJSON "https://example.org/books.json" }}
+{{ $data := getJSON "https://example.org/" "books.json" }}
```
The resulting data structure is a JSON object:
@@ -56,9 +58,25 @@ The resulting data structure is a JSON object:
]
```
+## Options
+
+Add headers to the request by providing an options map:
+
+```go-html-template
+{{ $opts := dict "Authorization" "Bearer abcd" }}
+{{ $data := getJSON "https://example.org/books.json" $opts }}
+```
+
+Add multiple headers using a slice:
+
+```go-html-template
+{{ $opts := dict "X-List" (slice "a" "b" "c") }}
+{{ $data := getJSON "https://example.org/books.json" $opts }}
+```
+
## Global resource alternative
-Consider using `resources.Get` with [`transform.Unmarshal`] when accessing a global resource.
+Consider using the [`resources.Get`] function with [`transform.Unmarshal`] when accessing a global resource.
```text
my-project/
@@ -80,7 +98,7 @@ my-project/
## Page resource alternative
-Consider using `.Resources.Get` with [`transform.Unmarshal`] when accessing a page resource.
+Consider using the [`Resources.Get`] method with [`transform.Unmarshal`] when accessing a page resource.
```text
my-project/
@@ -104,7 +122,7 @@ my-project/
## Remote resource alternative
-Consider using `resources.GetRemote` with [`transform.Unmarshal`] for improved error handling when accessing a remote resource.
+Consider using the [`resources.GetRemote`] function with [`transform.Unmarshal`] when accessing a remote resource to improve error handling and cache control.
```go-html-template
{{ $data := "" }}
@@ -121,4 +139,7 @@ Consider using `resources.GetRemote` with [`transform.Unmarshal`] for improved e
{{ end }}
```
+[`Resources.Get`]: methods/page/Resources
+[`resources.GetRemote`]: /functions/resources/getremote
+[`resources.Get`]: /functions/resources/get
[`transform.Unmarshal`]: /functions/transform/unmarshal
diff --git a/content/en/functions/data/_index.md b/content/en/functions/data/_index.md
new file mode 100644
index 000000000..142d6b528
--- /dev/null
+++ b/content/en/functions/data/_index.md
@@ -0,0 +1,12 @@
+---
+title: Data functions
+linkTitle: data
+description: Template functions to read local or remote data files.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: functions
+---
+
+Use these functions to read local or remote data files.
diff --git a/content/en/functions/debug/Dump.md b/content/en/functions/debug/Dump.md
index ff505a76b..d3161605f 100644
--- a/content/en/functions/debug/Dump.md
+++ b/content/en/functions/debug/Dump.md
@@ -1,16 +1,13 @@
---
title: debug.Dump
description: Returns an object dump as a string.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
+ related: []
returnType: string
signatures: [debug.Dump VALUE]
-relatedFunctions: []
---
```go-html-template
@@ -43,8 +40,6 @@ relatedFunctions: []
}
```
-
-
{{% note %}}
Output from this function may change from one release to the next. Use for debugging only.
{{% /note %}}
diff --git a/content/en/functions/debug/Timer.md b/content/en/functions/debug/Timer.md
index cfa2ad6dc..3e3af0a0c 100644
--- a/content/en/functions/debug/Timer.md
+++ b/content/en/functions/debug/Timer.md
@@ -1,21 +1,18 @@
---
title: debug.Timer
description: Creates a named timer that reports elapsed time to the console.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
+ related: []
returnType: debug.Timer
signatures: [debug.Timer NAME]
-relatedFunctions: []
---
{{< 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.
+Use the `debug.Timer` function to determine execution time for a block of code, useful for finding performance bottle necks in templates.
The timer starts when you instantiate it, and stops when you call its `Stop` method.
diff --git a/content/en/functions/debug/_index.md b/content/en/functions/debug/_index.md
new file mode 100644
index 000000000..418828515
--- /dev/null
+++ b/content/en/functions/debug/_index.md
@@ -0,0 +1,12 @@
+---
+title: Debug functions
+linkTitle: debug
+description: Template functions to debug your templates.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: functions
+---
+
+Use these functions to debug your templates.
diff --git a/content/en/functions/encoding/Base64Decode.md b/content/en/functions/encoding/Base64Decode.md
index 8bd554c83..821ca805a 100644
--- a/content/en/functions/encoding/Base64Decode.md
+++ b/content/en/functions/encoding/Base64Decode.md
@@ -1,24 +1,19 @@
---
title: encoding.Base64Decode
-linkTitle: base64Decode
description: Returns the base64 decoding of the given content.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [base64Decode]
+ related:
+ - functions/encoding/Base64Encode
returnType: string
signatures: [encoding.Base64Decode INPUT]
-signatures:
- -
- - base64Decode INPUT
aliases: [/functions/base64Decode]
---
```go-html-template
-{{ "SHVnbw==" | base64Decode }} → "Hugo"
+{{ "SHVnbw==" | base64Decode }} → Hugo
```
Use the `base64Decode` function to decode responses from APIs. For example, the result of this call to GitHub's API contains the base64-encoded representation of the repository's README file:
diff --git a/content/en/functions/encoding/Base64Encode.md b/content/en/functions/encoding/Base64Encode.md
index d548aca8e..14f67a132 100644
--- a/content/en/functions/encoding/Base64Encode.md
+++ b/content/en/functions/encoding/Base64Encode.md
@@ -1,22 +1,17 @@
---
title: encoding.Base64Encode
-linkTitle: base64Encode
description: Returns the base64 decoding of the given content.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [base64Encode]
+ related:
+ - functions/encoding/Base64Decode
returnType: string
signatures: [encoding.Base64Encode INPUT]
-relatedFunctions:
- - encoding.Base64Decode
- - encoding.Base64Encode
aliases: [/functions/base64, /functions/base64Encode]
---
```go-html-template
-{{ "Hugo" | base64Encode }} → "SHVnbw=="
+{{ "Hugo" | base64Encode }} → SHVnbw==
```
diff --git a/content/en/functions/encoding/Jsonify.md b/content/en/functions/encoding/Jsonify.md
index 0b9cb2e74..09b181e31 100644
--- a/content/en/functions/encoding/Jsonify.md
+++ b/content/en/functions/encoding/Jsonify.md
@@ -1,31 +1,25 @@
---
title: encoding.Jsonify
-linkTitle: jsonify
description: Encodes a given object to JSON.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [jsonify]
returnType: template.HTML
+ related:
+ - functions/transform/Remarshal
+ - functions/transform/Unmarshal
signatures:
- encoding.Jsonify INPUT
- encoding.Jsonify OPTIONS INPUT
-relatedFunctions:
- - encoding.Jsonify
- - transform.Remarshal
- - transform.Unmarshal
aliases: [/functions/jsonify]
---
-To customize the printing of the JSON, pass a map of options as the first
+To customize the printing of the JSON, pass an options map as the first
argument. Supported options are "prefix" and "indent". Each JSON element in
the output will begin on a new line beginning with *prefix* followed by one or
more copies of *indent* according to the indentation nesting.
-
```go-html-template
{{ dict "title" .Title "content" .Plain | jsonify }}
{{ dict "title" .Title "content" .Plain | jsonify (dict "indent" " ") }}
@@ -34,15 +28,15 @@ more copies of *indent* according to the indentation nesting.
## Options
-indent ("")
-: Indentation to use.
+indent
+: (`string`) Indentation to use. Default is "".
-prefix ("")
-: Indentation prefix.
+prefix
+: (`string`) Indentation prefix. Default is "".
noHTMLEscape (false)
-: Disable escaping of problematic HTML characters inside JSON quoted strings. The default behavior is to escape &, <, and > to \u0026, \u003c, and \u003e to avoid certain safety problems that can arise when embedding JSON in HTML.
+: (`bool`) Disable escaping of problematic HTML characters inside JSON quoted strings. The default behavior is to escape `&`, `<`, and `>` to `\u0026`, `\u003c`, and `\u003e` to avoid certain safety problems that can arise when embedding JSON in HTML. Default is `false`.
-See also the `.PlainWords`, `.Plain`, and `.RawContent` [page variables][pagevars].
+See also the `.PlainWords`, `.Plain`, and `.RawContent` [page variables].
-[pagevars]: /variables/page/
+[page variables]: /variables/page/
diff --git a/content/en/functions/encoding/_index.md b/content/en/functions/encoding/_index.md
new file mode 100644
index 000000000..3c4c4519e
--- /dev/null
+++ b/content/en/functions/encoding/_index.md
@@ -0,0 +1,12 @@
+---
+title: Encoding functions
+linkTitle: encoding
+description: Template functions to encode and decode data.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: functions
+---
+
+Use these functions to encode and decode data.
diff --git a/content/en/functions/fmt/Errorf.md b/content/en/functions/fmt/Errorf.md
index da9845073..c23d27372 100644
--- a/content/en/functions/fmt/Errorf.md
+++ b/content/en/functions/fmt/Errorf.md
@@ -1,20 +1,15 @@
---
title: fmt.Errorf
-linkTitle: errorf
description: Log an ERROR from a template.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [errorf]
+ related:
+ - functions/fmt/Erroridf
+ - functions/fmt/Warnf
returnType: string
signatures: ['fmt.Errorf FORMAT [INPUT]']
-relatedFunctions:
- - fmt.Errorf
- - fmt.Erroridf
- - fmt.Warnf
aliases: [/functions/errorf]
---
diff --git a/content/en/functions/fmt/Erroridf.md b/content/en/functions/fmt/Erroridf.md
index 986810436..a84671e3e 100644
--- a/content/en/functions/fmt/Erroridf.md
+++ b/content/en/functions/fmt/Erroridf.md
@@ -1,20 +1,15 @@
---
title: fmt.Erroridf
-linkTitle: erroridf
description: Log a suppressable ERROR from a template.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [erroridf]
+ related:
+ - functions/fmt/Errorf
+ - functions/fmt/Warnf
returnType: string
signatures: ['fmt.Erroridf ID FORMAT [INPUT]']
-relatedFunctions:
- - fmt.Errorf
- - fmt.Erroridf
- - fmt.Warnf
aliases: [/functions/erroridf]
---
@@ -40,7 +35,7 @@ ignoreErrors = ["error-42"]
To suppress this message:
-{{< code-toggle file=hugo copy=false >}}
+{{< code-toggle file=hugo >}}
ignoreErrors = ["error-42"]
{{< /code-toggle >}}
diff --git a/content/en/functions/fmt/Print.md b/content/en/functions/fmt/Print.md
index f9ff885f8..6f3128e5f 100644
--- a/content/en/functions/fmt/Print.md
+++ b/content/en/functions/fmt/Print.md
@@ -1,25 +1,20 @@
---
title: fmt.Print
-linkTitle: print
description: Prints the default representation of the given arguments using the standard `fmt.Print` function.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [print]
+ related:
+ - functions/fmt/Printf
+ - functions/fmt/Println
returnType: string
signatures: [fmt.Print INPUT]
-relatedFunctions:
- - fmt.Print
- - fmt.Printf
- - fmt.Println
aliases: [/functions/print]
---
```go-html-template
-{{ print "foo" }} → "foo"
-{{ print "foo" "bar" }} → "foobar"
+{{ print "foo" }} → foo
+{{ print "foo" "bar" }} → foobar
{{ print (slice 1 2 3) }} → [1 2 3]
```
diff --git a/content/en/functions/fmt/Printf.md b/content/en/functions/fmt/Printf.md
index 06b7222e9..af2fd398d 100644
--- a/content/en/functions/fmt/Printf.md
+++ b/content/en/functions/fmt/Printf.md
@@ -1,20 +1,15 @@
---
title: fmt.Printf
-linkTitle: printf
description: Formats a string using the standard `fmt.Sprintf` function.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [printf]
+ related:
+ - functions/fmt/Print
+ - functions/fmt/Println
returnType: string
signatures: ['fmt.Printf FORMAT [INPUT]']
-relatedFunctions:
- - fmt.Print
- - fmt.Printf
- - fmt.Println
aliases: [/functions/printf]
---
diff --git a/content/en/functions/fmt/Println.md b/content/en/functions/fmt/Println.md
index 358b5f8ac..a4db56ffb 100644
--- a/content/en/functions/fmt/Println.md
+++ b/content/en/functions/fmt/Println.md
@@ -1,23 +1,18 @@
---
title: fmt.Println
-linkTitle: println
-description: Prints the default representation of the given argument using the standard `fmt.Print` function and enforces a linebreak.
-categories: [functions]
+description: Prints the default representation of the given argument using the standard `fmt.Print` function and enforces a line break.
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [println]
+ related:
+ - functions/fmt/Print
+ - functions/fmt/Printf
returnType: string
signatures: [fmt.Println INPUT]
-relatedFunctions:
- - fmt.Print
- - fmt.Printf
- - fmt.Println
aliases: [/functions/println]
---
```go-html-template
-{{ println "foo" }} → "foo\n"
+{{ println "foo" }} → foo\n
```
diff --git a/content/en/functions/fmt/Warnf.md b/content/en/functions/fmt/Warnf.md
index be579a216..02dc0b9c1 100644
--- a/content/en/functions/fmt/Warnf.md
+++ b/content/en/functions/fmt/Warnf.md
@@ -1,20 +1,15 @@
---
title: fmt.Warnf
-linkTitle: warnf
description: Log a WARNING from a template.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [warnf]
+ related:
+ - functions/fmt/Errorf
+ - functions/fmt/Erroridf
returnType: string
signatures: ['fmt.Warnf FORMAT [INPUT]']
-relatedFunctions:
- - fmt.Errorf
- - fmt.Erroridf
- - fmt.Warnf
aliases: [/functions/warnf]
---
diff --git a/content/en/functions/fmt/_index.md b/content/en/functions/fmt/_index.md
new file mode 100644
index 000000000..51ef847ca
--- /dev/null
+++ b/content/en/functions/fmt/_index.md
@@ -0,0 +1,12 @@
+---
+title: Fmt functions
+linkTitle: fmt
+description: Template functions to print strings within a template or to print messages to the terminal
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: functions
+---
+
+Use these functions to print strings within a template or to print messages to the terminal.
diff --git a/content/en/functions/global/_index.md b/content/en/functions/global/_index.md
new file mode 100644
index 000000000..1e609b56e
--- /dev/null
+++ b/content/en/functions/global/_index.md
@@ -0,0 +1,11 @@
+---
+title: Global functions
+linkTitle: global
+description: Global template functions to access page and site data.
+categories: []
+menu:
+ docs:
+ parent: functions
+---
+
+Use these global functions to access page and site data.
diff --git a/content/en/functions/page/index.md b/content/en/functions/global/page.md
similarity index 91%
rename from content/en/functions/page/index.md
rename to content/en/functions/global/page.md
index 01f014078..fda767f21 100644
--- a/content/en/functions/page/index.md
+++ b/content/en/functions/global/page.md
@@ -1,19 +1,15 @@
---
title: page
-description: Provides global access to the .Page object.
-categories: [functions]
+description: Provides global access to a Page object.
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
+ related:
+ - functions/global/site
returnType:
signatures: [page]
-relatedFunctions:
- - hugo
- - page
- - site
+toc: true
aliases: [/functions/page]
---
@@ -47,7 +43,7 @@ Use the global `page` function to access the `Page` object from anywhere in any
### Be aware of top-level context
-The global `page` function accesses the `Page` object passed into the top-level template.
+The global `page` function accesses the `Page` object passed into the top-level template.
With this content structure:
@@ -94,7 +90,7 @@ Consider this section template:
```go-html-template
{{ range .Pages }}
-
+ {{ end }}
+{{ end }}
+{{< /code >}}
+
+{{% include "functions/go-template/_common/text-template.md" %}}
diff --git a/content/en/functions/go-template/break.md b/content/en/functions/go-template/break.md
new file mode 100644
index 000000000..14074d7c0
--- /dev/null
+++ b/content/en/functions/go-template/break.md
@@ -0,0 +1,33 @@
+---
+title: break
+description: Used with the range statement, stops the innermost iteration and bypasses all remaining iterations.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/go-template/continue
+ - functions/go-template/range
+ returnType:
+ signatures: [break]
+---
+
+This template code:
+
+```go-html-template
+{{ $s := slice "foo" "bar" "baz" }}
+{{ range $s }}
+ {{ if eq . "bar" }}
+ {{ break }}
+ {{ end }}
+
{{ . }}
+{{ end }}
+```
+
+Is rendered to:
+
+```html
+
foo
+```
+
+{{% include "functions/go-template/_common/text-template.md" %}}
diff --git a/content/en/functions/go-template/continue.md b/content/en/functions/go-template/continue.md
new file mode 100644
index 000000000..c8030b8b7
--- /dev/null
+++ b/content/en/functions/go-template/continue.md
@@ -0,0 +1,34 @@
+---
+title: continue
+description: Used with the range statement, stops the innermost iteration and continues to the next iteration.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/go-template/break
+ - functions/go-template/range
+ returnType:
+ signatures: [continue]
+---
+
+This template code:
+
+```go-html-template
+{{ $s := slice "foo" "bar" "baz" }}
+{{ range $s }}
+ {{ if eq . "bar" }}
+ {{ continue }}
+ {{ end }}
+
{{ . }}
+{{ end }}
+```
+
+Is rendered to:
+
+```html
+
foo
+
baz
+```
+
+{{% include "functions/go-template/_common/text-template.md" %}}
diff --git a/content/en/functions/go-template/define.md b/content/en/functions/go-template/define.md
new file mode 100644
index 000000000..4d09c14f3
--- /dev/null
+++ b/content/en/functions/go-template/define.md
@@ -0,0 +1,55 @@
+---
+title: define
+description: Defines a template.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/go-template/block
+ - functions/go-template/end
+ - functions/go-template/template
+ - functions/partials/Include
+ - functions/partials/IncludeCached
+ returnType:
+ signatures: [define NAME]
+---
+
+Use with the [`block`] statement:
+
+```go-html-template
+{{ block "main" . }}
+ {{ print "default value if 'main' template is empty" }}
+{{ end }}
+
+{{ define "main" }}
+
{{ .Title }}
+ {{ .Content }}
+{{ end }}
+```
+
+Use with the [`partial`] function:
+
+```go-html-template
+{{ partial "inline/foo.html" (dict "answer" 42) }}
+
+{{ define "partials/inline/foo.html" }}
+ {{ printf "The answer is %v." .answer }}
+{{ end }}
+```
+
+Use with the [`template`] function:
+
+```go-html-template
+{{ template "foo" (dict "answer" 42) }}
+
+{{ define "foo" }}
+ {{ printf "The answer is %v." .answer }}
+{{ end }}
+```
+
+[`block`]: /functions/go-template/block
+[`template`]: /functions/go-template/block
+[`partial`]: /functions/partials/include/
+
+{{% include "functions/go-template/_common/text-template.md" %}}
diff --git a/content/en/functions/go-template/else.md b/content/en/functions/go-template/else.md
new file mode 100644
index 000000000..ccb8b722c
--- /dev/null
+++ b/content/en/functions/go-template/else.md
@@ -0,0 +1,69 @@
+---
+title: else
+description: Begins an alternate block for if, with, and range statements.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/go-template/if
+ - functions/go-template/range
+ - functions/go-template/with
+ - functions/go-template/end
+ returnType:
+ signatures: [else VALUE]
+---
+
+Use with the [`if`] statement:
+
+```go-html-template
+{{ $var := "foo" }}
+{{ if $var }}
+ {{ $var }} → foo
+{{ else }}
+ {{ print "var is falsy" }}
+{{ end }}
+```
+
+Use with the [`with`] statement:
+
+```go-html-template
+{{ $var := "foo" }}
+{{ with $var }}
+ {{ . }} → foo
+{{ else }}
+ {{ print "var is falsy" }}
+{{ end }}
+```
+
+Use with the [`range`] statement:
+
+```go-html-template
+{{ $var := slice 1 2 3 }}
+{{ range $var }}
+ {{ . }} → 1 2 3
+{{ else }}
+ {{ print "var is falsy" }}
+{{ end }}
+```
+
+Use `else if` to check multiple conditions.
+
+```go-html-template
+{{ $var := 12 }}
+{{ if eq $var 6 }}
+ {{ print "var is 6" }}
+{{ else if eq $var 7 }}
+ {{ print "var is 7" }}
+{{ else if eq $var 42 }}
+ {{ print "var is 42" }}
+{{ else }}
+ {{ print "var is something else" }}
+{{ end }}
+```
+
+{{% include "functions/go-template/_common/text-template.md" %}}
+
+[`if`]: /functions/go-template/if
+[`with`]: /functions/go-template/with
+[`range`]: /functions/go-template/range
diff --git a/content/en/functions/go-template/end.md b/content/en/functions/go-template/end.md
new file mode 100644
index 000000000..07d004de5
--- /dev/null
+++ b/content/en/functions/go-template/end.md
@@ -0,0 +1,65 @@
+---
+title: end
+description: Terminates if, with, range, block, and define statements.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/go-template/block
+ - functions/go-template/define
+ - functions/go-template/if
+ - functions/go-template/range
+ - functions/go-template/with
+ returnType:
+ signatures: [end]
+---
+
+Use with the [`if`] statement:
+
+```go-html-template
+{{ $var := "foo" }}
+{{ if $var }}
+ {{ $var }} → foo
+{{ end }}
+```
+
+Use with the [`with`] statement:
+
+```go-html-template
+{{ $var := "foo" }}
+{{ with $var }}
+ {{ . }} → foo
+{{ end }}
+```
+
+Use with the [`range`] statement:
+
+```go-html-template
+{{ $var := slice 1 2 3 }}
+{{ range $var }}
+ {{ . }} → 1 2 3
+{{ end }}
+```
+
+Use with the [`block`] statement:
+
+```go-html-template
+{{ block "main" . }}{{ end }}
+```
+
+Use with the [`define`] statement:
+
+```go-html-template
+{{ define "main" }}
+ {{ print "this is the main section" }}
+{{ end }}
+```
+
+{{% include "functions/go-template/_common/text-template.md" %}}
+
+[`block`]: /functions/go-template/block
+[`define`]: /functions/go-template/define
+[`if`]: /functions/go-template/if
+[`range`]: /functions/go-template/range
+[`with`]: /functions/go-template/with
diff --git a/content/en/functions/go-template/if.md b/content/en/functions/go-template/if.md
new file mode 100644
index 000000000..e63c382e1
--- /dev/null
+++ b/content/en/functions/go-template/if.md
@@ -0,0 +1,54 @@
+---
+title: if
+description: Executes the block if the expression is truthy.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/go-template/with
+ - functions/go-template/else
+ - functions/go-template/end
+ - functions/collections/IsSet
+ returnType:
+ signatures: [if EXPR]
+---
+
+{{% include "functions/go-template/_common/truthy-falsy.md" %}}
+
+```go-html-template
+{{ $var := "foo" }}
+{{ if $var }}
+ {{ $var }} → foo
+{{ end }}
+```
+
+Use with the [`else`] statement:
+
+```go-html-template
+{{ $var := "foo" }}
+{{ if $var }}
+ {{ $var }} → foo
+{{ else }}
+ {{ print "var is falsy" }}
+{{ end }}
+```
+
+Use `else if` to check multiple conditions.
+
+```go-html-template
+{{ $var := 12 }}
+{{ if eq $var 6 }}
+ {{ print "var is 6" }}
+{{ else if eq $var 7 }}
+ {{ print "var is 7" }}
+{{ else if eq $var 42 }}
+ {{ print "var is 42" }}
+{{ else }}
+ {{ print "var is something else" }}
+{{ end }}
+```
+
+{{% include "functions/go-template/_common/text-template.md" %}}
+
+[`else`]: /functions/go-template/else
diff --git a/content/en/functions/go-template/len.md b/content/en/functions/go-template/len.md
index b8be621e8..43f150a5f 100644
--- a/content/en/functions/go-template/len.md
+++ b/content/en/functions/go-template/len.md
@@ -1,26 +1,20 @@
---
title: len
description: Returns the length of a string, slice, map, or collection.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
+ related:
+ - functions/strings/Count
+ - functions/strings/CountRunes
+ - functions/strings/CountWords
+ - functions/strings/RuneCount
returnType: int
- signatures: [len INPUT]
-relatedFunctions:
- - len
- - strings.Count
- - strings.CountRunes
- - strings.CountWords
- - strings.RuneCount
+ signatures: [len VALUE]
aliases: [/functions/len]
---
-{{% readfile file="/functions/_common/go-template-functions.md" %}}
-
With a string:
```go-html-template
@@ -53,3 +47,5 @@ You may also determine the number of pages in a collection with:
```go-html-template
{{ site.RegularPages.Len }} → 42
```
+
+{{% include "functions/go-template/_common/text-template.md" %}}
diff --git a/content/en/functions/go-template/not.md b/content/en/functions/go-template/not.md
new file mode 100644
index 000000000..4c7747c7b
--- /dev/null
+++ b/content/en/functions/go-template/not.md
@@ -0,0 +1,35 @@
+---
+title: not
+description: Returns the boolean negation of its single argument.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/go-template/and
+ - functions/go-template/or
+ returnType: bool
+ signatures: [not VALUE]
+---
+
+Unlike the `and` and `or` operators, the `not` operator always returns a boolean value.
+
+```go-html-template
+{{ not true }} → false
+{{ not false }} → true
+
+{{ not 1 }} → false
+{{ not 0 }} → true
+
+{{ not "x" }} → false
+{{ not "" }} → true
+```
+
+Use the `not` operator, twice in succession, to cast any value to a boolean value. For example:
+
+```go-html-template
+{{ 42 | not | not }} → true
+{{ "" | not | not }} → false
+```
+
+{{% include "functions/go-template/_common/text-template.md" %}}
diff --git a/content/en/functions/go-template/or.md b/content/en/functions/go-template/or.md
new file mode 100644
index 000000000..0d8619608
--- /dev/null
+++ b/content/en/functions/go-template/or.md
@@ -0,0 +1,26 @@
+---
+title: or
+description: Returns the first truthy argument. If all arguments are falsy, returns the last argument.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/go-template/and
+ - functions/go-template/not
+ returnType: any
+ signatures: [or VALUE...]
+---
+
+{{% include "functions/go-template/_common/truthy-falsy.md" %}}
+
+```go-html-template
+{{ or 0 1 2 }} → 1
+{{ or false "a" 1 }} → a
+{{ or 0 true "a" }} → true
+
+{{ or false "" 0 }} → 0
+{{ or 0 "" false }} → false
+```
+
+{{% include "functions/go-template/_common/text-template.md" %}}
diff --git a/content/en/functions/go-template/range.md b/content/en/functions/go-template/range.md
index cf01633b4..4c2c2e1c4 100644
--- a/content/en/functions/go-template/range.md
+++ b/content/en/functions/go-template/range.md
@@ -1,27 +1,86 @@
---
title: range
-description: Iterates over slices, maps, and page collections.
-categories: [functions]
+description: Iterates over a non-empty collection, binds context (the dot) to successive elements, and executes the block.
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
+ related:
+ - functions/go-template/break
+ - functions/go-template/continue
+ - functions/go-template/else
+ - functions/go-template/end
returnType:
signatures: [range COLLECTION]
-relatedFunctions:
- - with
- - range
aliases: [/functions/range]
toc: true
---
-{{% readfile file="/functions/_common/go-template-functions.md" %}}
+{{% include "functions/go-template/_common/truthy-falsy.md" %}}
-## Slices
+```go-html-template
+{{ $s := slice "foo" "bar" "baz" }}
+{{ range $var }}
+ {{ . }} → foo "bar" "baz"
+{{ end }}
+```
-Template:
+Use with the [`else`] statement:
+
+```go-html-template
+{{ $s := slice "foo" "bar" "baz" }}
+{{ range $s }}
+
{{ . }}
+{{ else }}
+
The collection is empty
+{{ end }}
+```
+
+Within a range block:
+
+- Use the [`continue`] statement to stop the innermost iteration and continue to the next iteration
+- Use the [`break`] statement to stop the innermost iteration and bypass all remaining iterations
+
+## Understanding context
+
+At the top of a page template, the [context] (the dot) is a `Page` object. Within the `range` block, the context is bound to each successive element.
+
+With this contrived example that uses the [`seq`] function to generate a slice of integers:
+
+```go-html-template
+{{ range seq 3 }}
+ {{ .Title }}
+{{ end }}
+```
+
+Hugo will throw an error:
+
+ can't evaluate field Title in type int
+
+The error occurs because we are trying to use the `.Title` method on an integer instead of a `Page` object. Within the `range` block, if we want to render the page title, we need to get the context passed into the template.
+
+{{% note %}}
+Use the `$` to get the context passed into the template.
+{{% /note %}}
+
+This template will render the page title three times:
+
+```go-html-template
+{{ range seq 3 }}
+ {{ $.Title }}
+{{ end }}
+```
+
+{{% note %}}
+Gaining a thorough understanding of context is critical for anyone writing template code.
+{{% /note %}}
+
+[`seq`]: functions/collections/seq/
+[context]: /getting-started/glossary/#context
+
+## Array or slice of scalars
+
+This template code:
```go-html-template
{{ $s := slice "foo" "bar" "baz" }}
@@ -30,7 +89,7 @@ Template:
{{ end }}
```
-Result:
+Is rendered to:
```html
-```
-
-## Continue
-
-Use the `continue` statement to stop the innermost iteration and continue to the next iteration.
-
-Template:
+Is rendered to:
```go-html-template
-{{ $s := slice "foo" "bar" "baz" }}
-{{ range $s }}
- {{ if eq . "bar" }}
- {{ continue }}
- {{ end }}
-
{{ . }}
-{{ end }}
+
key = age value = 30
+
key = name value = John
```
-Result:
+Unlike ranging over an array or slice, Hugo sorts by key when ranging over a map.
-```html
-
foo
-
baz
-```
+{{% include "functions/go-template/_common/text-template.md" %}}
+
+[`else`]: /functions/go-template/else
+[`break`]: /functions/go-template/break
+[`continue`]: /functions/go-template/continue
diff --git a/content/en/functions/go-template/template.md b/content/en/functions/go-template/template.md
new file mode 100644
index 000000000..c089010ca
--- /dev/null
+++ b/content/en/functions/go-template/template.md
@@ -0,0 +1,49 @@
+---
+title: template
+description: Executes the given template, optionally passing context.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/go-template/define
+ - functions/partials/Include
+ - functions/partials/IncludeCached
+ returnType:
+ signatures: ['template NAME [CONTEXT]']
+---
+
+Use the `template` function to execute [internal templates]. For example:
+
+```go-html-template
+{{ range (.Paginate .Pages).Pages }}
+
+{{ end }}
+{{ template "_internal/pagination.html" . }}
+```
+
+You can also use the `template` function to execute a defined template:
+
+```go-html-template
+{{ template "foo" (dict "answer" 42) }}
+
+{{ define "foo" }}
+ {{ printf "The answer is %v." .answer }}
+{{ end }}
+```
+
+The example above can be rewritten using an [inline partial] template:
+
+```go-html-template
+{{ partial "inline/foo.html" (dict "answer" 42) }}
+
+{{ define "partials/inline/foo.html" }}
+ {{ printf "The answer is %v." .answer }}
+{{ end }}
+```
+
+{{% include "functions/go-template/_common/text-template.md" %}}
+
+[`partial`]: /functions/partials/include/
+[inline partial]: /templates/partials/#inline-partials
+[internal templates]: /templates/internal
diff --git a/content/en/functions/go-template/urlquery.md b/content/en/functions/go-template/urlquery.md
index cbbfdfa7d..946828f56 100644
--- a/content/en/functions/go-template/urlquery.md
+++ b/content/en/functions/go-template/urlquery.md
@@ -1,23 +1,17 @@
---
title: urlquery
description: Returns the escaped value of the textual representation of its arguments in a form suitable for embedding in a URL query.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
+ related:
+ - functions/collections/Querify
returnType: string
- signatures: ['urlquery INPUT [INPUT]...']
-relatedFunctions:
- - collections.Querify
- - urlquery
+ signatures: ['urlquery VALUE [VALUE...]']
aliases: [/functions/urlquery]
---
-{{% readfile file="/functions/_common/go-template-functions.md" %}}
-
This template code:
```go-html-template
@@ -30,3 +24,5 @@ Is rendered to:
```html
Link
```
+
+{{% include "functions/go-template/_common/text-template.md" %}}
diff --git a/content/en/functions/go-template/with.md b/content/en/functions/go-template/with.md
index 06ca38150..9245e563f 100644
--- a/content/en/functions/go-template/with.md
+++ b/content/en/functions/go-template/with.md
@@ -1,35 +1,77 @@
---
title: with
-description: Rebinds the context (`.`) within its scope and skips the block if the variable is absent or empty.
-categories: [functions]
+description: Binds context (the dot) to the expression and executes the block if expression is truthy.
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
- returnType: any
- signatures: [with PIPELINE]
-relatedFunctions:
- - with
- - range
+ related:
+ - functions/go-template/if
+ - functions/go-template/else
+ - functions/go-template/end
+ - functions/collections/IsSet
+ returnType:
+ signatures: [with EXPR]
aliases: [/functions/with]
+toc: true
---
-{{% readfile file="/functions/_common/go-template-functions.md" %}}
+{{% include "functions/go-template/_common/truthy-falsy.md" %}}
-An alternative way of writing an `if` statement and then referencing the same value is to use `with` instead. `with` rebinds the context (`.`) within its scope and skips the block if the variable is absent, unset or empty.
+```go-html-template
+{{ $var := "foo" }}
+{{ with $var }}
+ {{ . }} → foo
+{{ end }}
+```
-The set of *empty* values is defined by [the Go templates package](https://golang.org/pkg/text/template/). Empty values include `false`, the number zero, and the empty string.
+Use with the [`else`] statement:
-If you want to render a block if an index or key is present in a slice, array, channel or map, regardless of whether the value is empty, you should use [`isset`](/functions/collections/isset) instead.
+```go-html-template
+{{ $var := "foo" }}
+{{ with $var }}
+ {{ . }} → foo
+{{ else }}
+ {{ print "var is falsy" }}
+{{ end }}
+```
-The following example checks for a [user-defined site variable](/variables/site/) called `twitteruser`. If the key-value is not set, the following will render nothing:
+## Understanding context
-{{< code file="layouts/partials/twitter.html" >}}
-{{ with .Site.Params.twitteruser }}
-
-
-{{ end }}
-{{< /code >}}
+At the top of a page template, the [context] (the dot) is a `Page` object. Inside of the `with` block, the context is bound to the value passed to the `with` statement.
+
+With this contrived example:
+
+```go-html-template
+{{ with 42 }}
+ {{ .Title }}
+{{ end }}
+```
+
+Hugo will throw an error:
+
+ can't evaluate field Title in type int
+
+The error occurs because we are trying to use the `.Title` method on an integer instead of a `Page` object. Inside of the `with` block, if we want to render the page title, we need to get the context passed into the template.
+
+{{% note %}}
+Use the `$` to get the context passed into the template.
+{{% /note %}}
+
+This template will render the page title as desired:
+
+```go-html-template
+{{ with 42 }}
+ {{ $.Title }}
+{{ end }}
+```
+
+{{% note %}}
+Gaining a thorough understanding of context is critical for anyone writing template code.
+{{% /note %}}
+
+[context]: /getting-started/glossary/#context
+
+{{% include "functions/go-template/_common/text-template.md" %}}
+
+[`else`]: /functions/go-template/else
diff --git a/content/en/functions/hugo/BuildDate.md b/content/en/functions/hugo/BuildDate.md
new file mode 100644
index 000000000..1fbdbeac6
--- /dev/null
+++ b/content/en/functions/hugo/BuildDate.md
@@ -0,0 +1,19 @@
+---
+title: hugo.BuildDate
+description: Returns the compile date of the Hugo binary.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: string
+ signatures: [hugo.BuildDate]
+---
+
+The `hugo.BuildDate` function returns the compile date of the Hugo binary, formatted per [RFC 3339].
+
+[RFC 3339]: https://datatracker.ietf.org/doc/html/rfc3339
+
+```go-html-template
+{{ hugo.BuildDate }} → 2023-11-01T17:57:00Z
+```
diff --git a/content/en/functions/hugo/CommitHash.md b/content/en/functions/hugo/CommitHash.md
new file mode 100644
index 000000000..cd4f2ce92
--- /dev/null
+++ b/content/en/functions/hugo/CommitHash.md
@@ -0,0 +1,15 @@
+---
+title: hugo.CommitHash
+description: Returns the Git commit hash of the Hugo binary.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: string
+ signatures: [hugo.CommitHash]
+---
+
+```go-html-template
+{{ hugo.CommitHash }} → a4892a07b41b7b3f1f143140ee4ec0a9a5cf3970
+```
diff --git a/content/en/functions/hugo/Deps.md b/content/en/functions/hugo/Deps.md
new file mode 100644
index 000000000..2f3f75e65
--- /dev/null
+++ b/content/en/functions/hugo/Deps.md
@@ -0,0 +1,66 @@
+---
+title: hugo.Deps
+description: Returns a slice of project dependencies, either Hugo Modules or local theme components.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: '[]hugo.Dependency'
+ signatures: [hugo.Deps]
+---
+
+The `hugo.Deps` function returns a slice of project dependencies, either Hugo Modules or local theme components. Each dependency contains:
+
+Owner
+: (`hugo.Dependency`) In the dependency tree, this is the first module that defines this module as a dependency (e.g., `github.com/gohugoio/hugo-mod-bootstrap-scss/v5`).
+
+Path
+: (`string`) The module path or the path below your `themes` directory (e.g., `github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2`).
+
+Replace
+: (`hugo.Dependency`) Replaced by this dependency.
+
+Time
+: (`time.Time`) The time that the version was created (e.g., `2022-02-13 15:11:28 +0000 UTC`).
+
+Vendor
+: (`bool`) Reports whether the dependency is vendored.
+
+Version
+: (`string`) The module version (e.g., `v2.21100.20000`).
+
+An example table listing the dependencies:
+
+```go-html-template
+
Dependencies
+
+
+
+
#
+
Owner
+
Path
+
Version
+
Time
+
Vendor
+
+
+
+ {{ range $index, $element := hugo.Deps }}
+
+
{{ add $index 1 }}
+
{{ with $element.Owner }}{{ .Path }}{{ end }}
+
+ {{ $element.Path }}
+ {{ with $element.Replace }}
+ => {{ .Path }}
+ {{ end }}
+
+
{{ $element.Version }}
+
{{ with $element.Time }}{{ . }}{{ end }}
+
{{ $element.Vendor }}
+
+ {{ end }}
+
+
+```
diff --git a/content/en/functions/hugo/Environment.md b/content/en/functions/hugo/Environment.md
new file mode 100644
index 000000000..f17a1e603
--- /dev/null
+++ b/content/en/functions/hugo/Environment.md
@@ -0,0 +1,28 @@
+---
+title: hugo.Environment
+description: Returns the current running environment.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: string
+ signatures: [hugo.Environment]
+---
+
+The `hugo.Environment` function returns the current running [environment] as defined through the `--environment` command line flag.
+
+```go-html-template
+{{ hugo.Environment }} → production
+```
+
+Command line examples:
+
+Command|Environment
+:--|:--
+`hugo`|`production`
+`hugo --environment staging`|`staging`
+`hugo server`|`development`
+`hugo server --environment staging`|`staging`
+
+[environment]: /getting-started/glossary/#environment
diff --git a/content/en/functions/hugo/Generator.md b/content/en/functions/hugo/Generator.md
new file mode 100644
index 000000000..a9496d87f
--- /dev/null
+++ b/content/en/functions/hugo/Generator.md
@@ -0,0 +1,15 @@
+---
+title: hugo.Generator
+description: Renders an HTML meta element identifying the software that generated the site.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: template.HTML
+ signatures: [hugo.Generator]
+---
+
+```go-html-template
+{{ hugo.Generator }} →
+```
diff --git a/content/en/functions/hugo/GoVersion.md b/content/en/functions/hugo/GoVersion.md
new file mode 100644
index 000000000..34c6266bf
--- /dev/null
+++ b/content/en/functions/hugo/GoVersion.md
@@ -0,0 +1,15 @@
+---
+title: hugo.GoVersion
+description: Returns the Go version used to compile the Hugo binary
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: string
+ signatures: [hugo.GoVersion]
+---
+
+```go-html-template
+{{ hugo.GoVersion }} → go1.21.1
+```
diff --git a/content/en/functions/hugo/IsDevelopment.md b/content/en/functions/hugo/IsDevelopment.md
new file mode 100644
index 000000000..361378b2f
--- /dev/null
+++ b/content/en/functions/hugo/IsDevelopment.md
@@ -0,0 +1,15 @@
+---
+title: hugo.IsDevelopment
+description: Reports whether the current running environment is "development".
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: bool
+ signatures: [hugo.IsDevelopment]
+---
+
+```go-html-template
+{{ hugo.IsDevelopment }} → true/false
+```
diff --git a/content/en/functions/hugo/IsExtended.md b/content/en/functions/hugo/IsExtended.md
new file mode 100644
index 000000000..84b68e6d3
--- /dev/null
+++ b/content/en/functions/hugo/IsExtended.md
@@ -0,0 +1,15 @@
+---
+title: hugo.IsExtended
+description: Reports whether the Hugo binary is the extended version.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: bool
+ signatures: [hugo.IsExtended]
+---
+
+```go-html-template
+{{ hugo.IsExtended }} → true/false
+```
diff --git a/content/en/functions/hugo/IsProduction.md b/content/en/functions/hugo/IsProduction.md
new file mode 100644
index 000000000..77945f1a0
--- /dev/null
+++ b/content/en/functions/hugo/IsProduction.md
@@ -0,0 +1,15 @@
+---
+title: hugo.IsProduction
+description: Reports whether the current running environment is "production".
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: bool
+ signatures: [hugo.IsProduction]
+---
+
+```go-html-template
+{{ hugo.IsProduction }} → true/false
+```
diff --git a/content/en/functions/hugo/IsServer.md b/content/en/functions/hugo/IsServer.md
new file mode 100644
index 000000000..add88b8eb
--- /dev/null
+++ b/content/en/functions/hugo/IsServer.md
@@ -0,0 +1,15 @@
+---
+title: hugo.IsServer
+description: Reports whether the built-in development server is running.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: bool
+ signatures: [hugo.IsServer]
+---
+
+```go-html-template
+{{ hugo.IsServer }} → true/false
+```
diff --git a/content/en/functions/hugo/Version.md b/content/en/functions/hugo/Version.md
new file mode 100644
index 000000000..9bb361a71
--- /dev/null
+++ b/content/en/functions/hugo/Version.md
@@ -0,0 +1,15 @@
+---
+title: hugo.Version
+description: Returns the current version of the Hugo binary.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: hugo.VersionString
+ signatures: [hugo.Version]
+---
+
+```go-html-template
+{{ hugo.Version }} → 0.120.3
+```
diff --git a/content/en/functions/hugo/WorkingDir.md b/content/en/functions/hugo/WorkingDir.md
new file mode 100644
index 000000000..ac3835ea8
--- /dev/null
+++ b/content/en/functions/hugo/WorkingDir.md
@@ -0,0 +1,15 @@
+---
+title: hugo.WorkingDir
+description: Returns the project working directory.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: string
+ signatures: [hugo.WorkingDir]
+---
+
+```go-html-template
+{{ hugo.WorkingDir }} → /home/user/projects/my-hugo-site
+```
diff --git a/content/en/functions/hugo/_index.md b/content/en/functions/hugo/_index.md
new file mode 100644
index 000000000..e13c12b33
--- /dev/null
+++ b/content/en/functions/hugo/_index.md
@@ -0,0 +1,12 @@
+---
+title: Hugo functions
+linkTitle: hugo
+description: Template functions to access information about the Hugo application and the current environment.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: functions
+---
+
+Use these functions to access information about the Hugo application and the current environment.
diff --git a/content/en/functions/hugo/index.md b/content/en/functions/hugo/index.md
deleted file mode 100644
index 64ea0db22..000000000
--- a/content/en/functions/hugo/index.md
+++ /dev/null
@@ -1,117 +0,0 @@
----
-title: hugo
-description: Provides global access to Hugo-related data.
-categories: [functions]
-keywords: []
-menu:
- docs:
- parent: functions
-function:
- aliases: []
- returnType:
- signatures: [hugo]
-relatedFunctions:
- - hugo
- - page
- - site
-aliases: [/functions/hugo]
----
-
-`hugo` returns an instance that contains the following functions:
-
-`hugo.BuildDate`
-: (`string`) The compile date of the current Hugo binary formatted per [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) (e.g., `2023-05-23T08:14:20Z`).
-
-`hugo.CommitHash`
-: (`string`) The Git commit hash of the Hugo binary (e.g., `0a95d6704a8ac8d41cc5ca8fffaad8c5c7a3754a`).
-
-`hugo.Deps`
-: (`[]*hugo.Dependency`) See [hugo.Deps](#hugodeps).
-
-`hugo.Environment`
-: (`string`) The current running environment as defined through the `--environment` CLI flag (e.g., `development`, `production`).
-
-`hugo.Generator`
-: (`template.HTML`) Renders an HTML `meta` element identifying the software that generated the site (e.g., ``).
-
-`hugo.GoVersion` {{< new-in "0.101.0" >}}
-: (`string`) The Go version used to compile the Hugo binary (e.g., `go1.20.4`).
-
-`hugo.IsDevelopment` {{< new-in "0.120.0" >}}
-: (`bool`) Returns `true` if `hugo.Environment` is "development".
-
-`hugo.IsExtended`
-: (`bool`) Returns `true` if the Hugo binary is the extended version.
-
-`hugo.IsProduction`
-: (`bool`) Returns `true` if `hugo.Environment` is "production".
-
-`hugo.IsServer` {{< new-in "0.120.0" >}}
-: (`bool`) Returns `true` if the site is being served with Hugo's built-in server.
-
-`hugo.Version`
-: (`hugo.VersionString`) The current version of the Hugo binary (e.g., `0.112.1`).
-
-`hugo.WorkingDir` {{< new-in "0.112.0" >}}
-: (`string`) The project working directory (e.g., `/home/user/projects/my-hugo-site`).
-
-## hugo.Deps
-
-{{< new-in "0.92.0" >}}
-
-`hugo.Deps` returns a list of dependencies for a project (either Hugo Modules or local theme components).
-
-Each dependency contains:
-
-Owner
-: (`*hugo.Dependency`) In the dependency tree, this is the first module that defines this module as a dependency (e.g., `github.com/gohugoio/hugo-mod-bootstrap-scss/v5`).
-
-Path
-: (`string`) The module path or the path below your `themes` directory (e.g., `github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2`).
-
-Replace
-: (`*hugo.Dependency`) Replaced by this dependency.
-
-Time
-: (`time.Time`) The time that the version was created (e.g., `2022-02-13 15:11:28 +0000 UTC`).
-
-Vendor
-: (`bool`) Returns `true` if the dependency is vendored.
-
-Version
-: (`string`) The module version (e.g., `v2.21100.20000`).
-
-An example table listing the dependencies:
-
-```html
-
Dependencies
-
-
-
-
#
-
Owner
-
Path
-
Version
-
Time
-
Vendor
-
-
-
- {{ range $index, $element := hugo.Deps }}
-
-
{{ add $index 1 }}
-
{{ with $element.Owner }}{{ .Path }}{{ end }}
-
- {{ $element.Path }}
- {{ with $element.Replace }}
- => {{ .Path }}
- {{ end }}
-
-
{{ $element.Version }}
-
{{ with $element.Time }}{{ . }}{{ end }}
-
{{ $element.Vendor }}
-
- {{ end }}
-
-
-```
diff --git a/content/en/functions/images/Brightness.md b/content/en/functions/images/Brightness.md
new file mode 100644
index 000000000..0001bcba8
--- /dev/null
+++ b/content/en/functions/images/Brightness.md
@@ -0,0 +1,36 @@
+---
+title: images.Brightness
+description: Returns an image filter that changes the brightness of an image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.Brightness PERCENTAGE]
+toc: true
+---
+
+The percentage must be in the range [-100, 100] where 0 has no effect. A value of `-100` produces a solid black image, and a value of `100` produces a solid white image.
+
+## Usage
+
+Create the image filter:
+
+```go-html-template
+{{ $filter := images.Brightness 12 }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Brightness"
+ filterArgs="12"
+ example=true
+>}}
diff --git a/content/en/functions/images/ColorBalance.md b/content/en/functions/images/ColorBalance.md
new file mode 100644
index 000000000..29829f9e6
--- /dev/null
+++ b/content/en/functions/images/ColorBalance.md
@@ -0,0 +1,36 @@
+---
+title: images.ColorBalance
+description: Returns an image filter that changes the color balance of an image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.ColorBalance PCTRED PCTGREEN PCTBLUE]
+toc: true
+---
+
+The percentage for each channel (red, green, blue) must be in the range [-100, 500].
+
+## Usage
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.ColorBalance -10 10 50 }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="ColorBalance"
+ filterArgs="-10,10,50"
+ example=true
+>}}
diff --git a/content/en/functions/images/Colorize.md b/content/en/functions/images/Colorize.md
new file mode 100644
index 000000000..c974103b9
--- /dev/null
+++ b/content/en/functions/images/Colorize.md
@@ -0,0 +1,40 @@
+---
+title: images.Colorize
+description: Returns an image filter that produces a colorized version of an image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.Colorize HUE SATURATION PERCENTAGE]
+toc: true
+---
+
+The hue is the angle on the color wheel, typically in the range [0, 360].
+
+The saturation must be in the range [0, 100].
+
+The percentage specifies the strength of the effect, and must be in the range [0, 100].
+
+## Usage
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.Colorize 180 50 20 }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Colorize"
+ filterArgs="180,50,20"
+ example=true
+>}}
diff --git a/content/en/functions/images/Config.md b/content/en/functions/images/Config.md
new file mode 100644
index 000000000..fafb5b024
--- /dev/null
+++ b/content/en/functions/images/Config.md
@@ -0,0 +1,31 @@
+---
+title: images.Config
+description: Returns an image.Config structure from the image at the specified path, relative to the working directory.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: image.Config
+ signatures: [images.Config PATH]
+aliases: [/functions/imageconfig]
+---
+
+See [image processing] for an overview of Hugo's image pipeline.
+
+[image processing]: /content-management/image-processing/
+
+```go-html-template
+{{ $ic := images.Config "/static/images/a.jpg" }}
+
+{{ $ic.Width }} → 600 (int)
+{{ $ic.Height }} → 400 (int)
+```
+
+Supported image formats include GIF, JPEG, PNG, TIFF, and WebP.
+
+{{% note %}}
+This is a legacy function, superseded by the `.Width` and `.Height` methods for global, page, and remote resources. See the [image processing] section for details.
+
+[image processing]: /content-management/image-processing
+{{% /note %}}
diff --git a/content/en/functions/images/Contrast.md b/content/en/functions/images/Contrast.md
new file mode 100644
index 000000000..532ae8c9c
--- /dev/null
+++ b/content/en/functions/images/Contrast.md
@@ -0,0 +1,36 @@
+---
+title: images.Contrast
+description: Returns an image filter that changes the contrast of an image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.Contrast PERCENTAGE]
+toc: true
+---
+
+The percentage must be in the range [-100, 100] where 0 has no effect. A value of `-100` produces a solid grey image, and a value of `100` produces an over-contrasted image.
+
+## Usage
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.Contrast -20 }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Contrast"
+ filterArgs="-20"
+ example=true
+>}}
diff --git a/content/en/functions/images/Filter.md b/content/en/functions/images/Filter.md
new file mode 100644
index 000000000..450a64814
--- /dev/null
+++ b/content/en/functions/images/Filter.md
@@ -0,0 +1,67 @@
+---
+title: images.Filter
+description: Applies one or more image filters to the given image resource.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - methods/resource/Filter
+ returnType: images.ImageResource
+ signatures: [images.Filter FILTERS... IMAGE]
+toc: true
+---
+
+Apply one or more [image filters](#image-filters) to the given image.
+
+To apply a single filter:
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with images.Filter images.Grayscale . }}
+
+ {{ end }}
+{{ end }}
+```
+
+To apply two or more filters, executing from left to right:
+
+```go-html-template
+{{ $filters := slice
+ images.Grayscale
+ (images.GaussianBlur 8)
+}}
+{{ with resources.Get "images/original.jpg" }}
+ {{ with images.Filter $filters . }}
+
+ {{ end }}
+{{ end }}
+```
+
+You can also apply image filters using the [`Filter`] method on a `Resource` object.
+
+[`Filter`]: /methods/resource/filter
+
+## Example
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with images.Filter images.Grayscale . }}
+
+ {{ end }}
+{{ end }}
+```
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Grayscale"
+ filterArgs=""
+ example=true
+>}}
+
+## Image filters
+
+Use any of these filters with the `images.Filter` function, or with the `Filter` method on a `Resource` object.
+
+{{< list-pages-in-section path=/functions/images filter=functions_images_no_filters filterType=exclude >}}
diff --git a/content/en/functions/images/Gamma.md b/content/en/functions/images/Gamma.md
new file mode 100644
index 000000000..affbdcfa8
--- /dev/null
+++ b/content/en/functions/images/Gamma.md
@@ -0,0 +1,36 @@
+---
+title: images.Gamma
+description: Returns an image filter that performs gamma correction on an image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.Gamma GAMMA]
+toc: true
+---
+
+The gamma value must be positive. A value greater than 1 lightens the image, while a value less than 1 darkens the image. The filter has no effect when the gamma value is 1.
+
+## Usage
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.Gamma 1.667 }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Gamma"
+ filterArgs="1.667"
+ example=true
+>}}
diff --git a/content/en/functions/images/GaussianBlur.md b/content/en/functions/images/GaussianBlur.md
new file mode 100644
index 000000000..e2f49a847
--- /dev/null
+++ b/content/en/functions/images/GaussianBlur.md
@@ -0,0 +1,36 @@
+---
+title: images.GaussianBlur
+description: Returns an image filter that applies a gaussian blur to an image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.GaussianBlur SIGMA]
+toc: true
+---
+
+The sigma value must be positive, and indicates how much the image will be blurred. The blur-affected radius is approximately 3 times the sigma value.
+
+## Usage
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.GaussianBlur 5 }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="GaussianBlur"
+ filterArgs="5"
+ example=true
+>}}
diff --git a/content/en/functions/images/Grayscale.md b/content/en/functions/images/Grayscale.md
new file mode 100644
index 000000000..d8a89b7f2
--- /dev/null
+++ b/content/en/functions/images/Grayscale.md
@@ -0,0 +1,34 @@
+---
+title: images.Grayscale
+description: Returns an image filter that produces a grayscale version of an image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.Grayscale]
+toc: true
+---
+
+## Usage
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.Grayscale }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Grayscale"
+ filterArgs=""
+ example=true
+>}}
diff --git a/content/en/functions/images/Hue.md b/content/en/functions/images/Hue.md
new file mode 100644
index 000000000..6eafac437
--- /dev/null
+++ b/content/en/functions/images/Hue.md
@@ -0,0 +1,36 @@
+---
+title: images.Hue
+description: Returns an image filter that rotates the hue of an image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.Hue SHIFT]
+toc: true
+---
+
+The hue angle shift is typically in the range [-180, 180] where 0 has no effect.
+
+## Usage
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.Hue -15 }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Hue"
+ filterArgs="-15"
+ example=true
+>}}
diff --git a/content/en/functions/images/Invert.md b/content/en/functions/images/Invert.md
new file mode 100644
index 000000000..1ee85e514
--- /dev/null
+++ b/content/en/functions/images/Invert.md
@@ -0,0 +1,34 @@
+---
+title: images.Invert
+description: Returns an image filter that negates the colors of an image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.Invert]
+toc: true
+---
+
+## Usage
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.Invert }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Invert"
+ filterArgs=""
+ example=true
+>}}
diff --git a/content/en/functions/images/Opacity.md b/content/en/functions/images/Opacity.md
new file mode 100644
index 000000000..c3b09efc4
--- /dev/null
+++ b/content/en/functions/images/Opacity.md
@@ -0,0 +1,50 @@
+---
+title: images.Opacity
+description: Returns an image filter that changes the opacity of an image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.Opacity OPACITY]
+toc: true
+---
+
+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
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.Opacity 0.65 }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+The `images.Opacity` filter is most useful for target formats such as PNG and WebP that support transparency. If the source image does not support transparency, combine this filter with the `images.Process` filter:
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ $filters := slice
+ (images.Opacity 0.65)
+ (images.Process "png")
+ }}
+ {{ with . | images.Filter $filters }}
+
+ {{ end }}
+{{ end }}
+```
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Opacity"
+ filterArgs="0.65"
+ example=true
+>}}
diff --git a/content/en/functions/images/Overlay.md b/content/en/functions/images/Overlay.md
new file mode 100644
index 000000000..f04e3668b
--- /dev/null
+++ b/content/en/functions/images/Overlay.md
@@ -0,0 +1,54 @@
+---
+title: images.Overlay
+description: Returns an image filter that overlays the source image at the given coordinates.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.Overlay RESOURCE X Y]
+toc: true
+---
+
+The coordinates are relative to the upper left corner.
+
+## Usage
+
+Capture the overlay image as a resource:
+
+```go-html-template
+{{ $overlay := "" }}
+{{ $path := "images/logo.png" }}
+{{ with resources.Get $path }}
+ {{ $overlay = . }}
+{{ else }}
+ {{ errorf "Unable to get resource %q" $path }}
+{{ end }}
+```
+
+The overlay image can be a [global resource], a [page resource], or a [remote resource].
+
+[global resource]: /getting-started/glossary/#global-resource
+[page resource]: /getting-started/glossary/#page-resource
+[remote resource]: /getting-started/glossary/#remote-resource
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.Overlay $overlay 20 20 }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Overlay"
+ filterArgs="images/logos/logo-64x64.png,20,20"
+ example=true
+>}}
diff --git a/content/en/functions/images/Padding.md b/content/en/functions/images/Padding.md
new file mode 100644
index 000000000..1362bc78e
--- /dev/null
+++ b/content/en/functions/images/Padding.md
@@ -0,0 +1,73 @@
+---
+title: images.Padding
+description: Returns an image filter that resizes the image canvas without resizing the image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: ['images.Padding V1 [V2] [V3] [V4] [COLOR]']
+toc: true
+---
+
+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
+[shorthand property]: https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties#edges_of_a_box
+
+## Usage
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.Padding 20 40 "#976941" }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+Combine with the [`Colors`] method to create a border with one of the image's most dominant colors:
+
+[`Colors`]: /methods/resource/colors
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ $filter := images.Padding 20 40 (index .Colors 2) }}
+ {{ with . | images.Filter $filter }}
+
+ {{ end }}
+{{ end }}
+```
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Padding"
+ filterArgs="20,40,20,40,#976941"
+ example=true
+>}}
+
+## Other recipes
+
+This example resizes an image to 300px wide, converts it to the WebP format, adds 20px vertical padding and 50px horizontal padding, then sets the canvas color to dark green with 33% opacity.
+
+Conversion to WebP is required to support transparency. PNG and WebP images have an alpha channel; JPEG and GIF do not.
+
+```go-html-template
+{{ $img := resources.Get "images/a.jpg" }}
+{{ $filters := slice
+ (images.Process "resize 300x webp")
+ (images.Padding 20 50 "#0705")
+}}
+{{ $img = $img.Filter $filters }}
+```
+
+To add a 2px gray border to an image:
+
+```go-html-template
+{{ $img = $img.Filter (images.Padding 2 "#777") }}
+```
diff --git a/content/en/functions/images/Pixelate.md b/content/en/functions/images/Pixelate.md
new file mode 100644
index 000000000..2016877ed
--- /dev/null
+++ b/content/en/functions/images/Pixelate.md
@@ -0,0 +1,34 @@
+---
+title: images.Pixelate
+description: Returns an image filter that applies a pixelation effect to an image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.Pixelate SIZE]
+toc: true
+---
+
+## Usage
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.Pixelate 4 }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Pixelate"
+ filterArgs="4"
+ example=true
+>}}
diff --git a/content/en/functions/images/Process.md b/content/en/functions/images/Process.md
new file mode 100644
index 000000000..f3cf494be
--- /dev/null
+++ b/content/en/functions/images/Process.md
@@ -0,0 +1,110 @@
+---
+title: images.Process
+description: Returns an image filter that processes the given image using the given specification.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ - methods/resource/Process
+ returnType: images.filter
+ signatures: [images.Process SPEC]
+toc: true
+---
+
+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
+
+The process specification is a space-delimited, case-insensitive list of one or more of the following in any sequence:
+
+action
+: Specify zero or one of `resize`, `fit`, `fill`, or `crop`. If you specify an action you must also provide dimensions. See [details](content-management/image-processing/#image-processing-methods).
+
+```go-html-template
+{{ $filter := images.Process "resize 300x" }}
+```
+
+dimensions
+: Required if you specify an action. Provide width _or_ height when using `resize`, else provide both width _and_ height. See [details](/content-management/image-processing/#dimensions).
+
+```go-html-template
+{{ $filter := images.Process "crop 200x200" }}
+```
+
+anchor
+: Use with the `crop` or `fill` action. Specify zero or one of `TopLeft`, `Top`, `TopRight`, `Left`, `Center`, `Right`, `BottomLeft`, `Bottom`, `BottomRight`, or `Smart`. Default is `Smart`. See [details](/content-management/image-processing/#anchor).
+
+```go-html-template
+{{ $filter := images.Process "crop 200x200 center" }}
+```
+
+rotation
+: Typically specify zero or one of `r90`, `r180`, or `r270`. Also supports arbitrary rotation angles. See [details](/content-management/image-processing/#rotation).
+
+```go-html-template
+{{ $filter := images.Process "r90" }}
+{{ $filter := images.Process "crop 200x200 center r90" }}
+```
+
+target format
+: Specify zero or one of `gif`, `jpeg`, `png`, `tiff`, or `webp`. See [details](/content-management/image-processing/#target-format).
+
+```go-html-template
+{{ $filter := images.Process "webp" }}
+{{ $filter := images.Process "crop 200x200 center r90 webp" }}
+```
+
+quality
+: Applicable to JPEG and WebP images. Optionally specify `qN` where `N` is an integer in the range [0, 100]. Default is `75`. See [details](/content-management/image-processing/#quality).
+
+```go-html-template
+{{ $filter := images.Process "q50" }}
+{{ $filter := images.Process "crop 200x200 center r90 webp q50" }}
+```
+
+hint
+: Applicable to WebP images. Specify zero or one of `drawing`, `icon`, `photo`, `picture`, or `text`. Default is `photo`. See [details](/content-management/image-processing/#hint).
+
+```go-html-template
+{{ $filter := images.Process "webp" "icon" }}
+{{ $filter := images.Process "crop 200x200 center r90 webp q50 icon" }}
+```
+
+background color
+: When converting a PNG or WebP with transparency to a format that does not support transparency, optionally specify a background color using a 3-digit or a 6-digit hexadecimal color code. Default is `#ffffff` (white). See [details](/content-management/image-processing/#background-color).
+
+```go-html-template
+{{ $filter := images.Process "jpeg #000" }}
+{{ $filter := images.Process "crop 200x200 center r90 q50 jpeg #000" }}
+```
+
+resampling filter
+: Typically specify zero or one of `Box`, `Lanczos`, `CatmullRom`, `MitchellNetravali`, `Linear`, or `NearestNeighbor`. Other resampling filters are available. See [details](/content-management/image-processing/#resampling-filter).
+
+```go-html-template
+{{ $filter := images.Process "resize 300x lanczos" }}
+{{ $filter := images.Process "resize 300x r90 q50 jpeg #000 lanczos" }}
+```
+
+## Usage
+
+Create a filter:
+
+```go-html-template
+{{ $filter := images.Process "resize 256x q40 webp" }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Process"
+ filterArgs="resize 256x q40 webp"
+ example=true
+>}}
diff --git a/content/en/functions/images/Saturation.md b/content/en/functions/images/Saturation.md
new file mode 100644
index 000000000..118bd0213
--- /dev/null
+++ b/content/en/functions/images/Saturation.md
@@ -0,0 +1,36 @@
+---
+title: images.Saturation
+description: Returns an image filter that changes the saturation of an image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.Saturation PERCENTAGE]
+toc: true
+---
+
+The percentage must be in the range [-100, 500] where 0 has no effect.
+
+## Usage
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.Saturation 65 }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Saturation"
+ filterArgs="65"
+ example=true
+>}}
diff --git a/content/en/functions/images/Sepia.md b/content/en/functions/images/Sepia.md
new file mode 100644
index 000000000..9f0b7adfb
--- /dev/null
+++ b/content/en/functions/images/Sepia.md
@@ -0,0 +1,36 @@
+---
+title: images.Sepia
+description: Returns an image filter that produces a sepia-toned version of an image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.Sepia PERCENTAGE]
+toc: true
+---
+
+The percentage must be in the range [0, 100] where 0 has no effect.
+
+## Usage
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.Sepia 75 }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Sepia"
+ filterArgs="75"
+ example=true
+>}}
diff --git a/content/en/functions/images/Sigmoid.md b/content/en/functions/images/Sigmoid.md
new file mode 100644
index 000000000..32765f923
--- /dev/null
+++ b/content/en/functions/images/Sigmoid.md
@@ -0,0 +1,40 @@
+---
+title: images.Sigmoid
+description: Returns an image filter that changes the contrast of an image using a sigmoidal function.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.Sigmoid MIDPOINT FACTOR]
+toc: true
+---
+
+This is a non-linear contrast change useful for photo adjustments; it preserves highlight and shadow detail.
+
+The midpoint is the midpoint of contrast. It must be in the range [0, 1], typically 0.5.
+
+The factor indicates how much to increase or decrease the contrast, typically in the range [-10, 10] where 0 has no effect. A positive value increases contrast, while a negative value decrease contrast.
+
+## Usage
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.Sigmoid 0.6 -4 }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Sigmoid"
+ filterArgs="0.6,-4"
+ example=true
+>}}
diff --git a/content/en/functions/images/Text.md b/content/en/functions/images/Text.md
new file mode 100644
index 000000000..0c1e74bce
--- /dev/null
+++ b/content/en/functions/images/Text.md
@@ -0,0 +1,95 @@
+---
+title: images.Text
+description: Returns an image filter that adds text to an image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: ['images.Text TEXT [OPTIONS]']
+toc: true
+---
+
+## Options
+
+Although none of the options are required, at a minimum you will want to set the `size` to be some reasonable percentage of the image height.
+
+color
+: (`string`) The font color, either a 3-digit or 6-digit hexadecimal color code. Default is `#ffffff` (white).
+
+font
+: (`resource.Resource`) The font can be a [global resource], a [page resource], or a [remote resource]. Default is the "Go Regular" TrueType font.
+
+linespacing
+: (`int`) The number of pixels between each line. For a line height of 1.4, set the `linespacing` to 0.4 multiplied by the `size`. Default is `2`.
+
+size
+: (`int`) The font size in pixels. Default is `20`.
+
+x
+: (`int`) The horizontal offset, in pixels, relative to the left of the image. Default is `10`.
+
+y
+: (`int`) The vertical offset, in pixels, relative to the top of the image. Default is `10`.
+
+[global resource]: /getting-started/glossary/#global-resource
+[page resource]: /getting-started/glossary/#page-resource
+[remote resource]: /getting-started/glossary/#remote-resource
+
+## Usage
+
+Capture the font as a resource:
+
+```go-html-template
+{{ $font := "" }}
+{{ $path := "https://github.com/google/fonts/raw/main/apache/roboto/static/Roboto-Regular.ttf" }}
+{{ with resources.GetRemote $path }}
+ {{ with .Err }}
+ {{ errorf "%s" . }}
+ {{ else }}
+ {{ $font = . }}
+ {{ end }}
+{{ else }}
+ {{ errorf "Unable to get resource %q" $path }}
+{{ end }}
+```
+
+Create the options map:
+
+```go-html-template
+{{ $opts := dict
+ "color" "#fbfaf5"
+ "font" $font
+ "linespacing" 8
+ "size" 40
+ "x" 25
+ "y" 190
+}}
+```
+
+Set the text:
+
+```go-html-template
+{{ $text := "Zion National Park" }}
+```
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.Text $text $opts }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Text"
+ filterArgs="Zion National Park,25,190,40,1.2,#fbfaf5"
+ example=true
+>}}
diff --git a/content/en/functions/images/UnsharpMask.md b/content/en/functions/images/UnsharpMask.md
new file mode 100644
index 000000000..57a74a54a
--- /dev/null
+++ b/content/en/functions/images/UnsharpMask.md
@@ -0,0 +1,40 @@
+---
+title: images.UnsharpMask
+description: Returns an image filter that sharpens an image.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/images/Filter
+ - methods/resource/Filter
+ returnType: images.filter
+ signatures: [images.UnsharpMask SIGMA AMOUNT THRESHOLD]
+toc: true
+---
+
+The sigma parameter is used in a gaussian function and affects the radius of effect. Sigma must be positive. The sharpen radius is approximately 3 times the sigma value.
+
+The amount parameter controls how much darker and how much lighter the edge borders become. Typically between 0.5 and 1.5.
+
+The threshold parameter controls the minimum brightness change that will be sharpened. Typically between 0 and 0.05.
+
+## Usage
+
+Create the filter:
+
+```go-html-template
+{{ $filter := images.UnsharpMask 10 0.4 0.03 }}
+```
+
+{{% include "functions/images/_common/apply-image-filter.md" %}}
+
+## Example
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="UnsharpMask"
+ filterArgs="10,0.4,0.03"
+ example=true
+>}}
diff --git a/content/en/functions/images/_common/_index.md b/content/en/functions/images/_common/_index.md
new file mode 100644
index 000000000..47d5812fb
--- /dev/null
+++ b/content/en/functions/images/_common/_index.md
@@ -0,0 +1,13 @@
+---
+cascade:
+ _build:
+ list: never
+ publishResources: false
+ render: never
+---
+
+
diff --git a/content/en/functions/images/_common/apply-image-filter.md b/content/en/functions/images/_common/apply-image-filter.md
new file mode 100644
index 000000000..acd3a733d
--- /dev/null
+++ b/content/en/functions/images/_common/apply-image-filter.md
@@ -0,0 +1,27 @@
+---
+# Do not remove front matter.
+---
+
+Apply the filter using the [`images.Filter`] function:
+
+[`images.Filter`]: /functions/images/filter
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with . | images.Filter $filter }}
+
+ {{ end }}
+{{ end }}
+```
+
+You can also apply the filter using the [`Filter`] method on a `Resource` object:
+
+[`Filter`]: methods/resource/filter
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with .Filter $filter }}
+
+ {{ end }}
+{{ end }}
+```
diff --git a/content/en/functions/images/_index.md b/content/en/functions/images/_index.md
new file mode 100644
index 000000000..13542ea73
--- /dev/null
+++ b/content/en/functions/images/_index.md
@@ -0,0 +1,12 @@
+---
+title: Image functions
+linkTitle: images
+description: Use these functions to create an image filter, apply an image filter to an image, and to retrieve image information.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: functions
+---
+
+Use these functions to create an image filter, apply an image filter to an image, and to retrieve image information.
diff --git a/content/en/functions/images/index.md b/content/en/functions/images/index.md
deleted file mode 100644
index a1351f190..000000000
--- a/content/en/functions/images/index.md
+++ /dev/null
@@ -1,302 +0,0 @@
----
-title: Image filters
-description: The images namespace provides a list of filters and other image related functions.
-categories: [functions]
-keywords: []
-aliases: [/functions/imageconfig/]
-menu:
- docs:
- parent: functions
-keywords: [images]
-toc: true
----
-
-See [images.Filter](#filter) for how to apply these filters to an image.
-
-## Process
-
-{{< new-in "0.119.0" >}}
-
-{{< funcsig >}}
-images.Process SRC SPEC
-{{< /funcsig >}}
-
-A general purpose image processing function.
-
-This filter has all the same options as the [Process](/content-management/image-processing/#process) method, but using it as a filter may be more effective if you need to apply multiple filters to an image:
-
-```go-html-template
-{{ $filters := slice
- images.Grayscale
- (images.GaussianBlur 8)
- (images.Process "resize 200x jpg q30")
-}}
-{{ $img = $img | images.Filter $filters }}
-```
-
-## Overlay
-
-{{< funcsig >}}
-images.Overlay SRC X Y
-{{< /funcsig >}}
-
-Overlay creates a filter that overlays the source image at position x y, e.g:
-
-
-```go-html-template
-{{ $logoFilter := (images.Overlay $logo 50 50 ) }}
-{{ $img := $img | images.Filter $logoFilter }}
-```
-
-A shorter version of the above, if you only need to apply the filter once:
-
-```go-html-template
-{{ $img := $img.Filter (images.Overlay $logo 50 50 )}}
-```
-
-The above will overlay `$logo` in the upper left corner of `$img` (at position `x=50, y=50`).
-
-## Opacity
-
-{{< new-in "0.119.0" >}}
-
-{{< funcsig >}}
-images.Opacity SRC OPACITY
-{{< /funcsig >}}
-
-Opacity creates a filter that changes the opacity of an image.
-The OPACITY parameter must be in range (0, 1).
-
-```go-html-template
-{{ $img := $img.Filter (images.Opacity 0.5 )}}
-```
-
-This filter is most useful for target formats that support transparency, e.g. PNG. If the source image is e.g. JPG, the most effective way would be to combine it with the [`Process`] filter:
-
-```go-html-template
-{{ $png := $jpg.Filter
- (images.Opacity 0.5)
- (images.Process "png")
-}}
-```
-
-## Text
-
-Using the `Text` filter, you can add text to an image.
-
-{{< funcsig >}}
-images.Text TEXT MAP)
-{{< /funcsig >}}
-
-The following example will add the text `Hugo rocks!` to the image with the specified color, size and position.
-
-```go-html-template
-{{ $img := resources.Get "/images/background.png" }}
-{{ $img = $img.Filter (images.Text "Hugo rocks!" (dict
- "color" "#ffffff"
- "size" 60
- "linespacing" 2
- "x" 10
- "y" 20
-))}}
-```
-
-You can load a custom font if needed. Load the font as a Hugo `Resource` and set it as an option:
-
-```go-html-template
-{{ $font := resources.GetRemote "https://github.com/google/fonts/raw/main/apache/roboto/static/Roboto-Black.ttf" }}
-{{ $img := resources.Get "/images/background.png" }}
-{{ $img = $img.Filter (images.Text "Hugo rocks!" (dict
- "font" $font
-))}}
-```
-
-## Padding
-
-{{< new-in "0.120.0" >}}
-
-Padding creates a filter that resizes the image canvas without resizing the image. 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
-[shorthand property]: https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties#edges_of_a_box
-
-{{% funcsig %}}
-images.Padding V1 [V2] [V3] [V4] [COLOR]
-{{% /funcsig %}}
-
-This example resizes the image to 300px wide, converts it to the WebP format, adds 20px vertical padding and 50px horizontal padding, then sets the canvas color to dark green with 33% opacity.
-
-```go-html-template
-{{ $img := resources.Get "images/a.jpg" }}
-{{ $filters := slice
- (images.Process "resize 300x webp")
- (images.Padding 20 50 "#0705")
-}}
-{{ $img = $img.Filter $filters }}
-```
-
-To add a 2px gray border to an image:
-
-```go-html-template
-{{ $img = $img.Filter (images.Padding 2 "#777") }}
-```
-
-## Brightness
-
-{{< funcsig >}}
-images.Brightness PERCENTAGE
-{{< /funcsig >}}
-
-Brightness creates a filter that changes the brightness of an image.
-The percentage parameter must be in range (-100, 100).
-
-### ColorBalance
-
-{{< funcsig >}}
-images.ColorBalance PERCENTAGERED PERCENTAGEGREEN PERCENTAGEBLUE
-{{< /funcsig >}}
-
-ColorBalance creates a filter that changes the color balance of an image.
-The percentage parameters for each color channel (red, green, blue) must be in range (-100, 500).
-
-## Colorize
-
-{{< funcsig >}}
-images.Colorize HUE SATURATION PERCENTAGE
-{{< /funcsig >}}
-
-Colorize creates a filter that produces a colorized version of an image.
-The hue parameter is the angle on the color wheel, typically in range (0, 360).
-The saturation parameter must be in range (0, 100).
-The percentage parameter specifies the strength of the effect, it must be in range (0, 100).
-
-## Contrast
-
-{{< funcsig >}}
-images.Contrast PERCENTAGE
-{{< /funcsig >}}
-
-Contrast creates a filter that changes the contrast of an image.
-The percentage parameter must be in range (-100, 100).
-
-## Gamma
-
-{{< funcsig >}}
-images.Gamma GAMMA
-{{< /funcsig >}}
-
-Gamma creates a filter that performs a gamma correction on an image.
-The gamma parameter must be positive. Gamma = 1 gives the original image.
-Gamma less than 1 darkens the image and gamma greater than 1 lightens it.
-
-## GaussianBlur
-
-{{< funcsig >}}
-images.GaussianBlur SIGMA
-{{< /funcsig >}}
-
-GaussianBlur creates a filter that applies a gaussian blur to an image.
-
-## Grayscale
-
-{{< funcsig >}}
-images.Grayscale
-{{< /funcsig >}}
-
-Grayscale creates a filter that produces a grayscale version of an image.
-
-## Hue
-
-{{< funcsig >}}
-images.Hue SHIFT
-{{< /funcsig >}}
-
-Hue creates a filter that rotates the hue of an image.
-The hue angle shift is typically in range -180 to 180.
-
-## Invert
-
-{{< funcsig >}}
-images.Invert
-{{< /funcsig >}}
-
-Invert creates a filter that negates the colors of an image.
-
-## Pixelate
-
-{{< funcsig >}}
-images.Pixelate SIZE
-{{< /funcsig >}}
-
-Pixelate creates a filter that applies a pixelation effect to an image.
-
-## Saturation
-
-{{< funcsig >}}
-images.Saturation PERCENTAGE
-{{< /funcsig >}}
-
-Saturation creates a filter that changes the saturation of an image.
-
-## Sepia
-
-{{< funcsig >}}
-images.Sepia PERCENTAGE
-{{< /funcsig >}}
-
-Sepia creates a filter that produces a sepia-toned version of an image.
-
-## Sigmoid
-
-{{< funcsig >}}
-images.Sigmoid MIDPOINT FACTOR
-{{< /funcsig >}}
-
-Sigmoid creates a filter that changes the contrast of an image using a sigmoidal function and returns the adjusted image.
-It's a non-linear contrast change useful for photo adjustments as it preserves highlight and shadow detail.
-
-## UnsharpMask
-
-{{< funcsig >}}
-images.UnsharpMask SIGMA AMOUNT THRESHOLD
-{{< /funcsig >}}
-
-UnsharpMask creates a filter that sharpens an image.
-The sigma parameter is used in a gaussian function and affects the radius of effect.
-Sigma must be positive. Sharpen radius roughly equals 3 * sigma.
-The amount parameter controls how much darker and how much lighter the edge borders become. Typically between 0.5 and 1.5.
-The threshold parameter controls the minimum brightness change that will be sharpened. Typically between 0 and 0.05.
-
-## Other Functions
-
-### Filter
-
-{{< funcsig >}}
-IMAGE | images.Filter FILTERS...
-{{< /funcsig >}}
-
-Can be used to apply a set of filters to an image:
-
-```go-html-template
-{{ $img := $img | images.Filter (images.GaussianBlur 6) (images.Pixelate 8) }}
-```
-
-Also see the [Filter Method](/content-management/image-processing/#filter).
-
-### ImageConfig
-
-Parses the image and returns the height, width, and color model.
-
-The `imageConfig` function takes a single parameter, a file path (_string_) relative to the _project's root directory_, with or without a leading slash.
-
-{{< funcsig >}}
-images.ImageConfig PATH
-{{< /funcsig >}}
-
-```go-html-template
-{{ with (imageConfig "favicon.ico") }}
-favicon.ico: {{ .Width }} x {{ .Height }}
-{{ end }}
-```
-
-[`Process`]: #process
diff --git a/content/en/functions/inflect/Humanize.md b/content/en/functions/inflect/Humanize.md
index 74d24f310..41d61a4e5 100644
--- a/content/en/functions/inflect/Humanize.md
+++ b/content/en/functions/inflect/Humanize.md
@@ -1,29 +1,26 @@
---
title: inflect.Humanize
-linkTitle: humanize
-description: Returns the humanized version of an argument with the first letter capitalized.
-categories: [functions]
+description: Returns the humanized version of the input with the first letter capitalized.
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [humanize]
+ related:
+ - functions/inflect/Pluralize
+ - functions/inflect/Singularize
returnType: string
signatures: [inflect.Humanize INPUT]
-relatedFunctions:
- - inflect.Humanize
- - inflect.Pluralize
- - inflect.Singularize
aliases: [/functions/humanize]
---
+```go-html-template
+{{ humanize "my-first-post" }} → My first post
+{{ humanize "myCamelPost" }} → My camel post
+```
+
If the input is either an int64 value or the string representation of an integer, humanize returns the number with the proper ordinal appended.
-
```go-html-template
-{{ humanize "my-first-post" }} → "My first post"
-{{ humanize "myCamelPost" }} → "My camel post"
-{{ humanize "52" }} → "52nd"
-{{ humanize 103 }} → "103rd"
+{{ humanize "52" }} → 52nd
+{{ humanize 103 }} → 103rd
```
diff --git a/content/en/functions/inflect/Pluralize.md b/content/en/functions/inflect/Pluralize.md
index 5bb444114..c25f89617 100644
--- a/content/en/functions/inflect/Pluralize.md
+++ b/content/en/functions/inflect/Pluralize.md
@@ -1,23 +1,18 @@
---
title: inflect.Pluralize
-linkTitle: pluralize
-description: Pluralizes the given word according to a set of common English pluralization rules
-categories: [functions]
+description: Pluralizes the given word according to a set of common English pluralization rules.
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [pluralize]
+ related:
+ - functions/inflect/Humanize
+ - functions/inflect/Singularize
returnType: string
signatures: [inflect.Pluralize INPUT]
-relatedFunctions:
- - inflect.Humanize
- - inflect.Pluralize
- - inflect.Singularize
aliases: [/functions/pluralize]
---
```go-html-template
-{{ "cat" | pluralize }} → "cats"
+{{ "cat" | pluralize }} → cats
```
diff --git a/content/en/functions/inflect/Singularize.md b/content/en/functions/inflect/Singularize.md
index 5aba4e4ee..29b543257 100644
--- a/content/en/functions/inflect/Singularize.md
+++ b/content/en/functions/inflect/Singularize.md
@@ -1,25 +1,20 @@
---
title: inflect.Singularize
-linkTitle: singularize
-description: Converts a word according to a set of common English singularization rules.
-categories: [functions]
+description: Singularizes the given word according to a set of common English singularization rules.
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [singularize]
+ related:
+ - functions/inflect/Humanize
+ - functions/inflect/Pluralize
returnType: string
signatures: [inflect.Singularize INPUT]
-relatedFunctions:
- - inflect.Humanize
- - inflect.Pluralize
- - inflect.Singularize
aliases: [/functions/singularize]
---
```go-html-template
-{{ "cats" | singularize }} → "cat"
+{{ "cats" | singularize }} → cat
```
See also the `.Data.Singular` [taxonomy variable](/variables/taxonomy/) for singularizing taxonomy names.
diff --git a/content/en/functions/inflect/_index.md b/content/en/functions/inflect/_index.md
new file mode 100644
index 000000000..601b409e6
--- /dev/null
+++ b/content/en/functions/inflect/_index.md
@@ -0,0 +1,12 @@
+---
+title: Inflect functions
+linkTitle: inflect
+description: Template functions to inflect English nouns.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: functions
+---
+
+These functions provide word inflection features such as singularization and pluralization of English nouns.
diff --git a/content/en/functions/js/Build.md b/content/en/functions/js/Build.md
new file mode 100644
index 000000000..e3b40a2ac
--- /dev/null
+++ b/content/en/functions/js/Build.md
@@ -0,0 +1,182 @@
+---
+title: js.Build
+description: Bundles, transpiles, tree shakes, and minifies JavaScript resources.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/resources/Babel
+ - functions/resources/Fingerprint
+ - functions/resources/Minify
+ returnType: resource.Resource
+ signatures: ['js.Build [OPTIONS] RESOURCE']
+toc: true
+---
+
+The `js.Build` function uses the [evanw/esbuild] package to:
+
+- Bundle
+- Transpile (TypeScript and JSX)
+- Tree shake
+- Minify
+- Create source maps
+
+[evanw/esbuild]: https://github.com/evanw/esbuild
+
+```go-html-template
+{{ with resources.Get "js/main.js" }}
+ {{ if hugo.IsDevelopment }}
+ {{ with . | js.Build }}
+
+ {{ end }}
+ {{ else }}
+ {{ $opts := dict "minify" true }}
+ {{ with . | js.Build $opts | fingerprint }}
+
+ {{ end }}
+ {{ end }}
+{{ end }}
+```
+
+## Options
+
+targetPath
+: (`string`) If not set, the source path will be used as the base target path.
+Note that the target path's extension may change if the target MIME type is different, e.g. when the source is TypeScript.
+
+params [map or slice]
+: (`map` or `slice`) Params that can be imported as JSON in your JS files, e.g.
+
+```go-html-template
+{{ $js := resources.Get "js/main.js" | js.Build (dict "params" (dict "api" "https://example.org/api")) }}
+```
+And then in your JS file:
+
+```js
+import * as params from '@params';
+```
+
+Note that this is meant for small data sets, e.g. configuration settings. For larger data, please put/mount the files into `/assets` and import them directly.
+
+minify
+: (`bool`)Let `js.Build` handle the minification.
+
+inject
+: (`slice`) This option allows you to automatically replace a global variable with an import from another file. The path names must be relative to `assets`. See https://esbuild.github.io/api/#inject
+
+shims
+: (`map`) This option allows swapping out a component with another. A common use case is to load dependencies like React from a CDN (with _shims_) when in production, but running with the full bundled `node_modules` dependency during development:
+
+```go-html-template
+{{ $shims := dict "react" "js/shims/react.js" "react-dom" "js/shims/react-dom.js" }}
+{{ $js = $js | js.Build dict "shims" $shims }}
+```
+
+The _shim_ files may look like these:
+
+```js
+// js/shims/react.js
+module.exports = window.React;
+```
+
+```js
+// js/shims/react-dom.js
+module.exports = window.ReactDOM;
+```
+
+With the above, these imports should work in both scenarios:
+
+```js
+import * as React from 'react'
+import * as ReactDOM from 'react-dom';
+```
+
+target
+: (`string`) The language target. One of: `es5`, `es2015`, `es2016`, `es2017`, `es2018`, `es2019`, `es2020` or `esnext`. Default is `esnext`.
+
+externals
+: (`slice`) External dependencies. Use this to trim dependencies you know will never be executed. See https://esbuild.github.io/api/#external
+
+defines
+: (`map`) Allow to define a set of string replacement to be performed when building. Should be a map where each key is to be replaced by its value.
+
+```go-html-template
+{{ $defines := dict "process.env.NODE_ENV" `"development"` }}
+```
+
+format
+: (`string`) The output format. One of: `iife`, `cjs`, `esm`. Default is `iife`, a self-executing function, suitable for inclusion as a `
+```
diff --git a/content/en/functions/js/_index.md b/content/en/functions/js/_index.md
new file mode 100644
index 000000000..3356e7c7b
--- /dev/null
+++ b/content/en/functions/js/_index.md
@@ -0,0 +1,12 @@
+---
+title: JavaScript functions
+linkTitle: js
+description: Template functions to work with JavaScript and TypeScript files.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: functions
+---
+
+Use these functions to work with JavaScript and TypeScript files.
diff --git a/content/en/functions/lang/FormatAccounting.md b/content/en/functions/lang/FormatAccounting.md
index 974dc4a1a..70365c216 100644
--- a/content/en/functions/lang/FormatAccounting.md
+++ b/content/en/functions/lang/FormatAccounting.md
@@ -1,27 +1,21 @@
---
title: lang.FormatAccounting
-description: Returns a currency representation of a number for the given currency and precision for the current language in accounting notation.
-categories: [functions]
+description: Returns a currency representation of a number for the given currency and precision for the current language and region in accounting notation.
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
+ related:
+ - functions/lang/FormatCurrency
+ - functions/lang/FormatNumber
+ - functions/lang/FormatNumberCustom
+ - functions/lang/FormatPercent
returnType: string
signatures: [lang.FormatAccounting PRECISION CURRENCY NUMBER]
-relatedFunctions:
- - lang.FormatAccounting
- - lang.FormatCurrency
- - lang.FormatNumber
- - lang.FormatNumberCustom
- - lang.FormatPercent
---
```go-html-template
{{ 512.5032 | lang.FormatAccounting 2 "NOK" }} → NOK512.50
```
-{{% note %}}
-{{% readfile file="/functions/_common/locales.md" %}}
-{{% /note %}}
+{{% include "functions/_common/locales.md" %}}
diff --git a/content/en/functions/lang/FormatCurrency.md b/content/en/functions/lang/FormatCurrency.md
index b29a807fe..91148c595 100644
--- a/content/en/functions/lang/FormatCurrency.md
+++ b/content/en/functions/lang/FormatCurrency.md
@@ -1,27 +1,21 @@
---
title: lang.FormatCurrency
-description: Returns a currency representation of a number for the given currency and precision for the current language.
-categories: [functions]
+description: Returns a currency representation of a number for the given currency and precision for the current language and region.
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
+ related:
+ - functions/lang/FormatAccounting
+ - functions/lang/FormatNumber
+ - functions/lang/FormatNumberCustom
+ - functions/lang/FormatPercent
returnType: string
signatures: [lang.FormatAccounting PRECISION CURRENCY NUMBER]
-relatedFunctions:
- - lang.FormatAccounting
- - lang.FormatCurrency
- - lang.FormatNumber
- - lang.FormatNumberCustom
- - lang.FormatPercent
---
```go-html-template
{{ 512.5032 | lang.FormatCurrency 2 "USD" }} → $512.50
```
-{{% note %}}
-{{% readfile file="/functions/_common/locales.md" %}}
-{{% /note %}}
+{{% include "functions/_common/locales.md" %}}
diff --git a/content/en/functions/lang/FormatNumber.md b/content/en/functions/lang/FormatNumber.md
index dd878fdef..597df742a 100644
--- a/content/en/functions/lang/FormatNumber.md
+++ b/content/en/functions/lang/FormatNumber.md
@@ -1,27 +1,21 @@
---
title: lang.FormatNumber
-description: Returns a numeric representation of a number with the given precision for the current language.
-categories: [functions]
+description: Returns a numeric representation of a number with the given precision for the current language and region.
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
+ related:
+ - functions/lang/FormatAccounting
+ - functions/lang/FormatCurrency
+ - functions/lang/FormatNumberCustom
+ - functions/lang/FormatPercent
returnType: string
signatures: [lang.FormatNumber PRECISION NUMBER]
-relatedFunctions:
- - lang.FormatAccounting
- - lang.FormatCurrency
- - lang.FormatNumber
- - lang.FormatNumberCustom
- - lang.FormatPercent
---
```go-html-template
{{ 512.5032 | lang.FormatNumber 2 }} → 512.50
```
-{{% note %}}
-{{% readfile file="/functions/_common/locales.md" %}}
-{{% /note %}}
+{{% include "functions/_common/locales.md" %}}
diff --git a/content/en/functions/lang/FormatNumberCustom.md b/content/en/functions/lang/FormatNumberCustom.md
index 97b022567..0b72f4983 100644
--- a/content/en/functions/lang/FormatNumberCustom.md
+++ b/content/en/functions/lang/FormatNumberCustom.md
@@ -1,31 +1,26 @@
---
title: lang.FormatNumberCustom
description: Returns a numeric representation of a number with the given precision using negative, decimal, and grouping options.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
+ related:
+ - functions/lang/FormatAccounting
+ - functions/lang/FormatCurrency
+ - functions/lang/FormatNumber
+ - functions/lang/FormatPercent
returnType: string
signatures: ['lang.FormatNumberCustom PRECISION NUMBER [OPTIONS...]']
-relatedFunctions:
- - lang.FormatAccounting
- - lang.FormatCurrency
- - lang.FormatNumber
- - lang.FormatNumberCustom
- - lang.FormatPercent
aliases: ['/functions/numfmt/']
---
This function formats a number with the given precision. The first options parameter is a space-delimited string of characters to represent negativity, the decimal point, and grouping. The default value is `- . ,`. The second options parameter defines an alternate delimiting character.
-Note that numbers are rounded up at 5 or greater. So, with precision set to 0, 1.5 becomes 2, and 1.4 becomes 1.
+Note that numbers are rounded up at 5 or greater. So, with precision set to 0, 1.5 becomes 2, and 1.4 becomes 1.
For a simpler function that adapts to the current language, see [`lang.FormatNumber`].
-
```go-html-template
{{ lang.FormatNumberCustom 2 12345.6789 }} → 12,345.68
{{ lang.FormatNumberCustom 2 12345.6789 "- , ." }} → 12.345,68
@@ -34,8 +29,6 @@ For a simpler function that adapts to the current language, see [`lang.FormatNum
{{ lang.FormatNumberCustom 0 -12345.6789 "-|.| " "|" }} → -12 346
```
-{{% note %}}
-{{% readfile file="/functions/_common/locales.md" %}}
-{{% /note %}}
+{{% include "functions/_common/locales.md" %}}
[`lang.FormatNumber`]: /functions/lang/formatnumber
diff --git a/content/en/functions/lang/FormatPercent.md b/content/en/functions/lang/FormatPercent.md
index dd2042490..529ada67b 100644
--- a/content/en/functions/lang/FormatPercent.md
+++ b/content/en/functions/lang/FormatPercent.md
@@ -1,27 +1,21 @@
---
title: lang.FormatPercent
-description: Returns a percentage representation of a number with the given precision for the current language.
-categories: [functions]
+description: Returns a percentage representation of a number with the given precision for the current language and region.
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
+ related:
+ - functions/lang/FormatAccounting
+ - functions/lang/FormatCurrency
+ - functions/lang/FormatNumber
+ - functions/lang/FormatNumberCustom
returnType: string
signatures: [lang.FormatPercent PRECISION NUMBER]
-relatedFunctions:
- - lang.FormatAccounting
- - lang.FormatCurrency
- - lang.FormatNumber
- - lang.FormatNumberCustom
- - lang.FormatPercent
---
```go-html-template
{{ 512.5032 | lang.FormatPercent 2 }} → 512.50%
```
-{{% note %}}
-{{% readfile file="/functions/_common/locales.md" %}}
-{{% /note %}}
+{{% include "functions/_common/locales.md" %}}
diff --git a/content/en/functions/lang/Merge.md b/content/en/functions/lang/Merge.md
index b3d21cd7a..75f5cdf01 100644
--- a/content/en/functions/lang/Merge.md
+++ b/content/en/functions/lang/Merge.md
@@ -1,31 +1,27 @@
---
title: lang.Merge
description: Merge missing translations from other languages.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
+ related: []
returnType: any
signatures: [lang.Merge FROM TO]
-relatedFunctions: []
aliases: [/functions/lang.merge]
---
As an example:
-```bash
+```sh
{{ $pages := .Site.RegularPages | lang.Merge $frSite.RegularPages | lang.Merge $enSite.RegularPages }}
```
Will "fill in the gaps" in the current site with, from left to right, content from the French site, and lastly the English.
-
A more practical example is to fill in the missing translations from the other languages:
-```bash
+```sh
{{ $pages := .Site.RegularPages }}
{{ range .Site.Home.Translations }}
{{ $pages = $pages | lang.Merge .Site.RegularPages }}
diff --git a/content/en/functions/lang/Translate.md b/content/en/functions/lang/Translate.md
index 718d8cfb2..630098a96 100644
--- a/content/en/functions/lang/Translate.md
+++ b/content/en/functions/lang/Translate.md
@@ -1,23 +1,19 @@
---
title: lang.Translate
-linkTitle: i18n
description: Translates a string using the translation tables in the i18n directory.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
- aliases: [i18n,T]
+action:
+ aliases: [T, i18n]
+ related: []
returnType: string
signatures: ['lang.Translate KEY [CONTEXT]']
-relatedFunctions: []
aliases: [/functions/i18n]
---
Let's say your multilingual site supports two languages, English and Polish. Create a translation table for each language in the `i18n` directory.
-```
+```text
i18n/
├── en.toml
└── pl.toml
@@ -34,12 +30,10 @@ The Unicode [CLDR Plural Rules chart] describes the pluralization categories for
The English translation table:
-{{< code-toggle file=i18n/en copy=false >}}
-# simple translations
+{{< code-toggle file=i18n/en >}}
privacy = 'privacy'
security = 'security'
-# translations with pluralization
[day]
one = 'day'
other = 'days'
@@ -51,12 +45,10 @@ other = '{{ . }} days'
The Polish translation table:
-{{< code-toggle file=i18n/pl copy=false >}}
-# simple translations
+{{< code-toggle file=i18n/pl >}}
privacy = 'prywatność'
security = 'bezpieczeństwo'
-# translations with pluralization
[day]
one = 'miesiąc'
few = 'miesiące'
@@ -108,17 +100,17 @@ When viewing the Polish language site:
{{ T "day_with_count" 5 }} → 5 miesięcy
```
-In the pluralization examples above, we passed an integer in context (the second argument). You can also pass a map in context, creating a `count` key to control pluralization.
+In the pluralization examples above, we passed an integer in context (the second argument). You can also pass a map in context, providing a `count` key to control pluralization.
Translation table:
-{{< code-toggle file=i18n/en copy=false >}}
+{{< code-toggle file=i18n/en >}}
[age]
one = '{{ .name }} is {{ .count }} year old.'
other = '{{ .name }} is {{ .count }} years old.'
{{< /code-toggle >}}
-Template:
+Template code:
```go-html-template
{{ T "age" (dict "name" "Will" "count" 1) }} → Will is 1 year old.
diff --git a/content/en/functions/lang/_index.md b/content/en/functions/lang/_index.md
new file mode 100644
index 000000000..934d97bff
--- /dev/null
+++ b/content/en/functions/lang/_index.md
@@ -0,0 +1,12 @@
+---
+title: Lang functions
+linkTitle: lang
+description: Template functions to adapt your site to meet language and regional requirements.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: functions
+---
+
+Use these functions to adapt your site to meet language and regional requirements.
diff --git a/content/en/functions/math/Abs.md b/content/en/functions/math/Abs.md
new file mode 100644
index 000000000..6e907d564
--- /dev/null
+++ b/content/en/functions/math/Abs.md
@@ -0,0 +1,15 @@
+---
+title: math.Abs
+description: Returns the absolute value of the given number.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: float64
+ signatures: [math.Abs VALUE]
+---
+
+```go-html-template
+{{ math.Abs -2.1 }} → 2.1
+```
diff --git a/content/en/functions/math/Add.md b/content/en/functions/math/Add.md
new file mode 100644
index 000000000..5e3bfb162
--- /dev/null
+++ b/content/en/functions/math/Add.md
@@ -0,0 +1,22 @@
+---
+title: math.Add
+description: Adds two or more numbers.
+categories: []
+keywords: []
+action:
+ aliases: [add]
+ related:
+ - functions/math/Div
+ - functions/math/Mul
+ - functions/math/Product
+ - functions/math/Sub
+ - functions/math/Sum
+ returnType: any
+ signatures: [math.Add VALUE VALUE...]
+---
+
+If one of the numbers is a float, the result is a float.
+
+```go-html-template
+{{ add 12 3 2 }} → 17
+```
diff --git a/content/en/functions/math/Ceil.md b/content/en/functions/math/Ceil.md
new file mode 100644
index 000000000..9f74991c3
--- /dev/null
+++ b/content/en/functions/math/Ceil.md
@@ -0,0 +1,17 @@
+---
+title: math.Ceil
+description: Returns the least integer value greater than or equal to the given number.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/math/Floor
+ - functions/math/Round
+ returnType: float64
+ signatures: [math.Ceil VALUE]
+---
+
+```go-html-template
+{{ math.Ceil 2.1 }} → 3
+```
diff --git a/content/en/functions/math/Counter.md b/content/en/functions/math/Counter.md
new file mode 100644
index 000000000..7f53bdd0c
--- /dev/null
+++ b/content/en/functions/math/Counter.md
@@ -0,0 +1,35 @@
+---
+title: math.Counter
+description: Increments and returns a global counter.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: uint64
+ signatures: [math.Counter]
+---
+
+The counter is global for both monolingual and multilingual sites, and its initial value for each build is 1.
+
+```go-html-template
+{{ warnf "single.html called %d times" math.Counter }}
+```
+
+```sh
+WARN single.html called 1 times
+WARN single.html called 2 times
+WARN single.html called 3 times
+```
+
+Use this function to:
+
+- Create unique warnings as shown above; the [`warnf`] function suppresses duplicate messages
+- Create unique target paths for the `resources.FromString` function where the target path is also the cache key
+
+[`warnf`]: /functions/fmt/warnf
+[`resources.FromString`]: /functions/resources/fromstring
+
+{{% note %}}
+Due to concurrency, the value returned in a given template for a given page will vary from one build to the next. You cannot use this function to assign a static id to each page.
+{{% /note %}}
diff --git a/content/en/functions/math/Div.md b/content/en/functions/math/Div.md
new file mode 100644
index 000000000..5123791b2
--- /dev/null
+++ b/content/en/functions/math/Div.md
@@ -0,0 +1,22 @@
+---
+title: math.Div
+description: Divides the first number by one or more numbers.
+categories: []
+keywords: []
+action:
+ aliases: [div]
+ related:
+ - functions/math/Add
+ - functions/math/Mul
+ - functions/math/Product
+ - functions/math/Sub
+ - functions/math/Sum
+ returnType: any
+ signatures: [math.Div VALUE VALUE...]
+---
+
+If one of the numbers is a float, the result is a float.
+
+```go-html-template
+{{ div 12 3 2 }} → 2
+```
diff --git a/content/en/functions/math/Floor.md b/content/en/functions/math/Floor.md
new file mode 100644
index 000000000..10ad758b6
--- /dev/null
+++ b/content/en/functions/math/Floor.md
@@ -0,0 +1,17 @@
+---
+title: math.Floor
+description: Returns the greatest integer value less than or equal to the given number.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/math/Ceil
+ - functions/math/Round
+ returnType: float64
+ signatures: [math.Floor VALUE]
+---
+
+```go-html-template
+{{ math.Floor 1.9 }} → 1
+```
diff --git a/content/en/functions/math/Log.md b/content/en/functions/math/Log.md
new file mode 100644
index 000000000..84edcb288
--- /dev/null
+++ b/content/en/functions/math/Log.md
@@ -0,0 +1,15 @@
+---
+title: math.Log
+description: Returns the natural logarithm of the given number.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related: []
+ returnType: float64
+ signatures: [math.Log VALUE]
+---
+
+```go-html-template
+{{ math.Log 42 }} → 3.737
+```
diff --git a/content/en/functions/math/Max.md b/content/en/functions/math/Max.md
new file mode 100644
index 000000000..9beff5630
--- /dev/null
+++ b/content/en/functions/math/Max.md
@@ -0,0 +1,16 @@
+---
+title: math.Max
+description: Returns the greater of all numbers. Accepts scalars, slices, or both.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/math/Min
+ returnType: float64
+ signatures: [math.Max VALUE...]
+---
+
+```go-html-template
+{{ math.Max 1 (slice 2 3) 4 }} → 4
+```
diff --git a/content/en/functions/math/Min.md b/content/en/functions/math/Min.md
new file mode 100644
index 000000000..79e464c74
--- /dev/null
+++ b/content/en/functions/math/Min.md
@@ -0,0 +1,16 @@
+---
+title: math.Min
+description: Returns the smaller of all numbers. Accepts scalars, slices, or both.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/math/Max
+ returnType: float64
+ signatures: [math.Min VALUE...]
+---
+
+```go-html-template
+{{ math.Min 1 (slice 2 3) 4 }} → 1
+```
diff --git a/content/en/functions/math/Mod.md b/content/en/functions/math/Mod.md
new file mode 100644
index 000000000..d312730c5
--- /dev/null
+++ b/content/en/functions/math/Mod.md
@@ -0,0 +1,16 @@
+---
+title: math.Mod
+description: Returns the modulus of two integers.
+categories: []
+keywords: []
+action:
+ aliases: [mod]
+ related:
+ - functions/math/ModBool
+ returnType: int64
+ signatures: [math.Mod VALUE1 VALUE2]
+---
+
+```go-html-template
+{{ mod 15 3 }} → 0
+```
diff --git a/content/en/functions/math/ModBool.md b/content/en/functions/math/ModBool.md
new file mode 100644
index 000000000..d915ff614
--- /dev/null
+++ b/content/en/functions/math/ModBool.md
@@ -0,0 +1,16 @@
+---
+title: math.ModBool
+description: Reports whether the modulus of two integers equals 0.
+categories: []
+keywords: []
+action:
+ aliases: [modBool]
+ related:
+ - functions/math/Mod
+ returnType: bool
+ signatures: [math.ModBool VALUE1 VALUE2]
+---
+
+```go-html-template
+{{ modBool 15 3 }} → true
+```
diff --git a/content/en/functions/math/Mul.md b/content/en/functions/math/Mul.md
new file mode 100644
index 000000000..1db8ad9eb
--- /dev/null
+++ b/content/en/functions/math/Mul.md
@@ -0,0 +1,22 @@
+---
+title: math.Mul
+description: Multiplies two or more numbers.
+categories: []
+keywords: []
+action:
+ aliases: [mul]
+ related:
+ - functions/math/Add
+ - functions/math/Div
+ - functions/math/Product
+ - functions/math/Sub
+ - functions/math/Sum
+ returnType: any
+ signatures: [math.Mul VALUE VALUE...]
+---
+
+If one of the numbers is a float, the result is a float.
+
+```go-html-template
+{{ mul 12 3 2 }} → 72
+```
diff --git a/content/en/functions/math/Pow.md b/content/en/functions/math/Pow.md
new file mode 100644
index 000000000..5a1482d73
--- /dev/null
+++ b/content/en/functions/math/Pow.md
@@ -0,0 +1,16 @@
+---
+title: math.Pow
+description: Returns the first number raised to the power of the second number.
+categories: []
+keywords: []
+action:
+ aliases: [pow]
+ related:
+ - functions/math/Sqrt
+ returnType: float64
+ signatures: [math.Pow VALUE1 VALUE2]
+---
+
+```go-html-template
+{{ math.Pow 2 3 }} → 8
+```
diff --git a/content/en/functions/math/Product.md b/content/en/functions/math/Product.md
new file mode 100644
index 000000000..343e9f73d
--- /dev/null
+++ b/content/en/functions/math/Product.md
@@ -0,0 +1,20 @@
+---
+title: math.Product
+description: Returns the product of all numbers. Accepts scalars, slices, or both.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/math/Add
+ - functions/math/Div
+ - functions/math/Mul
+ - functions/math/Sub
+ - functions/math/Sum
+ returnType: float64
+ signatures: [math.Product VALUE...]
+---
+
+```go-html-template
+{{ math.Product 1 (slice 2 3) 4 }} → 24
+```
diff --git a/content/en/functions/math/Round.md b/content/en/functions/math/Round.md
new file mode 100644
index 000000000..e0678eb78
--- /dev/null
+++ b/content/en/functions/math/Round.md
@@ -0,0 +1,17 @@
+---
+title: math.Round
+description: Returns the nearest integer, rounding half away from zero.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/math/Ceil
+ - functions/math/Floor
+ returnType: float64
+ signatures: [math.Round VALUE]
+---
+
+```go-html-template
+{{ math.Round 1.5 }} → 2
+```
diff --git a/content/en/functions/math/Sqrt.md b/content/en/functions/math/Sqrt.md
new file mode 100644
index 000000000..436cb31c3
--- /dev/null
+++ b/content/en/functions/math/Sqrt.md
@@ -0,0 +1,16 @@
+---
+title: math.Sqrt
+description: Returns the square root of the given number.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/math/Pow
+ returnType: float64
+ signatures: [math.Sqrt VALUE]
+---
+
+```go-html-template
+{{ math.Sqrt 81 }} → 9
+```
diff --git a/content/en/functions/math/Sub.md b/content/en/functions/math/Sub.md
new file mode 100644
index 000000000..6c4ef10d5
--- /dev/null
+++ b/content/en/functions/math/Sub.md
@@ -0,0 +1,21 @@
+---
+title: math.Sub
+description: Subtracts one or more numbers from the first number.
+categories: []
+action:
+ aliases: [sub]
+ related:
+ - functions/math/Add
+ - functions/math/Div
+ - functions/math/Mul
+ - functions/math/Product
+ - functions/math/Sum
+ returnType: any
+ signatures: [math.Sub VALUE VALUE...]
+---
+
+If one of the numbers is a float, the result is a float.
+
+```go-html-template
+{{ sub 12 3 2 }} → 7
+```
diff --git a/content/en/functions/math/Sum.md b/content/en/functions/math/Sum.md
new file mode 100644
index 000000000..ae1419fb3
--- /dev/null
+++ b/content/en/functions/math/Sum.md
@@ -0,0 +1,19 @@
+---
+title: math.Sum
+description: Returns the sum of all numbers. Accepts scalars, slices, or both.
+categories: []
+action:
+ aliases: []
+ related:
+ - functions/math/Add
+ - functions/math/Div
+ - functions/math/Mul
+ - functions/math/Product
+ - functions/math/Sub
+ returnType: float64
+ signatures: [math.Sum VALUE...]
+---
+
+```go-html-template
+{{ math.Sum 1 (slice 2 3) 4 }} → 10
+```
diff --git a/content/en/functions/math/_index.md b/content/en/functions/math/_index.md
new file mode 100644
index 000000000..76713bc99
--- /dev/null
+++ b/content/en/functions/math/_index.md
@@ -0,0 +1,11 @@
+---
+title: Math functions
+linkTitle: math
+description: Template functions to perform mathematical operations.
+categories: []
+menu:
+ docs:
+ parent: functions
+---
+
+Use these functions to perform mathematical operations.
diff --git a/content/en/functions/math/index.md b/content/en/functions/math/index.md
deleted file mode 100644
index fd4d10a31..000000000
--- a/content/en/functions/math/index.md
+++ /dev/null
@@ -1,39 +0,0 @@
----
-title: math
-description: Hugo provides mathematical operators in templates.
-categories: [functions]
-keywords: []
-
-menu:
- docs:
- parent: functions
-function:
- aliases: []
- returnType:
- signatures: []
-relatedFunctions: []
----
-
-| Function | Description | Example |
-|-----------------|-----------------------------------------------------------------------------|---------------------------------------------------|
-| `add` | Adds two or more numbers. | `{{ add 12 3 2 }}` → `17` |
-| | *If one of the numbers is a float, the result is a float.* | `{{ add 1.1 2 }}` → `3.1` |
-| `sub` | Subtracts one or more numbers from the first number. | `{{ sub 12 3 2 }}` → `7` |
-| | *If one of the numbers is a float, the result is a float.* | `{{ sub 3 2.5 }}` → `0.5` |
-| `mul` | Multiplies two or more numbers. | `{{ mul 12 3 2 }}` → `72` |
-| | *If one of the numbers is a float, the result is a float.* | `{{ mul 2 3.1 }}` → `6.2` |
-| `div` | Divides the first number by one or more numbers. | `{{ div 12 3 2 }}` → `2` |
-| | *If one of the numbers is a float, the result is a float.* | `{{ div 6 4.0 }}` → `1.5` |
-| `mod` | Modulus of two integers. | `{{ mod 15 3 }}` → `0` |
-| `modBool` | Boolean of modulus of two integers. Evaluates to `true` if result equals 0. | `{{ modBool 15 3 }}` → `true` |
-| `math.Abs` | Returns the absolute value of the given number. | `{{ math.Abs -2.1 }}` → `2.1` |
-| `math.Ceil` | Returns the least integer value greater than or equal to the given number. | `{{ math.Ceil 2.1 }}` → `3` |
-| `math.Floor` | Returns the greatest integer value less than or equal to the given number. | `{{ math.Floor 1.9 }}` → `1` |
-| `math.Log` | Returns the natural logarithm of the given number. | `{{ math.Log 42 }}` → `3.737` |
-| `math.Max` | Returns the greater of all numbers. Accepts scalars, slices, or both. | `{{ math.Max 1 (slice 2 3) 4 }}` → `4` |
-| `math.Min` | Returns the smaller of all numbers. Accepts scalars, slices, or both. | `{{ math.Min 1 (slice 2 3) 4 }}` → `1` |
-| `math.Product` | Returns the product of all numbers. Accepts scalars, slices, or both. | `{{ math.Product 1 (slice 2 3) 4 }}` → `24` |
-| `math.Pow` | Returns the first number raised to the power of the second number. | `{{ math.Pow 2 3 }}` → `8` |
-| `math.Round` | Returns the nearest integer, rounding half away from zero. | `{{ math.Round 1.5 }}` → `2` |
-| `math.Sqrt` | Returns the square root of the given number. | `{{ math.Sqrt 81 }}` → `9` |
-| `math.Sum` | Returns the sum of all numbers. Accepts scalars, slices, or both. | `{{ math.Sum 1 (slice 2 3) 4 }}` → `10` |
diff --git a/content/en/functions/os/FileExists.md b/content/en/functions/os/FileExists.md
index 52cfe32c8..b8104a066 100644
--- a/content/en/functions/os/FileExists.md
+++ b/content/en/functions/os/FileExists.md
@@ -1,22 +1,17 @@
---
title: os.FileExists
-linkTitle: fileExists
description: Reports whether the file or directory exists.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [fileExists]
+ related:
+ - functions/os/Getenv
+ - functions/os/ReadDir
+ - functions/os/ReadFile
+ - functions/os/Stat
returnType: bool
signatures: [os.FileExists PATH]
-relatedFunctions:
- - os.FileExists
- - os.Getenv
- - os.ReadDir
- - os.ReadFile
- - os.Stat
aliases: [/functions/fileexists]
---
@@ -36,11 +31,11 @@ content/
The function returns these values:
```go-html-template
-{{ os.FileExists "content" }} → true
-{{ os.FileExists "content/news" }} → true
-{{ os.FileExists "content/news/article-1" }} → false
-{{ os.FileExists "content/news/article-1.md" }} → true
-{{ os.FileExists "news" }} → true
-{{ os.FileExists "news/article-1" }} → false
-{{ os.FileExists "news/article-1.md" }} → true
+{{ fileExists "content" }} → true
+{{ fileExists "content/news" }} → true
+{{ fileExists "content/news/article-1" }} → false
+{{ fileExists "content/news/article-1.md" }} → true
+{{ fileExists "news" }} → true
+{{ fileExists "news/article-1" }} → false
+{{ fileExists "news/article-1.md" }} → true
```
diff --git a/content/en/functions/os/Getenv.md b/content/en/functions/os/Getenv.md
index 16f73f5aa..084d498ce 100644
--- a/content/en/functions/os/Getenv.md
+++ b/content/en/functions/os/Getenv.md
@@ -1,35 +1,49 @@
---
title: os.Getenv
-linkTitle: getenv
description: Returns the value of an environment variable, or an empty string if the environment variable is not set.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [getenv]
+ related:
+ - functions/os/FileExists
+ - functions/os/ReadDir
+ - functions/os/ReadFile
+ - functions/os/Stat
returnType: string
signatures: [os.Getenv VARIABLE]
-relatedFunctions:
- - os.FileExists
- - os.Getenv
- - os.ReadDir
- - os.ReadFile
- - os.Stat
aliases: [/functions/getenv]
+toc: true
---
-Examples:
+## Security
+
+By default, when using the `os.Getenv` function Hugo allows access to:
+
+- The `CI` environment variable
+- Any environment variable beginning with `HUGO_`
+
+To access other environment variables, adjust your site configuration. For example, to allow access to the `HOME` and `USER` environment variables:
+
+{{< code-toggle file=hugo >}}
+[security.funcs]
+getenv = ['^HUGO_', '^CI$', '^USER$', '^HOME$']
+{{< /code-toggle >}}
+
+Read more about Hugo's [security policy].
+
+[security policy]: /about/security-model/#security-policy
+
+## Examples
```go-html-template
-{{ os.Getenv "HOME" }} → /home/victor
-{{ os.Getenv "USER" }} → victor
+{{ getenv "HOME" }} → /home/victor
+{{ getenv "USER" }} → victor
```
You can pass values when building your site:
-```bash
+```sh
MY_VAR1=foo MY_VAR2=bar hugo
OR
@@ -42,8 +56,6 @@ hugo
And then retrieve the values within a template:
```go-html-template
-{{ os.Getenv "MY_VAR1" }} → foo
-{{ os.Getenv "MY_VAR2" }} → bar
+{{ getenv "MY_VAR1" }} → foo
+{{ getenv "MY_VAR2" }} → bar
```
-
-With Hugo v0.91.0 and later, you must explicitly allow access to environment variables. For details, review [Hugo's Security Policy](/about/security-model/#security-policy). By default, environment variables beginning with `HUGO_` are allowed when using the `os.Getenv` function.
diff --git a/content/en/functions/os/ReadDir.md b/content/en/functions/os/ReadDir.md
index d0ed87bdf..63af850b7 100644
--- a/content/en/functions/os/ReadDir.md
+++ b/content/en/functions/os/ReadDir.md
@@ -1,22 +1,17 @@
---
title: os.ReadDir
-linkTitle: readDir
description: Returns an array of FileInfo structures sorted by file name, one element for each directory entry.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [readDir]
- returnType: FileInfo
+ related:
+ - functions/os/FileExists
+ - functions/os/Getenv
+ - functions/os/ReadFile
+ - functions/os/Stat
+ returnType: os.FileInfo
signatures: [os.ReadDir PATH]
-relatedFunctions:
- - os.FileExists
- - os.Getenv
- - os.ReadDir
- - os.ReadFile
- - os.Stat
aliases: [/functions/readdir]
---
@@ -36,7 +31,7 @@ content/
This template code:
```go-html-template
-{{ range os.ReadDir "content" }}
+{{ range readDir "content" }}
{{ .Name }} → {{ .IsDir }}
{{ end }}
```
diff --git a/content/en/functions/os/ReadFile.md b/content/en/functions/os/ReadFile.md
index 30f2b3056..654e300ac 100644
--- a/content/en/functions/os/ReadFile.md
+++ b/content/en/functions/os/ReadFile.md
@@ -1,22 +1,17 @@
---
title: os.ReadFile
-linkTitle: readFile
description: Returns the contents of a file.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [readFile]
+ related:
+ - functions/os/FileExists
+ - functions/os/Getenv
+ - functions/os/ReadDir
+ - functions/os/Stat
returnType: string
signatures: [os.ReadFile PATH]
-relatedFunctions:
- - os.FileExists
- - os.Getenv
- - os.ReadDir
- - os.ReadFile
- - os.Stat
aliases: [/functions/readfile]
---
@@ -31,7 +26,7 @@ This is **bold** text.
This template code:
```go-html-template
-{{ os.ReadFile "README.md" }}
+{{ readFile "README.md" }}
```
Produces:
diff --git a/content/en/functions/os/Stat.md b/content/en/functions/os/Stat.md
index dfef3c815..6b6f668de 100644
--- a/content/en/functions/os/Stat.md
+++ b/content/en/functions/os/Stat.md
@@ -1,21 +1,17 @@
---
title: os.Stat
description: Returns a FileInfo structure describing a file or directory.
-categories: [functions]
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: []
- returnType: FileInfo
+ related:
+ - functions/os/FileExists
+ - functions/os/Getenv
+ - functions/os/ReadDir
+ - functions/os/ReadFile
+ returnType: os.FileInfo
signatures: [os.Stat PATH]
-relatedFunctions:
- - os.FileExists
- - os.Getenv
- - os.ReadDir
- - os.ReadFile
- - os.Stat
aliases: [/functions/os.stat]
---
diff --git a/content/en/functions/os/_index.md b/content/en/functions/os/_index.md
new file mode 100644
index 000000000..c080d0092
--- /dev/null
+++ b/content/en/functions/os/_index.md
@@ -0,0 +1,12 @@
+---
+title: OS functions
+linkTitle: os
+description: Template functions to interact with the operating system.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: functions
+---
+
+Use these functions to interact with the operating system.
diff --git a/content/en/functions/partials/Include.md b/content/en/functions/partials/Include.md
index ea9dfb31a..e9ed093d8 100644
--- a/content/en/functions/partials/Include.md
+++ b/content/en/functions/partials/Include.md
@@ -1,19 +1,16 @@
---
title: partials.Include
-linkTitle: partial
-description: Executes the named partial template. If the partial contains a return statement, returns that value, else returns the rendered output.
-categories: [functions]
+description: Executes the given partial template, optionally passing context. If the partial contains a return statement, returns that value, else returns the rendered output.
+categories: []
keywords: []
-menu:
- docs:
- parent: functions
-function:
+action:
aliases: [partial]
+ related:
+ - functions/go-template/template
+ - functions/partials/IncludeCached
+ - methods/page/Render
returnType: any
- signatures: ['partials.Include LAYOUT [CONTEXT]']
-relatedFunctions:
- - partials.Include
- - partials.IncludeCached
+ signatures: ['partials.Include NAME [CONTEXT]']
aliases: [/functions/partial]
---
@@ -63,5 +60,4 @@ Then, within the partial template:
{{ .name }} is majoring in {{ .major }}. Their grade point average is {{ .gpa }}.
+{{ end }}
+```
+
+[collection]: /getting-started/glossary/#collection
+[context]: /getting-started/glossary/#context
+[page kinds]: /getting-started/glossary/#page-kind
+[section]: /getting-started/glossary/#section
diff --git a/content/en/methods/page/Paginate.md b/content/en/methods/page/Paginate.md
new file mode 100644
index 000000000..878cae0a5
--- /dev/null
+++ b/content/en/methods/page/Paginate.md
@@ -0,0 +1,50 @@
+---
+title: Paginate
+description: Paginates a collection of pages.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/Paginator
+ returnType: page.Pager
+ signatures: ['PAGE.Paginate COLLECTION [N]']
+---
+
+[Pagination] is the process of splitting a list page into two or more pagers, where each pager contains a subset of the page collection and navigation links to other pagers.
+
+By default, the number of elements on each pager is determined by the value of the `paginate` setting in your site configuration. The default value is `10`. Override the value in your site configuration by providing a second argument, an integer, when calling the `Paginate` method.
+
+{{% note %}}
+There is also a `Paginator` method on `Page` objects, but it can neither filter nor sort the page collection.
+
+The `Paginate` method is more flexible.
+{{% /note %}}
+
+You can invoke pagination on the home page template, [`section`] templates, [`taxonomy`] templates, and [`term`] templates.
+
+{{< code file=layouts/_default/list.html >}}
+{{ $pages := where .Site.RegularPages "Section" "articles" }}
+{{ $pages = $pages.ByTitle }}
+{{ range (.Paginate $pages 7).Pages }}
+
+{{ end }}
+{{ template "_internal/pagination.html" . }}
+{{< /code >}}
+
+In the example above, we:
+
+1. Build a page collection
+2. Sort the collection by title
+3. Paginate the collection, with 7 elements per pager
+4. Range over the paginated page collection, rendering a link to each page
+5. Call the internal "pagination" template to create the navigation links between pagers.
+
+{{% note %}}
+Please note that the results of pagination are cached. Once you have invoked either the `Paginator` or `Paginate` method, the paginated collection is immutable. Additional invocations of these methods will have no effect.
+{{% /note %}}
+
+[context]: /getting-started/glossary/#context
+[pagination]: /templates/pagination/
+[`section`]: /getting-started/glossary/#section
+[`taxonomy`]: /getting-started/glossary/#taxonomy
+[`term`]: /getting-started/glossary/#term
diff --git a/content/en/methods/page/Paginator.md b/content/en/methods/page/Paginator.md
new file mode 100644
index 000000000..b1540286a
--- /dev/null
+++ b/content/en/methods/page/Paginator.md
@@ -0,0 +1,42 @@
+---
+title: Paginator
+description: Paginates the collection of regular pages received in context.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/Paginate
+ returnType: page.Pager
+ signatures: [PAGE.Paginator]
+---
+
+[Pagination] is the process of splitting a list page into two or more pagers, where each pager contains a subset of the page collection and navigation links to other pagers. The number of elements on each pager is determined by the value of the `paginate` setting in your site configuration. The default value is `10`.
+
+You can invoke pagination on the home page template, [`section`] templates, [`taxonomy`] templates, and [`term`] templates. Each of these receive a collection of regular pages in [context]. When you invoke the `Paginator` method, it paginates the page collection received in context.
+
+{{< code file=layouts/_default/list.html >}}
+{{ range .Paginator.Pages }}
+
+{{ end }}
+{{ template "_internal/pagination.html" . }}
+{{< /code >}}
+
+In the example above, the internal "pagination" template creates the navigation links between pagers.
+
+{{% note %}}
+Although simple to invoke, with the `Paginator` method you can neither filter nor sort the page collection. It acts upon the page collection received in context.
+
+The [`Paginate`] method is more flexible, and strongly recommended.
+
+[`paginate`]: /methods/page/paginate
+{{% /note %}}
+
+{{% note %}}
+Please note that the results of pagination are cached. Once you have invoked either the `Paginator` or `Paginate` method, the paginated collection is immutable. Additional invocations of these methods will have no effect.
+{{% /note %}}
+
+[context]: /getting-started/glossary/#context
+[pagination]: /templates/pagination/
+[`section`]: /getting-started/glossary/#section
+[`taxonomy`]: /getting-started/glossary/#taxonomy
+[`term`]: /getting-started/glossary/#term
diff --git a/content/en/methods/page/Param.md b/content/en/methods/page/Param.md
new file mode 100644
index 000000000..18fd67dfe
--- /dev/null
+++ b/content/en/methods/page/Param.md
@@ -0,0 +1,47 @@
+---
+title: Param
+description: Returns a page parameter with the given key, falling back to a site parameter if present.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: any
+ signatures: [PAGE.Param KEY]
+aliases: [/functions/param]
+---
+
+The `Param` method on a `Page` object looks for the given `KEY` in page parameters, and returns the corresponding value. If it cannot find the `KEY` in page parameters, it looks for the `KEY` in site parameters. If it cannot find the `KEY` in either location, the `Param` method returns `nil`.
+
+Site and theme developers commonly set parameters at the site level, allowing content authors to override those parameters at the page level.
+
+For example, to show a table of contents on every page, but allow authors to hide the table of contents as needed:
+
+Configuration:
+
+{{< code-toggle file=hugo >}}
+[params]
+display_toc = true
+{{< /code-toggle >}}
+
+Content:
+
+{{< code-toggle file="content/example.md" fm=true >}}
+title = 'Example'
+date = 2023-01-01
+draft = false
+display_toc = false
+{{< /code-toggle >}}
+
+Template:
+
+```go-html-template
+{{ if .Param "display_toc" }}
+ {{ .TableOfContents }}
+{{ end }}
+```
+
+The `Param` method returns the value associated with the given `KEY`, regardless of whether the value is truthy or falsy. If you need to ignore falsy values, use this construct instead:
+
+```go-html-template
+{{ or .Params.foo site.Params.foo }}
+```
diff --git a/content/en/methods/page/Params.md b/content/en/methods/page/Params.md
new file mode 100644
index 000000000..efe8287e0
--- /dev/null
+++ b/content/en/methods/page/Params.md
@@ -0,0 +1,43 @@
+---
+title: Params
+description: Returns a map of custom parameters as defined in the front matter of the given page.
+categories: []
+keywords: []
+action:
+ related:
+ - functions/collections/IndexFunction
+ - methods/site/Params
+ - methods/page/Param
+ returnType: maps.Params
+ signatures: [PAGE.Params]
+---
+
+With this front matter:
+
+{{< code-toggle file="content/news/annual-conference.md" >}}
+title = 'Annual conference'
+date = 2023-10-17T15:11:37-07:00
+display_related = true
+event-date = '2023'
+[params.author]
+ email = 'jsmith@example.org'
+ name = 'John Smith'
+{{< /code-toggle >}}
+
+The `title` and `date` fields are standard parameters---the other fields are user-defined.
+
+Access the custom parameters by [chaining] the [identifiers]:
+
+```go-html-template
+{{ .Params.display_related }} → true
+{{ .Params.author.name }} → John Smith
+```
+
+In the template example above, each of the keys is a valid identifier. For example, none of the keys contains a hyphen. To access a key that is not a valid identifier, use the [`index`] function:
+
+```go-html-template
+{{ index .Params "event-date" }} → 2023
+```
+[`index`]: /functions/collections/indexfunction
+[chaining]: /getting-started/glossary/#chain
+[identifiers]: /getting-started/glossary/#identifier
diff --git a/content/en/methods/page/Parent.md b/content/en/methods/page/Parent.md
new file mode 100644
index 000000000..dbd2cb9b3
--- /dev/null
+++ b/content/en/methods/page/Parent.md
@@ -0,0 +1,60 @@
+---
+title: Parent
+description: Returns the Page object of the parent section of the given page.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/Ancestors
+ - methods/page/CurrentSection
+ - methods/page/FirstSection
+ - methods/page/InSection
+ - methods/page/IsAncestor
+ - methods/page/IsDescendant
+ - methods/page/Sections
+ returnType: hugolib.pageState
+ signatures: [PAGE.Parent]
+---
+
+{{% include "methods/page/_common/definition-of-section.md" %}}
+
+{{% note %}}
+The parent section of a regular page is the [current section].
+
+[current section]: /methods/page/currentsection
+{{% /note %}}
+
+Consider this content structure:
+
+```text
+content/
+├── auctions/
+│ ├── 2023-11/
+│ │ ├── _index.md <-- parent: auctions
+│ │ ├── auction-1.md
+│ │ └── auction-2.md <-- parent: 2023-11
+│ ├── 2023-12/
+│ │ ├── _index.md
+│ │ ├── auction-3.md
+│ │ └── auction-4.md
+│ ├── _index.md <-- parent: home
+│ ├── bidding.md
+│ └── payment.md <-- parent: auctions
+├── books/
+│ ├── _index.md <-- parent: home
+│ ├── book-1.md
+│ └── book-2.md <-- parent: books
+├── films/
+│ ├── _index.md <-- parent: home
+│ ├── film-1.md
+│ └── film-2.md <-- parent: films
+└── _index.md <-- parent: nil
+```
+
+In the example above, note the parent section of the home page is nil. Code defensively by verifying existence of the parent section before calling methods on its `Page` object. To create a link to the parent section page of the current page:
+
+```go-html-template
+{{ with .Parent }}
+ {{ .LinkTitle }}
+{{ end }}
+```
diff --git a/content/en/methods/page/Permalink.md b/content/en/methods/page/Permalink.md
new file mode 100644
index 000000000..be6df5aad
--- /dev/null
+++ b/content/en/methods/page/Permalink.md
@@ -0,0 +1,25 @@
+---
+title: Permalink
+description: Returns the permalink of the given page.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/RelPermalink
+ returnType: string
+ signatures: [PAGE.Permalink]
+---
+
+Site configuration:
+
+{{< code-toggle file=hugo >}}
+title = 'Documentation'
+baseURL = 'https://example.org/docs/'
+{{< /code-toggle >}}
+
+Template:
+
+```go-html-template
+{{ $page := .Site.GetPage "/about" }}
+{{ $page.RelPermalink }} → https://example.org/docs/about/
+```
diff --git a/content/en/methods/page/Plain.md b/content/en/methods/page/Plain.md
new file mode 100644
index 000000000..6fdf60b62
--- /dev/null
+++ b/content/en/methods/page/Plain.md
@@ -0,0 +1,28 @@
+---
+title: Plain
+description: Returns the rendered content of the given page, removing all HTML tags.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/Content
+ - methods/page/RawContent
+ - methods/page/PlainWords
+ - methods/page/RenderShortcodes
+ returnType: string
+ signatures: [PAGE.Plain]
+---
+
+The `Plain` method on a `Page` object renders markdown and [shortcodes] to HTML, then strips the HTML [tags]. It does not strip HTML [entities]. The plain content does not include front matter.
+
+To prevent Go's [html/template] package from escaping HTML entities, pass the result through the [`htmlUnescape`] function.
+
+```go-html-template
+{{ .Plain | htmlUnescape }}
+```
+
+[shortcodes]: /getting-started/glossary/#shortcode
+[html/template]: https://pkg.go.dev/html/template
+[entities]: https://developer.mozilla.org/en-US/docs/Glossary/Entity
+[tags]: https://developer.mozilla.org/en-US/docs/Glossary/Tag
+[`htmlUnescape`]: /functions/
diff --git a/content/en/methods/page/PlainWords.md b/content/en/methods/page/PlainWords.md
new file mode 100644
index 000000000..f0a6a9c42
--- /dev/null
+++ b/content/en/methods/page/PlainWords.md
@@ -0,0 +1,34 @@
+---
+title: PlainWords
+description: Calls the Plain method, splits the result into a slice of words, and returns the slice.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/Content
+ - methods/page/RawContent
+ - methods/page/Plain
+ returnType: '[]string'
+ signatures: [PAGE.PlainWords]
+---
+
+The `PlainWords` method on a `Page` object calls the [`Plain`] method, then uses Go's [`strings.Fields`] function to split the result into words.
+
+{{% note %}}
+_Fields splits the string s around each instance of one or more consecutive white space characters, as defined by unicode.IsSpace, returning a slice of substrings of s or an empty slice if s contains only white space._
+{{% /note %}}
+
+As a result, elements within the slice may contain leading or trailing punctuation.
+
+```go-html-template
+{{ .PlainWords }}
+```
+
+To determine the approximate number of unique words on a page:
+
+```go-html-template
+{{ .PlainWords | uniq }} → 42
+```
+
+[`Plain`]: /methods/page/plain
+[`strings.Fields`]: https://pkg.go.dev/strings#Fields
diff --git a/content/en/methods/page/Prev.md b/content/en/methods/page/Prev.md
new file mode 100644
index 000000000..cde83b0f2
--- /dev/null
+++ b/content/en/methods/page/Prev.md
@@ -0,0 +1,53 @@
+---
+title: Prev
+description: Returns the previous page in a global page collection, relative to the given page.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/Next
+ - methods/page/PrevInSection
+ - methods/page/NextInSection
+ - methods/pages/Prev
+ - methods/pages/Next
+ returnType: hugolib.pageState
+ signatures: [PAGE.Prev]
+toc: true
+---
+
+The behavior of the `Prev` and `Next` methods on a `Page` object is probably the reverse of what you expect.
+
+With this content structure:
+
+```text
+content/
+├── pages/
+│ ├── _index.md
+│ ├── page-1.md <-- front matter: weight = 10
+│ ├── page-2.md <-- front matter: weight = 20
+│ └── page-3.md <-- front matter: weight = 30
+└── _index.md
+```
+
+When you visit page-2:
+
+- The `Prev` method points to page-3
+- The `Next` method points to page-1
+
+{{% note %}}
+Use the opposite label in your navigation links as shown in the example below.
+{{% /note %}}
+
+```go-html-template
+{{ with .Next }}
+ Prev
+{{ end }}
+
+{{ with .Prev }}
+ Next
+{{ end }}
+```
+
+## Compare to Pages methods
+
+{{% include "methods/_common/next-prev-on-page-vs-next-prev-on-pages.md" %}}
diff --git a/content/en/methods/page/PrevInSection.md b/content/en/methods/page/PrevInSection.md
new file mode 100644
index 000000000..bfbb86f3c
--- /dev/null
+++ b/content/en/methods/page/PrevInSection.md
@@ -0,0 +1,72 @@
+---
+title: PrevInSection
+description: Returns the previous page within a section, relative to the given page.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/NextInSection
+ - methods/page/Next
+ - methods/pages/Next
+ - methods/page/Prev
+ - methods/pages/Prev
+ returnType: hugolib.pageState
+ signatures: [PAGE.PrevInSection]
+---
+
+
+The behavior of the `PrevInSection` and `NextInSection` methods on a `Page` object is probably the reverse of what you expect.
+
+With this content structure:
+
+```text
+content/
+├── books/
+│ ├── _index.md
+│ ├── book-1.md
+│ ├── book-2.md
+│ └── book-3.md
+├── films/
+│ ├── _index.md
+│ ├── film-1.md
+│ ├── film-2.md
+│ └── film-3.md
+└── _index.md
+```
+
+When you visit book-2:
+
+- The `PrevInSection` method points to book-3
+- The `NextInSection` method points to book-1
+
+{{% note %}}
+Use the opposite label in your navigation links as shown in the example below.
+{{% /note %}}
+
+```go-html-template
+{{ with .NextInSection }}
+ Previous in section
+{{ end }}
+
+{{ with .PrevInSection }}
+ Next in section
+{{ end }}
+```
+
+{{% note %}}
+The navigation sort order may be different than the page collection sort order.
+{{% /note %}}
+
+With the `PrevInSection` and `NextInSection` methods, the navigation sort order is fixed, using Hugo’s default sort order. In order of precedence:
+
+1. Page [weight]
+2. Page [date] (descending)
+3. Page [linkTitle], falling back to page [title]
+4. Page file path if the page is backed by a file
+
+For example, with a page collection sorted by title, the navigation sort order will use Hugo’s default sort order. This is probably not what you want or expect. For this reason, the Next and Prev methods on a Pages object are a generally a better choice.
+
+[date]: /methods/page/date
+[weight]: /methods/page/weight
+[linkTitle]: /methods/page/linktitle
+[title]: /methods/page/title
diff --git a/content/en/methods/page/PublishDate.md b/content/en/methods/page/PublishDate.md
new file mode 100644
index 000000000..b1c0717a9
--- /dev/null
+++ b/content/en/methods/page/PublishDate.md
@@ -0,0 +1,35 @@
+---
+title: PublishDate
+description: Returns the publish date of the given page.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/Date
+ - methods/page/ExpiryDate
+ - methods/page/LastMod
+ returnType: time.Time
+ signatures: [PAGE.PublishDate]
+---
+
+By default, Hugo excludes pages with future publish dates when building your site. To include future pages, use the `--buildFuture` command line flag.
+
+Set the publish date in front matter:
+
+{{< code-toggle file=content/news/article-1.md fm=true >}}
+title = 'Article 1'
+publishDate = 2023-10-19T00:40:04-07:00
+{{< /code-toggle >}}
+
+The publish date is a [time.Time] value. Format and localize the value with the [`time.Format`] function, or use it with any of the [time methods].
+
+```go-html-template
+{{ .PublishDate | time.Format ":date_medium" }} → Oct 19, 2023
+```
+
+In the example above we explicitly set the publish date in front matter. With Hugo's default configuration, the `PublishDate` method returns the front matter value. This behavior is configurable, allowing you to set fallback values if the publish date is not defined in front matter. See [details].
+
+[`time.Format`]: /functions/time/format
+[details]: /getting-started/configuration/#configure-dates
+[time methods]: /methods/time
+[time.Time]: https://pkg.go.dev/time#Time
diff --git a/content/en/methods/page/RawContent.md b/content/en/methods/page/RawContent.md
new file mode 100644
index 000000000..9fea16db6
--- /dev/null
+++ b/content/en/methods/page/RawContent.md
@@ -0,0 +1,31 @@
+---
+title: RawContent
+description: Returns the raw content of the given page.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/Content
+ - methods/page/Plain
+ - methods/page/PlainWords
+ - methods/page/RenderShortcodes
+ returnType: string
+ signatures: [PAGE.RawContent]
+---
+
+The `RawContent` method on a `Page` object returns the raw content. The raw content does not include front matter.
+
+```go-html-template
+{{ .RawContent }}
+```
+
+This is useful when rendering a page in a plain text [content format].
+
+{{% note %}}
+[Shortcodes] within the content are not rendered. To get the raw content with shortcodes rendered, use the [`RenderShortcodes`] method on a `Page` object.
+
+[shortcodes]: /getting-started/glossary/#shortcode
+[`RenderShortcodes`]: /methods/page/rendershortcodes
+{{% /note %}}
+
+[content format]: /templates/output-formats
diff --git a/content/en/methods/page/ReadingTime.md b/content/en/methods/page/ReadingTime.md
new file mode 100644
index 000000000..531824b9b
--- /dev/null
+++ b/content/en/methods/page/ReadingTime.md
@@ -0,0 +1,49 @@
+---
+title: ReadingTime
+description: Returns the estimated reading time, in minutes, for the given page.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/WordCount
+ - methods/page/FuzzyWordCount
+ returnType: int
+ signatures: [PAGE.ReadingTime]
+---
+
+The estimated reading time is calculated by dividing the number of words in the content by the reading speed.
+
+By default, Hugo assumes a reading speed of 212 words per minute. For CJK languages, it assumes 500 words per minute.
+
+```go-html-template
+{{ printf "Estimated reading time: %d minutes" .ReadingTime }}
+```
+
+Reading speed varies by language. Create language-specific estimated reading times on your multilingual site using site parameters.
+
+{{< code-toggle file=hugo >}}
+[languages]
+ [languages.de]
+ contentDir = 'content/de'
+ languageCode = 'de-DE'
+ languageName = 'Deutsch'
+ weight = 2
+ [languages.de.params]
+ reading_speed = 179
+ [languages.en]
+ contentDir = 'content/en'
+ languageCode = 'en-US'
+ languageName = 'English'
+ weight = 1
+ [languages.en.params]
+ reading_speed = 228
+{{< /code-toggle >}}
+
+Then in your template:
+
+```go-html-template
+{{ $readingTime := div (float .WordCount) .Site.Params.reading_speed }}
+{{ $readingTime = math.Ceil $readingTime }}
+```
+
+We cast the `.WordCount` to a float to obtain a float when we divide by the reading speed. Then round up to the nearest integer.
diff --git a/content/en/methods/page/Ref.md b/content/en/methods/page/Ref.md
new file mode 100644
index 000000000..2f52a74c1
--- /dev/null
+++ b/content/en/methods/page/Ref.md
@@ -0,0 +1,44 @@
+---
+title: Ref
+description: Returns the absolute URL of the given page with the given path, language, and output format.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/RelRef
+ - functions/urls/RelRef
+ - functions/urls/Ref
+ returnType: string
+ signatures: [PAGE.Ref OPTIONS]
+---
+
+The map of option contains:
+
+path
+: (`string`) The path to the page, relative to the content directory. Required.
+
+lang
+: (`string`) The language (site) to search for the page. Default is the current language. Optional.
+
+outputFormat
+: (`string`) The output format to search for the page. Default is the current output format. Optional.
+
+The examples below show the rendered output when visiting a page on the English language version of the site:
+
+```go-html-template
+{{ $opts := dict "path" "/books/book-1" }}
+{{ .Ref $opts }} → http://localhost:1314/en/books/book-1/
+
+{{ $opts := dict "path" "/books/book-1" "lang" "de" }}
+{{ .Ref $opts }} → http://localhost:1314/de/books/book-1/
+
+{{ $opts := dict "path" "/books/book-1" "lang" "de" "outputFormat" "json" }}
+{{ .Ref $opts }} → http://localhost:1314/de/books/book-1/index.json
+```
+
+By default, Hugo will throw an error and fail the build if it cannot resolve the path. You can change this to a warning in your site configuration, and specify a URL to return when the path cannot be resolved.
+
+{{< code-toggle file=hugo >}}
+refLinksErrorLevel = 'warning'
+refLinksNotFoundURL = '/some/other/url'
+{{< /code-toggle >}}
diff --git a/content/en/methods/page/RegularPages.md b/content/en/methods/page/RegularPages.md
new file mode 100644
index 000000000..da433ec80
--- /dev/null
+++ b/content/en/methods/page/RegularPages.md
@@ -0,0 +1,87 @@
+---
+title: RegularPages
+description: Returns a collection of regular pages within the current section.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/Pages
+ - methods/page/RegularPagesRecursive
+ returnType: page.Pages
+ signatures: [PAGE.RegularPages]
+---
+
+The `RegularPages` method on a `Page` object is available to these [page kinds]: `home`, `section`, `taxonomy`, and `term`. The templates for these page kinds receive a page [collection] in [context].
+
+Range through the page collection in your template:
+
+```go-html-template
+{{ range .RegularPages.ByTitle }}
+
+{{ end }}
+```
+
+[collection]: /getting-started/glossary/#collection
+[context]: /getting-started/glossary/#context
+[page kinds]: /getting-started/glossary/#page-kind
+[section]: /getting-started/glossary/#section
diff --git a/content/en/methods/page/RegularPagesRecursive.md b/content/en/methods/page/RegularPagesRecursive.md
new file mode 100644
index 000000000..5a314cef3
--- /dev/null
+++ b/content/en/methods/page/RegularPagesRecursive.md
@@ -0,0 +1,90 @@
+---
+title: RegularPagesRecursive
+description: Returns a collection of regular pages within the current section, and regular pages within all descendant sections.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/Pages
+ - methods/page/RegularPages
+ returnType: page.Pages
+ signatures: [PAGE.RegularPagesRecursive]
+---
+
+The `RegularPagesRecursive` method on a `Page` object is available to these [page kinds]: `home`, `section`, `taxonomy`, and `term`. The templates for these page kinds receive a page [collection] in [context].
+
+Range through the page collection in your template:
+
+```go-html-template
+{{ range .RegularPagesRecursive.ByTitle }}
+
+ {{ .Render "summary" }}
+{{ end }}
+```
+
+In the example above, note that the template ("summary") is identified by its file name without directory or extension.
+
+Although similar to the [`partial`] function, there are key differences.
+
+`Render` method|`partial` function|
+:--|:--
+The `Page` object is automatically passed to the given template. You cannot pass additional context.| You must specify the context, allowing you to pass a combination of objects, slices, maps, and scalars.
+The path to the template is determined by the [content type].|You must specify the path to the template, relative to the layouts/partials directory.
+
+Consider this layout structure:
+
+```text
+layouts/
+├── _default/
+│ ├── baseof.html
+│ ├── home.html
+│ ├── li.html <-- used for other content types
+│ ├── list.html
+│ ├── single.html
+│ └── summary.html
+└── books/
+ ├── li.html <-- used when content type is "books"
+ └── summary.html
+```
+
+And this template:
+
+```go-html-template
+
+ {{ range site.RegularPages.ByDate }}
+ {{ .Render "li" }}
+ {{ end }}
+
+```
+
+When rendering content of type "books" the `Render` method calls:
+
+```text
+layouts/books/li.html
+```
+
+For all other content types the `Render` methods calls:
+
+```text
+layouts/_default/li.html
+```
+
+See [content views] for more examples.
+
+[content views]: /templates/views
+[`partial`]: /functions/partials/include
+[content type]: /getting-started/glossary/#content-type
diff --git a/content/en/methods/page/RenderShortcodes.md b/content/en/methods/page/RenderShortcodes.md
new file mode 100644
index 000000000..a62893f52
--- /dev/null
+++ b/content/en/methods/page/RenderShortcodes.md
@@ -0,0 +1,76 @@
+---
+title: RenderShortcodes
+description: Renders all shortcodes in the content of the given page, preserving the surrounding markup.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/RenderString
+ - methods/page/Content
+ - methods/page/RawContent
+ - methods/page/Plain
+ - methods/page/PlainWords
+ returnType: template.HTML
+ signatures: [PAGE.RenderShortcodes]
+toc: true
+---
+
+Use this method in shortcode templates to compose a page from multiple content files, while preserving a global context for footnotes and the table of contents.
+
+For example:
+
+{{< code file="layouts/shortcodes/include.html" >}}
+{{ $p := site.GetPage (.Get 0) }}
+{{ $p.RenderShortcodes }}
+{{< /code >}}
+
+Then in your markdown:
+
+{{< code file="content/about.md" lang=md >}}
+{{%/* include "/snippets/services.md" */%}}
+{{%/* include "/snippets/values.md" */%}}
+{{%/* include "/snippets/leadership.md" */%}}
+{{< /code >}}
+
+Each of the included markdown files can contain calls to other shortcodes.
+
+## Shortcode notation
+
+In the example above it's important to understand the difference between the two delimiters used when calling a shortcode:
+
+- `{{* myshortcode */>}}` tells Hugo that the rendered shortcode does not need further processing. For example, the shortcode content is HTML.
+- `{{%/* myshortcode */%}}` tells Hugo that the rendered shortcode needs further processing. For example, the shortcode content is markdown.
+
+Use the latter for the "include" shortcode described above.
+
+## Further explanation
+
+To understand what is returned by the `RenderShortcodes` method, consider this content file
+
+{{< code file="content/about.md" lang=text >}}
++++
+title = 'About'
+date = 2023-10-07T12:28:33-07:00
++++
+
+{{* ref "privacy" */>}}
+
+An *emphasized* word.
+{{< /code >}}
+
+With this template code:
+
+```go-html-template
+{{ $p := site.GetPage "/about" }}
+{{ $p.RenderShortcodes }}
+```
+
+Hugo renders this:;
+
+```html
+https://example.org/privacy/
+
+An *emphasized* word.
+```
+
+Note that the shortcode within the content file was rendered, but the surrounding markdown was preserved.
diff --git a/content/en/methods/page/RenderString.md b/content/en/methods/page/RenderString.md
new file mode 100644
index 000000000..5782cd2b1
--- /dev/null
+++ b/content/en/methods/page/RenderString.md
@@ -0,0 +1,51 @@
+---
+title: RenderString
+description: Renders markup to HTML.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/RenderShortcodes
+ - functions/transform/Markdownify
+ returnType: template.HTML
+ signatures: ['PAGE.RenderString [OPTIONS] MARKUP']
+aliases: [/functions/renderstring]
+---
+
+```go-html-template
+{{ $s := "An *emphasized* word" }}
+{{ $s | .RenderString }} → An emphasized word
+```
+
+This method takes an optional map of options:
+
+display
+: (`string`) Specify either `inline` or `block`. If `inline`, removes surrounding `p` tags from short snippets. Default is `inline`.
+
+markup
+: (`string`) Specify a [markup identifier] for the provided markup. Default is the `markup` front matter value, falling back to the value derived from the page's file extension.
+
+Render with the default markup renderer:
+
+```go-html-template
+{{ $s := "An *emphasized* word" }}
+{{ $s | .RenderString }} → An emphasized word
+
+{{ $opts := dict "display" "block" }}
+{{ $s | .RenderString $opts }} →
+```
+
+[markup identifier]: /content-management/formats/#list-of-content-formats
+[pandoc]: https://www.pandoc.org/
diff --git a/content/en/methods/page/Resources.md b/content/en/methods/page/Resources.md
new file mode 100644
index 000000000..a9fa3dab2
--- /dev/null
+++ b/content/en/methods/page/Resources.md
@@ -0,0 +1,81 @@
+---
+title: Resources
+description: Returns a collection of page resources.
+categories: []
+keywords: []
+action:
+ related:
+ - functions/resources/ByType
+ - functions/resources/Get
+ - functions/resources/GetMatch
+ - functions/resources/GetRemote
+ - functions/resources/Match
+ returnType: resource.Resources
+ signatures: [PAGE.Resources]
+toc: true
+---
+
+The `Resources` method on a `Page` object returns a collection of page resources. A page resource is a file within a [page bundle].
+
+To work with global or remote resources, see the [`resources`] functions.
+
+## Methods
+
+ByType
+: (`resource.Resources`) Returns a collection of page resources of the given [media type], or nil if none found. The media type is typically one of `image`, `text`, `audio`, `video`, or `application`.
+
+```go-html-template
+{{ range .Resources.ByType "image" }}
+
+{{ end }}
+```
+
+When working with global resources instead of page resources, use the [`resources.ByType`] function.
+
+Get
+: (`resource.Resource`) Returns a page resource from the given path, or nil if none found.
+
+```go-html-template
+{{ with .Resources.Get "images/a.jpg" }}
+
+{{ end }}
+```
+
+When working with global resources instead of page resources, use the [`resources.Get`] function.
+
+GetMatch
+: (`resource.Resource`) Returns the first page resource from paths matching the given [glob pattern], or nil if none found.
+
+```go-html-template
+{{ with .Resources.GetMatch "images/*.jpg" }}
+
+{{ end }}
+```
+
+When working with global resources instead of page resources, use the [`resources.GetMatch`] function.
+
+Match
+: (`resource.Resources`) Returns a collection of page resources from paths matching the given [glob pattern], or nil if none found.
+
+```go-html-template
+{{ range .Resources.Match "images/*.jpg" }}
+
+{{ end }}
+```
+
+When working with global resources instead of page resources, use the [`resources.Match`] function.
+
+## Pattern matching
+
+With the `GetMatch` and `Match` methods, Hugo determines a match using a case-insensitive [glob pattern].
+
+{{% include "functions/_common/glob-patterns.md" %}}
+
+[`resources.ByType`]: /functions/resources/ByType
+[`resources.GetMatch`]: /functions/resources/ByType
+[`resources.Get`]: /functions/resources/ByType
+[`resources.Match`]: /functions/resources/ByType
+[`resources`]: /functions/resources
+[glob pattern]: https://github.com/gobwas/glob#example
+[media type]: https://en.wikipedia.org/wiki/Media_type
+[page bundle]: /getting-started/glossary/#page-bundle
diff --git a/content/en/methods/page/Scratch.md b/content/en/methods/page/Scratch.md
new file mode 100644
index 000000000..f9ce7f7fb
--- /dev/null
+++ b/content/en/methods/page/Scratch.md
@@ -0,0 +1,23 @@
+---
+title: Scratch
+description: Creates a "scratch pad" on the given page to store and manipulate data.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/Store
+ - functions/collections/NewScratch
+ returnType: maps.Scratch
+ signatures: [PAGE.Scratch]
+aliases: [/extras/scratch/,/doc/scratch/,/functions/scratch]
+---
+
+The `Scratch` method on a `Page` object creates a [scratch pad] to store and manipulate data. To create a scratch pad that is not reset on server rebuilds, use the [`Store`] method instead.
+
+To create a locally scoped scratch pad that is not attached to a `Page` object, use the [`newScratch`] function.
+
+[`Store`]: /methods/page/store
+[`newScratch`]: functions/collections/newscratch
+[scratch pad]: /getting-started/glossary/#scratch-pad
+
+{{% include "methods/page/_common/scratch-methods.md" %}}
diff --git a/content/en/methods/page/Section.md b/content/en/methods/page/Section.md
new file mode 100644
index 000000000..30c8a9837
--- /dev/null
+++ b/content/en/methods/page/Section.md
@@ -0,0 +1,54 @@
+---
+title: Section
+description: Returns the name of the top level section in which the given page resides.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/Type
+ returnType: string
+ signatures: [PAGE.Section]
+---
+
+With this content structure:
+
+```text
+content/
+├── lessons/
+│ ├── math/
+│ │ ├── _index.md
+│ │ ├── lesson-1.md
+│ │ └── lesson-2.md
+│ └── _index.md
+└── _index.md
+```
+
+When rendering lesson-1.md:
+
+```go-html-template
+{{ .Section }} → lessons
+```
+
+In the example above "lessons" is the top level section.
+
+The `Section` method is often used with the [`where`] function to build a page collection.
+
+```go-html-template
+{{ range where .Site.RegularPages "Section" "lessons" }}
+
+{{ end }}
+```
+
+This is similar to using the [`Type`] method with the `where` function
+
+```go-html-template
+{{ range where .Site.RegularPages "Type" "lessons" }}
+
+```
+
+To render a link to home page of the primary (first) language:
+
+```go-html-template
+{{ with .Sites.First }}
+ {{ .Title }}
+{{ end }}
+```
+
+This is equivalent to:
+
+```go-html-template
+{{ with index .Sites 0 }}
+ {{ .Title }}
+{{ end }}
+```
diff --git a/content/en/methods/page/Slug.md b/content/en/methods/page/Slug.md
new file mode 100644
index 000000000..9fdb09b57
--- /dev/null
+++ b/content/en/methods/page/Slug.md
@@ -0,0 +1,25 @@
+---
+title: Slug
+description: Returns the URL slug of the given page as defined in front matter.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: string
+ signatures: [PAGE.Slug]
+---
+
+{{< code-toggle file=content/recipes/spicy-tuna-hand-rolls.md fm=true >}}
+title = 'How to make spicy tuna hand rolls'
+slug = 'sushi'
+{{< /code-toggle >}}
+
+This page will be served from:
+
+ https://example.org/recipes/sushi
+
+To get the slug value within a template:
+
+```go-html-template
+{{ .Slug }} → sushi
+```
diff --git a/content/en/methods/page/Store.md b/content/en/methods/page/Store.md
new file mode 100644
index 000000000..04e1d5256
--- /dev/null
+++ b/content/en/methods/page/Store.md
@@ -0,0 +1,97 @@
+---
+title: Store
+description: Creates a persistent "scratch pad" on the given page to store and manipulate data.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/scratch
+ - functions/collections/NewScratch
+ returnType: maps.Scratch
+ signatures: [PAGE.Store]
+aliases: [/functions/store]
+---
+
+The `Store` method on a `Page` object creates a persistent [scratch pad] to store and manipulate data. In contrast with the [`Scratch`] method, the scratch pad created by the `Store` method is not reset on server rebuilds.
+
+To create a locally scoped scratch pad that is not attached to a `Page` object, use the [`newScratch`] function.
+
+[`Scratch`]: /methods/page/scratch
+[`newScratch`]: functions/collections/newscratch
+[scratch pad]: /getting-started/glossary/#scratch-pad
+
+## Methods
+
+Set
+: Sets the value of a given key.
+
+```go-html-template
+{{ .Store.Set "greeting" "Hello" }}
+```
+
+Get
+: Gets the value of a given key.
+
+```go-html-template
+{{ .Store.Set "greeting" "Hello" }}
+{{ .Store.Get "greeting" }} → Hello
+```
+
+Add
+: Adds a given value to existing value(s) of the given key.
+
+: For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the following adds will be appended to that list.
+
+```go-html-template
+{{ .Store.Set "greeting" "Hello" }}
+{{ .Store.Add "greeting" "Welcome" }}
+{{ .Store.Get "greeting" }} → HelloWelcome
+```
+
+```go-html-template
+{{ .Store.Set "total" 3 }}
+{{ .Store.Add "total" 7 }}
+{{ .Store.Get "total" }} → 10
+```
+
+```go-html-template
+{{ .Store.Set "greetings" (slice "Hello") }}
+{{ .Store.Add "greetings" (slice "Welcome" "Cheers") }}
+{{ .Store.Get "greetings" }} → [Hello Welcome Cheers]
+```
+
+SetInMap
+: Takes a `key`, `mapKey` and `value` and adds a map of `mapKey` and `value` to the given `key`.
+
+```go-html-template
+{{ .Store.SetInMap "greetings" "english" "Hello" }}
+{{ .Store.SetInMap "greetings" "french" "Bonjour" }}
+{{ .Store.Get "greetings" }} → map[english:Hello french:Bonjour]
+```
+
+DeleteInMap
+: Takes a `key` and `mapKey` and removes the map of `mapKey` from the given `key`.
+
+```go-html-template
+{{ .Store.SetInMap "greetings" "english" "Hello" }}
+{{ .Store.SetInMap "greetings" "french" "Bonjour" }}
+{{ .Store.DeleteInMap "greetings" "english" }}
+{{ .Store.Get "greetings" }} → map[french:Bonjour]
+```
+
+GetSortedMapValues
+: Returns an array of values from `key` sorted by `mapKey`.
+
+```go-html-template
+{{ .Store.SetInMap "greetings" "english" "Hello" }}
+{{ .Store.SetInMap "greetings" "french" "Bonjour" }}
+{{ .Store.GetSortedMapValues "greetings" }} → [Hello Bonjour]
+```
+
+Delete
+: Removes the given key.
+
+```go-html-template
+{{ .Store.Set "greeting" "Hello" }}
+{{ .Store.Delete "greeting" }}
+```
diff --git a/content/en/methods/page/Summary.md b/content/en/methods/page/Summary.md
new file mode 100644
index 000000000..37ce86589
--- /dev/null
+++ b/content/en/methods/page/Summary.md
@@ -0,0 +1,29 @@
+---
+title: Summary
+description: Returns the content summary of the given page.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/Truncated
+ - methods/page/Description
+ returnType: template.HTML
+ signatures: [PAGE.Summary]
+---
+
+There are three ways to define the [content summary]:
+
+1. Let Hugo create the summary based on the first 70 words. You can change the number of words by setting the `summaryLength` in your site configuration.
+2. Manually split the content with a `<--more-->` tag in markdown. Everything before the tag is included in the summary.
+3. Create a `summary` field in front matter.
+
+To list the pages in a section with a summary beneath each link:
+
+```go-html-template
+{{ range .Pages }}
+
+```
diff --git a/content/en/methods/page/Truncated.md b/content/en/methods/page/Truncated.md
new file mode 100644
index 000000000..e6051f0cd
--- /dev/null
+++ b/content/en/methods/page/Truncated.md
@@ -0,0 +1,35 @@
+---
+title: Truncated
+description: Reports whether the content length exceeds the summary length.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/Summary
+ returnType: bool
+ signatures: [PAGE.Truncated]
+---
+
+There are three ways to define the [content summary]:
+
+1. Let Hugo create the summary based on the first 70 words. You can change the number of words by setting the `summaryLength` in your site configuration.
+2. Manually split the content with a `<--more-->` tag in markdown. Everything before the tag is included in the summary.
+3. Create a `summary` field in front matter.
+
+{{% note %}}
+The `Truncated` method returns `false` if you define the summary in front matter.
+{{% /note %}}
+
+The `Truncated` method returns `true` if the content length exceeds the summary length. This is useful for rendering a "read more" link:
+
+```go-html-template
+{{ range .Pages }}
+
+ {{ .Summary }}
+ {{ if .Truncated }}
+ Read more...
+ {{ end }}
+{{ end }}
+```
+
+[content summary]: /content-management/summaries
diff --git a/content/en/methods/page/Type.md b/content/en/methods/page/Type.md
new file mode 100644
index 000000000..d504bc8b8
--- /dev/null
+++ b/content/en/methods/page/Type.md
@@ -0,0 +1,56 @@
+---
+title: Type
+description: Returns the content type of the given page.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/Kind
+ - methods/page/Layout
+ - methods/page/Type
+ returnType: string
+ signatures: [PAGE.Type]
+---
+
+The `Type` method on a `Page` object returns the [content type] of the given page. The content type is defined by the `type` field in front matter, or inferred from the top-level directory name if the `type` field in front matter is not defined.
+
+With this content structure:
+
+```text
+content/
+├── auction/
+│ ├── _index.md
+│ ├── item-1.md
+│ └── item-2.md <-- front matter: type = books
+├── books/
+│ ├── _index.md
+│ ├── book-1.md
+│ └── book-2.md
+├── films/
+│ ├── _index.md
+│ ├── film-1.md
+│ └── film-2.md
+└── _index.md
+```
+
+To list the books, regardless of [section]:
+
+```go-html-template
+{{ range where .Site.RegularPages.ByTitle "Type" "books" }}
+
+```
+
+The `type` field in front matter is also useful for targeting a template. See [details].
+
+[content type]: /getting-started/glossary/#content-type
+[details]: /templates/lookup-order/#target-a-template
+[section]: /getting-started/glossary/#section
diff --git a/content/en/methods/page/Weight.md b/content/en/methods/page/Weight.md
new file mode 100644
index 000000000..75c75db86
--- /dev/null
+++ b/content/en/methods/page/Weight.md
@@ -0,0 +1,27 @@
+---
+title: Weight
+description: Returns the weight of the given page as defined in front matter.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: int
+ signatures: [PAGE.Weight]
+---
+
+The `Weight` method on a `Page` object returns the [weight] of the given page as defined in front matter.
+
+[weight]: /getting-started/glossary/#weight
+
+{{< code-toggle file=content/recipes/sushi.md fm=true >}}
+title = 'How to make spicy tuna hand rolls'
+weight = 42
+{{< /code-toggle >}}
+
+Page weight controls the position of a page within a collection that is sorted by weight. Assign weights using non-zero integers. Lighter items float to the top, while heavier items sink to the bottom. Unweighted or zero-weighted elements are placed at the end of the collection.
+
+Although rarely used within a template, you can access the value with:
+
+```go-html-template
+{{ .Weight }} → 42
+```
diff --git a/content/en/methods/page/WordCount.md b/content/en/methods/page/WordCount.md
new file mode 100644
index 000000000..bb1fdcf94
--- /dev/null
+++ b/content/en/methods/page/WordCount.md
@@ -0,0 +1,20 @@
+---
+title: WordCount
+description: Returns the number of words in the content of the given page.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/FuzzyWordCount
+ - methods/page/ReadingTime
+ returnType: int
+ signatures: [PAGE.WordCount]
+---
+
+```go-html-template
+{{ .WordCount }} → 103
+```
+
+To round up to nearest multiple of 100, use the [`FuzzyWordCount`] method.
+
+[`FuzzyWordCount`]: /methods/page/fuzzywordcount
diff --git a/content/en/methods/page/_common/_index.md b/content/en/methods/page/_common/_index.md
new file mode 100644
index 000000000..47d5812fb
--- /dev/null
+++ b/content/en/methods/page/_common/_index.md
@@ -0,0 +1,13 @@
+---
+cascade:
+ _build:
+ list: never
+ publishResources: false
+ render: never
+---
+
+
diff --git a/content/en/methods/page/_common/definition-of-section.md b/content/en/methods/page/_common/definition-of-section.md
new file mode 100644
index 000000000..7dc600789
--- /dev/null
+++ b/content/en/methods/page/_common/definition-of-section.md
@@ -0,0 +1,5 @@
+---
+# Do not remove front matter.
+---
+
+A _section_ is a top-level content directory, or any content directory with an _index.md file.
diff --git a/content/en/methods/page/_common/output-format-definition.md b/content/en/methods/page/_common/output-format-definition.md
new file mode 100644
index 000000000..25944464a
--- /dev/null
+++ b/content/en/methods/page/_common/output-format-definition.md
@@ -0,0 +1,11 @@
+---
+# Do not remove front matter.
+---
+
+Hugo generates one or more files per page when building a site. For example, when rendering home, [section], [taxonomy], and [term] pages, Hugo generates an HTML file and an RSS file. Both HTML and RSS are built-in _output formats_. Create multiple output formats, and control generation based on [page kind], or by enabling one or more output formats for one or more pages. See [details].
+
+[section]: /getting-started/glossary/#section
+[taxonomy]: /getting-started/glossary/#taxonomy
+[term]: /getting-started/glossary/#term
+[page kind]: /getting-started/glossary/#page-kind
+[details]: /templates/output-formats
diff --git a/content/en/methods/page/_common/output-format-methods.md b/content/en/methods/page/_common/output-format-methods.md
new file mode 100644
index 000000000..5e7111fe5
--- /dev/null
+++ b/content/en/methods/page/_common/output-format-methods.md
@@ -0,0 +1,27 @@
+---
+# Do not remove front matter.
+---
+
+Get IDENTIFIER
+: (`any`) Returns the `OutputFormat` object with the given identifier.
+
+MediaType
+: (`media.Type`) Returns the media type of the output format.
+
+MediaType.MainType
+: (`string`) Returns the main type of the output format's media type.
+
+MediaType.SubType
+: (`string`) Returns the subtype of the current format's media type.
+
+Name
+: (`string`) Returns the output identifier of the output format.
+
+Permalink
+: (`string`) Returns the permalink of the page generated by the current output format.
+
+Rel
+: (`string`) Returns the `rel` value of the output format, either the default or as defined in the site configuration.
+
+RelPermalink
+: (`string`) Returns the relative permalink of the page generated by the current output format.
diff --git a/content/en/methods/page/_common/scratch-methods.md b/content/en/methods/page/_common/scratch-methods.md
new file mode 100644
index 000000000..c09b4aadc
--- /dev/null
+++ b/content/en/methods/page/_common/scratch-methods.md
@@ -0,0 +1,79 @@
+---
+# Do not remove front matter.
+---
+
+## Methods
+
+Set
+: Sets the value of a given key.
+
+```go-html-template
+{{ .Scratch.Set "greeting" "Hello" }}
+```
+
+Get
+: Gets the value of a given key.
+
+```go-html-template
+{{ .Scratch.Set "greeting" "Hello" }}
+{{ .Scratch.Get "greeting" }} → Hello
+```
+
+Add
+: Adds a given value to existing value(s) of the given key.
+
+: For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the following adds will be appended to that list.
+
+```go-html-template
+{{ .Scratch.Set "greeting" "Hello" }}
+{{ .Scratch.Add "greeting" "Welcome" }}
+{{ .Scratch.Get "greeting" }} → HelloWelcome
+```
+
+```go-html-template
+{{ .Scratch.Set "total" 3 }}
+{{ .Scratch.Add "total" 7 }}
+{{ .Scratch.Get "total" }} → 10
+```
+
+```go-html-template
+{{ .Scratch.Set "greetings" (slice "Hello") }}
+{{ .Scratch.Add "greetings" (slice "Welcome" "Cheers") }}
+{{ .Scratch.Get "greetings" }} → [Hello Welcome Cheers]
+```
+
+SetInMap
+: Takes a `key`, `mapKey` and `value` and adds a map of `mapKey` and `value` to the given `key`.
+
+```go-html-template
+{{ .Scratch.SetInMap "greetings" "english" "Hello" }}
+{{ .Scratch.SetInMap "greetings" "french" "Bonjour" }}
+{{ .Scratch.Get "greetings" }} → map[english:Hello french:Bonjour]
+```
+
+DeleteInMap
+: Takes a `key` and `mapKey` and removes the map of `mapKey` from the given `key`.
+
+```go-html-template
+{{ .Scratch.SetInMap "greetings" "english" "Hello" }}
+{{ .Scratch.SetInMap "greetings" "french" "Bonjour" }}
+{{ .Scratch.DeleteInMap "greetings" "english" }}
+{{ .Scratch.Get "greetings" }} → map[french:Bonjour]
+```
+
+GetSortedMapValues
+: Returns an array of values from `key` sorted by `mapKey`.
+
+```go-html-template
+{{ .Scratch.SetInMap "greetings" "english" "Hello" }}
+{{ .Scratch.SetInMap "greetings" "french" "Bonjour" }}
+{{ .Scratch.GetSortedMapValues "greetings" }} → [Hello Bonjour]
+```
+
+Delete
+: Removes the given key.
+
+```go-html-template
+{{ .Scratch.Set "greeting" "Hello" }}
+{{ .Scratch.Delete "greeting" }}
+```
diff --git a/content/en/methods/page/_index.md b/content/en/methods/page/_index.md
new file mode 100644
index 000000000..278541c5a
--- /dev/null
+++ b/content/en/methods/page/_index.md
@@ -0,0 +1,12 @@
+---
+title: Page methods
+linkTitle: Page
+description: Use these methods with a Page object.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: methods
+---
+
+Use these methods with a Page object.
diff --git a/content/en/methods/pages/ByDate.md b/content/en/methods/pages/ByDate.md
new file mode 100644
index 000000000..41d9b7da7
--- /dev/null
+++ b/content/en/methods/pages/ByDate.md
@@ -0,0 +1,31 @@
+---
+title: ByDate
+description: Returns the given page collection sorted by date in ascending order.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/pages/ByExpiryDate
+ - methods/pages/ByLastMod
+ - methods/pages/ByPublishDate
+ returnType: page.Pages
+ signatures: [PAGES.ByDate]
+---
+
+When sorting by date, the value is determined by your [site configuration], defaulting to the `date` field in front matter.
+
+[site configuration]: /getting-started/configuration/#configure-dates
+
+```go-html-template
+{{ range .Pages.ByDate }}
+
+{{ end }}
+```
diff --git a/content/en/methods/pages/ByExpiryDate.md b/content/en/methods/pages/ByExpiryDate.md
new file mode 100644
index 000000000..cec8f975c
--- /dev/null
+++ b/content/en/methods/pages/ByExpiryDate.md
@@ -0,0 +1,31 @@
+---
+title: ByExpiryDate
+description: Returns the given page collection sorted by expiration date in ascending order.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/pages/ByDate
+ - methods/pages/ByLastMod
+ - methods/pages/ByPublishDate
+ returnType: page.Pages
+ signatures: [PAGES.ByExpiryDate]
+---
+
+When sorting by expiration date, the value is determined by your [site configuration], defaulting to the `expiryDate` field in front matter.
+
+[site configuration]: /getting-started/configuration/#configure-dates
+
+```go-html-template
+{{ range .Pages.ByExpiryDate }}
+
+{{ end }}
+```
diff --git a/content/en/methods/pages/ByLastmod.md b/content/en/methods/pages/ByLastmod.md
new file mode 100644
index 000000000..3c5a0347f
--- /dev/null
+++ b/content/en/methods/pages/ByLastmod.md
@@ -0,0 +1,31 @@
+---
+title: ByLastmod
+description: Returns the given page collection sorted by last modification date in ascending order.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/pages/ByDate
+ - methods/pages/ByExpiryDate
+ - methods/pages/ByPublishDate
+ returnType: page.Pages
+ signatures: [PAGES.ByLastmod]
+---
+
+When sorting by last modification date, the value is determined by your [site configuration], defaulting to the `lastmod` field in front matter.
+
+[site configuration]: /getting-started/configuration/#configure-dates
+
+```go-html-template
+{{ range .Pages.ByLastmod }}
+
+{{ end }}
+```
diff --git a/content/en/methods/pages/ByLinkTitle.md b/content/en/methods/pages/ByLinkTitle.md
new file mode 100644
index 000000000..073b1e1ba
--- /dev/null
+++ b/content/en/methods/pages/ByLinkTitle.md
@@ -0,0 +1,26 @@
+---
+title: ByLinkTitle
+description: Returns the given page collection sorted by link title in ascending order, falling back to title if link title is not defined.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/pages/ByTitle
+ - methods/pages/ByParam
+ returnType: page.Pages
+ signatures: [PAGES.ByLinkTitle]
+---
+
+```go-html-template
+{{ range .Pages.ByLinkTitle }}
+
+{{ end }}
+```
diff --git a/content/en/methods/pages/ByParam.md b/content/en/methods/pages/ByParam.md
new file mode 100644
index 000000000..0fb9b48c0
--- /dev/null
+++ b/content/en/methods/pages/ByParam.md
@@ -0,0 +1,36 @@
+---
+title: ByParam
+description: Returns the given page collection sorted by the given parameter in ascending order.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/pages/ByTitle
+ - methods/pages/ByLinkTitle
+ returnType: page.Pages
+ signatures: [PAGES.ByParam PARAM]
+---
+
+If the given parameter is not present in front matter, Hugo will use the matching parameter in your site configuration if present.
+
+```go-html-template
+{{ range .Pages.ByParam "author" }}
+
+{{ end }}
+```
+
+If the targeted parameter is nested, access the field using dot notation:
+
+```go-html-template
+{{ range .Pages.ByParam "author.last_name" }}
+
+{{ end }}
+```
diff --git a/content/en/methods/pages/ByPublishDate.md b/content/en/methods/pages/ByPublishDate.md
new file mode 100644
index 000000000..b7d026f5f
--- /dev/null
+++ b/content/en/methods/pages/ByPublishDate.md
@@ -0,0 +1,31 @@
+---
+title: ByPublishDate
+description: Returns the given page collection sorted by publish date in ascending order.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/pages/ByDate
+ - methods/pages/ByExpiryDate
+ - methods/pages/ByLastMod
+ returnType: page.Pages
+ signatures: [PAGES.ByPublishDate]
+---
+
+When sorting by publish date, the value is determined by your [site configuration], defaulting to the `publishDate` field in front matter.
+
+[site configuration]: /getting-started/configuration/#configure-dates
+
+```go-html-template
+{{ range .Pages.ByPublishDate }}
+
+{{ end }}
+```
diff --git a/content/en/methods/pages/ByWeight.md b/content/en/methods/pages/ByWeight.md
new file mode 100644
index 000000000..1e4de8e80
--- /dev/null
+++ b/content/en/methods/pages/ByWeight.md
@@ -0,0 +1,28 @@
+---
+title: ByWeight
+description: Returns the given page collection sorted by weight in ascending order.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: page.Pages
+ signatures: [PAGES.ByWeight]
+---
+
+Assign a [weight] to a page using the `weight` field in front matter. The weight must be a non-zero integer. Lighter items float to the top, while heavier items sink to the bottom. Unweighted or zero-weighted pages are placed at the end of the collection.
+
+[weight]: /getting-started/glossary/#weight
+
+```go-html-template
+{{ range .Pages.ByWeight }}
+
+{{ end }}
+```
diff --git a/content/en/methods/pages/GroupByDate.md b/content/en/methods/pages/GroupByDate.md
new file mode 100644
index 000000000..aa77f5881
--- /dev/null
+++ b/content/en/methods/pages/GroupByDate.md
@@ -0,0 +1,68 @@
+---
+title: GroupByDate
+description: Returns the given page collection grouped by date in descending order.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/pages/GroupByExpiryDate
+ - methods/pages/GroupByLastMod
+ - methods/pages/GroupByParamDate
+ - methods/pages/GroupByPublishDate
+ returnType: page.PagesGroup
+ signatures: ['PAGES.GroupByDate LAYOUT [SORT]']
+---
+
+When grouping by date, the value is determined by your [site configuration], defaulting to the `date` field in front matter.
+
+The [layout string] has the same format as the layout string for the [`time.Format`] function. The resulting group key is [localized] for language and region.
+
+[`time.Format`]: /functions/time/format/
+[layout string]: #layout-string
+[localized]: /getting-started/glossary/#localization
+[site configuration]: /getting-started/configuration/#configure-dates
+
+{{% include "methods/pages/_common/group-sort-order.md" %}}
+
+To group content by year and month:
+
+```go-html-template
+{{ range .Pages.GroupByDate "January 2006" }}
+
+{{ end }}
+```
+
+The pages within each group will also be sorted by date, either ascending or descending depending on the grouping option. To sort the pages within each group, use one of the sorting methods. For example, to sort the pages within each group by title:
+
+```go-html-template
+{{ range .Pages.GroupByDate "January 2006" }}
+
+{{ end }}
+```
+
+## Layout string
+
+{{% include "functions/_common/time-layout-string.md" %}}
diff --git a/content/en/methods/pages/GroupByExpiryDate.md b/content/en/methods/pages/GroupByExpiryDate.md
new file mode 100644
index 000000000..d398be775
--- /dev/null
+++ b/content/en/methods/pages/GroupByExpiryDate.md
@@ -0,0 +1,68 @@
+---
+title: GroupByExpiryDate
+description: Returns the given page collection grouped by expiration date in descending order.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/pages/GroupByDate
+ - methods/pages/GroupByLastMod
+ - methods/pages/GroupByParamDate
+ - methods/pages/GroupByPublishDate
+ returnType: page.PagesGroup
+ signatures: ['PAGES.GroupByExpiryDate LAYOUT [SORT]']
+---
+
+When grouping by expiration date, the value is determined by your [site configuration], defaulting to the `expiryDate` field in front matter.
+
+The [layout string] has the same format as the layout string for the [`time.Format`] function. The resulting group key is [localized] for language and region.
+
+[`time.Format`]: /functions/time/format/
+[layout string]: #layout-string
+[localized]: /getting-started/glossary/#localization
+[site configuration]: /getting-started/configuration/#configure-dates
+
+{{% include "methods/pages/_common/group-sort-order.md" %}}
+
+To group content by year and month:
+
+```go-html-template
+{{ range .Pages.GroupByExpiryDate "January 2006" }}
+
+{{ end }}
+```
+
+The pages within each group will also be sorted by expiration date, either ascending or descending depending on your grouping option. To sort the pages within each group, use one of the sorting methods. For example, to sort the pages within each group by title:
+
+```go-html-template
+{{ range .Pages.GroupByExpiryDate "January 2006" }}
+
+{{ end }}
+```
+
+## Layout string
+
+{{% include "functions/_common/time-layout-string.md" %}}
diff --git a/content/en/methods/pages/GroupByLastmod.md b/content/en/methods/pages/GroupByLastmod.md
new file mode 100644
index 000000000..30f1431f7
--- /dev/null
+++ b/content/en/methods/pages/GroupByLastmod.md
@@ -0,0 +1,68 @@
+---
+title: GroupByLastmod
+description: Returns the given page collection grouped by last modification date in descending order.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/pages/GroupByDate
+ - methods/pages/GroupByExpiryDate
+ - methods/pages/GroupByParamDate
+ - methods/pages/GroupByPublishDate
+ returnType: page.PagesGroup
+ signatures: ['PAGES.GroupByLastmod LAYOUT [SORT]']
+---
+
+When grouping by last modification date, the value is determined by your [site configuration], defaulting to the `lastmod` field in front matter.
+
+The [layout string] has the same format as the layout string for the [`time.Format`] function. The resulting group key is [localized] for language and region.
+
+[`time.Format`]: /functions/time/format/
+[layout string]: #layout-string
+[localized]: /getting-started/glossary/#localization
+[site configuration]: /getting-started/configuration/#configure-dates
+
+{{% include "methods/pages/_common/group-sort-order.md" %}}
+
+To group content by year and month:
+
+```go-html-template
+{{ range .Pages.GroupByLastmod "January 2006" }}
+
+{{ end }}
+```
+
+The pages within each group will also be sorted by last modification date, either ascending or descending depending on your grouping option. To sort the pages within each group, use one of the sorting methods. For example, to sort the pages within each group by title:
+
+```go-html-template
+{{ range .Pages.GroupByLastmod "January 2006" }}
+
+{{ end }}
+```
diff --git a/content/en/methods/pages/GroupByParamDate.md b/content/en/methods/pages/GroupByParamDate.md
new file mode 100644
index 000000000..03642fcbe
--- /dev/null
+++ b/content/en/methods/pages/GroupByParamDate.md
@@ -0,0 +1,65 @@
+---
+title: GroupByParamDate
+description: Returns the given page collection grouped by the given date parameter in descending order.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/pages/GroupByDate
+ - methods/pages/GroupByExpiryDate
+ - methods/pages/GroupByLastMod
+ - methods/pages/GroupByPublishDate
+ returnType: page.PagesGroup
+ signatures: ['PAGES.GroupByParamDate PARAM LAYOUT [SORT]']
+---
+
+The [layout string] has the same format as the layout string for the [`time.Format`] function. The resulting group key is [localized] for language and region.
+
+[`time.Format`]: /functions/time/format/
+[layout string]: #layout-string
+[localized]: /getting-started/glossary/#localization
+
+{{% include "methods/pages/_common/group-sort-order.md" %}}
+
+To group content by year and month:
+
+```go-html-template
+{{ range .Pages.GroupByParamDate "eventDate" "January 2006" }}
+
+{{ end }}
+```
+
+To sort the groups in ascending order:
+
+```go-html-template
+{{ range .Pages.GroupByParamDate "eventDate" "January 2006" "asc" }}
+
+{{ end }}
+```
+
+The pages within each group will also be sorted by the parameter date, either ascending or descending depending on your grouping option. To sort the pages within each group, use one of the sorting methods. For example, to sort the pages within each group by title:
+
+```go-html-template
+{{ range .Pages.GroupByParamDate "eventDate" "January 2006" }}
+
+{{ end }}
+```
+
+## Layout string
+
+{{% include "functions/_common/time-layout-string.md" %}}
diff --git a/content/en/methods/pages/GroupByPublishDate.md b/content/en/methods/pages/GroupByPublishDate.md
new file mode 100644
index 000000000..9264ecae2
--- /dev/null
+++ b/content/en/methods/pages/GroupByPublishDate.md
@@ -0,0 +1,68 @@
+---
+title: GroupByPublishDate
+description: Returns the given page collection grouped by publish date in descending order.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/pages/GroupByDate
+ - methods/pages/GroupByExpiryDate
+ - methods/pages/GroupByLastMod
+ - methods/pages/GroupByParamDate
+ returnType: page.PagesGroup
+ signatures: ['PAGES.GroupByPublishDate LAYOUT [SORT]']
+---
+
+When grouping by publish date, the value is determined by your [site configuration], defaulting to the `publishDate` field in front matter.
+
+The [layout string] has the same format as the layout string for the [`time.Format`] function. The resulting group key is [localized] for language and region.
+
+[`time.Format`]: /functions/time/format/
+[layout string]: #layout-string
+[localized]: /getting-started/glossary/#localization
+[site configuration]: /getting-started/configuration/#configure-dates
+
+{{% include "methods/pages/_common/group-sort-order.md" %}}
+
+To group content by year and month:
+
+```go-html-template
+{{ range .Pages.GroupByPublishDate "January 2006" }}
+
+{{ end }}
+```
+
+The pages within each group will also be sorted by publish date, either ascending or descending depending on your grouping option. To sort the pages within each group, use one of the sorting methods. For example, to sort the pages within each group by title:
+
+```go-html-template
+{{ range .Pages.GroupByPublishDate "January 2006" }}
+
+{{ end }}
+```
diff --git a/content/en/methods/pages/Next.md b/content/en/methods/pages/Next.md
new file mode 100644
index 000000000..638822e5d
--- /dev/null
+++ b/content/en/methods/pages/Next.md
@@ -0,0 +1,55 @@
+---
+title: Next
+description: Returns the next page in a local page collection, relative to the given page.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/pages/Prev
+ - methods/page/Next
+ - methods/page/NextInSection
+ - methods/page/Prev
+ - methods/page/PrevInSection
+ returnType: hugolib.pageState
+ signatures: [PAGES.Next PAGE]
+toc: true
+---
+
+The behavior of the `Prev` and `Next` methods on a `Pages` objects is probably the reverse of what you expect.
+
+With this content structure and the page collection sorted by weight in ascending order:
+
+```text
+content/
+├── pages/
+│ ├── _index.md
+│ ├── page-1.md <-- front matter: weight = 10
+│ ├── page-2.md <-- front matter: weight = 20
+│ └── page-3.md <-- front matter: weight = 30
+└── _index.md
+```
+
+When you visit page-2:
+
+- The `Prev` method points to page-3
+- The `Next` method points to page-1
+
+{{% note %}}
+Use the opposite label in your navigation links as shown in the example below.
+{{% /note %}}
+
+```go-html-template
+{{ $pages := where .Site.RegularPages.ByWeight "Section" "pages" }}
+
+{{ with $pages.Next . }}
+ Previous
+{{ end }}
+
+{{ with $pages.Prev . }}
+ Next
+{{ end }}
+```
+
+## Compare to Page methods
+
+{{% include "methods/_common/next-prev-on-page-vs-next-prev-on-pages.md" %}}
diff --git a/content/en/methods/pages/Prev.md b/content/en/methods/pages/Prev.md
new file mode 100644
index 000000000..3a4dcfd1d
--- /dev/null
+++ b/content/en/methods/pages/Prev.md
@@ -0,0 +1,55 @@
+---
+title: Prev
+description: Returns the previous page in a local page collection, relative to the given page.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/pages/Next
+ - methods/page/Next
+ - methods/page/NextInSection
+ - methods/page/Prev
+ - methods/page/PrevInSection
+ returnType: hugolib.pageStates
+ signatures: [PAGES.Prev PAGE]
+toc: true
+---
+
+The behavior of the `Prev` and `Next` methods on a `Pages` objects is probably the reverse of what you expect.
+
+With this content structure and the page collection sorted by weight in ascending order:
+
+```text
+content/
+├── pages/
+│ ├── _index.md
+│ ├── page-1.md <-- front matter: weight = 10
+│ ├── page-2.md <-- front matter: weight = 20
+│ └── page-3.md <-- front matter: weight = 30
+└── _index.md
+```
+
+When you visit page-2:
+
+- The `Prev` method points to page-3
+- The `Next` method points to page-1
+
+{{% note %}}
+Use the opposite label in your navigation links as shown in the example below.
+{{% /note %}}
+
+```go-html-template
+{{ $pages := where .Site.RegularPages.ByWeight "Section" "pages" }}
+
+{{ with $pages.Next . }}
+ Previous
+{{ end }}
+
+{{ with $pages.Prev . }}
+ Next
+{{ end }}
+```
+
+## Compare to Page methods
+
+{{% include "methods/_common/next-prev-on-page-vs-next-prev-on-pages.md" %}}
diff --git a/content/en/methods/pages/Related.md b/content/en/methods/pages/Related.md
new file mode 100644
index 000000000..60ca4ca67
--- /dev/null
+++ b/content/en/methods/pages/Related.md
@@ -0,0 +1,77 @@
+---
+title: Related
+description: Returns a collection of pages related to the given page.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/HeadingsFiltered
+ - functions/collections/KeyVals
+ returnType: page.Pages
+ signatures: [PAGES.Related PAGE/OPTIONS]
+---
+
+Based on front matter, Hugo uses several factors to identify content related to the given page. Use the default [related content configuration], or tune the results to the desired indices and parameters. See [details].
+
+The argument passed to the `Related` method may be a `Page` or an options map. For example, to pass the current page:
+
+{{< code file="layouts/_default/single.html" lang=go-html-template copy=false >}}
+{{ with .Site.RegularPages.Related . | first 5 }}
+
+{{ end }}
+{{< /code >}}
+
+
+## Options
+
+indices
+: (`slice`) The indices to search within.
+
+document
+: (`page`) The page for which to find related content. Required when specifying an options map.
+
+namedSlices
+: (`slice`) The keywords to search for, expressed as a slice of `KeyValues` using the [`keyVals`] function.
+
+[`keyVals`]: /functions/collections/keyvals/
+
+fragments
+: (`slice`) A list of special keywords that is used for indices configured as type "fragments". This will match the [fragment] identifiers of the documents.
+
+A contrived example using all of the above:
+
+```go-html-template
+{{ $page := . }}
+{{ $opts := dict
+ "indices" (slice "tags" "keywords")
+ "document" $page
+ "namedSlices" (slice (keyVals "tags" "hugo" "rocks") (keyVals "date" $page.Date))
+ "fragments" (slice "heading-1" "heading-2")
+}}
+```
+
+[details]: /content-management/related/
+[fragment]: /getting-started/glossary/#fragment
+[related content configuration]: /content-management/related/
diff --git a/content/en/methods/pages/Reverse.md b/content/en/methods/pages/Reverse.md
new file mode 100644
index 000000000..b54cf451e
--- /dev/null
+++ b/content/en/methods/pages/Reverse.md
@@ -0,0 +1,16 @@
+---
+title: Reverse
+description: Returns the given page collection in reverse order.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: page.Pages
+ signatures: [PAGES.Reverse]
+---
+
+```go-html-template
+{{ range .Pages.ByDate.Reverse }}
+
+{{ end }}
+```
diff --git a/content/en/methods/pages/_common/_index.md b/content/en/methods/pages/_common/_index.md
new file mode 100644
index 000000000..47d5812fb
--- /dev/null
+++ b/content/en/methods/pages/_common/_index.md
@@ -0,0 +1,13 @@
+---
+cascade:
+ _build:
+ list: never
+ publishResources: false
+ render: never
+---
+
+
diff --git a/content/en/methods/pages/_common/group-sort-order.md b/content/en/methods/pages/_common/group-sort-order.md
new file mode 100644
index 000000000..bb5be82f6
--- /dev/null
+++ b/content/en/methods/pages/_common/group-sort-order.md
@@ -0,0 +1,5 @@
+---
+# Do not remove front matter.
+---
+
+For the optional sort order, specify either `asc` for ascending order, or `desc` for descending order.
diff --git a/content/en/methods/pages/_index.md b/content/en/methods/pages/_index.md
new file mode 100644
index 000000000..d8a64f5d5
--- /dev/null
+++ b/content/en/methods/pages/_index.md
@@ -0,0 +1,13 @@
+---
+title: Pages methods
+linkTitle: Pages
+description: Use these methods with a collection of Page objects.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: methods
+aliases: [/variables/pages]
+---
+
+Use these methods with a collection of Page objects.
diff --git a/content/en/methods/resource/Colors.md b/content/en/methods/resource/Colors.md
new file mode 100644
index 000000000..9eca058fe
--- /dev/null
+++ b/content/en/methods/resource/Colors.md
@@ -0,0 +1,20 @@
+---
+title: Colors
+description: Applicable to images, returns a slice of the most dominant colors using a simple histogram method.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: '[]string'
+ signatures: [RESOURCE.Colors]
+---
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+ {{ .Colors }} → [#bebebd #514947 #768a9a #647789 #90725e #a48974]
+{{ end }}
+```
+
+This method is fast, but if you also scale down your images, it would be good for performance to extract the colors from the scaled image.
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
diff --git a/content/en/methods/resource/Content.md b/content/en/methods/resource/Content.md
new file mode 100644
index 000000000..f51abd327
--- /dev/null
+++ b/content/en/methods/resource/Content.md
@@ -0,0 +1,61 @@
+---
+title: Content
+description: Returns the content of the given resource.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: any
+ signatures: [RESOURCE.Content]
+toc:
+---
+
+The `Content` method on a `Resource` object returns `template.HTML` when the resource type is `page`, otherwise it returns a `string`.
+
+[resource type]: /methods/resource/resourcetype
+
+{{< code file="assets/quotations/kipling.txt" >}}
+He travels the fastest who travels alone.
+{{< /code >}}
+
+To get the content:
+
+```go-html-template
+{{ with resources.Get "quotations/kipling.txt" }}
+ {{ .Content }} → He travels the fastest who travels alone.
+{{ end }}
+```
+
+To get the size in bytes:
+
+```go-html-template
+{{ with resources.Get "quotations/kipling.txt" }}
+ {{ .Content | len }} → 42
+{{ end }}
+```
+
+To create an inline image:
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+
+{{ end }}
+```
+
+To create inline CSS:
+
+```go-html-template
+{{ with resources.Get "css/style.css" }}
+
+{{ end }}
+```
+
+To create inline JavaScript:
+
+```go-html-template
+{{ with resources.Get "js/script.js" }}
+
+{{ end }}
+```
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
diff --git a/content/en/methods/resource/Crop.md b/content/en/methods/resource/Crop.md
new file mode 100644
index 000000000..711fc07b0
--- /dev/null
+++ b/content/en/methods/resource/Crop.md
@@ -0,0 +1,48 @@
+---
+title: Crop
+description: Applicable to images, returns an image resource cropped to the given dimensions without resizing.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/resource/Fit
+ - methods/resource/Fill
+ - methods/resource/Resize
+ - methods/resource/Process
+ - functions/images/Process
+ returnType: images.ImageResource
+ signatures: [RESOURCE.Crop SPEC]
+toc: true
+---
+
+Crop an image to match the given dimensions without resizing. You must provide both width and height.
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with .Crop "200x200" }}
+
+ {{ end }}
+{{ end }}
+```
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
+
+{{% include "/methods/resource/_common/processing-spec.md" %}}
+
+## Example
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with .Crop "200x200 topright webp q85 lanczos" }}
+
+ {{ end }}
+{{ end }}
+```
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Process"
+ filterArgs="crop 200x200 topright webp q85 lanczos"
+ example=true
+>}}
diff --git a/content/en/methods/resource/Data.md b/content/en/methods/resource/Data.md
new file mode 100644
index 000000000..0fbaf6199
--- /dev/null
+++ b/content/en/methods/resource/Data.md
@@ -0,0 +1,53 @@
+---
+title: Data
+description: Applicable to resources returned by the resources.GetRemote function, returns information from the HTTP response.
+categories: []
+keywords: []
+action:
+ related:
+ - functions/resources/GetRemote
+ - methods/resource/Err
+ returnType: map
+ signatures: [RESOURCE.Data]
+---
+
+The `Data` method on a resource returned by the [`resources.GetRemote`] function returns information from the HTTP response.
+
+[`resources.GetRemote`]: functions/resources/getremote
+
+```go-html-template
+{{ $url := "https://example.org/images/a.jpg" }}
+{{ with resources.GetRemote $url }}
+ {{ with .Err }}
+ {{ errorf "%s" . }}
+ {{ else }}
+ {{ with .Data }}
+ {{ .ContentLength }} → 42764
+ {{ .ContentType }} → image/jpeg
+ {{ .Status }} → 200 OK
+ {{ .StatusCode }} → 200
+ {{ .TransferEncoding }} → []
+ {{ end }}
+ {{ end }}
+{{ else }}
+ {{ errorf "Unable to get remote resource %q" $url }}
+{{ end }}
+```
+
+ContentLength
+: (`int`) The content length in bytes.
+
+ContentType
+: (`string`) The content type.
+
+Status
+: (`string`) The HTTP status text.
+
+StatusCode
+: (`int`) The HTTP status code.
+
+TransferEncoding
+: (`string`) The transfer encoding.
+
+
+[`resources.GetRemote`]: functions/resources/getremote
diff --git a/content/en/methods/resource/Err.md b/content/en/methods/resource/Err.md
new file mode 100644
index 000000000..f4b410aa7
--- /dev/null
+++ b/content/en/methods/resource/Err.md
@@ -0,0 +1,56 @@
+---
+title: Err
+description: Applicable to resources returned by the resources.GetRemote function, returns an error message if the HTTP request fails, else nil.
+categories: []
+keywords: []
+action:
+ related:
+ - functions/resources/GetRemote
+ - methods/resource/Data
+ returnType: resource.resourceError
+ signatures: [RESOURCE.Err]
+---
+
+The `Err` method on a resource returned by the [`resources.GetRemote`] function returns an error message if the HTTP request fails, else nil. If you do not handle the error yourself, Hugo will fail the build.
+
+[`resources.GetRemote`]: functions/resources/getremote
+
+In this example we send an HTTP request to a nonexistent domain:
+
+```go-html-template
+{{ $url := "https://broken-example.org/images/a.jpg" }}
+{{ with resources.GetRemote $url }}
+ {{ with .Err }}
+ {{ errorf "%s" . }}
+ {{ else }}
+
+ {{ end }}
+{{ else }}
+ {{ errorf "Unable to get remote resource %q" $url }}
+{{ end }}
+```
+
+The code above captures the error from the HTTP request, then fails the build:
+
+```text
+ERROR error calling resources.GetRemote: Get "https://broken-example.org/images/a.jpg": dial tcp: lookup broken-example.org on 127.0.0.53:53: no such host
+```
+
+To log an error as a warning instead of an error:
+
+```go-html-template
+{{ $url := "https://broken-example.org/images/a.jpg" }}
+{{ with resources.GetRemote $url }}
+ {{ with .Err }}
+ {{ warnf "%s" . }}
+ {{ else }}
+
+ {{ end }}
+{{ else }}
+ {{ errorf "Unable to get remote resource %q" $url }}
+{{ end }}
+```
+
+{{% note %}}
+An HTTP response with a 404 status code is not an HTTP request error. To handle 404 status codes, code defensively using the nested `with-else-end` construct as shown above.
+{{% /note %}}
diff --git a/content/en/methods/resource/Exif.md b/content/en/methods/resource/Exif.md
new file mode 100644
index 000000000..bf18efd50
--- /dev/null
+++ b/content/en/methods/resource/Exif.md
@@ -0,0 +1,78 @@
+---
+title: Exif
+description: Applicable to images, returns an EXIF object containing image metatdata.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: exif.ExifInfo
+ signatures: [RESOURCE.Exif]
+toc: true
+---
+
+Applicable to images, the `Exif` method on an image `Resource` object returns an [EXIF] object containing image metatdata.
+
+## Methods
+
+Date
+: (`time.Time`) Returns the image creation date/time. Format with the [`time.Format`]function.
+
+Lat
+: (`float64`) Returns the GPS latitude in degrees.
+
+Long
+: (`float64`) Returns the GPS longitude in degrees.
+
+Tags
+: (`exif.Tags`) Returns a collection of the available EXIF tags for this image. You may include or exclude specific tags from this collection in the [site configuration].
+
+## Examples
+
+To list the creation date, location, and EXIF tags:
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+ {{ with .Exif }}
+
Date: {{ .Date }}
+
Lat/Long: {{ .Lat }}/{{ .Long }}
+ {{ with .Tags }}
+
Tags
+
+
+
Tag
Value
+
+
+ {{ range $k, $v := . }}
+
{{ $k }}
{{ $v }}
+ {{ end }}
+
+
+ {{ end }}
+ {{ end }}
+{{ end }}
+```
+
+To list specific values:
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+ {{ with .Exif }}
+
+ {{ with .Date }}
Date: {{ .Format "January 02, 2006" }}
{{ end }}
+ {{ with .Tags.ApertureValue }}
Aperture: {{ lang.FormatNumber 2 . }}
{{ end }}
+ {{ with .Tags.BrightnessValue }}
Brightness: {{ lang.FormatNumber 2 . }}
{{ end }}
+ {{ with .Tags.ExposureTime }}
Exposure Time: {{ . }}
{{ end }}
+ {{ with .Tags.FNumber }}
F Number: {{ . }}
{{ end }}
+ {{ with .Tags.FocalLength }}
Focal Length: {{ . }}
{{ end }}
+ {{ with .Tags.ISOSpeedRatings }}
ISO Speed Ratings: {{ . }}
{{ end }}
+ {{ with .Tags.LensModel }}
Lens Model: {{ . }}
{{ end }}
+
+ {{ end }}
+{{ end }}
+```
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
+
+[exif]: https://en.wikipedia.org/wiki/Exif
+[site configuration]: /content-management/image-processing/#exif-data
+[`time.Format`]: /functions/time/format
diff --git a/content/en/methods/resource/Fill.md b/content/en/methods/resource/Fill.md
new file mode 100644
index 000000000..8bbaf93ee
--- /dev/null
+++ b/content/en/methods/resource/Fill.md
@@ -0,0 +1,48 @@
+---
+title: Fill
+description: Applicable to images, returns an image resource cropped and resized to the given dimensions.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/resource/Crop
+ - methods/resource/Fit
+ - methods/resource/Resize
+ - methods/resource/Process
+ - functions/images/Process
+ returnType: images.ImageResource
+ signatures: [RESOURCE.Fill SPEC]
+toc: true
+---
+
+Crop and resize an image to match the given dimensions. You must provide both width and height.
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with .Fill "200x200" }}
+
+ {{ end }}
+{{ end }}
+```
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
+
+{{% include "/methods/resource/_common/processing-spec.md" %}}
+
+## Example
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with .Fill "200x200 top webp q85 lanczos" }}
+
+ {{ end }}
+{{ end }}
+```
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Process"
+ filterArgs="fill 200x200 top webp q85 lanczos"
+ example=true
+>}}
diff --git a/content/en/methods/resource/Filter.md b/content/en/methods/resource/Filter.md
new file mode 100644
index 000000000..329168da7
--- /dev/null
+++ b/content/en/methods/resource/Filter.md
@@ -0,0 +1,68 @@
+---
+title: Filter
+description: Applicable to images, applies one or more image filters to the given image resource.
+categories: []
+keywords: []
+action:
+ related:
+ - functions/images/Filter
+ returnType: resources.resourceAdapter
+ signatures: [RESOURCE.Filter FILTER...]
+toc: true
+---
+
+Apply one or more [image filters](#image-filters) to the given image.
+
+To apply a single filter:
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with .Filter images.Grayscale }}
+
+ {{ end }}
+{{ end }}
+```
+
+To apply two or more filters, executing from left to right:
+
+```go-html-template
+{{ $filters := slice
+ images.Grayscale
+ (images.GaussianBlur 8)
+}}
+{{ with resources.Get "images/original.jpg" }}
+ {{ with .Filter $filters }}
+
+ {{ end }}
+{{ end }}
+```
+
+You can also apply image filters using the [`images.Filter`] function.
+
+[`images.Filter`]: /functions/images/filter
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
+
+## Example
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with .Filter images.Grayscale }}
+
+ {{ end }}
+{{ end }}
+```
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Grayscale"
+ filterArgs=""
+ example=true
+>}}
+
+## Image filters
+
+Use any of these filters with the `Filter` method.
+
+{{< list-pages-in-section path=/functions/images filter=functions_images_no_filters filterType=exclude >}}
diff --git a/content/en/methods/resource/Fit.md b/content/en/methods/resource/Fit.md
new file mode 100644
index 000000000..13354fe5a
--- /dev/null
+++ b/content/en/methods/resource/Fit.md
@@ -0,0 +1,48 @@
+---
+title: Fit
+description: Applicable to images, returns an image resource downscaled to fit the given dimensions while maintaining aspect ratio.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/resource/Crop
+ - methods/resource/Fill
+ - methods/resource/Resize
+ - methods/resource/Process
+ - functions/images/Process
+ returnType: images.ImageResource
+ signatures: [RESOURCE.Fit SPEC]
+toc: true
+---
+
+Downscale an image to fit the given dimensions while maintaining aspect ratio. You must provide both width and height.
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with .Fit "200x200" }}
+
+ {{ end }}
+{{ end }}
+```
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
+
+{{% include "/methods/resource/_common/processing-spec.md" %}}
+
+## Example
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with .Fit "300x175 webp q85 lanczos" }}
+
+ {{ end }}
+{{ end }}
+```
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Process"
+ filterArgs="fit 300x175 webp q85 lanczos"
+ example=true
+>}}
diff --git a/content/en/methods/resource/Height.md b/content/en/methods/resource/Height.md
new file mode 100644
index 000000000..dcaf6c514
--- /dev/null
+++ b/content/en/methods/resource/Height.md
@@ -0,0 +1,27 @@
+---
+title: Height
+description: Applicable to images, returns the height of the given resource.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/resource/Width
+ returnType: int
+ signatures: [RESOURCE.Height]
+---
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+ {{ .Height }} → 400
+{{ end }}
+```
+
+Use the `Width` and `Height` methods together when rendering an `img` element:
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+
+{{ end }}
+```
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
diff --git a/content/en/methods/resource/Key.md b/content/en/methods/resource/Key.md
new file mode 100644
index 000000000..747df414c
--- /dev/null
+++ b/content/en/methods/resource/Key.md
@@ -0,0 +1,45 @@
+---
+title: Key
+description: Returns the unique key for the given resource, equivalent to its publishing path.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/resource/Permalink
+ - methods/resource/RelPermalink
+ - methods/resource/Publish
+ returnType: string
+ signatures: [RESOURCE.Key]
+---
+
+By way of example, consider this site configuration:
+
+{{< code-toggle file=hugo copy=false >}}
+baseURL = 'https://example.org/docs/'
+{{< /code-toggle >}}
+
+And this template:
+
+```go-html-template
+ {{ with resources.Get "images/a.jpg" }}
+ {{ with resources.Copy "foo/bar/b.jpg" . }}
+ {{ .Key }} → foo/bar/b.jpg
+
+ {{ .Name }} → images/a.jpg
+ {{ .Title }} → images/a.jpg
+
+ {{ .RelPermalink }} → /docs/foo/bar/b.jpg
+ {{ end }}
+ {{ end }}
+```
+
+We used the [`resources.Copy`] function to change the publishing path. The `Key` method returns the updated path, but note that it is different than the value returned by [`RelPermalink`]. The `RelPermalink` value includes the subdirectory segment of the `baseURL` in the site configuration.
+
+The `Key` method is useful if you need to get the resource's publishing path without publishing the resource. Unlike the `Permalink`, `RelPermalink`, or `Publish` methods, calling `Key` will not publish the resource.
+
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
+
+[`Permalink`]: /methods/resource/permalink
+[`RelPermalink`]: /methods/resource/relpermalink
+[`resources.Copy`]: /functions/resources/copy
diff --git a/content/en/methods/resource/MediaType.md b/content/en/methods/resource/MediaType.md
new file mode 100644
index 000000000..6dea8706c
--- /dev/null
+++ b/content/en/methods/resource/MediaType.md
@@ -0,0 +1,52 @@
+---
+title: MediaType
+description: Returns a media type object for the given resource.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: media.Type
+ signatures: [RESOURCE.MediaType]
+---
+
+The `MediaType` method on a `Resource` object returns an object with additional methods.
+
+## Methods
+
+Type
+: (`string`) The resource's media type.
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+ {{ .MediaType.Type }} → image/jpeg
+{{ end }}
+```
+
+MainType
+: (`string`) The main type of the resource’s media type.
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+ {{ .MediaType.MainType }} → image
+{{ end }}
+```
+
+SubType
+: (`string`) The subtype of the resource’s media type. This may or may not correspond to the file suffix.
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+ {{ .MediaType.SubType }} → jpeg
+{{ end }}
+```
+
+Suffixes
+: (`slice`) A slice of possible file suffixes for the resource’s media type.
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+ {{ .MediaType.Suffixes }} → [jpg jpeg jpe jif jfif]
+{{ end }}
+```
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
diff --git a/content/en/methods/resource/Name.md b/content/en/methods/resource/Name.md
new file mode 100644
index 000000000..1c584adad
--- /dev/null
+++ b/content/en/methods/resource/Name.md
@@ -0,0 +1,82 @@
+---
+title: Name
+description: Returns the name of the given resource as optionally defined in front matter, falling back to a relative path or hashed file name depending on resource type.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/resource/Title
+ returnType: string
+ signatures: [RESOURCE.Name]
+toc: true
+---
+
+The value returned by the `Name` method on a `Resource` object depends on the resource type.
+
+## Global resource
+
+With a [global resource], the `Name` method returns the path to the resource, relative to the assets directory.
+
+```text
+assets/
+└── images/
+ └── a.jpg
+```
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+ {{ .Name }} → images/a.jpg
+{{ end }}
+```
+
+## Page resource
+
+With a [page resource], the `Name` method returns the path to the resource, relative to the page bundle.
+
+```text
+content/
+├── posts/
+│ ├── post-1/
+│ │ ├── images/
+│ │ │ └── a.jpg
+│ │ └── index.md
+│ └── _index.md
+└── _index.md
+```
+
+```go-html-template
+{{ with .Resources.Get "images/a.jpg" }}
+ {{ .Name }} → images/a.jpg
+{{ end }}
+```
+
+If you create an element in the `resources` array in front matter, the `Name` method returns the value of the `name` parameter:
+
+{{< code-toggle file="content/posts/post-1.md" fm=true >}}
+title = 'Post 1'
+[[resources]]
+src = 'images/a.jpg'
+name = 'cat'
+title = 'Felix the cat'
+[resources.params]
+temperament = 'malicious'
+{{< /code-toggle >}}
+
+```go-html-template
+{{ with .Resources.Get "cat" }}
+ {{ .Name }} → cat
+{{ end }}
+```
+## Remote resource
+
+With a [remote resource], the `Name` method returns a hashed file name.
+
+```go-html-template
+{{ with resources.GetRemote "https://example.org/images/a.jpg" }}
+ {{ .Name }} → a_18432433023265451104.jpg
+{{ end }}
+```
+
+[global resource]: /getting-started/glossary/#global-resource
+[page resource]: /getting-started/glossary/#page-resource
+[remote resource]: /getting-started/glossary/#remote-resource
diff --git a/content/en/methods/resource/Params.md b/content/en/methods/resource/Params.md
new file mode 100644
index 000000000..7a9ec89b3
--- /dev/null
+++ b/content/en/methods/resource/Params.md
@@ -0,0 +1,65 @@
+---
+title: Params
+description: Returns a map of resource parameters as defined in front matter.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: map
+ signatures: [RESOURCE.Params]
+---
+
+Use the `Params` method with [page resources]. It is not applicable to either [global] or [remote] resources.
+
+[global]: /getting-started/glossary/#global-resource
+[page resources]: /getting-started/glossary/#page-resource
+[remote]: /getting-started/glossary/#remote-resource
+
+With this content structure:
+
+```text
+content/
+├── posts/
+│ ├── cats/
+│ │ ├── images/
+│ │ │ └── a.jpg
+│ │ └── index.md
+│ └── _index.md
+└── _index.md
+```
+
+And this front matter:
+
+{{< code-toggle file=content/posts/cats.md fm=true copy=false >}}
+title = 'Cats'
+[[resources]]
+ src = 'images/a.jpg'
+ title = 'Felix the cat'
+ [resources.params]
+ alt = 'Photograph of black cat'
+ temperament = 'vicious'
+{{< /code-toggle >}}
+
+And this template:
+
+```go-html-template
+{{ with .Resources.Get "images/a.jpg" }}
+
+
+ {{ .Title }} is {{ .Params.temperament }}
+
+{{ end }}
+```
+
+Hugo renders:
+
+```html
+
+
+ Felix the cat is vicious
+
+```
+
+See the [page resources] section for more information.
+
+[page resources]: /content-management/page-resources
diff --git a/content/en/methods/resource/Permalink.md b/content/en/methods/resource/Permalink.md
new file mode 100644
index 000000000..ab0ad41b0
--- /dev/null
+++ b/content/en/methods/resource/Permalink.md
@@ -0,0 +1,25 @@
+---
+title: Permalink
+description: Publishes the given resource and returns its permalink.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/resource/RelPermalink
+ - methods/resource/Publish
+ - methods/resource/Key
+ returnType: string
+ signatures: [RESOURCE.Permalink]
+---
+
+The `Permalink` method on a `Resource` object writes the resource to the publish directory, typically `public`, and returns its [permalink].
+
+[permalink]: /getting-started/glossary/#permalink
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+ {{ .Permalink }} → https://example.org/images/a.jpg
+{{ end }}
+```
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
diff --git a/content/en/methods/resource/Process.md b/content/en/methods/resource/Process.md
new file mode 100644
index 000000000..c3f86feee
--- /dev/null
+++ b/content/en/methods/resource/Process.md
@@ -0,0 +1,66 @@
+---
+title: Process
+description: Applicable to images, returns an image resource processed with the given specification.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/resource/Crop
+ - methods/resource/Fit
+ - methods/resource/Fill
+ - methods/resource/Resize
+ - functions/images/Process
+ returnType: images.ImageResource
+ signatures: [RESOURCE.Process SPEC]
+toc: true
+---
+
+Process an image with the given specification. The specification can contain an optional action, one of `resize`, `crop`, `fit` or `fill`. This means that you can use this method instead of [`Crop`], [`Fill`], [`Fit`], or [`Resize`].
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with .Process "crop 200x200" }}
+
+ {{ end }}
+{{ end }}
+```
+
+You can also use this method to apply simple transformations such as rotation and conversion:
+
+```go-html-template
+{{/* Rotate 90 degrees counter-clockwise. */}}
+{{ $image := $image.Process "r90" }}
+
+{{/* Convert to WebP. */}}
+{{ $image := $image.Process "webp" }}
+```
+
+The `Process` method is also available as a filter, which is more effective if you need to apply multiple filters to an image. See [`images.Process`].
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
+
+{{% include "/methods/resource/_common/processing-spec.md" %}}
+
+## Example
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with .Process "crop 200x200 topright webp q85 lanczos" }}
+
+ {{ end }}
+{{ end }}
+```
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Process"
+ filterArgs="crop 200x200 topright webp q85 lanczos"
+ example=true
+>}}
+
+[`Crop`]: /methods/resource/crop
+[`Fill`]: /methods/resource/fill
+[`Fit`]: /methods/resource/fit
+[`Resize`]: /methods/resource/resize
+[`images.Process`]: /functions/images/process
diff --git a/content/en/methods/resource/Publish.md b/content/en/methods/resource/Publish.md
new file mode 100644
index 000000000..b090bfe5a
--- /dev/null
+++ b/content/en/methods/resource/Publish.md
@@ -0,0 +1,35 @@
+---
+title: Publish
+description: Publishes the given resource.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/resource/Permalink
+ - methods/resource/RelPermalink
+ - methods/resource/Key
+ returnType: nil
+ signatures: [RESOURCE.Publish]
+---
+
+The `Publish` method on a `Resource` object writes the resource to the publish directory, typically `public`.
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+ {{ .Publish }}
+{{ end }}
+```
+
+The `Permalink` and `RelPermalink` methods also publish a resource. `Publish` is a convenience method for publishing without a return value. For example, this:
+
+```go-html-template
+{{ $resource.Publish }}
+```
+
+Instead of this:
+
+```go-html-template
+{{ $noop := $resource.Permalink }}
+```
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
diff --git a/content/en/methods/resource/RelPermalink.md b/content/en/methods/resource/RelPermalink.md
new file mode 100644
index 000000000..2b96c35d7
--- /dev/null
+++ b/content/en/methods/resource/RelPermalink.md
@@ -0,0 +1,25 @@
+---
+title: RelPermalink
+description: Publishes the given resource and returns its relative permalink.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/resource/Permalink
+ - methods/resource/Publish
+ - methods/resource/Key
+ returnType: string
+ signatures: [RESOURCE.RelPermalink]
+---
+
+The `Permalink` method on a `Resource` object writes the resource to the publish directory, typically `public`, and returns its [relative permalink].
+
+[relative permalink]: /getting-started/glossary/#relative-permalink
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+ {{ .RelPermalink }} → /images/a.jpg
+{{ end }}
+```
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
diff --git a/content/en/methods/resource/Resize.md b/content/en/methods/resource/Resize.md
new file mode 100644
index 000000000..4ba054bb5
--- /dev/null
+++ b/content/en/methods/resource/Resize.md
@@ -0,0 +1,49 @@
+---
+title: Resize
+description: Applicable to images, returns an image resource resized to the given width and/or height.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/resource/Crop
+ - methods/resource/Fit
+ - methods/resource/Fill
+ - methods/resource/Process
+ - functions/images/Process
+ returnType: images.ImageResource
+ signatures: [RESOURCE.Resize SPEC]
+---
+
+Resize an image to the given width and/or height.
+
+If you specify both width and height, the resulting image will be disproportionally scaled unless the original image has the same aspect ratio.
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with .Resize "300x" }}
+
+ {{ end }}
+{{ end }}
+```
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
+
+{{% include "/methods/resource/_common/processing-spec.md" %}}
+
+## Example
+
+```go-html-template
+{{ with resources.Get "images/original.jpg" }}
+ {{ with .Resize "300x webp q85 lanczos" }}
+
+ {{ end }}
+{{ end }}
+```
+
+{{< img
+ src="images/examples/zion-national-park.jpg"
+ alt="Zion National Park"
+ filter="Process"
+ filterArgs="resize 300x webp q85 lanczos"
+ example=true
+>}}
diff --git a/content/en/methods/resource/ResourceType.md b/content/en/methods/resource/ResourceType.md
new file mode 100644
index 000000000..1522b7d32
--- /dev/null
+++ b/content/en/methods/resource/ResourceType.md
@@ -0,0 +1,43 @@
+---
+title: ResourceType
+description: Returns the main type of the given resource's media type.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: string
+ signatures: [RESOURCE.ResourceType]
+---
+
+Common resource types include `audio`, `image`, `text`, and `video`.
+
+```go-html-template
+{{ with resources.Get "image/a.jpg" }}
+ {{ .ResourceType }} → image
+ {{ .MediaType.MainType }} → image
+{{ end }}
+```
+
+When working with content files, the resource type is `page`.
+
+```text
+content/
+├── lessons/
+│ ├── lesson-1/
+│ │ ├── _objectives.md <-- resource type = page
+│ │ ├── _topics.md <-- resource type = page
+│ │ ├── _example.jpg <-- resource type = image
+│ │ └── index.md
+│ └── _index.md
+└── _index.md
+```
+
+With the structure above, we can range through page resources of type `page` to build content:
+
+{{< code file="layouts/lessons/single.html" lang=go-html-template copy=false >}}
+{{ range .Resources.ByType "page" }}
+ {{ .Content }}
+{{ end }}
+{{< /code >}}
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
diff --git a/content/en/methods/resource/Title.md b/content/en/methods/resource/Title.md
new file mode 100644
index 000000000..78540b20a
--- /dev/null
+++ b/content/en/methods/resource/Title.md
@@ -0,0 +1,95 @@
+---
+title: Title
+description: Returns the title of the given resource as optionally defined in front matter, falling back to a relative path or hashed file name depending on resource type.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/resource/Name
+ returnType: string
+ signatures: [RESOURCE.Title]
+toc: true
+---
+
+The value returned by the `Title` method on a `Resource` object depends on the resource type.
+
+## Global resource
+
+With a [global resource], the `Title` method returns the path to the resource, relative to the assets directory.
+
+```text
+assets/
+└── images/
+ └── a.jpg
+```
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+ {{ .Title }} → images/a.jpg
+{{ end }}
+```
+
+## Page resource
+
+With a [page resource], the `Title` method returns the path to the resource, relative to the page bundle.
+
+```text
+content/
+├── posts/
+│ ├── post-1/
+│ │ ├── images/
+│ │ │ └── a.jpg
+│ │ └── index.md
+│ └── _index.md
+└── _index.md
+```
+
+```go-html-template
+{{ with .Resources.Get "images/a.jpg" }}
+ {{ .Title }} → images/a.jpg
+{{ end }}
+```
+
+If you create an element in the `resources` array in front matter, the `Title` method returns the value of the `title` parameter:
+
+{{< code-toggle file="content/posts/post-1.md" fm=true >}}
+title = 'Post 1'
+[[resources]]
+src = 'images/a.jpg'
+name = 'cat'
+title = 'Felix the cat'
+[resources.params]
+temperament = 'malicious'
+{{< /code-toggle >}}
+
+```go-html-template
+{{ with .Resources.Get "cat" }}
+ {{ .Title }} → Felix the cat
+{{ end }}
+```
+
+If the page resource is a content file, the `Title` methods return the `title` field as defined in front matter.
+
+```text
+content/
+├── lessons/
+│ ├── lesson-1/
+│ │ ├── _objectives.md <-- resource type = page
+│ │ └── index.md
+│ └── _index.md
+└── _index.md
+```
+
+## Remote resource
+
+With a [remote resource], the `Title` method returns a hashed file name.
+
+```go-html-template
+{{ with resources.GetRemote "https://example.org/images/a.jpg" }}
+ {{ .Title }} → a_18432433023265451104.jpg
+{{ end }}
+```
+
+[global resource]: /getting-started/glossary/#global-resource
+[page resource]: /getting-started/glossary/#page-resource
+[remote resource]: /getting-started/glossary/#remote-resource
diff --git a/content/en/methods/resource/Width.md b/content/en/methods/resource/Width.md
new file mode 100644
index 000000000..8b96c95e8
--- /dev/null
+++ b/content/en/methods/resource/Width.md
@@ -0,0 +1,27 @@
+---
+title: Width
+description: Applicable to images, returns the width of the given resource.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/resource/Height
+ returnType: int
+ signatures: [RESOURCE.Width]
+---
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+ {{ .Width }} → 600
+{{ end }}
+```
+
+Use the `Width` and `Height` methods together when rendering an `img` element:
+
+```go-html-template
+{{ with resources.Get "images/a.jpg" }}
+
+{{ end }}
+```
+
+{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
diff --git a/content/en/methods/resource/_common/_index.md b/content/en/methods/resource/_common/_index.md
new file mode 100644
index 000000000..47d5812fb
--- /dev/null
+++ b/content/en/methods/resource/_common/_index.md
@@ -0,0 +1,13 @@
+---
+cascade:
+ _build:
+ list: never
+ publishResources: false
+ render: never
+---
+
+
diff --git a/content/en/methods/resource/_common/global-page-remote-resources.md b/content/en/methods/resource/_common/global-page-remote-resources.md
new file mode 100644
index 000000000..4ea4d1b87
--- /dev/null
+++ b/content/en/methods/resource/_common/global-page-remote-resources.md
@@ -0,0 +1,13 @@
+---
+# Do not remove front matter.
+---
+
+{{% note %}}
+
+Use this method with [global], [page], or [remote] resources.
+
+[global]: /getting-started/glossary/#global-resource
+[page]: /getting-started/glossary/#page-resource
+[remote]: /getting-started/glossary/#remote-resource
+
+{{% /note %}}
diff --git a/content/en/methods/resource/_common/processing-spec.md b/content/en/methods/resource/_common/processing-spec.md
new file mode 100644
index 000000000..1a3ed887d
--- /dev/null
+++ b/content/en/methods/resource/_common/processing-spec.md
@@ -0,0 +1,34 @@
+---
+# Do not remove front matter.
+---
+
+## Process specification
+
+The process specification is a space-delimited, case-insensitive list of one or more of the following in any sequence:
+
+action
+: Applicable to the [`Process`](/methods/resource/process) method only. Specify zero or one of `resize`, `fit`, `fill`, or `crop`. If you specify an action you must also provide dimensions.
+
+dimensions
+: Provide width _or_ height when using the [`Resize`](/methods/resource/resize) method, else provide both width _and_ height. See [details](/content-management/image-processing/#dimensions).
+
+anchor
+: Use with the [`Crop`](/methods/resource/crop) and [`Fill`](/methods/resource/fill) methods. Specify zero or one of `TopLeft`, `Top`, `TopRight`, `Left`, `Center`, `Right`, `BottomLeft`, `Bottom`, `BottomRight`, or `Smart`. Default is `Smart`. See [details](/content-management/image-processing/#anchor).
+
+rotation
+: Typically specify zero or one of `r90`, `r180`, or `r270`. Also supports arbitrary rotation angles. See [details](/content-management/image-processing/#rotation).
+
+target format
+: Specify zero or one of `gif`, `jpeg`, `png`, `tiff`, or `webp`. See [details](/content-management/image-processing/#target-format).
+
+quality
+: Applicable to JPEG and WebP images. Optionally specify `qN` where `N` is an integer in the range [0, 100]. Default is `75`. See [details](/content-management/image-processing/#quality).
+
+hint
+: Applicable to WebP images. Specify zero or one of `drawing`, `icon`, `photo`, `picture`, or `text`. Default is `photo`. See [details](/content-management/image-processing/#hint).
+
+background color
+: When converting a PNG or WebP with transparency to a format that does not support transparency, optionally specify a background color using a 3-digit or a 6-digit hexadecimal color code. Default is `#ffffff` (white). See [details](/content-management/image-processing/#background-color).
+
+resampling filter
+: Typically specify zero or one of `Box`, `Lanczos`, `CatmullRom`, `MitchellNetravali`, `Linear`, or `NearestNeighbor`. Other resampling filters are available. See [details](/content-management/image-processing/#resampling-filter).
diff --git a/content/en/methods/resource/_index.md b/content/en/methods/resource/_index.md
new file mode 100644
index 000000000..e9426e1a5
--- /dev/null
+++ b/content/en/methods/resource/_index.md
@@ -0,0 +1,12 @@
+---
+title: Resource methods
+linkTitle: Resource
+description: Use these methods with global, page, and remote Resource objects.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: methods
+---
+
+Use these methods with global, page, and remote Resource objects.
diff --git a/content/en/methods/shortcode/Get.md b/content/en/methods/shortcode/Get.md
new file mode 100644
index 000000000..2465023a6
--- /dev/null
+++ b/content/en/methods/shortcode/Get.md
@@ -0,0 +1,51 @@
+---
+title: Get
+description: Returns the value of the given parameter.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/shortcode/IsNamedParams
+ - methods/shortcode/Params
+ returnType: any
+ signatures: [SHORTCODE.Get PARAM]
+toc: true
+---
+
+Specify the parameter by position or by name. When calling a shortcode within markdown, use either positional or named parameters, but not both.
+
+{{% note %}}
+Some shortcodes support positional parameters, some support named parameters, and others support both. Refer to the shortcode's documentation for usage details.
+{{% /note %}}
+
+## Positional parameters
+
+This shortcode call uses positional parameters:
+
+{{< code file="content/about.md" lang=md copy=false >}}
+{{* myshortcode "Hello" "world" */>}}
+{{< /code >}}
+
+To retrieve parameters by position:
+
+{{< code file="layouts/shortcodes/myshortcode.html" lang=go-html-template copy=false >}}
+{{ printf "%s %s." (.Get 0) (.Get 1) }} → Hello world.
+{{< /code >}}
+
+## Named parameters
+
+This shortcode call uses named parameters:
+
+{{< code file="content/about.md" lang=md copy=false >}}
+{{* myshortcode greeting="Hello" firstName="world" */>}}
+{{< /code >}}
+
+To retrieve parameters by name:
+
+{{< code file="layouts/shortcodes/myshortcode.html" lang=go-html-template copy=false >}}
+{{ printf "%s %s." (.Get "greeting") (.Get "firstName") }} → Hello world.
+{{< /code >}}
+
+{{% note %}}
+Parameter names are case-sensitive.
+{{% /note %}}
diff --git a/content/en/methods/shortcode/Inner.md b/content/en/methods/shortcode/Inner.md
new file mode 100644
index 000000000..98e97b5ea
--- /dev/null
+++ b/content/en/methods/shortcode/Inner.md
@@ -0,0 +1,153 @@
+---
+title: Inner
+description: Returns the content between opening and closing shortcode tags, applicable when the shortcode call includes a closing tag.
+categories: []
+keywords: []
+action:
+ related:
+ - functions/strings/Trim
+ - methods/page/RenderString
+ - functions/transform/Markdownify
+ - methods/shortcode/InnerDeindent
+ returnType: template.HTML
+ signatures: [SHORTCODE.Inner]
+---
+
+This content:
+
+{{< code file="content/services.md" lang=md copy=false >}}
+{{* card title="Product Design" */>}}
+We design the **best** widgets in the world.
+{{* /card */>}}
+{{< /code >}}
+
+With this shortcode:
+
+{{< code file="layouts/shortcodes/card.html" lang=go-html-template copy=false >}}
+
+ {{ with .Get "title" }}
+
{{ . }}
+ {{ end }}
+
+ {{ trim .Inner "\r\n" }}
+
+
+{{< /code >}}
+
+Is rendered to:
+
+```html
+
+
Product Design
+
+ We design the **best** widgets in the world.
+
+
+```
+
+{{% note %}}
+Content between opening and closing shortcode tags may include leading and/or trailing newlines, depending on placement within the markdown. Use the [`trim`] function as shown above to remove both carriage returns and newlines.
+
+[`trim`]: /functions/strings/trim
+{{% /note %}}
+
+{{% note %}}
+In the example above, the value returned by `Inner` is markdown, but it was rendered as plain text. Use either of the following approaches to render markdown to HTML.
+{{% /note %}}
+
+
+## Use the RenderString method
+
+Let's modify the example above to pass the value returned by `Inner` through the [`RenderString`] method on the `Page` object:
+
+[`RenderString`]: /methods/page/renderstring
+
+{{< code file="layouts/shortcodes/card.html" lang=go-html-template copy=false >}}
+
+ {{ with .Get "title" }}
+
{{ . }}
+ {{ end }}
+
+ {{ trim .Inner "\r\n" | .Page.RenderString }}
+
+
+{{< /code >}}
+
+Hugo renders this to:
+
+```html
+
+
Product design
+
+ We produce the best widgets in the world.
+
+
+```
+
+You can use the [`markdownify`] function instead of the `RenderString` method, but the latter is more flexible. See [details].
+
+[details]: /methods/page/renderstring
+[`markdownify`]: /functions/transform/markdownify
+
+## Use alternate notation
+
+Instead of calling the shortcode with the `{{* */>}}` notation, use the `{{%/* */%}}` notation:
+
+{{< code file="content/services.md" lang=md copy=false >}}
+{{%/* card title="Product Design" */%}}
+We design the **best** widgets in the world.
+{{%/* /card */%}}
+{{< /code >}}
+
+When you use the `{{%/* */%}}` notation, Hugo renders the entire shortcode as markdown, requiring the following changes.
+
+First, configure the renderer to allow raw HTML within markdown:
+
+{{< code-toggle file=hugo copy=false >}}
+[markup.goldmark.renderer]
+unsafe = true
+{{< /code-toggle >}}
+
+This configuration is not unsafe if _you_ control the content. Read more about Hugo's [security model].
+
+Second, because we are rendering the entire shortcode as markdown, we must adhere to the rules governing [indentation] and inclusion of [raw HTML blocks] as provided in the [CommonMark] specification.
+
+{{< code file="layouts/shortcodes/card.html" lang=go-html-template copy=false >}}
+
+ {{ with .Get "title" }}
+
{{ . }}
+ {{ end }}
+
+
+ {{ trim .Inner "\r\n" }}
+
+
+{{< /code >}}
+
+The difference between this and the previous example is subtle but required. Note the change in indentation, the addition of a blank line, and removal of the `RenderString` method.
+
+```diff
+--- layouts/shortcodes/a.html
++++ layouts/shortcodes/b.html
+@@ -1,8 +1,9 @@
+
+ {{ with .Get "title" }}
+-
{{ . }}
++
{{ . }}
+ {{ end }}
+
+- {{ trim .Inner "\r\n" | .Page.RenderString }}
++
++ {{ trim .Inner "\r\n" }}
+
+
+```
+
+{{% note %}}
+When using the `{{%/* */%}}` notation, do not pass the value returned by `Inner` through the `RenderString` method or the `markdownify` function.
+{{% /note %}}
+
+[commonmark]: https://commonmark.org/
+[indentation]: https://spec.commonmark.org/0.30/#indented-code-blocks
+[raw html blocks]: https://spec.commonmark.org/0.30/#html-blocks
+[security model]: /about/security-model/
diff --git a/content/en/methods/shortcode/InnerDeindent.md b/content/en/methods/shortcode/InnerDeindent.md
new file mode 100644
index 000000000..34191df1f
--- /dev/null
+++ b/content/en/methods/shortcode/InnerDeindent.md
@@ -0,0 +1,99 @@
+---
+title: InnerDeindent
+description: Returns the content between opening and closing shortcode tags, with indentation removed, applicable when the shortcode call includes a closing tag.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/shortcode/Inner
+ returnType: template.HTML
+ signatures: [SHORTCODE.InnerDeindent]
+---
+
+Similar to the [`Inner`] method, `InnerDeindent` returns the content between opening and closing shortcode tags. However, with `InnerDeindent`, indentation before the content is removed.
+
+This allows us to effectively bypass the rules governing [indentation] as provided in the [CommonMark] specification.
+
+Consider this markdown, an unordered list with a small gallery of thumbnail images within each list item:
+
+{{< code file="content/about.md" lang=md copy=false >}}
+- Gallery one
+
+ {{* gallery */>}}
+ 
+ 
+ {{* /gallery */>}}
+
+- Gallery two
+
+ {{* gallery */>}}
+ 
+ 
+ {{* /gallery */>}}
+{{< /code >}}
+
+In the example above, notice that the content between the opening and closing shortcode tags is indented by four spaces. Per the CommonMark specification, this is treated as an indented code block.
+
+With this shortcode, calling `Inner` instead of `InnerDeindent`:
+
+{{< code file="layouts/shortcodes/gallery.html" lang=go-html-template copy=false >}}
+
+ {{ trim .Inner "\r\n" | .Page.RenderString }}
+
+{{< /code >}}
+
+Hugo renders the markdown to:
+
+```html
+
+```
+
+Although technically correct per the CommonMark specification, this is not what we want. If we remove the indentation using the `InnerDeindent` method:
+
+{{< code file="layouts/shortcodes/gallery.html" lang=go-html-template copy=false >}}
+
+ {{ trim .InnerDeindent "\r\n" | .Page.RenderString }}
+
+{{< /code >}}
+
+Hugo renders the markdown to:
+
+```html
+
+
+
Gallery one
+
+
+
+
+
+
+
Gallery two
+
+
+
+
+
+
+```
+
+[commonmark]: https://commonmark.org/
+[indentation]: https://spec.commonmark.org/0.30/#indented-code-blocks
+[`Inner`]: /methods/shortcode/inner
diff --git a/content/en/methods/shortcode/IsNamedParams.md b/content/en/methods/shortcode/IsNamedParams.md
new file mode 100644
index 000000000..eac3fc812
--- /dev/null
+++ b/content/en/methods/shortcode/IsNamedParams.md
@@ -0,0 +1,30 @@
+---
+title: IsNamedParams
+description: Reports whether the shortcode call specifies named or positional parameters.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/shortcode/Get
+ returnType: bool
+ signatures: [SHORTCODE.IsNamedParams]
+---
+
+To support both positional and named parameters when calling a shortcode, use the `IsNamedParams` method to determine how the shortcode was called.
+
+With this shortcode template:
+
+{{< code file="layouts/shortcodes/myshortcode.html" lang=go-html-template copy=false >}}
+{{ if .IsNamedParams }}
+ {{ printf "%s %s." (.Get "greeting") (.Get "firstName") }}
+{{ else }}
+ {{ printf "%s %s." (.Get 0) (.Get 1) }}
+{{ end }}
+{{< /code >}}
+
+Both of these calls return the same value:
+
+{{< code file="content/about.md" lang=md copy=false >}}
+{{* myshortcode greeting="Hello" firstName="world" */>}}
+{{* myshortcode "Hello" "world" */>}}
+{{< /code >}}
diff --git a/content/en/methods/shortcode/Name.md b/content/en/methods/shortcode/Name.md
new file mode 100644
index 000000000..011138e00
--- /dev/null
+++ b/content/en/methods/shortcode/Name.md
@@ -0,0 +1,29 @@
+---
+title: Name
+description: Returns the shortcode file name, excluding the file extension.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/shortcode/Position
+ - functions/fmt/Errorf
+ returnType: string
+ signatures: [SHORTCODE.Name]
+---
+
+The `Name` method is useful for error reporting. For example, if your shortcode requires a "greeting" parameter:
+
+{{< code file="layouts/shortcodes/myshortcode.html" lang=go-html-template copy=false >}}
+{{ $greeting := "" }}
+{{ with .Get "greeting" }}
+ {{ $greeting = . }}
+{{ else }}
+ {{ errorf "The %q shortcode requires a 'greeting' parameter. See %s" .Name .Position }}
+{{ end }}
+{{< /code >}}
+
+In the absence of a "greeting" parameter, Hugo will throw an error message and fail the build:
+
+```text
+ERROR The "myshortcode" shortcode requires a 'greeting' parameter. See "/home/user/project/content/about.md:11:1"
+```
diff --git a/content/en/methods/shortcode/Ordinal.md b/content/en/methods/shortcode/Ordinal.md
new file mode 100644
index 000000000..50cd2b0d3
--- /dev/null
+++ b/content/en/methods/shortcode/Ordinal.md
@@ -0,0 +1,50 @@
+---
+title: Ordinal
+description: Returns the zero-based ordinal of the shortcode in relation to its parent.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: int
+ signatures: [SHORTCODE.Ordinal]
+---
+
+The `Ordinal` method returns the zero-based ordinal of the shortcode in relation to its parent. If the parent is the page itself, the ordinal represents the position of this shortcode in the page content.
+
+This method is useful for, among other things, assigning unique element IDs when a shortcode is called two or more times from the same page. For example:
+
+{{< code file="content/about.md" lang=md copy=false >}}
+{{* img src="images/a.jpg" */>}}
+
+{{* img src="images/b.jpg" */>}}
+{{< /code >}}
+
+This shortcode performs error checking, then renders an HTML `img` element with a unique `id` attribute:
+
+{{< code file="layouts/shortcodes/img.html" lang=go-html-template copy=false >}}
+{{ $src := "" }}
+{{ with .Get "src" }}
+ {{ $src = . }}
+ {{ with resources.Get $src }}
+ {{ $id := printf "img-%03d" $.Ordinal }}
+
+ {{ else }}
+ {{ errorf "The %q shortcode was unable to find %s. See %s" $.Name $src $.Position }}
+ {{ end }}
+{{ else }}
+ {{ errorf "The %q shortcode requires a 'src' parameter. See %s" .Name .Position }}
+{{ end }}
+{{< /code >}}
+
+Hugo renders the page to:
+
+```html
+
+
+```
+
+{{% note %}}
+In the shortcode template above, the [`with`] statement is used to create conditional blocks. Remember that the `with` statement binds context (the dot) to its expression. Inside of a `with` block, preface shortcode method calls with a `$` to access the top level context passed into the template.
+
+[`with`]: /functions/go-template/with
+{{% /note %}}
diff --git a/content/en/methods/shortcode/Page.md b/content/en/methods/shortcode/Page.md
new file mode 100644
index 000000000..83d414599
--- /dev/null
+++ b/content/en/methods/shortcode/Page.md
@@ -0,0 +1,36 @@
+---
+title: Page
+description: Returns the Page object from which the shortcode was called.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: hugolib.pageForShortcode
+ signatures: [SHORTCODE.Page]
+---
+
+With this content:
+
+{{< code-toggle file=content/books/les-miserables.md copy=false fm=true >}}
+title = 'Les Misérables'
+author = 'Victor Hugo'
+published = 1862
+isbn = '978-0451419439'
+{{< /code-toggle >}}
+
+Calling this shortcode:
+
+```text
+{{* book-details */>}}
+```
+
+We can access the front matter values using the `Page` method:
+
+{{< code file="layouts/shortcodes/book-details.html" lang=go-html-template copy=false >}}
+
+
Title: {{ .Page.Title }}
+
Author: {{ .Page.Params.author }}
+
Published: {{ .Page.Params.publication_year }}
+
ISBN: {{ .Page.Params.isbn }}
+
+{{< /code >}}
diff --git a/content/en/methods/shortcode/Params.md b/content/en/methods/shortcode/Params.md
new file mode 100644
index 000000000..e1ac23a3b
--- /dev/null
+++ b/content/en/methods/shortcode/Params.md
@@ -0,0 +1,33 @@
+---
+title: Params
+description: Returns a collection of the shortcode parameters.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/shortcode/Get
+ returnType: any
+ signatures: [SHORTCODE.Params]
+---
+
+When you call a shortcode using positional parameters, the `Params` method returns a slice.
+
+{{< code file="content/about.md" lang=md copy=false >}}
+{{* myshortcode "Hello" "world" */>}}
+{{< /code >}}
+
+{{< code file="layouts/shortcodes/myshortcode.html" lang=go-html-template copy=false >}}
+{{ index .Params 0 }} → Hello
+{{ index .Params 1 }} → world
+{{< /code >}}
+
+When you call a shortcode using named parameters, the `Params` method returns a map.
+
+{{< code file="content/about.md" lang=md copy=false >}}
+{{* myshortcode greeting="Hello" name="world" */>}}
+{{< /code >}}
+
+{{< code file="layouts/shortcodes/myshortcode.html" lang=go-html-template copy=false >}}
+{{ .Params.greeting }} → Hello
+{{ .Params.name }} → world
+{{< /code >}}
diff --git a/content/en/methods/shortcode/Parent.md b/content/en/methods/shortcode/Parent.md
new file mode 100644
index 000000000..f40148bc5
--- /dev/null
+++ b/content/en/methods/shortcode/Parent.md
@@ -0,0 +1,50 @@
+---
+title: Parent
+description: Returns the parent shortcode context in nested shortcodes.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: hugolib.ShortcodeWithPage
+ signatures: [SHORTCODE.Parent]
+---
+
+This is useful for inheritance of common shortcode parameters from the root.
+
+In this contrived example, the "greeting" shortcode is the parent, and the "now" shortcode is child.
+
+{{< code file="content/welcome.md" lang=md copy=false >}}
+{{* greeting dateFormat="Jan 2, 2006" */>}}
+Welcome. Today is {{* now */>}}.
+{{* /greeting */>}}
+{{< /code >}}
+
+{{< code file="layouts/shortcodes/greeting.html" lang=go-html-template copy=false >}}
+
+ {{ trim .Inner "\r\n" | .Page.RenderString }}
+
+{{< /code >}}
+
+{{< code file="layouts/shortcodes/now.html" lang=go-html-template copy=false >}}
+{{- $dateFormat := "January 2, 2006 15:04:05" }}
+
+{{- with .Params }}
+ {{- with .dateFormat }}
+ {{- $dateFormat = . }}
+ {{- end }}
+{{- else }}
+ {{- with .Parent.Params }}
+ {{- with .dateFormat }}
+ {{- $dateFormat = . }}
+ {{- end }}
+ {{- end }}
+{{- end }}
+
+{{- now | time.Format $dateFormat -}}
+{{< /code >}}
+
+The "now" shortcode formats the current time using:
+
+1. The `dateFormat` parameter passed to the "now" shortcode, if present
+2. The `dateFormat` parameter passed to the "greeting" shortcode, if present
+3. The default layout string defined at the top of the shortcode
diff --git a/content/en/methods/shortcode/Position.md b/content/en/methods/shortcode/Position.md
new file mode 100644
index 000000000..181a13e4d
--- /dev/null
+++ b/content/en/methods/shortcode/Position.md
@@ -0,0 +1,33 @@
+---
+title: Position
+description: Returns the filename and position from which the shortcode was called.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/shortcode/Name
+ - functions/fmt/Errorf
+ returnType: text.Position
+ signatures: [SHORTCODE.Position]
+---
+
+The `Position` method is useful for error reporting. For example, if your shortcode requires a "greeting" parameter:
+
+{{< code file="layouts/shortcodes/myshortcode.html" lang=go-html-template copy=false >}}
+{{ $greeting := "" }}
+{{ with .Get "greeting" }}
+ {{ $greeting = . }}
+{{ else }}
+ {{ errorf "The %q shortcode requires a 'greeting' parameter. See %s" .Name .Position }}
+{{ end }}
+{{< /code >}}
+
+In the absence of a "greeting" parameter, Hugo will throw an error message and fail the build:
+
+```text
+ERROR The "myshortcode" shortcode requires a 'greeting' parameter. See "/home/user/project/content/about.md:11:1"
+```
+
+{{% note %}}
+The position can relatively expensive to calculate. Limit its use to error reporting.
+{{% /note %}}
diff --git a/content/en/methods/shortcode/Scratch.md b/content/en/methods/shortcode/Scratch.md
new file mode 100644
index 000000000..76586abe2
--- /dev/null
+++ b/content/en/methods/shortcode/Scratch.md
@@ -0,0 +1,24 @@
+---
+title: Scratch
+description: Creates a "scratch pad" scoped to the shortcode to store and manipulate data.
+categories: []
+keywords: []
+action:
+ related:
+ - functions/collections/NewScratch
+ returnType: maps.Scratch
+ signatures: [SHORTCODE.Scratch]
+---
+
+The `Scratch` method within a shortcode creates a [scratch pad] to store and manipulate data. The scratch pad is scoped to the shortcode, and is reset on server rebuilds.
+
+{{% note %}}
+With the introduction of the [`newScratch`] function, and the ability to [assign values to template variables] after initialization, the `Scratch` method within a shortcode is obsolete.
+
+[assign values to variables]: https://go.dev/doc/go1.11#text/template
+[`newScratch`]: functions/collections/newscratch
+{{% /note %}}
+
+[scratch pad]: /getting-started/glossary/#scratch-pad
+
+{{% include "methods/page/_common/scratch-methods.md" %}}
diff --git a/content/en/methods/shortcode/_index.md b/content/en/methods/shortcode/_index.md
new file mode 100644
index 000000000..d26366844
--- /dev/null
+++ b/content/en/methods/shortcode/_index.md
@@ -0,0 +1,12 @@
+---
+title: Shortcode methods
+linkTitle: Shortcode
+description: Use these methods in your shortcode templates.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: methods
+---
+
+Use these methods in your shortcode templates.
diff --git a/content/en/methods/site/AllPages.md b/content/en/methods/site/AllPages.md
new file mode 100644
index 000000000..8df6348f9
--- /dev/null
+++ b/content/en/methods/site/AllPages.md
@@ -0,0 +1,26 @@
+---
+title: AllPages
+description: Returns a collection of all pages in all languages.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/site/Pages
+ - methods/site/RegularPages
+ - methods/site/Sections
+ returnType: page.Pages
+ signatures: [SITE.AllPages]
+---
+
+This method returns all page [kinds] in all languages. That includes the home page, section pages, taxonomy pages, term pages, and regular pages.
+
+In most cases you should use the [`RegularPages`] method instead.
+
+[`RegularPages`]: methods/site/regularpages
+[kinds]: /getting-started/glossary/#page-kind
+
+```go-html-template
+{{ range .Site.AllPages }}
+
+{{ end }}
+```
+
+Hugo renders this to:
+
+```html
+
Fiction
+
+
The Hunchback of Notre Dame (978-0140443530)
+
Les Misérables (978-0451419439)
+
+
Nonfiction
+
+
The Ancien Régime and the Revolution (978-0141441641)
+
Interpreting the French Revolution (978-0521280495)
+
+```
+
+To limit the listing to fiction, and sort by title:
+
+```go-html-template
+
+ {{ range sort .Site.Data.books.fiction "title" }}
+
{{ .title }} ({{ .author }})
+ {{ end }}
+
+```
+
+To find a fiction book by ISBN:
+
+```go-html-template
+{{ range where .Site.Data.books.fiction "isbn" "978-0140443530" }}
+
{{ .title }} ({{ .author }})
+{{ end }}
+```
+
+In the template examples above, each of the keys is a valid identifier. For example, none of the keys contains a hyphen. To access a key that is not a valid identifier, use the [`index`] function:
+
+[`index`]: /functions/collections/indexfunction
+[chaining]: /getting-started/glossary/#chain
+[identifiers]: /getting-started/glossary/#identifier
diff --git a/content/en/methods/site/GetPage.md b/content/en/methods/site/GetPage.md
new file mode 100644
index 000000000..1e949f37c
--- /dev/null
+++ b/content/en/methods/site/GetPage.md
@@ -0,0 +1,109 @@
+---
+title: GetPage
+description: Returns a Page object from the given path.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/GetPage
+ returnType: hugolib.pageState
+ signatures: [SITE.GetPage PATH]
+toc: true
+---
+
+The `GetPage` method is also available on `Page` objects, allowing you to specify a path relative to the current page. See [details].
+
+[details]: /methods/page/getpage
+
+When using the `GetPage` method on a `Site` object, specify a path relative to the content directory.
+
+If Hugo cannot resolve the path to a page, the method returns nil.
+
+Consider this content structure:
+
+```text
+content/
+├── works/
+│ ├── paintings/
+│ │ ├── _index.md
+│ │ ├── starry-night.md
+│ │ └── the-mona-lisa.md
+│ ├── sculptures/
+│ │ ├── _index.md
+│ │ ├── david.md
+│ │ └── the-thinker.md
+│ └── _index.md
+└── _index.md
+```
+
+This home page template:
+
+```go-html-template
+{{ with .Site.GetPage "/works/paintings" }}
+
+ {{ range .Pages }}
+
{{ .Title }} by {{ .Params.artist }}
+ {{ end }}
+
+{{ end }}
+```
+
+Is rendered to:
+
+```html
+
+
Starry Night by Vincent van Gogh
+
The Mona Lisa by Leonardo da Vinci
+
+```
+
+To get a regular page instead of a section page:
+
+```go-html-template
+{{ with .Site.GetPage "/works/paintings/starry-night" }}
+ {{ .Title }} → Starry Night
+ {{ .Params.artist }} → Vincent van Gogh
+{{ end }}
+```
+
+## Multilingual projects
+
+With multilingual projects, the `GetPage` method on a `Site` object resolves the given path to a page in the current language.
+
+To get a page from a different language, query the `Sites` object:
+
+```go-html-template
+{{ with where .Site.Sites "Language.Lang" "eq" "de" }}
+ {{ with index . 0 }}
+ {{ with .GetPage "/works/paintings/starry-night" }}
+ {{ .Title }} → Sternenklare Nacht
+ {{ end }}
+ {{ end }}
+{{ end }}
+```
+
+## Page bundles
+
+Consider this content structure:
+
+```text
+content/
+├── headless/
+│ ├── a.jpg
+│ ├── b.jpg
+│ ├── c.jpg
+│ └── index.md <-- front matter: headless = true
+└── _index.md
+```
+
+In the home page template, use the `GetPage` method on a `Site` object to render all the images in the headless [page bundle]:
+
+```go-html-template
+{{ with .Site.GetPage "/headless" }}
+ {{ range .Resources.ByType "image" }}
+
+ {{ end }}
+{{ end }}
+```
+
+[page bundle]: /getting-started/glossary/#page-bundle
diff --git a/content/en/methods/site/Home.md b/content/en/methods/site/Home.md
new file mode 100644
index 000000000..52612dd12
--- /dev/null
+++ b/content/en/methods/site/Home.md
@@ -0,0 +1,25 @@
+---
+title: Home
+description: Returns the home Page object for the given site.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: hugolib.pageState
+ signatures: [SITE.Home]
+---
+
+This method is useful for obtaining a link to the home page.
+
+Site configuration:
+
+{{< code-toggle file=hugo >}}
+baseURL = 'https://example.org/docs/'
+{{< /code-toggle >}}
+
+Template:
+
+```go-html-template
+{{ .Site.Home.Permalink }} → https://example.org/docs/
+{{ .Site.Home.RelPermalink }} → /docs/
+```
diff --git a/content/en/methods/site/IsMultiLingual.md b/content/en/methods/site/IsMultiLingual.md
new file mode 100644
index 000000000..61cc5e462
--- /dev/null
+++ b/content/en/methods/site/IsMultiLingual.md
@@ -0,0 +1,34 @@
+---
+title: IsMultiLingual
+description: Reports whether the site is multilingual.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: bool
+ signatures: [SITE.IsMultiLingual]
+---
+
+Site configuration:
+
+{{< code-toggle file=hugo >}}
+defaultContentLanguage = 'de'
+defaultContentLanguageInSubdir = true
+[languages]
+ [languages.de]
+ languageCode = 'de-DE'
+ languageName = 'Deutsch'
+ title = 'Projekt Dokumentation'
+ weight = 1
+ [languages.en]
+ languageCode = 'en-US'
+ languageName = 'English'
+ title = 'Project Documentation'
+ weight = 2
+{{< /code-toggle >}}
+
+Template:
+
+```go-html-template
+{{ .Site.IsMultiLingual }} → true
+```
diff --git a/content/en/methods/site/Language.md b/content/en/methods/site/Language.md
new file mode 100644
index 000000000..1babc099b
--- /dev/null
+++ b/content/en/methods/site/Language.md
@@ -0,0 +1,83 @@
+---
+title: Language
+description: Returns the language object for the given site.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/language
+ returnType: langs.Language
+ signatures: [SITE.Language]
+toc: true
+---
+
+The `Language` method on a `Site` object returns the language object for the given site. The language object points to the language definition in the site configuration.
+
+You can also use the `Language` method on a `Page` object. See [details].
+
+## Methods
+
+The examples below assume the following in your site configuration:
+
+{{< code-toggle file=hugo >}}
+[languages.de]
+languageCode = 'de-DE'
+languageDirection = 'ltr'
+languageName = 'Deutsch'
+weight = 1
+{{< /code-toggle >}}
+
+Lang
+: (`string`) The language tag as defined by [RFC 5646].
+
+```go-html-template
+{{ .Site.Language.Lang }} → de
+```
+
+LanguageCode
+: (`string`) The language code from the site configuration.
+
+```go-html-template
+{{ .Site.Language.LanguageCode }} → de-DE
+```
+
+LanguageDirection
+: (`string`) The language direction from the site configuration, either `ltr` or `rtl`.
+
+```go-html-template
+{{ .Site.Language.LanguageDirection }} → ltr
+```
+
+LanguageName
+: (`string`) The language name from the site configuration.
+
+```go-html-template
+{{ .Site.Language.LanguageName }} → Deutsch
+```
+
+Weight
+: (`int`) The language weight from the site configuration which determines its order in the slice of languages returned by the `Languages` method on a `Site` object.
+
+```go-html-template
+{{ .Site.Language.Weight }} → 1
+```
+
+## Example
+
+Some of the methods above are commonly used in a base template as attributes for the `html` element.
+
+```go-html-template
+{{ jsonify (dict "indent" " ") .Site.Languages }}
+```
+
+With this site configuration:
+
+{{< code-toggle file=hugo >}}
+defaultContentLanguage = 'de'
+defaultContentLanguageInSubdir = false
+
+[languages.de]
+languageCode = 'de-DE'
+languageDirection = 'ltr'
+languageName = 'Deutsch'
+title = 'Projekt Dokumentation'
+weight = 1
+
+[languages.en]
+languageCode = 'en-US'
+languageDirection = 'ltr'
+languageName = 'English'
+title = 'Project Documentation'
+weight = 2
+{{< /code-toggle >}}
+
+This template:
+
+```go-html-template
+
+ {{ range .Site.Languages }}
+
{{ .Title }} ({{ .LanguageName }})
+ {{ end }}
+
+```
+
+Is rendered to:
+
+```html
+
+
Projekt Dokumentation (Deutsch)
+
Project Documentation (English)
+
+```
diff --git a/content/en/methods/site/LastChange.md b/content/en/methods/site/LastChange.md
new file mode 100644
index 000000000..aceee691d
--- /dev/null
+++ b/content/en/methods/site/LastChange.md
@@ -0,0 +1,21 @@
+---
+title: LastChange
+description: Returns the last modification date of site content.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: time.Time
+ signatures: [SITE.LastChange]
+---
+
+The `LastChange` method on a `Site` object returns a [`time.Time`] value. Use this with time [functions] and [methods]. For example:
+
+```go-html-template
+{{ .Site.LastChange | time.Format ":date_long" }} → October 16, 2023
+
+```
+
+[`time.Time`]: https://pkg.go.dev/time#Time
+[functions]: /functions/time
+[methods]: /methods/time
diff --git a/content/en/methods/site/MainSections.md b/content/en/methods/site/MainSections.md
new file mode 100644
index 000000000..251fe1a97
--- /dev/null
+++ b/content/en/methods/site/MainSections.md
@@ -0,0 +1,55 @@
+---
+title: MainSections
+description: Returns a slice of the main section names as defined in the site configuration, falling back to the top level section with the most pages.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: '[]string'
+ signatures: [SITE.MainSections]
+---
+
+Site configuration:
+
+{{< code-toggle file=hugo >}}
+[params]
+mainSections = ['books','films']
+{{< /code-toggle >}}
+
+Template:
+
+```go-html-template
+{{ .Site.MainSections }} → [books films]
+```
+
+If `params.mainSections` is not defined in the site configuration, this method returns a slice with one element---the top level section with the most pages.
+
+With this content structure, the "films" section has the most pages:
+
+```text
+content/
+├── books/
+│ ├── book-1.md
+│ └── book-2.md
+├── films/
+│ ├── film-1.md
+│ ├── film-2.md
+│ └── film-3.md
+└── _index.md
+```
+
+Template:
+
+```go-html-template
+{{ .Site.MainSections }} → [films]
+```
+
+When creating a theme, instead of hardcoding section names when listing the most relevant pages on the front page, instruct site authors to set `params.mainSections` in their site configuration.
+
+Then your home page template can do something like this:
+
+```go-html-template
+{{ range where .Site.RegularPages "Section" "in" .Site.MainSections }}
+
+{{ end }}
+```
diff --git a/content/en/methods/site/Menus.md b/content/en/methods/site/Menus.md
new file mode 100644
index 000000000..1967a9211
--- /dev/null
+++ b/content/en/methods/site/Menus.md
@@ -0,0 +1,94 @@
+---
+title: Menus
+description: Returns a collection of menu objects for the given site.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/page/IsMenuCurrent
+ - methods/page/HasMenuCurrent
+ returnType: navigation.Menus
+ signatures: [SITE.Menus]
+---
+
+The `Menus` method on a `Site` object returns a collection of menus, where each menu contains one or more entries, either flat or nested. Each entry points to a page within the site, or to an external resource.
+
+{{% note %}}
+Menus can be defined and localized in several ways. Please see the [menus] section for a complete explanation and examples.
+
+[menus]: /content-management/menus/
+{{% /note %}}
+
+A site can have multiple menus. For example, a main menu and a footer menu:
+
+{{< code-toggle file=hugo >}}
+[[menu.main]]
+name = 'Home'
+pageRef = '/'
+weight = 10
+
+[[menu.main]]
+name = 'Books'
+pageRef = '/books'
+weight = 20
+
+[[menu.main]]
+name = 'Films'
+pageRef = '/films'
+weight = 30
+
+[[menu.footer]]
+name = 'Legal'
+pageRef = '/legal'
+weight = 10
+
+[[menu.footer]]
+name = 'Privacy'
+pageRef = '/privacy'
+weight = 20
+{{< /code-toggle >}}
+
+This template renders the main menu:
+
+```go-html-template
+{{ with site.Menus.main }}
+
+{{ end }}
+```
+
+When viewing the home page, the result is:
+
+```html
+
+```
+
+When viewing the "books" page, the result is:
+
+```html
+
+```
+
+You will typically render a menu using a partial template. As the active menu entry will be different on each page, use the [`partial`] function to call the template. Do not use the [`partialCached`] function.
+
+The example above is simplistic. Please see the [menu templates] section for more information.
+
+[menu templates]: /templates/menu-templates
+
+[`partial`]: /functions/partials/include
+[`partialCached`]: /functions/partials/includecached
diff --git a/content/en/methods/site/Pages.md b/content/en/methods/site/Pages.md
new file mode 100644
index 000000000..583e98c11
--- /dev/null
+++ b/content/en/methods/site/Pages.md
@@ -0,0 +1,26 @@
+---
+title: Pages
+description: Returns a collection of all pages.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/site/AllPages
+ - methods/site/RegularPages
+ - methods/site/Sections
+ returnType: page.Pages
+ signatures: [SITE.Pages]
+---
+
+This method returns all page [kinds] in the current language. That includes the home page, section pages, taxonomy pages, term pages, and regular pages.
+
+In most cases you should use the [`RegularPages`] method instead.
+
+[`RegularPages`]: methods/site/regularpages
+[kinds]: /getting-started/glossary/#page-kind
+
+```go-html-template
+{{ range .Site.Pages }}
+
+{{ end }}
+```
+
+By default, Hugo sorts page collections by:
+
+1. The page `weight` as defined in front matter
+1. The page `date` as defined in front matter
+1. The page `linkTitle` as defined in front matter
+1. The file path
+
+If the `linkTitle` is not defined, Hugo evaluates the `title` instead.
+
+To change the sort order, use any of the `Pages` [sorting methods]. For example:
+
+```go-html-template
+{{ range .Site.RegularPages.ByTitle }}
+
+```
+
+To render a link to home page of the primary (first) language:
+
+```go-html-template
+{{ with .Site.Sites.First }}
+ {{ .Title }}
+{{ end }}
+```
+
+This is equivalent to:
+
+```go-html-template
+{{ with index .Site.Sites 0 }}
+ {{ .Title }}
+{{ end }}
+```
diff --git a/content/en/methods/site/Taxonomies.md b/content/en/methods/site/Taxonomies.md
new file mode 100644
index 000000000..72bfc75d5
--- /dev/null
+++ b/content/en/methods/site/Taxonomies.md
@@ -0,0 +1,99 @@
+---
+title: Taxonomies
+description: Returns a data structure containing the site's taxonomy objects, the terms within each taxonomy object, and the pages to which the terms are assigned.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: page.TaxonomyList
+ signatures: [SITE.Taxonomies]
+---
+
+Conceptually, the `Taxonomies` method on a `Site` object returns a data structure such as:
+
+{{< code-toggle >}}
+taxonomy a:
+ - term 1:
+ - page 1
+ - page 2
+ - term 2:
+ - page 1
+taxonomy b:
+ - term 1:
+ - page 2
+ - term 2:
+ - page 1
+ - page 2
+{{< /code-toggle >}}
+
+For example, on a book review site you might create two taxonomies; one for genres and another for authors.
+
+With this site configuration:
+
+{{< code-toggle file=hugo >}}
+[taxonomies]
+genre = 'genres'
+author = 'authors'
+{{< /code-toggle >}}
+
+And this content structure:
+
+```text
+content/
+├── books/
+│ ├── and-then-there-were-none.md --> genres: suspense
+│ ├── death-on-the-nile.md --> genres: suspense
+│ └── jamaica-inn.md --> genres: suspense, romance
+│ └── pride-and-prejudice.md --> genres: romance
+└── _index.md
+```
+
+Conceptually, the taxonomies data structure looks like:
+
+{{< code-toggle >}}
+genres:
+ - suspense:
+ - And Then There Were None
+ - Death on the Nile
+ - Jamaica Inn
+ - romance:
+ - Jamaica Inn
+ - Pride and Prejudice
+authors:
+ - achristie:
+ - And Then There Were None
+ - Death on the Nile
+ - ddmaurier:
+ - Jamaica Inn
+ - jausten:
+ - Pride and Prejudice
+{{< /code-toggle >}}
+
+
+To list the "suspense" books:
+
+```go-html-template
+
+```
+
+{{% note %}}
+Hugo's taxonomy system is powerful, allowing you to classify content and create relationships between pages.
+
+Please see the [taxonomies] section for a complete explanation and examples.
+
+[taxonomies]: content-management/taxonomies/
+{{% /note %}}
diff --git a/content/en/methods/site/Title.md b/content/en/methods/site/Title.md
new file mode 100644
index 000000000..a357286c1
--- /dev/null
+++ b/content/en/methods/site/Title.md
@@ -0,0 +1,22 @@
+---
+title: Title
+description: Returns the title as defined in the site configuration.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: string
+ signatures: [SITE.Title]
+---
+
+Site configuration:
+
+{{< code-toggle file=hugo >}}
+title = 'My Documentation Site'
+{{< /code-toggle >}}
+
+Template:
+
+```go-html-template
+{{ .Site.Title }} → My Documentation Site
+```
diff --git a/content/en/methods/site/_index.md b/content/en/methods/site/_index.md
new file mode 100644
index 000000000..39f66f308
--- /dev/null
+++ b/content/en/methods/site/_index.md
@@ -0,0 +1,12 @@
+---
+title: Site methods
+linkTitle: Site
+description: Use these methods with Site objects.
+categories: []
+keywords: []
+menu:
+ docs:
+ parent: methods
+---
+
+Use these methods with Site objects. A multilingual project will have two or more sites, one for each language.
diff --git a/content/en/methods/taxonomy/Alphabetical.md b/content/en/methods/taxonomy/Alphabetical.md
new file mode 100644
index 000000000..2c07fbef4
--- /dev/null
+++ b/content/en/methods/taxonomy/Alphabetical.md
@@ -0,0 +1,78 @@
+---
+title: Alphabetical
+description: Returns an ordered taxonomy, sorted alphabetically by term.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/taxonomy/ByCount
+ returnType: page.OrderedTaxonomy
+ signatures: [TAXONOMY.Alphabetical]
+toc: true
+---
+
+The `Alphabetical` method on a `Taxonomy` object returns an [ordered taxonomy], sorted alphabetically by [term].
+
+While a `Taxonomy` object is a [map], an ordered taxonomy is a [slice], where each element is an object that contains the term and a slice of its [weighted pages].
+
+{{% include "methods/taxonomy/_common/get-a-taxonomy-object.md" %}}
+
+## Get the ordered taxonomy
+
+Now that we have captured the “genres” Taxonomy object, let’s get the ordered taxonomy sorted alphabetically by term:
+
+```go-html-template
+{{ $taxonomyObject.Alphabetical }}
+```
+
+To reverse the sort order:
+
+```go-html-template
+{{ $taxonomyObject.Alphabetical.Reverse }}
+```
+
+To inspect the data structure:
+
+```go-html-template
+
+```
+
+{{% include "methods/taxonomy/_common/ordered-taxonomy-element-methods.md" %}}
+
+## Example
+
+With this template:
+
+```go-html-template
+{{ range $taxonomyObject.Alphabetical }}
+
+```
+
+[ordered taxonomy]: /getting-started/glossary/#ordered-taxonomy
+[term]: /getting-started/glossary/#term
+[map]: /getting-started/glossary/#map
+[slice]: /getting-started/glossary/#slice
+[term]: /getting-started/glossary/#term
+[weighted pages]: /getting-started/glossary/#weighted-page
diff --git a/content/en/methods/taxonomy/ByCount.md b/content/en/methods/taxonomy/ByCount.md
new file mode 100644
index 000000000..d0caa7d2c
--- /dev/null
+++ b/content/en/methods/taxonomy/ByCount.md
@@ -0,0 +1,78 @@
+---
+title: ByCount
+description: Returns an ordered taxonomy, sorted by the number of pages associated with each term.
+categories: []
+keywords: []
+action:
+ related:
+ - methods/taxonomy/Alphabetical
+ returnType: page.OrderedTaxonomy
+ signatures: [TAXONOMY.ByCount]
+toc: true
+---
+
+The `ByCount` method on a `Taxonomy` object returns an [ordered taxonomy], sorted by the number of pages associated with each [term].
+
+While a `Taxonomy` object is a [map], an ordered taxonomy is a [slice], where each element is an object that contains the term and a slice of its [weighted pages].
+
+{{% include "methods/taxonomy/_common/get-a-taxonomy-object.md" %}}
+
+## Get the ordered taxonomy
+
+Now that we have captured the “genres” Taxonomy object, let’s get the ordered taxonomy sorted by the number of pages associated with each term:
+
+```go-html-template
+{{ $taxonomyObject.ByCount }}
+```
+
+To reverse the sort order:
+
+```go-html-template
+{{ $taxonomyObject.ByCount.Reverse }}
+```
+
+To inspect the data structure:
+
+```go-html-template
+
+```
+
+{{% include "methods/taxonomy/_common/ordered-taxonomy-element-methods.md" %}}
+
+## Example
+
+With this template:
+
+```go-html-template
+{{ range $taxonomyObject.ByCount }}
+
+```
+
+[ordered taxonomy]: /getting-started/glossary/#ordered-taxonomy
+[term]: /getting-started/glossary/#term
+[map]: /getting-started/glossary/#map
+[slice]: /getting-started/glossary/#slice
+[term]: /getting-started/glossary/#term
+[weighted pages]: /getting-started/glossary/#weighted-page
diff --git a/content/en/methods/taxonomy/Count.md b/content/en/methods/taxonomy/Count.md
new file mode 100644
index 000000000..50f705ec9
--- /dev/null
+++ b/content/en/methods/taxonomy/Count.md
@@ -0,0 +1,26 @@
+---
+title: Count
+description: Returns the number of number of weighted pages to which the given term has been assigned.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: int
+ signatures: [TAXONOMY.Count TERM]
+toc: true
+---
+
+The `Count` method on a `Taxonomy` object returns the number of number of [weighted pages] to which the given [term] has been assigned.
+
+{{% include "methods/taxonomy/_common/get-a-taxonomy-object.md" %}}
+
+## Count the weighted pages
+
+Now that we have captured the "genres" `Taxonomy` object, let's count the number of weighted pages to which the "suspense" term has been assigned:
+
+```go-html-template
+{{ $taxonomyObject.Count "suspense" }} → 3
+```
+
+[weighted pages]: /getting-started/glossary/#weighted-page
+[term]: /getting-started/glossary/#term
diff --git a/content/en/methods/taxonomy/Get.md b/content/en/methods/taxonomy/Get.md
new file mode 100644
index 000000000..3bac86f08
--- /dev/null
+++ b/content/en/methods/taxonomy/Get.md
@@ -0,0 +1,72 @@
+---
+title: Get
+description: Returns a slice of weighted pages to which the given term has been assigned.
+categories: []
+keywords: []
+action:
+ related: []
+ returnType: page.WeightedPages
+ signatures: [TAXONOMY.Get TERM]
+toc: true
+---
+
+The `Get` method on a `Taxonomy` object returns a slice of [weighted pages] to which the given [term] has been assigned.
+
+{{% include "methods/taxonomy/_common/get-a-taxonomy-object.md" %}}
+
+## Get the weighted pages
+
+Now that we have captured the "genres" `Taxonomy` object, let's get the weighted pages to which the "suspense" term has been assigned:
+
+```go-html-template
+{{ $weightedPages := $taxonomyObject.Get "suspense" }}
+```
+
+The above is equivalent to:
+
+```go-html-template
+{{ $weightedPages := $taxonomyObject.suspense }}
+```
+
+But, if the term is not a valid [identifier], you cannot use the [chaining] syntax. For example, this will throw an error because the identifier contains a hyphen:
+
+```go-html-template
+{{ $weightedPages := $taxonomyObject.my-genre }}
+```
+
+You could also use the [`index`] function, but the syntax is more verbose:
+
+```go-html-template
+{{ $weightedPages := index $taxonomyObject "my-genre" }}
+```
+
+To inspect the data structure:
+
+```go-html-template
+
{{ jsonify (dict "indent" " ") $weightedPages }}
+```
+
+## Example
+
+With this template:
+
+```go-html-template
+{{ $weightedPages := $taxonomyObject.Get "suspense" }}
+{{ range $weightedPages }}
+
+```
+
+[chaining]: /getting-started/glossary/#chain
+[`index`]: /functions/collections/indexfunction
+[identifier]: /getting-started/glossary/#identifier
+[term]: /getting-started/glossary/#term
+[weighted pages]: /getting-started/glossary/#weighted-page
diff --git a/content/en/methods/taxonomy/_common/_index.md b/content/en/methods/taxonomy/_common/_index.md
new file mode 100644
index 000000000..47d5812fb
--- /dev/null
+++ b/content/en/methods/taxonomy/_common/_index.md
@@ -0,0 +1,13 @@
+---
+cascade:
+ _build:
+ list: never
+ publishResources: false
+ render: never
+---
+
+
diff --git a/content/en/methods/taxonomy/_common/get-a-taxonomy-object.md b/content/en/methods/taxonomy/_common/get-a-taxonomy-object.md
new file mode 100644
index 000000000..d9bd14364
--- /dev/null
+++ b/content/en/methods/taxonomy/_common/get-a-taxonomy-object.md
@@ -0,0 +1,68 @@
+---
+# Do not remove front matter.
+---
+
+Before we can use a `Taxonomy` method, we need to capture a `Taxonomy` object.
+
+## Capture a taxonomy object
+
+Consider this site configuration:
+
+{{< code-toggle file=hugo >}}
+[taxonomies]
+genre = 'genres'
+author = 'authors'
+{{< /code-toggle >}}
+
+And this content structure:
+
+```text
+content/
+├── books/
+│ ├── and-then-there-were-none.md --> genres: suspense
+│ ├── death-on-the-nile.md --> genres: suspense
+│ └── jamaica-inn.md --> genres: suspense, romance
+│ └── pride-and-prejudice.md --> genres: romance
+└── _index.md
+```
+
+To capture the "genres" taxonomy object from within any template, use the [`Taxonomies`] method on a `Site` object.
+
+```go-html-template
+{{ $taxonomyObject := .Site.Taxonomies.genres }}
+```
+
+To capture the "genres" taxonomy object when rendering its page with a taxonomy template, use the [`Terms`] method on the page's [`Data`] object:
+
+{{< code file="layouts/_default/taxonomy.html" lang=go-html-template >}}
+{{ $taxonomyObject := .Data.Terms }}
+{{< /code >}}
+
+To inspect the data structure:
+
+```go-html-template
+
{{ jsonify (dict "indent" " ") $taxonomyObject }}
+```
+
+Although the [`Alphabetical`] and [`ByCount`] methods provide a better data structure for ranging through the taxonomy, you can render the weighted pages by term directly from the `Taxonomy` object:
+
+```go-html-template
+{{ range $term, $weightedPages := $taxonomyObject }}
+
{{ end }}
{{ end }}
@@ -649,7 +646,7 @@ If you restrict front matter to the TOML format, and omit quotation marks surrou
{{ range where (where site.RegularPages "Type" "events") "Params.start_date" "gt" now }}
{{ $startDate := .Params.start_date | time.Format ":date_medium" }}
{{ end }}
@@ -666,9 +663,9 @@ If you restrict front matter to the TOML format, and omit quotation marks surrou
[internal templates]: /templates/internal
[math]: /functions/math
[pagevars]: /variables/page
-[param]: /functions/param
+[param]: /methods/page/param
[partials]: /templates/partials
-[relpermalink]: /variables/page#page-variables
+[relpermalink]: /variables/page
[`safehtml`]: /functions/safe/html
[sitevars]: /variables/site
[variables]: /variables
diff --git a/content/en/templates/lists/index.md b/content/en/templates/lists/index.md
index b48969e96..7e95cc5bc 100644
--- a/content/en/templates/lists/index.md
+++ b/content/en/templates/lists/index.md
@@ -110,7 +110,7 @@ You can now access this `_index.md`'s' content in your list template:
This above will output the following HTML:
-{{< code file="example.com/posts/index.html" copy=false >}}
+{{< code file="example.com/posts/index.html" >}}
@@ -134,7 +134,7 @@ You do *not* have to create an `_index.md` file for every list page (i.e. sectio
Using this same `layouts/_default/list.html` template and applying it to the `quotes` section above will render the following output. Note that `quotes` does not have an `_index.md` file to pull from:
-{{< code file="example.com/quote/index.html" copy=false >}}
+{{< code file="example.com/quote/index.html" >}}
@@ -144,8 +144,8 @@ Using this same `layouts/_default/list.html` template and applying it to the `qu
@@ -194,374 +194,29 @@ This list template has been modified slightly from a template originally used in
{{ end }}
{{< /code >}}
-## Order content
+## Sort content
-Hugo lists render the content based on metadata you provide in [front matter]. In addition to sane defaults, Hugo also ships with multiple methods to make quick work of ordering content inside list templates:
+By default, Hugo sorts page collections by:
-### Default: Weight > Date > LinkTitle > FilePath
+1. Page [weight]
+2. Page [date] (descending)
+3. Page [linkTitle], falling back to page [title]
+4. Page file path if the page is backed by a file
-{{< code file="layouts/partials/default-order.html" >}}
-
-{{< /code >}}
+[date]: /methods/page/date
+[weight]: /methods/page/weight
+[linkTitle]: /methods/page/linktitle
+[title]: /methods/page/title
-### By weight
+Change the sort order using any of the methods below.
-Lower weight gets higher precedence. So content with lower weight will come first.
-
-{{< code file="layouts/partials/by-weight.html" >}}
-
-{{< /code >}}
-
-### By page parameter
-
-Order based on the specified front matter parameter. Content that does not have the specified front matter field will use the site's `.Site.Params` default. If the parameter is not found at all in some entries, those entries will appear together at the end of the ordering.
-
-{{< code file="layouts/partials/by-rating.html" >}}
-
-{{ range (.Pages.ByParam "rating") }}
-
-{{ end }}
-{{< /code >}}
-
-If the targeted front matter field is nested beneath another field, you can access the field using dot notation.
-
-{{< code file="layouts/partials/by-nested-param.html" >}}
-{{ range (.Pages.ByParam "author.last_name") }}
-
-{{ end }}
-{{< /code >}}
-
-### Reverse order
-
-Reversing order can be applied to any of the above methods. The following uses `ByDate` as an example:
-
-{{< code file="layouts/partials/by-date-reverse.html" >}}
-
-{{< /code >}}
+{{< list-pages-in-section path=/methods/pages filter=methods_pages_sort filterType=include titlePrefix=. omitElementIDs=true >}}
## Group content
-Hugo provides some functions for grouping pages by Section, Type, Date, etc.
+Group your content by field, parameter, or date using any of the methods below.
-### By page field
-
-{{< code file="layouts/partials/by-page-field.html" >}}
-
-{{ range .Pages.GroupBy "Section" }}
-
-{{ end }}
-{{< /code >}}
-
-In the above example, you may want `{{ .Title }}` to point the `title` field you have added to your `_index.md` file instead. You can access this value using the [`.GetPage` function][getpage]:
-
-{{< code file="layouts/partials/by-page-field.html" >}}
-
-{{ range .Pages.GroupBy "Section" }}
-
- {{ with $.Site.GetPage "section" .Key }}
-
-{{ end }}
-{{< /code >}}
-
-{{< new-in "0.97.0" >}} `GroupByDate` accepts the same time layouts as in [`time.Format`] and the `.Key` in the result will be localized for the current language.
-
-### By publish date
-
-{{< code file="layouts/partials/by-page-publish-date.html" >}}
-
-{{ range .Pages.GroupByPublishDate "2006-01" }}
-
-{{ end }}
-{{< /code >}}
-
-{{< new-in "0.97.0" >}} `GroupByDate` accepts the same time layouts as in [`time.Format`] and the `.Key` in the result will be localized for the current language.
-
-### By expiration date
-
-{{< code file="layouts/partials/by-page-expiry-date.html" >}}
-
-{{ range .Pages.GroupByExpiryDate "2006-01" }}
-
-{{ end }}
-{{< /code >}}
-
-{{< new-in "0.97.0" >}} `GroupByDate` accepts the same time layouts as in [`time.Format`] and the `.Key` in the result will be localized for the current language.
-
-### By last modified date
-
-{{< code file="layouts/partials/by-page-lastmod.html" >}}
-
-{{ range .Pages.GroupByLastmod "2006-01" }}
-
-{{ end }}
-{{< /code >}}
-
-{{< new-in "0.97.0" >}} `GroupByDate` accepts the same time layouts as in [`time.Format`] and the `.Key` in the result will be localized for the current language.
-
-### By page parameter
-
-{{< code file="layouts/partials/by-page-param.html" >}}
-
-{{ range .Pages.GroupByParam "param_key" }}
-
- {{ end }}
-{{< /code >}}
-
-### By page parameter in date format
-
-The following template takes grouping by `date` a step further and uses Go's layout string. See the [`Format` function] for more examples of how to use Go's layout string to format dates in Hugo.
-
-{{< code file="layouts/partials/by-page-param-as-date.html" >}}
-
-{{ range .Pages.GroupByParamDate "param_key" "2006-01" }}
-
-{{ end }}
-{{< /code >}}
-
-### Reverse key order
-
-Ordering of groups is performed by keys in alphanumeric order (A–Z, 1–100) and in reverse chronological order (i.e., with the newest first) for dates.
-
-While these are logical defaults, they are not always the desired order. There are two different syntaxes to change Hugo's default ordering for groups, both of which work the same way.
-
-#### 1. Adding the reverse method
-
-```go-html-template
-{{ range (.Pages.GroupBy "Section").Reverse }}
-```
-
-```go-html-template
-{{ range (.Pages.GroupByDate "2006-01").Reverse }}
-```
-
-#### 2. Providing the alternate direction
-
-```go-html-template
-{{ range .Pages.GroupByDate "2006-01" "asc" }}
-```
-
-```go-html-template
-{{ range .Pages.GroupBy "Section" "desc" }}
-```
-
-### Order within groups
-
-Because Grouping returns a `{{ .Key }}` and a slice of pages, all the ordering methods listed above are available.
-
-Here is the ordering for the example that follows:
-
-1. Content is grouped by month according to the `date` field in front matter.
-2. Groups are listed in ascending order (i.e., the oldest groups first)
-3. Pages within each respective group are ordered alphabetically according to the `title`.
-
-{{< code file="layouts/partials/by-group-by-page.html" >}}
-{{ range .Pages.GroupByDate "2006-01" "asc" }}
-