Merge commit '35dec7c96f7ee3eb17dd444f7067f0c776fb56ae'

This commit is contained in:
Bjørn Erik Pedersen 2023-12-04 15:24:01 +01:00
commit d19ed4d4e6
No known key found for this signature in database
810 changed files with 24147 additions and 7766 deletions

View file

@ -1,361 +1,133 @@
{
"version": "0.2",
"words": [
"aaabaab",
"aabb",
"aabba",
"aabbaa",
"aabbaabb",
"aabbaabbab",
"abbaa",
"abourget",
"absurl",
"adoc",
"algolia",
"allowfullscreen",
"ananke",
"anchorize",
"anthonyfok",
"asciidoctor",
"attrlink",
"azblob",
"baseof",
"bbaa",
"bcde",
"bcdef",
"beevelop",
"Bergevin",
"bibtex",
"Bjørn",
"blackfriday",
"blogue",
"bogem",
"Bootcamp",
"brlink",
"Brotli",
"Browsersync",
"canonicalization",
"canonify",
"Catmull",
"Catwoman",
"changefreq",
"Cheatsheet",
"choco",
"chromastyles",
"clockoon",
"Cloudinary",
"CNAME",
"Codecademy's",
"CODEOWNERS",
"Coen",
"Commento",
"Cond",
"contentdir",
"Contentful",
"Copr",
"copyrighthtml",
"corejs",
"countrunes",
"countwords",
"crossreferences",
"daftaupe",
"datatable",
"DATOCMS",
"debugconfig",
"defang",
"Deindent",
"DELIM",
"dhersam",
"digitalcraftsman",
"Disqus",
"Dmdh",
"doas",
"dokuwiki",
"dpkg",
"DRING",
"Eiqc",
"Eliott",
"embeddable",
"Emojify",
"Enwrite",
"eopkg",
"eparis",
"errorf",
"erroridf",
"esbuild",
"Evernote",
"Exif",
"exitwp",
"expirydate",
"Feminella",
"firstpost",
"Flickr",
"Formspree",
"fpath",
"Francia",
"freenode",
"frontmatter",
"funcs",
"funcsig",
"Garen",
"Garuda",
"gcloud",
"Getenv",
"getjson",
"getpage",
"Gitee",
"Gmfc",
"Goel",
"Gohugo",
"gohugoio",
"goldenbridge",
"Goldmark",
"gomodules",
"GOPATH",
"govendor",
"Gowans",
"Grayscale",
"Gregor",
"Gruber",
"gtag",
"gvfs",
"hidecaption",
"hmac",
"Hokus",
"hola",
"hügó",
"hugodeps",
"hugodoc",
"Hugofy",
"hugolang",
"hugoversion",
"Hyas",
"Hyvor",
"iframes",
"ifttt",
"iife",
"imgproc",
"importr",
"IMWQ",
"indice",
"innershortcode",
"Intelli",
"interdoc",
"IPTC",
"ismenucurrent",
"Isset",
"Isso",
"Jaco",
"JIRN",
"johnpatitucci",
"Joomla",
"JRBR",
"jsonify",
"Karmada",
"katex",
"keycdn",
"KEYVALS",
"kubernetes",
"Kubuntu",
"Lanczos",
"langformatnumber",
"lastmod",
"libwebp",
"linktitle",
"Lipi",
"lrwxr",
"Lubuntu",
"maingo",
"markdownified",
"markdownify",
"mathjax",
"mdhender",
"mdshortcode",
"MENUENTRY",
"mercredi",
"Milli",
"Mittwoch",
"mkdir",
"modh",
"monokai",
"Morling",
"mspowerpoint",
"Multihost",
"Muut",
"myclass",
"mydeployment",
"myindex",
"mylayout",
"mylogin",
"mypage",
"mypartials",
"mypost",
"mysite",
"myspa",
"mystyle",
"mytextpartial",
"mytheme",
"NDJSON",
"needsexample",
"Netravali",
"newparam",
"Nichlas",
"Nikhil",
"Nikola",
"Njjy",
"nlist",
"nobr",
"nocopy",
"Norsk",
"nosniff",
"NOSQL",
"notoc",
"novembre",
"numfmt",
"NUMWORKERMULTIPLIER",
"Obhu",
"octohug",
"Octopress",
"oldparam",
"onrender",
"opengraph",
"OWASP",
"Pandoc",
"partialcached",
"Pastorius",
"Patitucci",
"PCRE",
"peaceiris",
"Pedersen",
"Pekka",
"permalinkable",
"plainify",
"POSIX",
"postprocess",
"Poupin",
"prerender",
"println",
"Pritchard",
"publishdate",
"Pygments",
"qref",
"querify",
"QVOMC",
"Racic",
"Rclone",
"rdwatters",
"readfile",
"rebinded",
"recommendedby",
"REDIR",
"reftext",
"relatedfuncs",
"relref",
"relurl",
"remarkjs",
"rgba",
"Riku",
"rlimit",
"roboto",
"rssxml",
"rwxrwxrwx",
"RYUGV",
"safehtml",
"safejs",
"Samsa",
"schemaorg",
"setx",
"Shekhar",
"Shortcode",
"Shortcodes",
"signup",
"Silvola",
"Sindre",
"sitemapindex",
"sitemapxml",
"slugorfilename",
"Smartcrop",
"Sobre",
"Sprintf",
"Startseite",
"strconv",
"stringifier",
"struct",
"structs",
"subdir",
"svgs",
"symdiff",
"Talkyard",
"taxo",
"taxonomyname",
"tbody",
"tdewolff",
"testshortcodes",
"thead",
"Thinkful",
"Tknx",
"TLDR",
"TMPDIR",
"toclevels",
"TOCSS",
"todos",
"tojson",
"Tomango",
"topologix",
"Torikian",
"totoml",
"toyaml",
"twitteruser",
"Unmarshal",
"unpublishdate",
"Unsharp",
"urlize",
"urlset",
"utimestamp",
"vendored",
"vimrc",
"wanghc",
"Wappalyzer",
"warnf",
"webp",
"Wercker",
"wibble",
"wordcount",
"workson",
"Wowchemy",
"wpxr",
"Xbaabbab",
"Xubuntu",
"xvzf",
"yoyoyo",
"yunbox",
"Zgotmpl",
"Zorin",
"zzbbaabb",
"مدونتي"
],
"language": "en,en-US,de,fr",
"allowCompoundWords": true,
"files": [
"**/*.md"
],
"ignoreRegExpList": [
"<!-- prettier-ignore -->\\n(`{3,})\\w*\\n[\\s\\S]+?\\1",
"\\[(\\*{2})?@\\w+?\\1\\]",
"\\[`\\w+`\\]",
"ve{2,}r{2,}y",
"ve+r+y+long\\w*",
"\\/.*?\\/",
"\\_\\w+",
"\\#\\w+"
"flagWords": [
"alot",
"hte",
"reccommend",
"seperate"
],
"ignorePaths": [
".cspell.json",
"**/node_modules/**",
"*.min.*",
"**/news/*",
"**/showcase/*"
"**/emojis.md",
"**/commands/*",
"**/showcase/*",
"**/tools/*"
],
"useGitignore": true,
"enabled": true
"ignoreRegExpList": [
"# cspell: ignore fenced code blocks",
"^(\\s*`{3,}).*[\\s\\S]*?^\\1",
"# cspell: ignore words joined with dot",
"\\w+\\.\\w+",
"# cspell: ignore strings within backticks",
"`.+`",
"# cspell: ignore strings within single quotes",
"'.+'",
"# cspell: ignore strings within double quotes",
"\".+\"",
"# cspell: ignore strings within brackets",
"\\[.+\\]",
"# cspell: ignore strings within parentheses",
"\\(.+\\)",
"# cspell: ignore words that begin with a slash",
"/\\w+",
"# cspell: ignore everything within action delimiters",
"\\{\\{.+\\}\\}",
"# cspell: ignore everything after a right arrow",
"\\s+→\\s+.+"
],
"language": "en",
"words": [
"antialiasing",
"codeowners",
"composability",
"configurators",
"defang",
"deindent",
"downscale",
"downscaled",
"downscaling",
"exif",
"geolocalized",
"grayscale",
"marshal",
"marshaling",
"multihost",
"performantly",
"preconfigured",
"prerendering",
"redirection",
"redirections",
"shortcode",
"shortcodes",
"subexpression",
"subexpressions",
"suppressable",
"templating",
"transpile",
"transpiles",
"unmarshal",
"unmarshaling",
"# ----------------------------------------------------------------------",
"# cspell: ignore foreign language words",
"# ----------------------------------------------------------------------",
"bezpieczeństwo",
"dokumentation",
"libros",
"miesiąc",
"miesiąc",
"miesięcy",
"miesięcy",
"misérables",
"projekt",
"régime",
"# ----------------------------------------------------------------------",
"# cspell: ignore proper nouns",
"# ----------------------------------------------------------------------",
"Eliott",
"Gregor",
"Jaco",
"Noll",
"Pastorius",
"Samsa",
"# ----------------------------------------------------------------------",
"# cspell: ignore operating systems and software packages",
"# ----------------------------------------------------------------------",
"asciidoctor",
"brotli",
"corejs",
"disqus",
"doas",
"eopkg",
"gitee",
"goldmark",
"kubuntu",
"lubuntu",
"nosql",
"pandoc",
"pkgin",
"rclone",
"xubuntu",
"# ----------------------------------------------------------------------",
"# cspell: ignore miscellaneous",
"# ----------------------------------------------------------------------",
"dring",
"getenv",
"gohugo",
"inor",
"jdoe",
"milli",
"rgba",
"rsmith",
"stringifier",
"struct",
"tdewolff",
"tjones",
"toclevels",
"vals",
"xfeff",
"zgotmplz"
]
}

View file

@ -15,7 +15,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v2

View file

@ -1,9 +1,9 @@
name: "Check spelling"
on: # rebuild any PRs and main branch changes
on:
push:
pull_request:
branches-ignore:
- "dependabot/**"
pull_request:
permissions:
contents: read
@ -12,10 +12,11 @@ jobs:
spellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: streetsidesoftware/cspell-action@v2
- uses: actions/checkout@v4
- uses: streetsidesoftware/cspell-action@v4
with:
check_dot_files: false
files: content/**/*.md
incremental_files_only: true
inline: warning
strict: false

View file

@ -18,10 +18,10 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Lint Code Base
uses: github/super-linter/slim@v4
uses: super-linter/super-linter/slim@v5
env:
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -1,183 +1,190 @@
Apache License
==============
Version 2.0, January 2004
http://www.apache.org/licenses/
_Version 2.0, January 2004_
_&lt;<http://www.apache.org/licenses/>&gt;_
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
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
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.
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]

View file

@ -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 ...

View file

@ -0,0 +1,7 @@
@media print {
#page-footer,
body > footer,
body > nav {
display: none;
}
}

View file

@ -0,0 +1,11 @@
#right-sidebar {
scrollbar-width: none; /* hide scrollbar: Firefox */
-ms-overflow-style: none; /* hide scrollbar: Internet Explorer 10+ */
height: calc(100vh - 9rem);
overflow-y: auto;
}
#right-sidebar::-webkit-scrollbar { /* hide scrollbar: WebKit */
width: 0;
height: 0;
}

View file

@ -0,0 +1,20 @@
/*
Make h6 elements behave like dt elements. Initially implemented to support
linkable glossary entries.
Yes, it's a hack. That's why it's in the shame file.
*/
h6 {
margin-top: 0;
margin-bottom: 0;
font-size: 1.125rem;
}
h6:first-of-type {
margin-top: 3em;
}
h6 ~ p {
margin: 0.5em 0 2em 0;
}

View file

@ -21,18 +21,18 @@
@import '_no-js';
@import '_social-icons';
@import '_stickyheader';
@import '_right-sidebar';
@import '_svg';
@import '_chroma';
@import '_variables';
@import '_print';
@import '_shame';
.nested-blockquote blockquote {
border-left: 4px solid var(--primary-color);
padding-left: 1em;
/*margin: 0;*/
}
.mw-90 {
max-width:90%;
}

View file

@ -5174,6 +5174,16 @@ code, .code, pre code, .highlight pre {
right:0;
}
}
#right-sidebar {
scrollbar-width: none; /* hide scrollbar: Firefox */
-ms-overflow-style: none; /* hide scrollbar: Internet Explorer 10+ */
height: calc(100vh - 9rem);
overflow-y: auto;
}
#right-sidebar::-webkit-scrollbar { /* hide scrollbar: WebKit */
width: 0;
height: 0;
}
.fill-current { fill: currentColor; }
/* Background */
.chroma { background-color: #ffffff }
@ -5305,10 +5315,33 @@ code, .code, pre code, .highlight pre {
.chroma .gt { color: #aa0000 }
/* TextWhitespace */
.chroma .w { color: #bbbbbb }
@media print {
#page-footer,
body > footer,
body > nav {
display: none;
}
}
/*
Make h6 elements behave like dt elements. Initially implemented to support
linkable glossary entries.
Yes, it's a hack. That's why it's in the shame file.
*/
h6 {
margin-top: 0;
margin-bottom: 0;
font-size: 1.125rem;
}
h6:first-of-type {
margin-top: 3em;
}
h6 ~ p {
margin: 0.5em 0 2em 0;
}
.nested-blockquote blockquote {
border-left: 4px solid #0594CB;
padding-left: 1em;
/*margin: 0;*/
}
.mw-90 {
max-width:90%;

View file

@ -1,5 +1,5 @@
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}
{{- if and (ge .Level 2) (le .Level 4) }}{{" " -}}
{{- if in (slice 2 3 4 6) .Level }}{{" " -}}
<a class="header-link" href="#{{ .Anchor | safeURL }}"><svg class="fill-current o-60 hover-accent-color-light" height="22px" viewBox="0 0 24 24" width="22px" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"/><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg></a>
{{- end -}}
</h{{ .Level }}>

View file

@ -0,0 +1,250 @@
{{- /* Last modified: 2023-09-04T09:23:04-07:00 */}}
{{- /*
Copyright 2023 Veriphor LLC
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.
*/}}
{{- /*
This render hook resolves internal destinations by looking for a matching:
1. Content page
2. Page resource (a file in the current page bundle)
3. Section resource (a file in the current section)
4. Global resource (a file in the assets directory)
It skips the section resource lookup if the current page is a leaf bundle.
External destinations are not modified.
You must place global resources in the assets directory. If you have placed
your resources in the static directory, and you are unable or unwilling to move
them, you must mount the static directory to the assets directory by including
both of these entries in your site configuration:
[[module.mounts]]
source = 'assets'
target = 'assets'
[[module.mounts]]
source = 'static'
target = 'assets'
By default, if this render hook is unable to resolve a destination, including a
fragment if present, it passes the destination through without modification. To
emit a warning or error, set the error level in your site configuration:
[params.render_hooks.link]
errorLevel = 'warning' # ignore (default), warning, or error (fails the build)
When you set the error level to warning, and you are in a development
environment, you can visually highlight broken internal links:
[params.render_hooks.link]
errorLevel = 'warning' # ignore (default), warning, or error (fails the build)
highlightBroken = true # true or false (default)
This will add a "broken" class to anchor elements with invalid src attributes.
Add a rule to your CSS targeting the broken links:
a.broken {
background: #ff0;
border: 2px solid #f00;
padding: 0.1em 0.2em;
}
This render hook may be unable to resolve destinations created with the ref and
relref shortcodes. Unless you set the error level to ignore you should not use
either of these shortcodes in conjunction with this render hook.
@context {string} Destination The link destination.
@context {page} Page A reference to the page containing the link.
@context {string} PlainText The link description as plain text.
@context {string} Text The link description.
@context {string} Title The link title.
@returns {template.html}
*/}}
{{- /* Initialize. */}}
{{- $renderHookName := "link" }}
{{- /* Verify minimum required version. */}}
{{- $minHugoVersion := "0.120.0" }}
{{- if lt hugo.Version $minHugoVersion }}
{{- errorf "The %q render hook requires Hugo v%s or later." $renderHookName $minHugoVersion }}
{{- end }}
{{- /* Error level when unable to resolve destination: ignore, warning, or error. */}}
{{- $errorLevel := or site.Params.render_hooks.link.errorLevel "ignore" | lower }}
{{- /* If true, adds "broken" class to broken links. Applicable in development environment when errorLevel is warning. */}}
{{- $highlightBrokenLinks := or site.Params.render_hooks.link.highlightBroken false }}
{{- /* Validate error level. */}}
{{- if not (in (slice "ignore" "warning" "error") $errorLevel) }}
{{- errorf "The %q render hook is misconfigured. The errorLevel %q is invalid. Please check your site configuration." $renderHookName $errorLevel }}
{{- end }}
{{- /* Determine content path for warning and error messages. */}}
{{- $contentPath := "" }}
{{- with .Page.File }}
{{- $contentPath = .Path }}
{{- else }}
{{- $contentPath = .Path }}
{{- end }}
{{- /* Parse destination. */}}
{{- $u := urls.Parse .Destination }}
{{- /* Set common message. */}}
{{- $msg := printf "The %q render hook was unable to resolve the destination %q in %s" $renderHookName $u.String $contentPath }}
{{- /* Set attributes for anchor element. */}}
{{- $attrs := dict "href" $u.String }}
{{- if $u.IsAbs }}
{{- /* Destination is a remote resource. */}}
{{- $attrs = merge $attrs (dict "rel" "external") }}
{{- else }}
{{- with $u.Path }}
{{- with $p := or ($.Page.GetPage .) ($.Page.GetPage (strings.TrimRight "/" .)) }}
{{- /* Destination is a page. */}}
{{- $href := .RelPermalink }}
{{- with $u.RawQuery }}
{{- $href = printf "%s?%s" $href . }}
{{- end }}
{{- with $u.Fragment }}
{{- $ctx := dict
"contentPath" $contentPath
"errorLevel" $errorLevel
"page" $p
"parsedURL" $u
"renderHookName" $renderHookName
}}
{{- partial "inline/h-rh-l/validate-fragment.html" $ctx }}
{{- $href = printf "%s#%s" $href . }}
{{- end }}
{{- $attrs = dict "href" $href }}
{{- else }}
{{- with $.Page.Resources.Get $u.Path }}
{{- /* Destination is a page resource; drop query and fragment. */}}
{{- $attrs = dict "href" .RelPermalink }}
{{- else }}
{{- with (and (ne $.Page.BundleType "leaf") ($.Page.CurrentSection.Resources.Get $u.Path)) }}
{{- /* Destination is a section resource, and current page is not a leaf bundle. */}}
{{- $attrs = dict "href" .RelPermalink }}
{{- else }}
{{- with resources.Get $u.Path }}
{{- /* Destination is a global resource; drop query and fragment. */}}
{{- $attrs = dict "href" .RelPermalink }}
{{- else }}
{{- if eq $errorLevel "warning" }}
{{- warnf $msg }}
{{- if and $highlightBrokenLinks hugo.IsDevelopment }}
{{- $attrs = merge $attrs (dict "class" "broken") }}
{{- end }}
{{- else if eq $errorLevel "error" }}
{{- errorf $msg }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- else }}
{{- with $u.Fragment }}
{{- /* Destination is on the same page; prepend relative permalink. */}}
{{- $ctx := dict
"contentPath" $contentPath
"errorLevel" $errorLevel
"page" $.Page
"parsedURL" $u
"renderHookName" $renderHookName
}}
{{- partial "inline/h-rh-l/validate-fragment.html" $ctx }}
{{- $attrs = dict "href" (printf "%s#%s" $.Page.RelPermalink .) }}
{{- else }}
{{- if eq $errorLevel "warning" }}
{{- warnf $msg }}
{{- if and $highlightBrokenLinks hugo.IsDevelopment }}
{{- $attrs = merge $attrs (dict "class" "broken") }}
{{- end }}
{{- else if eq $errorLevel "error" }}
{{- errorf $msg }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Title }}
{{- $attrs = merge $attrs (dict "title" .) }}
{{- end -}}
{{- /* Render anchor element. */ -}}
<a
{{- range $k, $v := $attrs }}
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
{{- end -}}
>{{ .Text | safeHTML }}</a>
{{- define "partials/inline/h-rh-l/validate-fragment.html" }}
{{- /*
Validates the fragment portion of a link destination.
@context {string} contentPath The page containing the link.
@context {srting} errorLevel The error level when unable to resolve destination; ignore (default), warning, or error.
@context {page} page The page corresponding to the link destination
@context {struct} parsedURL The link destination parsed by urls.Parse.
@context {string} renderHookName The name of the render hook.
*/}}
{{- /* Initialize. */}}
{{- $contentPath := .contentPath }}
{{- $errorLevel := .errorLevel }}
{{- $p := .page }}
{{- $u := .parsedURL }}
{{- $renderHookName := .renderHookName }}
{{- /* Validate. */}}
{{- with $u.Fragment }}
{{- if $p.Fragments.Identifiers.Contains . }}
{{- if gt ($p.Fragments.Identifiers.Count .) 1 }}
{{- $msg := printf "The %q render hook detected duplicate heading IDs %q in %s" $renderHookName . $contentPath }}
{{- if eq $errorLevel "warning" }}
{{- warnf $msg }}
{{- else if eq $errorLevel "error" }}
{{- errorf $msg }}
{{- end }}
{{- end }}
{{- else }}
{{- /* Determine target path for warning and error message. */}}
{{- $targetPath := "" }}
{{- with $p.File }}
{{- $targetPath = .Path }}
{{- else }}
{{- $targetPath = .Path }}
{{- end }}
{{- /* Set common message. */}}
{{- $msg := printf "The %q render hook was unable to find heading ID %q in %s. See %s" $renderHookName . $targetPath $contentPath }}
{{- if eq $targetPath $contentPath }}
{{- $msg = printf "The %q render hook was unable to find heading ID %q in %s" $renderHookName . $targetPath }}
{{- end }}
{{- /* Throw warning or error. */}}
{{- if eq $errorLevel "warning" }}
{{- warnf $msg }}
{{- else if eq $errorLevel "error" }}
{{- errorf $msg }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}

View file

@ -95,7 +95,7 @@
{{- partial "opengraph/twitter_cards.html" . -}}
{{ if hugo.IsProduction }}
{{ partial "gtag" . }}
{{ partial "gtag.html" . }}
{{ end }}
</head>
@ -104,7 +104,7 @@
class="ma0 sans-serif bg-primary-color-light{{ with getenv "HUGO_ENV" }}
{{ . }}
{{ end }}">
{{ partial "hooks/after-body-start" . }}
{{ partial "hooks/after-body-start.html" . }}
{{ block "nav" . }}{{ partial "site-nav.html" . }}{{ end }}
{{ block "header" . }}{{ end }}
<main role="main" class="content-with-sidebar min-vh-100 pb7 pb0-ns">
@ -113,7 +113,7 @@
{{ block "footer" . }}{{ partialCached "site-footer.html" . }}{{ end }}
{{ partial "hooks/before-body-end" . }}
{{ partial "hooks/before-body-end.html" . }}
</body>
</html>

View file

@ -1,23 +1,30 @@
<header class="flex-none w-100">
{{ if .Params.categories }}
{{ if in (slice "functions" "methods") .Type }}
{{ with .FirstSection }}
<a href="{{ .RelPermalink }}" class="f6 fw8 mb0 link mid-gray dim mr3">
{{ humanize .Title | upper }}
</a>
{{ end }}
{{ with .CurrentSection }}
<a href="{{ .RelPermalink }}" class="f6 fw8 mb0 link mid-gray dim mr3">
{{ humanize .Title | upper }}
</a>
{{ end }}
{{ else }}
{{ range .Params.categories }}
<a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}" class="f6 fw8 mb0 link mid-gray dim mr3">
{{ humanize . | upper }}
</a>
{{ end }}
{{end}}
{{ end }}
<h1 class="lh-title mb3 mv0 pt3 primary-color-dark">
{{- if eq .Section "functions" -}}
{{ .LinkTitle }}
{{- else -}}
{{ .Title }}
{{- end -}}
</h1>
</header>
<aside class="bt bw1 pt3 mt2 mid-gray b--mid-gray fn w-100">
{{ with .Params.description }}
<div class="f4 fw4 lh-copy">
<div class="mb4 f4 fw4 lh-copy">
{{ . | markdownify }}
</div>
{{ end }}
@ -31,7 +38,11 @@
<img src="{{ . }}" alt="Featured Image for {{ $.Title }}" class="mw-100">
{{ end }}
<div class="prose prose-{{ .Type }}" id="prose">
{{- partial "docs/functions-signature.html" . -}}
<div class="prose" id="prose">
<div class="mb4">
{{- partial "docs/functions-signatures.html" . -}}
{{- partial "docs/functions-return-type.html" . -}}
{{- partial "docs/functions-aliases.html" . -}}
</div>
{{ .Content }}
</div>

View file

@ -2,26 +2,24 @@
<article class="w-100 ph4 pb5 pb6-ns pt1 pt5-ns">
<div class="flex-l">
<div class="order-2 w-100 w-20-l ph5-m ph0-l mb4 sticky">
{{- partial "toc.html" . -}}
</div>
<div class="order-1 w-60-l mw7 ph0 ph5-ns mid-gray nested-copy-line-height no-underline nested-links nested-img nested-copy-seperator nested-blockquote mt0-ns" style="flex-grow:1;">
<div class="documentation-copy center measure-wide-l">
<div id="readout" class="fixed right-0 bottom-0">
<div class="order-0 w-20 dn db-l">
{{ partial "nav-links-docs.html" . }}
</div>
<div class="order-1 flex-grow-1 ph0 ph5-ns mt0-ns mid-gray nested-copy-line-height no-underline nested-links nested-img nested-copy-seperator nested-blockquote">
<div style="max-width: 40rem;" class="documentation-copy">
<div id="readout" class="fixed right-0 bottom-0"></div>
{{ .Render "page" }}
{{ partial "related.html" . }}
</div>
</div>
<div class="order-0 w-20 dn db-l">
{{ partial "nav-links-docs.html" . }}
<div id="right-sidebar" class="order-2 w-20 dn db-l sticky pt2">
{{ partial "right-sidebar.html" . }}
</div>
</div>
</article>
<div class="w-100 bg-light-gray">
<div id="page-footer" class="w-100 bg-light-gray">
<div class="mw7 pa4 center nested-lh-copy lh-copy">
{{ partial "docs/page-meta-data.html" . }}
{{ partial "page-edit.html" . }}

View file

@ -1,27 +1,27 @@
{{ define "header" }}
{{ partial "hero" . }}
{{ partial "boxes-small-news" . }}
{{ partial "hero.html" . }}
{{ partial "boxes-small-news.html" . }}
{{ end }}
{{ define "main" }}
<section class="w-100 ph4 ph5-ns pv4">
{{- partial "home-page-sections/features-icons" . -}}
{{- partial "home-page-sections/features-icons.html" . -}}
</section>
{{ partial "home-page-sections/sponsors.html" (dict "cx" . "gtag" "home" ) }}
{{- partial "home-page-sections/features-single" . -}}
{{- partial "home-page-sections/features-single.html" . -}}
{{- partial "home-page-sections/showcase.html" . -}}
<section class="w-100 ph4 ph5-ns pv4 pv6-ns mid-gray bg-white bb bt b--light-gray">
{{- partial "home-page-sections/installation" . -}}
{{- partial "home-page-sections/installation.html" . -}}
</section>
<section class="w-100 ph4 ph5-ns pv4 pv6-ns mid-gray bg-accent-color-dark">
{{- partial "home-page-sections/tweets" . -}}
{{- partial "home-page-sections/tweets.html" . -}}
</section>
<section class="w-100 ph4 ph5-ns pt4 pb5 mid-gray bg-primary-color-light bb bt b--light-gray ">
{{- partial "home-page-sections/open-source-involvement" . -}}
{{- partial "home-page-sections/open-source-involvement.html" . -}}
</section>
{{ end }}

View file

@ -10,32 +10,61 @@
</div>
</article>
<!-- TODO: May be a good idea in this case to add monthly archives -->
<div class="flex flex-wrap">
{{/* [wip] add archive lists
<div class="w-100 w-20-ns dn">
<ul>
<li>
<a href="#">
archive section
</a>
</li>
</ul>
</div> */}}
{{ $interior_classes := $.Site.Params.flex_box_interior_classes }}
<section class="flex-ns flex-wrap justify-between w-100 w-80-nsTK v-top">
{{ $paginator := .Paginate (.Pages | lang.Merge (where .Sites.First.RegularPages "Section" .Section)) -}}
{{ range $paginator.Pages }}
{{ partial "boxes-section-summaries" (dict "context" . "classes" $interior_classes "fullcontent" false) }}
{{ $news_items := slice }}
{{/* Get releases from GitHub. */}}
{{ $u := "https://api.github.com/repos/gohugoio/hugo/releases" }}
{{ $releases := partial "inline/get-remote-data.html" $u }}
{{ $releases = where $releases "draft" false }}
{{ $releases = where $releases "prerelease" false }}
{{ range $releases | first 20 }}
{{ $ctx := dict
"Date" (.published_at | time.AsTime)
"Title" (printf "Release %s" .name)
"Permalink" .html_url
"Section" "news"
"Summary" ""
}}
{{ $news_items = $news_items | append $ctx }}
{{ end }}
{{/* Get content pages from news section. */}}
{{ range .Pages }}
{{ $ctx := dict
"Date" .Date
"Title" .Title
"RelPermalink" .RelPermalink
"Section" "news"
"Summary" .Summary
"Params" (dict "description" .Description)
}}
{{ $news_items = $news_items | append $ctx }}
{{ end }}
{{/* Sort by date (descending) and render. */}}
{{ range sort $news_items "Date" "desc" }}
{{ partial "boxes-section-summaries.html" (dict "context" . "classes" $interior_classes "fullcontent" false) }}
{{ end }}
</section>
</div>
<div class="nested-list-reset nested-links">
{{/* pagination.html: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/template_embedded.go#L117 */}}
{{ template "_internal/pagination.html" . }}
</div>
</div>
{{ end }}
{{ define "partials/inline/get-remote-data.html" }}
{{ $u := . }}
{{ $r := "" }}
{{ with $r = resources.GetRemote $u }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ end }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $u }}
{{ end }}
{{ return ($r | transform.Unmarshal) }}
{{ end }}

View file

@ -34,9 +34,6 @@
Go to <a href="https://github.com/gohugoio/hugo/releases" class="link primary-color dim">Hugo Releases</a> for the release downloads.
</p>
{{ end }}
<!--
NOTE: Removed to test builds without it.
partial "components/author-github-data" (dict "context" . "size" "110") -->
<div class="nested-links mt4">
{{- partial "previous-next-links-in-section.html" . -}}

View file

@ -1,35 +1,46 @@
<div class="relative {{ .classes }} weight-{{ .context.Weight }}">
<div class="bg-white mb2 pa3 pa4-l gray">
{{ $href := .context.RelPermalink }}
{{ if eq .context.Section "news" }}
<date class="f6 db" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
{{ $href = .context.Permalink }}
<time class="f6 db" datetime="{{ .context.Date.Format `2006-01-02T15:04:05Z07:00` }}">
{{ .context.Date.Format "January 2, 2006" }}
</date>
</time>
{{ end }}
<h1 class="near-black f3">
<a href="{{ .context.RelPermalink }}" class="link primary-color dim">
{{- if eq .context.Section "functions" -}}
{{ .context.LinkTitle }}
{{- else -}}
<a href="{{ $href }}" class="link primary-color dim">
{{ .context.Title }}
{{- end -}}
</a>
</h1>
<div class="lh-copy links">
{{ if eq .context.Section "commands" }}
{{ replaceRE `(?s).*?##\s.*?\n\n(.*?)\n.*` "$1" .context.RawContent }}
{{ else }}
{{ if in (slice "functions" "methods") .context.Type }}
{{ with $signature := index .context.Params.action.signatures 0 }}
{{ if $.context.Params.action.returnType }}
{{ $signature = printf "%s ⟼ %s" $signature $.context.Params.action.returnType }}
{{ end }}
<pre class="f6 mb3 ph3 pv2 bg-light-gray overflow-x-auto">
{{- $signature -}}
</pre>
{{ end }}
{{ end }}
{{ if .context.Params.description }}
{{ .context.Params.description | markdownify }}
{{ else }}
{{ .context.Summary }}
{{ end }}
<a href="{{ .context.RelPermalink }}" class="f6 mt2 db link primary-color dim">
{{ end }}
<a href="{{ $href }}" class="f6 mt2 db link primary-color dim">
Read More &raquo;
</a>
</div>
</div>
</div>

View file

@ -1,18 +1 @@
<section class="relative w-100 bg-black white">
<div class="flex flex-wrap w-90-l center center mw9">
<!-- <a href="/news/" class="link accent-color tr-ns f6 w-100 w-50-m w-10-l bg-animate hover-bg-accent-color hover-white pv3 pv4-l ph3 ph4-l dib">
Latest News:
</a> -->
{{ range first 4 ( sort (where .Site.RegularPages "Section" "news") "Date" "desc" ) }}
<!-- only show 2 boxes on mobile -->
{{ $.Scratch.Add "i" 1 }}{{ $i := $.Scratch.Get "i" }}
<a href="{{ .RelPermalink }}" class="link lh-copy light-gray f6 w-100 w-50-m w-25-l bg-animate hover-bg-accent-color hover-white pv3 pv4-ns ph3 ph4-ns{{ if ge $i 3 }} dn dib-l{{ else }} dib{{ end }}">
<span class="f6 gray pb1 db">
{{ .Date.Format "January 2, 2006" }}
</span>
{{ .Params.description | markdownify | truncate 100 "…"}}
</a>
{{ end }}
</div>
</section>
{{/* Empty for now. */}}

View file

@ -0,0 +1,12 @@
{{- with .Params.action.aliases }}
{{- $label := "Alias" }}
{{- if gt (len .) 1 }}
{{- $label = "Aliases" }}
{{- end }}
<p class="fw7 primary-color-dark">{{ $label }}</p>
{{- range . }}
<pre class="f5 ph3 pv2 bg-light-gray" style="border-left:4px solid #0594CB;">
{{- . -}}
</pre>
{{- end }}
{{- end -}}

View file

@ -0,0 +1,6 @@
{{- with .Params.action.returnType }}
<p class="fw7 primary-color-dark">Returns</p>
<pre class="f5 ph3 pv2 bg-light-gray" style="border-left:4px solid #0594CB;">
{{- . -}}
</pre>
{{- end -}}

View file

@ -1,11 +0,0 @@
{{ if isset .Params "signature" -}}
{{- with .Params.signature }}
<h2 class="minor mb1 pt4 primary-color-dark">Syntax</h2>
{{- range . }}
<pre class="f5 mb4 ph3 pv2 bg-light-gray" style="border-left:4px solid #0594CB;">
{{- . -}}
</pre>
{{- end }}
{{- end -}}
{{ end }}
{{/* The inline style overrides `pre` styling defaults */}}

View file

@ -1,11 +1,11 @@
{{- with .Params.function.signatures }}
<h2 class="minor mb1 pt4 primary-color-dark">Syntax</h2>
{{- with .Params.action.signatures }}
<p class="fw7 primary-color-dark">Syntax</p>
{{- range . }}
{{- $signature := . }}
{{- if $.Params.function.returnType }}
{{- $signature = printf "%s ⟼ %s" . $.Params.function.returnType }}
{{- end }}
<pre class="f5 mb4 ph3 pv2 bg-light-gray overflow-x-auto" style="border-left:4px solid #0594CB;">
<pre class="f5 ph3 pv2 bg-light-gray overflow-x-auto" style="border-left:4px solid #0594CB;">
{{- $signature -}}
</pre>
{{- end }}

View file

@ -1,4 +1,4 @@
{{ with .Site.GoogleAnalytics }}
{{ with site.Config.Services.GoogleAnalytics.ID }}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script>
<script>
window.dataLayer = window.dataLayer || [];

View file

@ -6,6 +6,7 @@
<div class="flex-ns flex-wrap justify-between">
{{ if $.Site.Data.homepagetweets }}
{{ range first 4 (sort $.Site.Data.homepagetweets.tweet "date" "desc" ) }}
<div class="homepage-tweet relative {{ $interior_classes }} br1 mid-gray pv3 nested-links shadow-5">
<div class="absolute top-0 left-0 ma2 o-10">
@ -21,5 +22,6 @@
</blockquote>
</div>
{{ end }}
{{ end }}
</div>
</div>

View file

@ -1 +1,7 @@
{{/* Deliberately empty */}}
{{ if .Page.Store.Get "hasMermaid" }}
<script type="module" async>
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@9/+esm';
mermaid.initialize({ startOnLoad: true });
</script>
{{ end }}

View file

@ -9,8 +9,8 @@
</a>
</div>
{{ partial "nav-links" .}}
{{ partial "nav-links.html" .}}
<div class="dn-l">
{{ partial "nav-button-open" .}}
{{ partial "nav-button-open.html" .}}
</div>
</header>

View file

@ -39,4 +39,4 @@
{{ end }}{{ end }}
{{- /* Facebook Page Admin ID for Domain Insights */}}
{{- with .Site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
{{- with site.Params.social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}

View file

@ -17,6 +17,6 @@
{{- end }}
<meta name="twitter:title" content="{{ .Title }}"/>
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
{{ with .Site.Social.twitter -}}
{{ with site.Params.social.twitter -}}
<meta name="twitter:site" content="@{{ . }}"/>
{{ end -}}

View file

@ -16,13 +16,15 @@
</div>
</article>
<!-- TODO: May be a good idea in this case to add monthly archives -->
<div class="flex flex-wrap">
{{ $interior_classes := .context.Site.Params.flex_box_interior_classes }}
<section class="flex-ns flex-wrap justify-between w-100">
{{ range $section_to_display }}
{{ partial "boxes-section-summaries" (dict "context" . "classes" $interior_classes "fullcontent" true) }}
{{ $pages := $section_to_display }}
{{ if in (slice "functions" "methods") $.context.Type }}
{{ $pages = $.context.Pages }}
{{ end }}
{{ range $pages }}
{{ partial "boxes-section-summaries.html" (dict "context" . "classes" $interior_classes "fullcontent" true) }}
{{ end }}
</section>
</div>

View file

@ -1,9 +1,22 @@
{{ $related := .Site.RegularPages.Related . | first 5 }}
{{ with $related }}
<h2>See Also</h2>
<ul>
{{ range . }}
{{- $heading := "See also" }}
{{- $related := site.RegularPages.Related . | first 5 }}
{{- if in (slice "functions" "methods") .Type }}
{{- $related = slice }}
{{- range .Params.action.related }}
{{- with site.GetPage (lower .) }}
{{- $related = $related | append . }}
{{- else }}
{{- errorf "The 'related' partial was unable to get page %s" . }}
{{- end }}
{{- end }}
{{- end }}
{{- with $related }}
<h2>{{ $heading }}</h2>
<ul>
{{- range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
{{ end }}
{{- end }}
</ul>
{{- end }}

View file

@ -0,0 +1,29 @@
<aside class="right-0 f6 pv4 pv0-ns ph4-l nested-list-reset nested-copy-line-height">
<div class="nested-links">
{{- partial "previous-next-links-in-section.html" . }}
</div>
{{- /* Table of contents is visible if toc = true in front matter. */}}
{{- if .Params.toc }}
<div class="nested-links">
<p class="f5 fw8 mid-gray mb0">On this page</p>
{{- .TableOfContents }}
</div>
{{- end }}
{{- /* Section menu for single pages is visible if showSectionMenu = true in top level section page. */}}
{{- if .FirstSection.Params.showSectionMenu }}
{{- with .CurrentSection.RegularPages }}
<p class="mb0"><a class="link f5 fw8 mid-gray" href="{{ $.CurrentSection.RelPermalink }}">In this section</a></p>
<nav>
<ul>
{{- range . }}
<li>
<a style="padding: 2px 5px;" class="dib link hover-bg-black-40 hover-white blue nl1" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
</li>
{{- end }}
</ul>
</nav>
{{- end }}
{{- end }}
</aside>

View file

@ -1,6 +1,6 @@
{{/*
Disable Twitter for now as we lost access to the account.
with .Site.Social.twitter }}
with site.Params.social.twitter }}
<a href="https://twitter.com/intent/follow?screen_name={{ . }}" title="Follow on Twitter" class="link-transition twitter link dib z-999 pt3 pt0-l mr2">
{{ partial "svg/twitter.svg" (dict "size" "32px") }}
</a>

View file

@ -1,13 +0,0 @@
<!-- TOCs need to be declared explicitly in the front matter of content/*.md -->
<aside class="fixed-lTK mw5-l right-0 f6 bl-l b--moon-gray pv4 pv0-ns ph4-l nested-list-reset nested-links nested-copy-line-height">
{{ if .Params.toc }}
<p class="b">What's on this Page</p>
{{ .TableOfContents }}
{{ end }}
{{- partial "previous-next-links-in-section.html" . -}}
{{- if .Params.godocref -}}
<a target="_blank" class="tooltip right godoc-link" data-tooltip="See the related Godocs for {{.Title }}" href="{{.Params.godocref}}" >
</a>
{{- end -}}
</aside>

View file

@ -1,24 +1,101 @@
{{ $langs := (slice "yaml" "toml" "json") }}
<div class="code relative" {{ with .Get "file" }}id="{{ . | urlize}}"{{ end }}>
{{- /*
Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
@param {string} [config] The section of site.Data.docs.config to render.
@param {bool} [copy=false] If true, display a copy to clipboard button.
@param {string} [file] The file name to display above the rendered code.
@param {bool} [fm=false] If true, render the code as front matter.
@param {bool} [skipHeader=false] If false, omit top level key(s) when rendering a section of site.Data.docs.config.
@returns {template.HTML}
*/}}
{{- /* Initialize. */}}
{{- $config := "" }}
{{- $dataKey := "" }}
{{- $copy := false }}
{{- $file := "" }}
{{- $fm := false }}
{{- $skipHeader := false }}
{{- /* Get parameters. */}}
{{- $config = .Get "config" }}
{{- $dataKey = .Get "dataKey" }}
{{- $file = .Get "file" }}
{{- if in (slice "false" false 0) (.Get "copy") }}
{{- $copy = false }}
{{- else if in (slice "true" true 1) (.Get "copy") }}
{{- $copy = true }}
{{- end }}
{{- if in (slice "false" false 0) (.Get "fm") }}
{{- $fm = false }}
{{- else if in (slice "true" true 1) (.Get "fm") }}
{{- $fm = true }}
{{- end }}
{{- if in (slice "false" false 0) (.Get "skipHeader") }}
{{- $skipHeader = false }}
{{- else if in (slice "true" true 1) (.Get "skipHeader") }}
{{- $skipHeader = true }}
{{- end }}
{{- /* Define constants. */}}
{{- $delimiters := dict "toml" "+++" "yaml" "---" }}
{{- $langs := slice "yaml" "toml" "json" }}
{{- $placeHolder := "#-hugo-placeholder-#" }}
{{- /* Render. */}}
{{- $code := "" }}
{{- if $config }}
{{- $file = $file | default "hugo" }}
{{- $sections := (split $config ".") }}
{{- $configSection := index $.Site.Data.docs.config $sections }}
{{- $code = dict $sections $configSection }}
{{- if $skipHeader }}
{{- $code = $configSection }}
{{- end }}
{{- else if $dataKey }}
{{- $file = $file | default $dataKey }}
{{- $sections := (split $dataKey ".") }}
{{- $code = index $.Site.Data.docs $sections }}
{{- else }}
{{- $code = $.Inner }}
{{- end }}
<div class="code relative" {{ with $file }}id="{{ . | urlize }}"{{ end }}>
<div class="code-nav flex flex-nowrap items-stretch">
{{- with .Get "file" -}}
<div class="san-serif f6 dib lh-solid pl2 pv2 mr2">{{ . }}.</div>
{{- end -}}
{{ range $langs }}
<button data-toggle-tab="{{ . }}" class="tab-button {{ cond (eq . "yaml") "active" ""}} ba san-serif f6 dib lh-solid ph2 pv2">{{ . }}</button>&nbsp;
{{ end }}
{{- with $file }}
<div class="san-serif f6 dib lh-solid pl2 pv2 mr2">
{{ . }}{{ if not $fm }}.{{ end }}
</div>
{{- end }}
{{- range $langs }}
<button
data-toggle-tab="{{ . }}"
class="tab-button {{ cond (eq . "yaml") "active" "" }} ba san-serif f6 dib lh-solid ph2 pv2">
{{ . }}
</button>
&nbsp;
{{- end }}
</div>
<div class="tab-content">
{{ range $langs }}
<div data-pane="{{ . }}" class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" ""}}">
{{ highlight ($.Inner | transform.Remarshal . | safeHTML) . ""}}
{{- range $langs }}
<div
data-pane="{{ . }}"
class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" "" }}">
{{- $hCode := $code | transform.Remarshal . }}
{{- if and $fm (in (slice "toml" "yaml") .) }}
{{- $hCode = printf "%s\n%s\n%s" $placeHolder $hCode $placeHolder }}
{{- end }}
{{- $hCode = $hCode | replaceRE `\n+` "\n" }}
{{ highlight $hCode . "" | replaceRE $placeHolder (index $delimiters .) | safeHTML }}
</div>
{{ if ne ($.Get "copy") "false" }}
<button class="needs-js copy copy-toggle bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button">
</button>
{{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
{{end}}
{{ end }}
{{- if $copy }}
<button
class="needs-js copy copy-toggle bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2"
title="Copy this code to your clipboard."
data-clipboard-action="copy"
aria-label="copy button"></button>
{{- /* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
{{- end }}
{{- end }}
</div>
</div>

View file

@ -1,15 +1,35 @@
<div class="code relative bg-primary-color moon-gray" id="{{.Get "file" | urlize}}">
{{- with .Get "file" -}}
<div class="filename san-serif f6 dib lh-solid pl2 pv2">{{.}}</div>
{{- end -}}
{{- /*
Renders syntax highlighted code.
{{ if ne (.Get "copy") "false" }}
<button class="needs-js copy bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button">
</button>
{{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
{{end}}
<div class="code-copy-content nt3" {{with .Get "download"}}id="{{.}}"{{end}}>
{{- .Inner -}}
@param {bool} [copy=false] If true, display a copy to clipboard button.
@param {string} [file] The file name to display above the rendered code.
@param {string} [lang] The code language of the inner content.
@returns {template.HTML}
*/}}
{{- /* Get parameters. */}}
{{- $copy := false }}
{{- if in (slice "false" false 0) (.Get "copy") }}
{{- $copy = false }}
{{- else if in (slice "true" true 1) (.Get "copy")}}
{{- $copy = true }}
{{- end }}
{{- $file := or (.Get "file") "&nbsp;" }}
{{- $lang := or (.Get "lang") (path.Ext $file | strings.TrimPrefix ".") "text" }}
{{- /* Use the go-html-template Chroma lexer for HTML. */}}
{{- if eq $lang "html" }}
{{- $lang = "go-html-template" }}
{{- end }}
{{- /* Render. */}}
<div class="code relative" id="{{ $file | urlize }}">
<div class="f6 dib lh-solid pl2 pv2">{{ $file | htmlUnescape }}</div>
{{- if $copy }}
<button class="needs-js copy bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button"></button>
{{- end }}
<div class="code-copy-content nt3">
{{- highlight (trim .Inner "\n\r") $lang }}
</div>
</div>

View file

@ -1,18 +1,33 @@
<table class="utils-table">
<thead>
{{ $package := (index .Params 0) }}
{{ $listname := (index .Params 1) }}
{{ $list := (index (index .Site.Data.docs $package) $listname) }}
{{ $fields := after 2 .Params }}
<table class="table table-bordered">
<tr>
<td class="col-title">Title</td>
<td class="col-author">Author</td>
<td class="col-date">Date</td>
{{ range $fields }}
{{ $s := . }}
{{ if eq $s "_key" }}
{{ $s = "Type" }}
{{ end }}
<th>{{ $s }}</th>
{{ end }}
</tr>
</thead>
<tbody>
{{ range $ind, $art := $.Site.Data.articles.article }}
{{ range $k1, $v1 := $list }}
<tr>
<td><a href="{{$art.url}}" target="_blank">{{$art.title | markdownify }}</a></td>
<td>{{ $art.author | markdownify }}</td>
<td>{{ $art.date }}</td>
{{ range $k2, $v2 := . }}
{{ $.Scratch.Set $k2 $v2 }}
{{ end }}
{{ range $fields }}
{{ $s := "" }}
{{ if eq . "_key" }}
{{ $s = $k1 }}
{{ else }}
{{ $s = $.Scratch.Get . }}
{{ end }}
<td>{{ $s }}</td>
{{ end }}
</tr>
{{ end }}
</tbody>
</table>

View file

@ -0,0 +1,14 @@
{{ $_hugo_config := `{ "version": 1 }` }}
{{ with .Get 0 }}
{{ $version := printf "v%v" (strings.TrimLeft "vV" .) }}
{{ $href := printf "https://github.com/gohugoio/hugo/releases/tag/%s" $version }}
<aside>
<div class="admonition-content bl bw2 b--dark-red" >
<p>Deprecated in <a href="{{ $href }}">{{ $version }}</a></p>
{{ $.Inner }}
</div>
</aside>
{{ else }}
{{ errorf "The %q shortcode requires a single positional parameter indicating version. See %s" .Name .Position }}
{{ end }}

View file

@ -1,13 +0,0 @@
{{- $pathURL := .Get "pathURL" -}}
{{- $path := .Get "path" -}}
{{- $files := readDir $path -}}
<table>
<th>Size in bytes</th>
<th>Name</th>
{{- range $files }}
<tr>
<td>{{ .Size }}</td>
<td><a href="{{ $pathURL }}{{ .Name | relURL }}" target="_blank"> {{ .Name }}</a></td>
</tr>
{{- end }}
</table>

View file

@ -1,11 +0,0 @@
{{ $file := .Get 0}}
{{ $filepath := $file }}
{{ $syntax := index (split $file ".") 1 }}
{{ $syntaxoverride := eq (len .Params) 2 }}
<div class="code-copy" id="{{$file | urlize}}">
<div class="code-copy-header"><div class="action-buttons"></div><span title="" class="filename">{{$filepath}}</span><i class="icon-{{$syntax}} input"></i></div>
<button class="copy-button" title="Copy to clipboard" data-clipboard-snippet>
<div class="copy-text"><i class="icon-clipboard"></i> COPY</div>
</button>
<pre><code class="language-{{if $syntaxoverride}}{{.Get 1}}{{else}}{{$syntax}}{{end}}">{{- readFile $file -}}</code></pre>
</div>

View file

@ -1,12 +0,0 @@
{{ $file := .Get 0}}
{{ $filepath := replace $file "static/" ""}}
{{ $syntax := index (split $file ".") 1 }}
{{ $syntaxoverride := eq (len .Params) 2 }}
<div class="code-copy" id="{{$file | urlize}}">
<div class="code-copy-header examplesite"><div class="action-buttons"></div><span class="filename"><i class="icon-website"></i>{{$filepath}}</span><i class="icon-{{$syntax}} input"></i></div>
<button class="copy-button" title="Copy to clipboard" data-clipboard-snippet>
<div class="copy-text"><i class="icon-clipboard"></i> COPY</div>
</button>
<pre><code class="language-{{if $syntaxoverride}}{{.Get 1}}{{else}}{{$syntax}}{{end}}">{{- readFile $file -}}</code></pre>
<a role="button" target="_blank" href="{{$.Site.Params.ghdocsrepo}}{{$file}}" title="See {{$filepath}} source on GitHub" class="tooltip see-on-github" data-tooltip="See {{$filepath}} source on GitHub">Source<i class="icon-github"></i></a>
</div>

View file

@ -1,13 +0,0 @@
<!-- Similar to exfile.html but *only* pulls the front matter from the example/content/*md -->
{{ $file := .Get 0}}
{{ $filepath := replace $file "static/" ""}}
{{ $syntax := index (split $file ".") 1 }}
{{ $syntaxoverride := eq (len .Params) 2 }}
<div class="code-copy" id="{{$file | urlize}}">
<div class="code-copy-header examplesite"><div class="action-buttons"></div><span title="" class="filename">{{$filepath}}</span><i class="icon-{{$syntax}} input"></i></div>
<button class="copy-button" title="Copy to clipboard" data-clipboard-snippet>
<div class="copy-text"><i class="icon-clipboard"></i> COPY</div>
</button>
<pre><code class="language-{{if $syntaxoverride}}{{.Get 1}}{{else}}{{$syntax}}{{end}}">{{- readFile $file -}}</code></pre>
<a role="button" target="_blank" href="{{$.Site.Params.ghdocsrepo}}{{$file}}" title="See {{$filepath}} on GitHub" class="see-on-github">Source<i class="icon-github"></i></a>
</div>

View file

@ -1,9 +0,0 @@
{{ range .Params }}
{{ if eq (substr . 0 1) "@" }}
<a href="//github.com/{{ substr . 1 }}">{{ . }}</a>
{{ else if eq (substr . 0 2) "0x" }}
<a href="//github.com/gohugoio/hugo/commit/{{ substr . 2 }}">{{ substr . 2 6 }}</a>
{{ else }}
<a href="//github.com/gohugoio/hugo/issues/{{ . }}">#{{ . }}</a>
{{ end }}
{{ end }}

View file

@ -1 +0,0 @@
<a href="{{$.Site.Params.ghrepo}}" target="_blank">GitHub repository</a>

View file

@ -0,0 +1,374 @@
{{- /*
Renders the given image using the given filter, if any.
@param {string} src The path to the image which must be a remote, page, or global resource.
@param {string} [filter] The filter to apply to the image (case-insensitive).
@param {string} [filterArgs] A comma-delimited list of arguments to pass to the filter.
@param {bool} [example=false] If true, renders a before/after example.
@param {int} [exampleWidth=384] Image width, in pixels, when rendering a before/after example.
@returns {template.HTML}
@examples
{{< img src="zion-national-park.jpg" >}}
{{< img src="zion-national-park.jpg" alt="Zion National Park" >}}
{{< img
src="zion-national-park.jpg"
alt="Zion National Park"
filter="grayscale"
>}}
{{< img
src="zion-national-park.jpg"
alt="Zion National Park"
filter="process"
filterArgs="resize 400x webp"
>}}
{{< img
src="zion-national-park.jpg"
alt="Zion National Park"
filter="colorize"
filterArgs="180,50,20"
>}}
{{< img
src="zion-national-park.jpg"
alt="Zion National Park"
filter="grayscale"
example=true
>}}
{{< img
src="zion-national-park.jpg"
alt="Zion National Park"
filter="grayscale"
example=true
exampleWidth=400
>}}
When using the text filter, provide the arguments in this order:
0. The text
1. The horizontal offset, in pixels, relative to the left of the image (default 20)
2. The vertical offset, in pixels, relative to the top of the image (default 20)
3. The font size in pixels (default 64)
4. The line height (default 1.2)
5. The font color (default #ffffff)
{{< img
src="images/examples/zion-national-park.jpg"
alt="Zion National Park"
filter="Text"
filterArgs="Zion National Park,25,250,56"
example=true
>}}
When using the padding filter, provide all arguments in this order:
0. Padding top
1. Padding right
2. Padding bottom
3. Padding right
4. Canvas color
{{< img
src="images/examples/zion-national-park.jpg"
alt="Zion National Park"
filter="Padding"
filterArgs="20,50,20,50,#0705"
example=true
>}}
*/}}
{{- /* Initialize. */}}
{{- $alt := "" }}
{{- $src := "" }}
{{- $filter := "" }}
{{- $filterArgs := slice }}
{{- $example := false }}
{{- $exampleWidth := 384 }}
{{- /* Default values to use with the text filter. */}}
{{ $textFilterOpts := dict
"xOffset" 20
"yOffset" 20
"fontSize" 64
"lineHeight" 1.2
"fontColor" "#ffffff"
"fontPath" "https://github.com/google/fonts/raw/main/apache/roboto/static/Roboto-Regular.ttf"
}}
{{- /* Get and validate parameters. */}}
{{- with .Get "alt" }}
{{- $alt = .}}
{{- end }}
{{- with .Get "src" }}
{{- $src = . }}
{{- else }}
{{- errorf "The %q shortcode requires a file parameter. See %s" .Name .Position }}
{{- end }}
{{- with .Get "filter" }}
{{- $filter = . | lower }}
{{- end }}
{{- $validFilters := slice
"brightness" "colorbalance" "colorize" "contrast" "gamma" "gaussianblur"
"grayscale" "hue" "invert" "none" "opacity" "overlay" "padding" "pixelate"
"process" "saturation" "sepia" "sigmoid" "text" "unsharpmask"
}}
{{- with $filter }}
{{- if not (in $validFilters .) }}
{{- errorf "The filter passed to the %q shortcode is invalid. The filter must be one of %s. See %s" $.Name (delimit $validFilters ", " ", or ") $.Position }}
{{- end }}
{{- end }}
{{- with .Get "filterArgs" }}
{{- $filterArgs = split . "," }}
{{- $filterArgs = apply $filterArgs "trim" "." " " }}
{{- end }}
{{- if in (slice "false" false 0) (.Get "example") }}
{{- $example = false }}
{{- else if in (slice "true" true 1) (.Get "example")}}
{{- $example = true }}
{{- end }}
{{- with .Get "exampleWidth" }}
{{- $exampleWidth = . | int }}
{{- end }}
{{- /* Get image. */}}
{{- $ctx := dict "page" .Page "src" $src "name" .Name "position" .Position }}
{{- $i := partial "inline/get-resource.html" $ctx }}
{{- /* Resize if rendering before/after examples. */}}
{{- if $example }}
{{- $i = $i.Resize (printf "%dx" $exampleWidth) }}
{{- end }}
{{- /* Create filter. */}}
{{- $f := "" }}
{{- $ctx := dict "filter" $filter "args" $filterArgs "name" .Name "position" .Position }}
{{- if eq $filter "brightness" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" -100 "max" 100) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Brightness (index $filterArgs 0) }}
{{- else if eq $filter "colorbalance" }}
{{- $ctx = merge $ctx (dict "argsRequired" 3) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "percentage red" "argValue" (index $filterArgs 0) "min" -100 "max" 500) }}
{{- template "validate-arg-value" $ctx }}
{{- $ctx = merge $ctx (dict "argName" "percentage green" "argValue" (index $filterArgs 1) "min" -100 "max" 500) }}
{{- template "validate-arg-value" $ctx }}
{{- $ctx = merge $ctx (dict "argName" "percentage blue" "argValue" (index $filterArgs 2) "min" -100 "max" 500) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.ColorBalance (index $filterArgs 0) (index $filterArgs 1) (index $filterArgs 2) }}
{{- else if eq $filter "colorize" }}
{{- $ctx = merge $ctx (dict "argsRequired" 3) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "hue" "argValue" (index $filterArgs 0) "min" 0 "max" 360) }}
{{- template "validate-arg-value" $ctx }}
{{- $ctx = merge $ctx (dict "argName" "saturation" "argValue" (index $filterArgs 1) "min" 0 "max" 100) }}
{{- template "validate-arg-value" $ctx }}
{{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 2) "min" 0 "max" 100) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Colorize (index $filterArgs 0) (index $filterArgs 1) (index $filterArgs 2) }}
{{- else if eq $filter "contrast" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" -100 "max" 100) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Contrast (index $filterArgs 0) }}
{{- else if eq $filter "gamma" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "gamma" "argValue" (index $filterArgs 0) "min" 0 "max" 100) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Gamma (index $filterArgs 0) }}
{{- else if eq $filter "gaussianblur" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "sigma" "argValue" (index $filterArgs 0) "min" 0 "max" 1000) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.GaussianBlur (index $filterArgs 0) }}
{{- else if eq $filter "grayscale" }}
{{- $ctx = merge $ctx (dict "argsRequired" 0) }}
{{- template "validate-arg-count" $ctx }}
{{- $f = images.Grayscale }}
{{- else if eq $filter "hue" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "shift" "argValue" (index $filterArgs 0) "min" -180 "max" 180) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Hue (index $filterArgs 0) }}
{{- else if eq $filter "invert" }}
{{- $ctx = merge $ctx (dict "argsRequired" 0) }}
{{- template "validate-arg-count" $ctx }}
{{- $f = images.Invert }}
{{- else if eq $filter "opacity" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "opacity" "argValue" (index $filterArgs 0) "min" 0 "max" 1) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Opacity (index $filterArgs 0) }}
{{- else if eq $filter "overlay" }}
{{- $ctx = merge $ctx (dict "argsRequired" 3) }}
{{- template "validate-arg-count" $ctx }}
{{- $ctx := dict "src" (index $filterArgs 0) "name" .Name "position" .Position }}
{{- $overlayImg := partial "inline/get-resource.html" $ctx }}
{{- $f = images.Overlay $overlayImg (index $filterArgs 1 | float ) (index $filterArgs 2 | float) }}
{{- else if eq $filter "padding" }}
{{- $ctx = merge $ctx (dict "argsRequired" 5) }}
{{- template "validate-arg-count" $ctx }}
{{- $f = images.Padding
(index $filterArgs 0 | int)
(index $filterArgs 1 | int)
(index $filterArgs 2 | int)
(index $filterArgs 3 | int)
(index $filterArgs 4)
}}
{{- else if eq $filter "pixelate" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "size" "argValue" (index $filterArgs 0) "min" 0 "max" 1000) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Pixelate (index $filterArgs 0) }}
{{- else if eq $filter "process" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $f = images.Process (index $filterArgs 0) }}
{{- else if eq $filter "saturation" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" -100 "max" 500) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Saturation (index $filterArgs 0) }}
{{- else if eq $filter "sepia" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" 0 "max" 100) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Sepia (index $filterArgs 0) }}
{{- else if eq $filter "sigmoid" }}
{{- $ctx = merge $ctx (dict "argsRequired" 2) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "midpoint" "argValue" (index $filterArgs 0) "min" 0 "max" 1) }}
{{- template "validate-arg-value" $ctx }}
{{- $ctx = merge $ctx (dict "argName" "factor" "argValue" (index $filterArgs 1) "min" -10 "max" 10) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Sigmoid (index $filterArgs 0) (index $filterArgs 1) }}
{{- else if eq $filter "text" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $ctx := dict "src" $textFilterOpts.fontPath "name" .Name "position" .Position }}
{{- $font := or (partial "inline/get-resource.html" $ctx) }}
{{- $fontSize := or (index $filterArgs 3 | int) $textFilterOpts.fontSize }}
{{- $lineHeight := math.Max (or (index $filterArgs 4 | float) $textFilterOpts.lineHeight) 1 }}
{{- $opts := dict
"x" (or (index $filterArgs 1 | int) $textFilterOpts.xOffset)
"y" (or (index $filterArgs 2 | int) $textFilterOpts.yOffset)
"size" $fontSize
"linespacing" (mul (sub $lineHeight 1) $fontSize)
"color" (or (index $filterArgs 5) $textFilterOpts.fontColor)
"font" $font
}}
{{- $f = images.Text (index $filterArgs 0) $opts }}
{{- else if eq $filter "unsharpmask" }}
{{- $ctx = merge $ctx (dict "argsRequired" 3) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "sigma" "argValue" (index $filterArgs 0) "min" 0 "max" 500) }}
{{- template "validate-arg-value" $ctx }}
{{- $ctx = merge $ctx (dict "argName" "amount" "argValue" (index $filterArgs 1) "min" 0 "max" 100) }}
{{- template "validate-arg-value" $ctx }}
{{- $ctx = merge $ctx (dict "argName" "threshold" "argValue" (index $filterArgs 2) "min" 0 "max" 1) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.UnsharpMask (index $filterArgs 0) (index $filterArgs 1) (index $filterArgs 2) }}
{{- end }}
{{- /* Apply filter. */}}
{{- $fi := $i }}
{{- with $f }}
{{- $fi = $i.Filter . }}
{{- end }}
{{- /* Render. */}}
{{- if $example }}
<p>Original</p>
<img class='di ba b--black-20' style="width: initial;" src="{{ $i.RelPermalink }}" alt="{{ $alt }}">
<p>Processed</p>
<img class='di ba b--black-20' style="width: initial;" src="{{ $fi.RelPermalink }}" alt="{{ $alt }}">
{{- else -}}
<img class='di' style="width: initial;" src="{{ $fi.RelPermalink }}" alt="{{ $alt }}">
{{- end }}
{{- define "validate-arg-count" }}
{{- $msg := "When using the %q filter, the %q shortcode requires an args parameter with %d %s. See %s" }}
{{- if lt (len .args) .argsRequired }}
{{- $text := "values" }}
{{- if eq 1 .argsRequired }}
{{- $text = "value" }}
{{- end }}
{{- errorf $msg .filter .name .argsRequired $text .position }}
{{- end }}
{{- end }}
{{- define "validate-arg-value" }}
{{- $msg := "The %q argument passed to the %q shortcode is invalid. Expected a value in the range [%v,%v], but received %v. See %s" }}
{{- if or (lt .argValue .min) (gt .argValue .max) }}
{{- errorf $msg .argName .name .min .max .argValue .position }}
{{- end }}
{{- end }}
{{- define "partials/inline/get-resource.html" }}
{{- $r := "" }}
{{- $u := urls.Parse .src }}
{{- $msg := "The %q shortcode was unable to resolve %s. See %s" }}
{{- if $u.IsAbs }}
{{- with resources.GetRemote $u.String }}
{{- with .Err }}
{{- errorf "%s" }}
{{- else }}
{{- /* This is a remote resource. */}}
{{- $r = . }}
{{- end }}
{{- else }}
{{- errorf $msg $.name $u.String $.position }}
{{- end }}
{{- else }}
{{- with .page.Resources.Get (strings.TrimPrefix "./" $u.Path) }}
{{- /* This is a page resource. */}}
{{- $r = . }}
{{- else }}
{{- with resources.Get $u.Path }}
{{- /* This is a global resource. */}}
{{- $r = . }}
{{- else }}
{{- errorf $msg $.name $u.Path $.position }}
{{- end }}
{{- end }}
{{- end }}
{{- return $r}}
{{- end -}}

View file

@ -0,0 +1,37 @@
{{- /*
Renders the given image using the given process specification.
@param {string} (positional parameter 0) The path to the image, relative to the current page. The image must be a page resource.
@param {string}} (positional parameter 1) The image processing specification.
@returns template.HTML
@example {{< imgproc "sunset.jpg" "resize 300x" />}}
*/}}
{{- with $.Get 0 }}
{{- with $i := $.Page.Resources.Get . }}
{{- with $spec := $.Get 1 }}
{{- with $i.Process . }}
<figure style="padding: 0.25rem; margin: 2rem 0; background-color: #cccc">
<img style="max-width: 100%; width: auto; height: auto;" src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
<figcaption>
<small>
{{- with $.Inner }}
{{ . }}
{{- else }}
{{ $spec }}
{{- end }}
</small>
</figcaption>
</figure>
{{- end }}
{{- else }}
{{- errorf "The %q shortcode requires a positional parameter (1) containing the image processing specification. See %s" $.Name $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode requires a positional parameter (0) indicating the image path, relative to the current page. See %s" $.Name $.Position }}
{{- end }}

View file

@ -0,0 +1,20 @@
{{- /*
Renders the page using the RenderShortcode method on the Page object.
You must call this shortcode using the {{% %}} notation.
@param {string} (postional parameter 0) The path to the page, relative to the content directory.
@returns template.HTML
@example {{% include "functions/_common/glob-patterns" %}}
*/}}
{{- with .Get 0 }}
{{- with site.GetPage . }}
{{- .RenderShortcodes }}
{{- else }}
{{- errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode requires a positional parameter indicating the path of the file to include. See %s" .Name .Position }}
{{- end }}

View file

@ -0,0 +1,96 @@
{{- /*
Renders a desciption list of the pages in the given section.
Render a subset of the pages in the section by specifying a predefined filter,
and whether to include those pages.
Filters are defined in the data directory, in the file named page_filters. Each
filter is an array of paths to a file, relative to the root of the content
directory. Hugo will throw an error if the specified filter does not exist, or
if any of the pages in the filter do not exist.
The definition term elements (dt) have an id attribute derived from the title
of the page. This is probably unique, because pages of the same title in the
same section is unlikely.
If you render a complete list on a page, then call the shortcode again to
render a subset, you will generate duplicate element ids. In this case, set
omitElementIDs to true for the subset.
@param {string} path The path to the section.
@param {string} [filter=""] The name of filter list.
@param {string} [filterType=""] The type of filter, either include or exclude.
@param {string} [omitElementIDs=false] Whether to omit dt element ids.
@param {string} [titlePrefix=""] The string to prepend to the link title.
@returns template.HTML
@example {{< list-pages-in-section path=/methods/resources >}}
@example {{< list-pages-in-section path=/functions/images filter=some_filter filterType=exclude >}}
@example {{< list-pages-in-section path=/functions/images filter=some_filter filterType=exclude titlePrefix=foo >}}
@example {{< list-pages-in-section path=/functions/images filter=some_filter filterType=exclude titlePrefix=foo omitElementIDs=true >}}
*/}}
{{- /* Initialize. */}}
{{- $filter := or "" (.Get "filter" | lower)}}
{{- $filterType := or (.Get "filterType") "none" | lower }}
{{- $filteredPages := slice }}
{{- $titlePrefix := or (.Get "titlePrefix") "" }}
{{- $omitElementIDs := false }}
{{- /* Get boolean parameters. */}}
{{- if in (slice "false" false 0) (.Get "omitElementIDs") }}
{{- $omitElementIDs = false }}
{{- else if in (slice "true" true 1) (.Get "omitElementIDs")}}
{{- $omitElementIDs = true }}
{{- end }}
{{- /* Build slice of filtered pages. */}}
{{- with $filter }}
{{- with index site.Data.page_filters . }}
{{- range . }}
{{- with site.GetPage . }}
{{- $filteredPages = $filteredPages | append . }}
{{- else }}
{{- errorf "The %q shortcode was unable to find %q as specified in the page_filters data file. See %s" $.Name . $.Position }}
{{- end }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode was unable to find the %q filter in the page_filters data file. See %s" $.Name . $.Position }}
{{- end }}
{{- end }}
{{- /* Render */}}
{{- with $sectionPath := .Get "path" }}
{{- with site.GetPage . }}
{{- with .RegularPages }}
<dl>
{{- range $page := .ByTitle }}
{{- if or
(and (eq $filterType "include") (in $filteredPages $page))
(and (eq $filterType "exclude") (not (in $filteredPages $page)))
(eq $filterType "none")
}}
{{- $linkTitle := .LinkTitle }}
{{- with $titlePrefix }}
{{- $linkTitle = printf "%s%s" . $linkTitle }}
{{- end }}
{{- $idAttribute := "" }}
{{- if not $omitElementIDs }}
{{- $id := path.Join .File.Dir .File.ContentBaseName | replaceRE `[\|/]` ":" | lower }}
{{- $idAttribute = printf " id=%q" $id }}
{{- end }}
<dt {{- $idAttribute | safeHTMLAttr }}><a href="{{ $page.RelPermalink }}">{{ $linkTitle }}</a></dt>
<dd>{{- $page.Description | $page.RenderString }}</dd>
{{- end }}
{{- end }}
</dl>
{{- else }}
{{- warnf "The %q shortcode found no pages in the %q section. See %s" $.Name $sectionPath $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode was unable to find %q. See %s" $.Name $sectionPath $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode requires a 'path' parameter indicating the path to the section. See %s" $.Name $.Position }}
{{- end }}

View file

@ -0,0 +1,13 @@
{{ $version := .Get 0 }}
{{ if not $version }}
{{ errorf "Missing version in new-in shortcode " }}
{{ end }}
{{ $version = $version | strings.TrimPrefix "v" }}
<button
class="bg-white hover:bg-gray-100 text-gray-800 font-semibold py-2 mr2 px-4 border border-gray-400 rounded shadow">
<a
href="{{ printf "https://github.com/gohugoio/hugo/releases/tag/v%s" $version }}"
target="_blank"
>New in v{{ $version }}</a
>
</button>

View file

@ -1 +0,0 @@
<pre><code class="nohighlight">{{ .Inner }}</code></pre>

View file

@ -1,9 +1,7 @@
{{ $_hugo_config := `{ "version": 1 }` }}
<aside class="admonition note">
<div class="note-icon">
{{partial "svg/exclamation.svg" (dict "size" "20px" ) }}
<aside>
<div class="admonition-content bl bw2 b--blue" >
{{ .Inner }}
</div>
<!-- <h2 id="{{if .Get 0}}{{.Get 0 | urlize}}{{else}}note{{end}}">{{if .Get 0}}{{.Get 0 | markdownify}}{{else}}Note{{end}}</h2> -->
<!-- <h3>Note</h3> -->
<div class="admonition-content">{{- .Inner -}}</div>
</aside>

View file

@ -1,11 +0,0 @@
{{$file := .Get "file"}}
{{$icon := index (split $file ".") 1 }}
<div class="code" id="{{$file | urlize}}">
<div class="filename" title="{{$file}}">{{$file}}</div>
<!-- <div class="code-icon">
<i class="icon-{{$icon}}"></i>
</div> -->
<div class="code-copy-content output-content">
{{- .Inner -}}
</div>
</div>

View file

@ -0,0 +1,37 @@
{{/*
Renders the child sections of the given top-level section, listing each childs's immediate descendants.
@param {string} section The top-level section to render.
@returns template.HTML
@example {{% quick-reference section="functions" %}}
*/}}
{{ $section := "" }}
{{ with .Get "section" }}
{{ $section = . }}
{{ else }}
{{ errorf "The %q shortcodes requires a 'section' parameter. See %s" .Name .Postion }}
{{ end }}
{{/* Do not change the markdown indentation, and do not remove blank lines. */}}
{{ with site.GetPage $section }}
{{ range .Sections }}
## {{ .LinkTitle }}
{{ .RawContent }}
{{ range .Pages }}
{{ $aliases := "" }}
{{ if eq .Section "functions" }}
{{ $aliases = delimit .Params.action.aliases " or " }}
{{ end }}
[{{ .LinkTitle }}]({{ .RelPermalink }}) {{ with $aliases }}({{ . }}){{ end }}
: {{ .Description }}
{{ end }}
{{ end }}
{{ else }}
{{ errorf "The %q shortcodes was unable to find the %q section. See %s" .Name $section .Postion }}
{{ end }}

View file

@ -1,6 +1,29 @@
{{$file := .Get "file"}}
{{- if eq (.Get "markdown") "true" -}}
{{- $file | readFile | markdownify -}}
{{- else -}}
{{ $file | readFile | safeHTML }}
{{- end -}}
{{- $highlight := or (.Get "highlight") "" }}
{{- $markdown := false }}
{{- if in (slice "false" false 0) (.Get "markdown") }}
{{- $markdown = false }}
{{- else if in (slice "true" true 1) (.Get "markdown") }}
{{- $markdown = true }}
{{- end }}
{{- with .Get "file" }}
{{- if os.FileExists . }}
{{- with os.ReadFile . }}
{{- $content := trim . "\n\r" }}
{{- if $markdown }}
{{- $content | markdownify }}
{{- else if $highlight }}
{{- highlight $content $highlight }}
{{- else }}
{{- $content | safeHTML }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode was unable to read %q. See %s" $.Name . $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode requires a 'file' parameter. See %s" $.Name $.Position }}
{{- end }}

View file

@ -1,9 +0,0 @@
{{ $_hugo_config := `{ "version": 1 }` }}
<aside class="admonition tip">
<div class="tip-icon">
{{partial "svg/exclamation.svg" .}}
</div>
<!-- <h2 id="{{if .Get 0}}{{.Get 0 | urlize}}{{else}}tip{{end}}">{{if .Get 0}}{{.Get 0 | markdownify}}{{else}}Tip{{end}}</h2> -->
<!-- <h3>Tip</h3> -->
<div class="admonition-content">{{- .Inner -}}</div>
</aside>

View file

@ -1,9 +0,0 @@
{{ $_hugo_config := `{ "version": 1 }` }}
<aside class="admonition warning">
<div class="admonition-icon">
{{partial "svg/exclamation.svg" .}}
</div>
<!-- <h2 id="{{if .Get 0}}{{.Get 0 | urlize}}{{else}}warning{{end}}">{{if .Get 0}}{{.Get 0 | markdownify}}{{else}}Warning{{end}}</h2> -->
<!-- <h3>Warning</h3> -->
<div class="admonition-content">{{- .Inner -}}</div>
</aside>

View file

@ -1,11 +0,0 @@
<div class="video-wrapper" data-streaming="youtube" data-videoid="{{.Get "id"}}" >
<i class="icon-video-play-button shortcode"></i>
{{if (.Get "thumbnail")}}
<div style="background-image:url(/images/thumbnails/{{.Get "thumbnail"}})" alt="YouTube Thumbnail" class="video-thumbnail"></div>
{{else}}
<div style="background-image:url(//img.youtube.com/vi/{{.Get "id"}}/0.jpg)" alt="YouTube Thumbnail" class="video-thumbnail"></div>
{{end}}
</div>
{{ if (.Get "description") }}
<div class="video-description">{{ .Get "description" | markdownify }}</div>
{{ end }}

View file

@ -1 +1 @@
# github.com/gohugoio/gohugoioTheme v0.0.0-20230927165800-342e2c850f18
# github.com/gohugoio/gohugoioTheme v0.0.0-20231111235806-77931ac4875e

View file

@ -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: []
---

View file

@ -0,0 +1,10 @@
---
title: {{ replace .File.ContentBaseName "-" " " | title }}
description:
categories: []
keywords: []
action:
related: []
returnType:
signatures: []
---

View file

@ -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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -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/'
post = 'break'
[[docs]]
name = "Hugo Modules"
weight = 40
identifier = "modules"
post = "break"
url = "/hugo-modules/"
# Core menus
name = 'Content management'
weight = 40
identifier = 'content-management'
post = 'expanded'
pageRef = '/content-management/'
[[docs]]
name = "Content management"
weight = 50
identifier = "content-management"
post = "expanded"
url = "/content-management/"
name = 'Templates'
weight = 50
identifier = 'templates'
pageRef = '/templates/'
[[docs]]
name = "Templates"
weight = 60
identifier = "templates"
url = "/templates/"
name = 'Functions'
weight = 60
identifier = 'functions'
pageRef = '/functions/'
[[docs]]
name = "Functions"
weight = 70
identifier = "functions"
url = "/functions/"
name = 'Methods'
weight = 70
identifier = 'methods'
pageRef = '/methods/'
[[docs]]
name = "Variables"
weight = 80
identifier = "variables"
url = "/variables/"
name = 'Quick reference'
weight = 80
identifier = 'quick-reference'
pageRef = '/quick-reference/'
[[docs]]
name = "Hugo Pipes"
weight = 90
identifier = "hugo-pipes"
url = "/hugo-pipes/"
name = 'Variables'
weight = 85
identifier = 'variables'
pageRef = '/variables/'
[[docs]]
name = "CLI"
weight = 100
post = "break"
identifier = "commands"
url = "/commands/"
name = 'Hugo Modules'
weight = 90
identifier = 'modules'
pageRef = '/hugo-modules/'
[[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'

View file

@ -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)

View file

@ -2,6 +2,7 @@
title: Benefits of static site generators
linkTitle: Static site generators
description: Improved performance, security and ease of use are just a few of the reasons static site generators are so appealing.
categories: [about]
keywords: [ssg,static,performance,security]
menu:
docs:

View file

@ -1,6 +1,8 @@
---
title: Hugo features
description: Hugo boasts blistering speed, robust content management, and a powerful templating language making it a great fit for all kinds of static websites.
categories: [about]
keywords: []
menu:
docs:
parent: about

View file

@ -2,15 +2,15 @@
title: Hugo and the General Data Protection Regulation
linkTitle: Hugo and the GDPR
description: About how to configure your Hugo site to meet the new regulations.
layout: single
categories: [about]
keywords: ["GDPR", "Privacy", "Data Protection"]
menu:
docs:
parent: about
weight: 60
weight: 60
aliases: [/privacy/,/gdpr/]
toc: true
aliases: [/privacy/,/gdpr/]
---
General Data Protection Regulation ([GDPR](https://en.wikipedia.org/wiki/General_Data_Protection_Regulation)) is a regulation in EU law on data protection and privacy for all individuals within the European Union and the European Economic Area. It became enforceable on 25 May 2018.
@ -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

View file

@ -1,160 +1,80 @@
---
title: License
description: Hugo v0.15 and later are released under the Apache 2.0 license.
categories: ["about hugo"]
keywords: ["License","apache"]
description: Hugo is released under the Apache 2.0 license.
categories: [about]
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_ <br>
<https://www.apache.org/licenses/LICENSE-2.0>
*Terms and Conditions for use, reproduction, and distribution*
_Version 2.0, January 2004_
_<http://www.apache.org/licenses/>_
## 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 >}}

View file

@ -1,15 +1,15 @@
---
title: Hugo's security model
description: A summary of Hugo's security model.
layout: single
keywords: ["Security", "Privacy"]
categories: [about]
keywords: [security,privacy]
menu:
docs:
parent: about
weight: 50
weight: 50
aliases: [/security/]
toc: true
aliases: [/security/]
---
## Runtime security
@ -31,7 +31,7 @@ Hugo has a built-in security policy that restricts access to [os/exec](https://p
The default configuration is listed below. Any build using features not in the allow list of the security policy will fail with a detailed message about what needs to be done. Most of these settings are allow lists (string or slice, [Regular Expressions](https://pkg.go.dev/regexp) or `none` which matches nothing).
{{< code-toggle config="security" />}}
{{< code-toggle config=security />}}
Note that these and other configuration settings in Hugo can be overridden by the OS environment. If you want to block all remote HTTP fetching of data:

View file

@ -1,14 +1,15 @@
---
title: What is Hugo
description: Hugo is a fast and modern static site generator written in Go, and designed to make website creation fun again.
layout: single
categories: [about]
keywords: []
menu:
docs:
parent: about
weight: 20
weight: 20
aliases: [/overview/introduction/,/about/why-i-built-hugo/]
toc: true
aliases: [/overview/introduction/,/about/why-i-built-hugo/]
---
Hugo is a general-purpose website framework. Technically speaking, Hugo is a [static site generator]. Unlike systems that dynamically build a page with each visitor request, Hugo builds pages when you create or update your content. Since websites are viewed far more often than they are edited, Hugo is designed to provide an optimal viewing experience for your website's end users and an ideal writing experience for website authors.

View file

@ -0,0 +1,13 @@
---
cascade:
_build:
list: never
publishResources: false
render: never
---
<!--
Files within this headless branch bundle are markdown snippets. Each file must contain front matter delimiters, though front matter fields are not required.
Include the rendered content using the "include" shortcode.
-->

View file

@ -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 >}}

View file

@ -2,13 +2,13 @@
title: Content management
linkTitle: Overview
description: Hugo makes managing large static sites easy with support for archetypes, content types, menus, cross references, summaries, and more.
categories: []
keywords: []
menu:
docs:
identifier: content-management-overview
parent: content-management
weight: 10
keywords: [source, organization]
categories: [content management]
weight: 10
aliases: [/content/,/content/organization]
---

View file

@ -1,15 +1,15 @@
---
title: Archetypes
description: An archetype is a template for new content.
keywords: [archetypes,generators,metadata,front matter]
categories: [content management]
keywords: [archetypes,generators,metadata,front matter]
menu:
docs:
parent: content-management
weight: 140
quicklinks:
toc: true
weight: 140
toc: true
aliases: [/content/archetypes/]
---
@ -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&nbsp;`.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
```

View file

@ -1,102 +1,321 @@
---
title: Build options
description: Build options help define how Hugo must treat a given page when building the site.
categories: [content management,fundamentals]
keywords: [build,content,front matter, page resources]
categories: [fundamentals,content management]
menu:
docs:
parent: content-management
weight: 70
toc: true
weight: 70
toc: true
aliases: [/content/build-options/]
---
They are stored in a reserved front matter object named `_build` with the following defaults:
Build options are stored in a reserved front matter object named `_build` with these defaults:
{{< code-toggle >}}
_build:
render: always
list: always
publishResources: true
{{< code-toggle file=content/example/index.md fm=true >}}
[_build]
list = 'always'
publishResources = true
render = 'always'
{{< /code-toggle >}}
#### render
If `always`, the page will be treated as a published page, holding its dedicated output files (`index.html`, etc...) and permalink.
list
: When to include the page within page collections. Specify one of:
Valid values are:
- `always`
: Include the page in _all_ page collections. For example, `site.RegularPages`, `.Pages`, etc. This is the default value.
- `never`
: The page will not be included in any page collection.
- `always (default)`
: The page will be rendered to disk and get a `RelPermalink` etc.
- `link`
: The page will be not be rendered to disk, but will get a `RelPermalink`.
#### list
Valid values are:
- `never`
: The page will not be included in any page collection.
- `always (default)`
: The page will be included in all page collections, e.g. `site.RegularPages`, `.Pages`.
- `local`
: The page will be included in any _local_ page collection, e.g. `.RegularPages`, `.Pages`. One use case for this would be to create fully navigable, but headless content sections.
: Include the page in _local_ page collections. For example, `.RegularPages`, `.Pages`, etc. Use this option to create fully navigable but headless content sections.
#### publishResources
- `never`
: Do not include the page in _any_ page collection.
If set to `true` (default) the [Bundle's Resources](/content-management/page-bundles) will be published.
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.
publishResources
: Applicable to [page bundles], determines whether to publish the associated [page resources]. Specify one of:
- `true`
: Always publish resources. This is the default value.
- `false`
: Only publish a resource when invoking its [`Permalink`], [`RelPermalink`], or [`Publish`] method within a template.
render
: When to render the page. Specify one of:
- `always`
: Always render the page to disk. This is the default value.
- `link`
: Do not render the page to disk, but include it in all page collections.
- `never`
: Never render the page to disk, and exclude it from all page collections.
[page bundles]: content-management/page-bundles
[page resources]: /content-management/page-resources
[`Permalink`]: /methods/resource/permalink
[`RelPermalink`]: /methods/resource/relpermalink
[`Publish`]: /methods/resource/publish
{{% note %}}
Any page, regardless of their build options, will always be available using the [`.GetPage`](/functions/getpage) methods.
Any page, regardless of its build options, will always be available by using the [`.Page.GetPage`] or [`.Site.GetPage`] method.
[`.Page.GetPage`]: /methods/page/getpage
[`.Site.GetPage`]: /methods/site/getpage
{{% /note %}}
### Illustrative use cases
## Example -- headless page
#### Not publishing a page
Create a unpublished page whose content and resources can be included in other pages.
Project needs a "Who We Are" content file for front matter and body to be used by the homepage but nowhere else.
```text
content/
├── headless/
│ ├── a.jpg
│ ├── b.jpg
│ └── index.md <-- leaf bundle
└── _index.md <-- home page
```
{{< code-toggle file="content/who-we-are.md" fm=true copy=false >}}
title: Who we are
_build:
list: false
render: false
Set the build options in front matter:
{{< code-toggle file=content/headless/index.md fm=true >}}
title = 'Headless page'
[_build]
list = 'never'
publishResources = false
render = 'never'
{{< /code-toggle >}}
{{< code file="layouts/index.html" copy=false >}}
<section id="who-we-are">
{{ with site.GetPage "who-we-are" }}
To include the content and images on the home page:
{{< code file=layouts/_default/home.html >}}
{{ with .Site.GetPage "/headless" }}
{{ .Content }}
{{ range .Resources.ByType "image" }}
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
{{ end }}
</section>
{{ end }}
{{< /code >}}
#### Listing pages without publishing them
The published site will have this structure:
Website needs to showcase a few of the hundred "testimonials" available as content files without publishing any of them.
```text
public/
├── headless/
│ ├── a.jpg
│ └── b.jpg
└── index.html
```
To avoid setting the build options on every testimonials, one can use [`cascade`](/content-management/front-matter#front-matter-cascade) on the testimonial section's content file.
In the example above, note that:
{{< code-toggle >}}
title: Testimonials
_build:
render: true
cascade:
_build:
render: false
list: true # default
1. Hugo did not publish an HTML file for the page.
2. Despite setting `publishResources` to `false` in front matter, Hugo published the [page resources] because we invoked the [`RelPermalink`] method on each resource. This is the expected behavior.
## Example -- headless section
Create a unpublished section whose content and resources can be included in other pages.
[branch bundle]: /content-management/page-bundles
```text
content/
├── headless/
│ ├── note-1/
│ │ ├── a.jpg
│ │ ├── b.jpg
│ │ └── index.md <-- leaf bundle
│ ├── note-2/
│ │ ├── c.jpg
│ │ ├── d.jpg
│ │ └── index.md <-- leaf bundle
│ └── _index.md <-- branch bundle
└── _index.md <-- home page
```
Set the build options in front matter, using the `cascade` keyword to "cascade" the values down to descendant pages.
{{< code-toggle file=content/headless/_index.md fm=true >}}
title = 'Headless section'
[[cascade]]
[cascade._build]
list = 'local'
publishResources = false
render = 'never'
{{< /code-toggle >}}
{{< code file="layouts/_defaults/testimonials.html" copy=false >}}
<section id="testimonials">
{{ range first 5 .Pages }}
<blockquote cite="{{ .Params.cite }}">
In the front matter above, note that we have set `list` to `local` to include the descendant pages in local page collections.
To include the content and images on the home page:
{{< code file=layouts/_default/home.html >}}
{{ with .Site.GetPage "/headless" }}
{{ range .Pages }}
{{ .Content }}
</blockquote>
{{ range .Resources.ByType "image" }}
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
{{ end }}
</section>
{{ end }}
{{ end }}
{{< /code >}}
The published site will have this structure:
```text
public/
├── headless/
│ ├── note-1/
│ │ ├── a.jpg
│ │ └── b.jpg
│ └── note-2/
│ ├── c.jpg
│ └── d.jpg
└── index.html
```
In the example above, note that:
1. Hugo did not publish an HTML file for the page.
2. Despite setting `publishResources` to `false` in front matter, Hugo correctly published the [page resources] because we invoked the [`RelPermalink`] method on each resource. This is the expected behavior.
## Example -- list without publishing
Publish a section page without publishing the descendant pages. For example, to create a glossary:
```text
content/
├── glossary/
│ ├── _index.md
│ ├── bar.md
│ ├── baz.md
│ └── foo.md
└── _index.md
```
Set the build options in front matter, using the `cascade` keyword to "cascade" the values down to descendant pages.
{{< code-toggle file=content/glossary/_index.md fm=true >}}
title = 'Glossary'
[_build]
render = 'always'
[[cascade]]
[cascade._build]
list = 'local'
publishResources = false
render = 'never'
{{< /code-toggle >}}
To render the glossary:
{{< code file=layouts/glossary/list.html >}}
<dl>
{{ range .Pages }}
<dt>{{ .Title }}</dt>
<dd>{{ .Content }}</dd>
{{ end }}
</dl>
{{< /code >}}
The published site will have this structure:
```text
public/
├── glossary/
│ └── index.html
└── index.html
```
## Example -- publish without listing
Publish a section's descendant pages without publishing the section page itself.
```text
content/
├── books/
│ ├── _index.md
│ ├── book-1.md
│ └── book-2.md
└── _index.md
```
Set the build options in front matter:
{{< code-toggle file=content/books/_index.md >}}
title = 'Books'
[_build]
render = 'never'
list = 'never'
{{< /code-toggle >}}
The published site will have this structure:
```html
public/
├── books/
│ ├── book-1/
│ │ └── index.html
│ └── book-2/
│ └── index.html
└── index.html
```
## Example -- conditionally hide section
Consider this example. A documentation site has a team of contributors with access to 20 custom shortcodes. Each shortcode takes several arguments, and requires documentation for the contributors to reference when using them.
Instead of external documentation for the shortcodes, include an "internal" section that is hidden when building the production site.
```text
content/
├── internal/
│ ├── shortcodes/
│ │ ├── _index.md
│ │ ├── shortcode-1.md
│ │ └── shortcode-2.md
│ └── _index.md
├── reference/
│ ├── _index.md
│ ├── reference-1.md
│ └── reference-2.md
├── tutorials/
│ ├── _index.md
│ ├── tutorial-1.md
│ └── tutorial-2.md
└── _index.md
```
Set the build options in front matter, using the `cascade` keyword to "cascade" the values down to descendant pages, and use the `target` keyword to target the production environment.
{{< code-toggle file=content/internal/_index.md >}}
title = 'Internal'
[[cascade]]
[cascade._build]
render = 'never'
list = 'never'
[cascade._target]
environment = 'production'
{{< /code-toggle >}}
The production site will have this structure:
```html
public/
├── reference/
│ ├── reference-1/
│ │ └── index.html
│ ├── reference-2/
│ │ └── index.html
│ └── index.html
├── tutorials/
│ ├── tutorial-1/
│ │ └── index.html
│ ├── tutorial-2/
│ │ └── index.html
│ └── index.html
└── index.html
```

View file

@ -1,14 +1,14 @@
---
title: Comments
description: Hugo ships with an internal Disqus template, but this isn't the only commenting system that will work with your new Hugo website.
categories: [content management]
keywords: [sections,content,organization]
categories: [project organization]
menu:
docs:
parent: content-management
weight: 220
toc: true
weight: 220
toc: true
aliases: [/extras/comments/]
---

View file

@ -2,13 +2,13 @@
title: Links and cross references
description: Shortcodes for creating links to documents.
categories: [content management]
keywords: ["cross references","references", "anchors", "urls"]
keywords: [cross references,references,anchors,urls]
menu:
docs:
parent: content-management
weight: 170
toc: true
weight: 170
toc: true
aliases: [/extras/crossreferences/]
---
@ -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/

View file

@ -7,12 +7,12 @@ menu:
docs:
parent: content-management
weight: 50
toc: true
weight: 50
toc: true
---
{{< new-in "0.93.0" >}}
{{< new-in 0.93.0 >}}
## GoAT diagrams (Ascii)
## GoAT diagrams (ASCII)
Hugo supports [GoAT](https://github.com/bep/goat) natively. This means that this code block:
@ -165,7 +165,6 @@ Created from <https://arthursonzogni.com/Diagon/#Tree>
└─Fedora
```
### Sequence diagram
<https://arthursonzogni.com/Diagon/#Sequence>
@ -186,7 +185,6 @@ Created from <https://arthursonzogni.com/Diagon/#Tree>
```
### Flowchart
<https://arthursonzogni.com/Diagon/#Flowchart>
@ -232,7 +230,6 @@ Created from <https://arthursonzogni.com/Diagon/#Tree>
```
### Table
<https://arthursonzogni.com/Diagon/#Table>

View file

@ -7,8 +7,8 @@ menu:
docs:
parent: content-management
weight: 40
toc: true
weight: 40
toc: true
aliases: [/content/markdown-extras/,/content/supported-formats/,/doc/supported-formats/]
---
@ -24,12 +24,12 @@ 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/).|
|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.|
|Pandoc|pandoc, pdc|Needs [Pandoc](https://www.pandoc.org/) installed.|
|HTML|html, htm|To be treated as a content file, with layout, shortcodes etc., it must have front matter. If not, it will be copied as-is.|
| 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.|
|Pandoc|`pandoc`, `pdc`|Needs [Pandoc](https://www.pandoc.org/) installed.|
|HTML|`html`, `htm`|To be treated as a content file, with layout, shortcodes etc., it must have front matter. If not, it will be copied as-is.|
The `markup identifier` is fetched from either the `markup` variable in front matter or from the file extension. For markup-related configuration, see [Configure Markup](/getting-started/configuration-markup/).
@ -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&nbsp;[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

View file

@ -2,13 +2,13 @@
title: Front matter
description: Hugo allows you to add front matter in yaml, toml, or json to your content files.
categories: [content management]
keywords: ["front matter", "yaml", "toml", "json", "metadata", "archetypes"]
keywords: [front matter,yaml,toml,json,metadata,archetypes]
menu:
docs:
parent: content-management
weight: 60
toc: true
weight: 60
toc: true
aliases: [/content/front-matter/]
---
@ -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.
@ -131,7 +131,7 @@ videos
weight
: used for [ordering your content in lists][ordering]. Lower weight gets higher precedence. So content with lower weight will come first. If set, weights should be non-zero, as 0 is interpreted as an *unset* weight.
\<taxonomies\>
taxonomies
: Field name of the *plural* form of the index. See `tags` and `categories` in the above front matter examples. *Note that the plural form of user-defined taxonomies cannot be the same as any of the predefined front matter variables.*
{{% note %}}
@ -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"
@ -187,11 +187,17 @@ environment
Any of the above can be omitted.
{{% note %}}
When making a site that supports multiple languages, defining a `[[cascade]]` is recommended to be done in [Site Config](../../getting-started/configuration/#cascade) to prevent duplication.
If you instea define a `[[cascade]]` in front matter for multiple languages, an `content/XX/foo/_index.md` file needs to be made on a per-language basis, with `XX` the glob pattern matching the Page's language. In this case, the **lang** keyword is ignored.
{{% /note %}}
### Example
In `content/blog/_index.md`
{{< code-toggle copy=false >}}
{{< code-toggle >}}
title: Blog
cascade:
banner: images/typewriter.jpg
@ -219,13 +225,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/

View file

@ -1,8 +1,8 @@
---
title: Image processing
description: Resize, crop, rotate, filter, and convert images.
categories: [fundamentals,content management]
keywords: [resources, images]
categories: [content management,fundamentals]
keywords: [resources,images]
menu:
docs:
parent: content-management
@ -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" }}
@ -104,15 +105,15 @@ Example 4: Skips rendering if there's problem accessing a remote resource.
The `image` resource implements the [`Process`], [`Resize`], [`Fit`], [`Fill`], [`Crop`], [`Filter`], [`Colors`] and [`Exif`] methods.
{{% note %}}
Metadata (EXIF, IPTC, XMP, etc.) is not preserved during image transformation. Use the [`Exif`] method with the _original_ image to extract EXIF metadata from JPEG or TIFF images.
Metadata (EXIF, IPTC, XMP, etc.) is not preserved during image transformation. Use the `Exif` method with the _original_ image to extract EXIF metadata from JPEG or TIFF images.
{{% /note %}}
### Process
{{< new-in "0.119.0" >}}
{{< 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.
@ -205,7 +205,7 @@ Sometimes it can be useful to create the filter chain once and then reuse it.
### Colors
{{< new-in "0.104.0" >}}
{{< new-in 0.104.0 >}}
`.Colors` returns a slice of hex strings with the dominant colors in the image using a simple histogram method.
@ -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
@ -347,9 +346,9 @@ The default value is 75. You may override the default value in the [site configu
### Hint
<!-- Specifies a libwebp preset, not a libwebp image hint. -->
Applicable to WebP images, this option corresponds to a set of predefined encoding parameters, and is equivalent to the `-preset` flag for the [`cwebp`] encoder.
Applicable to WebP images, this option corresponds to a set of predefined encoding parameters.
[`cwebp`]: https://developers.google.com/speed/webp/docs/cwebp
Value|Example
:--|:--
@ -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 %}}
@ -436,7 +433,7 @@ Note the self-closing shortcode syntax above. You may call the `imgproc` shortco
Define an `imaging` section in your site configuration to set the default [image processing options](#image-processing-options).
{{< code-toggle config="imaging" />}}
{{< code-toggle config=imaging />}}
anchor
: See image processing options: [anchor](#anchor).
@ -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 = ""
@ -478,7 +475,9 @@ includeFields
: Regular expression matching the EXIF tags to include in the `.Tags` collection. Default is&nbsp;`""`. To include all available tags, set this value to&nbsp;`".*"`.
{{% note %}}
To improve performance and decrease cache size, if you set neither `excludeFields` nor `includeFields`, Hugo excludes the following tags: `ColorSpace`, `Contrast`, `Exif`, `Exposure[M|P|B]`, `Flash`, `GPS`, `JPEG`, `Metering`, `Resolution`, `Saturation`, `Sensing`, `Sharp`, and `WhiteBalance`.
To improve performance and decrease cache size, Hugo excludes the following tags: `ColorSpace`, `Contrast`, `Exif`, `Exposure[M|P|B]`, `Flash`, `GPS`, `JPEG`, `Metering`, `Resolution`, `Saturation`, `Sensing`, `Sharp`, and `WhiteBalance`.
To control tag availability, change the `excludeFields` or `includeFields` settings as described above.
{{% /note %}}
## Smart cropping of images
@ -487,9 +486,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 +496,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
```

Some files were not shown because too many files have changed in this diff Show more