mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-14 20:37:55 -05:00
Merge commit 'a6e635ca7d905d9ec3ffd708db2694f680b03aae'
This commit is contained in:
commit
e99eba39e7
143 changed files with 3258 additions and 2109 deletions
|
@ -71,6 +71,7 @@
|
|||
"attrlink",
|
||||
"canonify",
|
||||
"codeowners",
|
||||
"dynacache",
|
||||
"eturl",
|
||||
"getenv",
|
||||
"gohugo",
|
||||
|
@ -89,6 +90,7 @@
|
|||
"# cspell: ignore foreign language words",
|
||||
"# ----------------------------------------------------------------------",
|
||||
"bezpieczeństwo",
|
||||
"blatt",
|
||||
"buch",
|
||||
"descripción",
|
||||
"dokumentation",
|
||||
|
|
15
docs/_vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/Route4MeLogoBlueOnWhite.svg
generated
Normal file
15
docs/_vendor/github.com/gohugoio/gohugoioTheme/assets/images/sponsors/Route4MeLogoBlueOnWhite.svg
generated
Normal file
|
@ -0,0 +1,15 @@
|
|||
<svg width="150" height="36" viewBox="0 0 150 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.9337 13.4895H41.1147C41.4378 13.4895 41.8417 13.4895 42.1648 13.4895C42.5686 13.4895 42.8917 13.4087 43.2148 13.2472C43.5379 13.0856 43.7803 12.9241 43.9418 12.6818C44.1034 12.4394 44.2649 12.0355 44.2649 11.6317C44.2649 11.2278 44.1841 10.8239 44.0226 10.5816C43.861 10.3393 43.6187 10.0969 43.3764 10.0162C43.1341 9.85461 42.811 9.77384 42.4879 9.77384C42.1648 9.69306 41.7609 9.69306 41.4378 9.69306H39.0145V13.4895H38.9337ZM35.2181 6.46204H41.7609C42.6494 6.46204 43.4572 6.54282 44.1841 6.70437C44.9919 6.86592 45.6381 7.18902 46.2035 7.51212C46.769 7.916 47.2536 8.40065 47.5767 9.12763C47.8998 9.77384 48.0614 10.6624 48.0614 11.6317C48.0614 12.8433 47.7383 13.8934 47.0921 14.7011C46.4459 15.5089 45.5573 16.0743 44.3457 16.3166L48.6268 23.5057H44.1841L40.63 16.7205H38.7722V23.5057H35.0565V6.46204H35.2181Z" fill="#425277"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M53.3926 17.6091C53.3926 18.4976 53.6349 19.2246 54.1195 19.79C54.6042 20.3554 55.3312 20.5977 56.2197 20.5977C57.1082 20.5977 57.8352 20.3554 58.3199 19.79C58.8045 19.2246 59.0468 18.4976 59.0468 17.6091C59.0468 16.7205 58.8045 15.9935 58.3199 15.4281C57.8352 14.8627 57.1082 14.6204 56.2197 14.6204C55.3312 14.6204 54.6042 14.8627 54.1195 15.4281C53.6349 16.0743 53.3926 16.7205 53.3926 17.6091ZM49.8384 17.6091C49.8384 16.6397 50 15.832 50.3231 15.105C50.6462 14.378 51.1308 13.7318 51.6963 13.1664C52.2617 12.601 52.9887 12.1971 53.7157 11.9548C54.5234 11.6317 55.3312 11.5509 56.2197 11.5509C57.1082 11.5509 57.916 11.7124 58.7237 11.9548C59.5315 12.2779 60.1777 12.6818 60.7431 13.1664C61.3086 13.7318 61.7932 14.378 62.1163 15.105C62.4394 15.832 62.601 16.7205 62.601 17.6091C62.601 18.5784 62.4394 19.3861 62.1163 20.1131C61.7932 20.8401 61.3086 21.4863 60.7431 22.0517C60.1777 22.6171 59.4507 23.021 58.7237 23.2633C57.916 23.5864 57.1082 23.6672 56.2197 23.6672C55.3312 23.6672 54.5234 23.5057 53.7157 23.2633C52.9079 22.9402 52.2617 22.5364 51.6963 22.0517C51.1308 21.4863 50.6462 20.8401 50.3231 20.1131C50 19.3861 49.8384 18.5784 49.8384 17.6091Z" fill="#425277"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M75.929 23.5057H72.4556V21.8902H72.3748C72.2133 22.1325 72.0517 22.3748 71.8902 22.5364C71.7286 22.7787 71.4863 22.9403 71.1632 23.1826C70.8401 23.3441 70.517 23.5057 70.1939 23.5865C69.79 23.6672 69.4669 23.748 68.9823 23.748C68.0937 23.748 67.3668 23.5865 66.8013 23.3441C66.2359 23.1018 65.832 22.6979 65.5089 22.2133C65.1858 21.7286 65.0243 21.1632 64.8627 20.4362C64.782 19.79 64.7012 19.063 64.7012 18.2553V11.7932H68.2553V17.5283C68.2553 17.8514 68.2553 18.1745 68.2553 18.5784C68.2553 18.9015 68.3361 19.3054 68.4976 19.5477C68.6592 19.79 68.8207 20.1131 69.063 20.2747C69.3054 20.4362 69.6285 20.5978 70.1131 20.5978C70.5978 20.5978 70.9209 20.517 71.244 20.3554C71.5671 20.1939 71.7286 19.9516 71.8902 19.7092C72.0517 19.4669 72.1325 19.1438 72.2133 18.7399C72.2941 18.4168 72.2941 18.013 72.2941 17.6091V11.7932H75.929V23.5057Z" fill="#425277"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M86.3489 14.7011H83.1987V18.5784C83.1987 18.9015 83.1987 19.2246 83.2794 19.4669C83.2794 19.7092 83.3602 19.9515 83.5218 20.1131C83.6026 20.2746 83.7641 20.4362 84.0064 20.5977C84.2488 20.6785 84.5719 20.7593 84.895 20.7593C85.0565 20.7593 85.2988 20.7593 85.6219 20.6785C85.945 20.6785 86.1874 20.517 86.3489 20.4362V23.4249C85.945 23.5864 85.5412 23.6672 85.1373 23.748C84.7334 23.8288 84.2488 23.8288 83.8449 23.8288C83.2795 23.8288 82.714 23.748 82.1486 23.6672C81.6639 23.5057 81.1793 23.3441 80.7754 23.021C80.3715 22.7787 80.1292 22.3748 79.8869 21.8902C79.6446 21.4055 79.5638 20.9208 79.5638 20.2746V14.7011H77.3021V11.7932H79.5638V8.31988H83.1179V11.7932H86.2681V14.7011H86.3489Z" fill="#425277"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M96.1228 16.3166C96.1228 15.6704 95.9612 15.1858 95.5573 14.7819C95.1535 14.378 94.588 14.1357 93.9418 14.1357C93.5379 14.1357 93.2148 14.2165 92.8917 14.2973C92.5686 14.4588 92.3263 14.6204 92.084 14.7819C91.8417 15.0242 91.6801 15.1858 91.5993 15.5089C91.5186 15.7512 91.4378 16.0743 91.357 16.3166H96.1228ZM99.1922 21.4863C98.6268 22.2133 97.8998 22.7787 97.0113 23.1826C96.1228 23.5864 95.2342 23.748 94.2649 23.748C93.3764 23.748 92.5686 23.5864 91.7609 23.3441C90.9531 23.021 90.3069 22.6171 89.7415 22.1325C89.1761 21.567 88.6914 20.9208 88.3683 20.1939C88.0452 19.4669 87.8837 18.5784 87.8837 17.6898C87.8837 16.7205 88.0452 15.9128 88.3683 15.1858C88.6914 14.4588 89.1761 13.8126 89.7415 13.2472C90.3069 12.6817 91.0339 12.2779 91.7609 12.0355C92.5686 11.7124 93.3764 11.6317 94.2649 11.6317C95.0727 11.6317 95.8804 11.7932 96.5266 12.0355C97.1728 12.3586 97.7383 12.7625 98.2229 13.2472C98.7076 13.8126 99.0307 14.4588 99.273 15.1858C99.5153 15.9128 99.6769 16.8013 99.6769 17.6898V18.8207H91.357C91.5186 19.5477 91.8417 20.0323 92.3263 20.4362C92.811 20.8401 93.3764 21.0824 94.1034 21.0824C94.6688 21.0824 95.1535 20.9208 95.5573 20.6785C95.9612 20.4362 96.2843 20.0323 96.6074 19.6284L99.1922 21.4863Z" fill="#425277"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M108.562 11.147L104.766 17.0436H108.562V11.147ZM108.562 20.1131H101.212V17.0436L108.078 6.46205H111.955V17.0436H114.136V20.1131H111.955V23.5057H108.481V20.1131H108.562Z" fill="#FFC63C"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M116.478 6.46205H122.052L126.01 17.6091L129.968 6.46205H135.541V23.5057H131.826V10.42H131.745L127.302 23.5057H124.475L120.194 10.42V23.5057H116.478V6.46205Z" fill="#425277"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M146.446 16.3166C146.446 15.6704 146.284 15.1858 145.88 14.7819C145.477 14.378 144.911 14.1357 144.265 14.1357C143.861 14.1357 143.538 14.2165 143.215 14.2973C142.892 14.4588 142.649 14.6204 142.407 14.7819C142.165 15.0242 142.003 15.1858 141.922 15.5089C141.842 15.7512 141.761 16.0743 141.68 16.3166H146.446ZM149.515 21.4863C148.95 22.2133 148.223 22.7787 147.334 23.1826C146.446 23.5864 145.557 23.748 144.588 23.748C143.7 23.748 142.892 23.5864 142.084 23.3441C141.276 23.021 140.63 22.6171 140.065 22.1325C139.499 21.567 139.015 20.9208 138.691 20.1939C138.368 19.4669 138.207 18.5784 138.207 17.6898C138.207 16.7205 138.368 15.9128 138.691 15.1858C139.015 14.4588 139.499 13.8126 140.065 13.2472C140.63 12.6817 141.357 12.2779 142.084 12.0355C142.892 11.7124 143.7 11.6317 144.588 11.6317C145.396 11.6317 146.204 11.7932 146.85 12.0355C147.496 12.3586 148.061 12.7625 148.546 13.2472C149.031 13.8126 149.354 14.4588 149.596 15.1858C149.838 15.9128 150 16.8013 150 17.6898V18.8207H141.68C141.842 19.5477 142.165 20.0323 142.649 20.4362C143.134 20.8401 143.7 21.0824 144.426 21.0824C144.992 21.0824 145.477 20.9208 145.88 20.6785C146.284 20.4362 146.607 20.0323 146.931 19.6284L149.515 21.4863Z" fill="#425277"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M28.1906 1.53473C28.1906 0.646204 28.9176 0 29.7253 0C30.6139 0 31.2601 0.726979 31.2601 1.53473C31.2601 2.42326 30.5331 3.06947 29.7253 3.06947C28.9176 3.15024 28.1906 2.42326 28.1906 1.53473Z" fill="#FF6400"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 1.53473C0 0.726979 0.726979 0 1.53473 0C2.42326 0 3.15024 0.726979 3.15024 1.53473C3.15024 2.42326 2.42326 3.15024 1.53473 3.15024C0.726979 3.15024 0 2.42326 0 1.53473Z" fill="#FF6400"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.2941 33.6834C22.2941 32.7948 23.021 32.1486 23.8288 32.1486C24.7173 32.1486 25.3635 32.8756 25.3635 33.6834C25.3635 34.5719 24.6366 35.2181 23.8288 35.2181C23.021 35.2181 22.2941 34.5719 22.2941 33.6834Z" fill="#FF6400"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.0323 6.62363C20.2746 6.86595 20.2746 7.18906 20.0323 7.35061L17.3667 10.0162C17.1244 10.2585 17.2051 10.4201 17.5283 10.5816C19.063 11.1471 20.2746 12.3587 20.7593 13.8126C20.84 14.055 21.0824 14.1357 21.3247 13.9742L23.9903 11.3086C24.2326 11.0663 24.5557 11.0663 24.7173 11.3086L27.0598 13.6511C27.3021 13.8934 27.4636 13.8126 27.4636 13.4895V4.20036C27.4636 4.03881 27.3829 3.95804 27.2213 3.95804H17.8514C17.5282 3.95804 17.5282 4.11959 17.6898 4.36191L20.0323 6.62363ZM13.7318 10.5008C13.9741 10.4201 14.0549 10.1777 13.8934 9.93542L11.2278 7.26983C10.9854 7.0275 10.9854 6.7044 11.2278 6.54285L13.5703 4.20036C13.8126 3.95804 13.7318 3.79649 13.4087 3.79649H4.2003C4.03875 3.95804 3.8772 4.03881 3.8772 4.20036V13.4895C3.8772 13.8126 4.03875 13.8126 4.28107 13.6511L6.62356 11.3086C6.86589 11.0663 7.18899 11.0663 7.35054 11.3086L10.0161 13.9742C10.2585 14.2165 10.42 14.1357 10.5816 13.8126C11.0662 12.2779 12.2778 11.0663 13.7318 10.5008ZM15.9127 21.1632C15.5896 21.1632 15.5089 21.4055 15.5896 21.6479L17.1244 25.0404C17.2051 25.2828 17.1244 25.6059 16.882 25.7674L13.8934 27.1406C13.651 27.3021 13.651 27.4637 13.8934 27.5445L22.6171 30.6947C22.7787 30.7755 22.9402 30.6947 22.9402 30.5332L26.1712 21.8094C26.252 21.5671 26.1712 21.4055 25.8481 21.5671L22.8594 22.9403C22.6171 23.1018 22.294 22.9403 22.1324 22.6979L20.4362 19.063C20.3554 18.8207 20.1131 18.8207 19.9515 18.9823C19.4669 19.6285 18.8207 20.1939 18.0129 20.5978C17.5282 20.8401 16.882 21.0017 16.3166 21.0824C16.3166 21.0824 16.0743 21.1632 15.9127 21.1632Z" fill="#FFC63C"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.7124 15.6705C11.7124 13.4895 13.4895 11.7932 15.5896 11.7932C17.7706 11.7932 19.4668 13.5703 19.4668 15.6705C19.4668 17.8514 17.6898 19.6285 15.5896 19.6285C13.4895 19.5477 11.7124 17.8514 11.7124 15.6705Z" fill="#FF6400"/>
|
||||
</svg>
|
After Width: | Height: | Size: 9.3 KiB |
|
@ -6,12 +6,13 @@
|
|||
bgcolor = "#ffffff"
|
||||
|
||||
[[banners]]
|
||||
name = "Route4Me"
|
||||
link = "https://route4me.com"
|
||||
title = "Route Planning & Route Optimization Software"
|
||||
utm_campaign = "hugosponsor"
|
||||
bgcolor = "#334799"
|
||||
link_attr = "style='color: #ffffff; font-weight: bold; text-decoration: none; text-align: center'"
|
||||
name = "Route4Me"
|
||||
link = "https://route4me.com/"
|
||||
title = "Route Planning & Route Optimization Software"
|
||||
no_query_params = true
|
||||
utm_campaign = "hugosponsor"
|
||||
bgcolor = "#334799"
|
||||
link_attr = "style='color: #ffffff; font-weight: bold; text-decoration: none; text-align: center'"
|
||||
|
||||
[[banners]]
|
||||
name = "Your Company?"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
{{- partial "home-page-sections/features-single.html" . -}}
|
||||
|
||||
{{- partial "home-page-sections/showcase.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.html" . -}}
|
||||
|
|
|
@ -23,7 +23,10 @@
|
|||
class="{{ $classes_box }} o-100"
|
||||
style="background-color: {{ .bgcolor }};">
|
||||
{{ $query_params := .query_params | default "" }}
|
||||
{{ $url := printf "%s?%s%s" .link $query_params (querify "utm_source" (.utm_source | default $utmSource ) "utm_medium" "banner" "utm_campaign" (.utm_campaign | default "hugosponsor") "utm_content" (.utm_content | default "gohugoio")) | safeURL }}
|
||||
{{ $url := .link }}
|
||||
{{ if not .no_query_params }}
|
||||
{{ $url = printf "%s?%s%s" .link $query_params (querify "utm_source" (.utm_source | default $utmSource ) "utm_medium" "banner" "utm_campaign" (.utm_campaign | default "hugosponsor") "utm_content" (.utm_content | default "gohugoio")) | safeURL }}
|
||||
{{ end }}
|
||||
{{ $logo := resources.Get .logo }}
|
||||
{{ $gtagID := printf "Sponsor %s %s" .name $gtag | title }}
|
||||
{{ $classes := "" }}
|
||||
|
|
|
@ -1 +1 @@
|
|||
# github.com/gohugoio/gohugoioTheme v0.0.0-20240619093131-b595d5fb8c52
|
||||
# github.com/gohugoio/gohugoioTheme v0.0.0-20240728210410-d42c342ce472
|
||||
|
|
|
@ -128,11 +128,11 @@ weight = 10
|
|||
identifier = 'themes'
|
||||
url = 'https://themes.gohugo.io/'
|
||||
|
||||
[[global]]
|
||||
name = 'Showcase'
|
||||
weight = 20
|
||||
identifier = 'showcase'
|
||||
pageRef = '/showcase/'
|
||||
# [[global]]
|
||||
# name = 'Showcase'
|
||||
# weight = 20
|
||||
# identifier = 'showcase'
|
||||
# pageRef = '/showcase/'
|
||||
|
||||
# Anything with a weight > 100 gets an external icon
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ toc: true
|
|||
: Render each page of your site to one or more output formats, with granular control by page kind, section, and path. While HTML is the default output format, you can add JSON, RSS, CSV, and more. For example, create a REST API to access content.
|
||||
|
||||
[Templates]
|
||||
: Create templates usings variables, functions, and methods to transform your content, resources, and data into a published page. While HTML templates are the most common, you can create templates for any output format.
|
||||
: Create templates using variables, functions, and methods to transform your content, resources, and data into a published page. While HTML templates are the most common, you can create templates for any output format.
|
||||
|
||||
[Themes]
|
||||
: Reduce development time and cost by using one of the hundreds of themes contributed by the Hugo community. Themes are available for corporate sites, documentation projects, image portfolios, landing pages, personal and professional blogs, resumes, CVs, and more.
|
||||
|
@ -80,17 +80,19 @@ toc: true
|
|||
[URL management]
|
||||
: Serve any page from any path via global configuration or on a page-by-page basis.
|
||||
|
||||
|
||||
## Asset pipelines
|
||||
|
||||
[CSS bundling]
|
||||
: Transpile Sass to CSS, bundle, tree shake, minify, create source maps, perform SRI hashing, and integrate with PostCSS.
|
||||
[Image processing]
|
||||
: Convert, resize, crop, rotate, adjust colors, apply filters, overlay text and images, and extract EXIF data.
|
||||
|
||||
[JavaScript bundling]
|
||||
: Transpile TypeScript and JSX to JavaScript, bundle, tree shake, minify, create source maps, and perform SRI hashing.
|
||||
|
||||
[Image processing]
|
||||
: Convert, resize, crop, rotate, adjust colors, apply filters, overlay text and images, and extract EXIF data.
|
||||
[Sass processing]
|
||||
: Transpile Sass to CSS, bundle, tree shake, minify, create source maps, perform SRI hashing, and integrate with PostCSS.
|
||||
|
||||
[Tailwind CSS processing]
|
||||
: Compile Tailwind CSS utility classes into standard CSS, bundle, tree shake, optimize, minify, perform SRI hashing, and integrate with PostCSS.
|
||||
|
||||
## Performance
|
||||
|
||||
|
@ -104,7 +106,7 @@ toc: true
|
|||
: Minify HTML, CSS, and JavaScript to reduce file size, bandwidth consumption, and loading times.
|
||||
|
||||
[CCPA]: https://en.wikipedia.org/wiki/California_Consumer_Privacy_Act
|
||||
[CSS bundling]: /functions/resources/tocss/
|
||||
[Sass processing]: /functions/css/Sass/
|
||||
[Caching]: /functions/partials/includecached/
|
||||
[CommonMark]: https://spec.commonmark.org/current/
|
||||
[Content adapters]: /content-management/content-adapters/
|
||||
|
@ -130,6 +132,7 @@ toc: true
|
|||
[Segmentation]: /getting-started/configuration/#configure-segments
|
||||
[Shortcodes]: /content-management/shortcodes/
|
||||
[Syntax highlighting]: /content-management/syntax-highlighting/
|
||||
[Tailwind CSS processing]: /functions/css/tailwindcss/
|
||||
[Taxonomies]: /content-management/taxonomies/
|
||||
[Templates]: templates/introduction/
|
||||
[Themes]: https://themes.gohugo.io/
|
||||
|
|
|
@ -15,7 +15,7 @@ aliases: [/gdpr/,/about/hugo-and-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.
|
||||
|
||||
**Hugo is a static site generator. By using Hugo you are already standing on very solid ground. Static HTML files on disk are much easier to reason about compared to server and database driven web sites.**
|
||||
**Hugo is a static site generator. By using Hugo you are already standing on very solid ground. Static HTML files on disk are much easier to reason about compared to server and database driven websites.**
|
||||
|
||||
But even static websites can integrate with external services, so from version `0.41`, Hugo provides a **privacy configuration** that covers the relevant built-in templates.
|
||||
|
||||
|
|
|
@ -74,5 +74,5 @@ Open-source commenting systems:
|
|||
[front matter]: /content-management/front-matter/
|
||||
[kaijuissue]: https://github.com/spf13/kaiju/issues/new
|
||||
[issotutorial]: https://stiobhart.net/2017-02-24-isso-comments/
|
||||
[partials]: /templates/partials/
|
||||
[partials]: /templates/partial/
|
||||
[MongoDB]: https://www.mongodb.com/
|
||||
|
|
|
@ -241,7 +241,7 @@ Step 3
|
|||
{{< /code >}}
|
||||
|
||||
Step 4
|
||||
: Create a single page template to render each book review.
|
||||
: Create a single template to render each book review.
|
||||
|
||||
{{< code file=layouts/books/single.html copy=true >}}
|
||||
{{ define "main" }}
|
||||
|
|
|
@ -36,12 +36,12 @@ The `ref` and `relref` shortcodes require a single argument: the path to a conte
|
|||
The pages can be referenced as follows:
|
||||
|
||||
```text
|
||||
{{</* ref "document2" */>}} // <- From pages/document1.md, relative path
|
||||
{{</* ref "document2" */>}} <-- From pages/document1.md, relative path
|
||||
{{</* ref "document2#anchor" */>}}
|
||||
{{</* ref "document2.md" */>}}
|
||||
{{</* ref "document2.md#anchor" */>}}
|
||||
{{</* ref "#anchor" */>}} // <- From pages/document2.md
|
||||
{{</* ref "/blog/my-post" */>}} // <- From anywhere, absolute path
|
||||
{{</* ref "#anchor" */>}} <-- From pages/document2.md
|
||||
{{</* ref "/blog/my-post" */>}} <-- From anywhere, absolute path
|
||||
{{</* ref "/blog/my-post.md" */>}}
|
||||
{{</* relref "document" */>}}
|
||||
{{</* relref "document.md" */>}}
|
||||
|
@ -52,12 +52,12 @@ The pages can be referenced as follows:
|
|||
index.md can be reference either by its path or by its containing folder without the ending `/`. \_index.md can be referenced only by its containing folder:
|
||||
|
||||
```text
|
||||
{{</* ref "/about" */>}} // <- References /about/_index.md
|
||||
{{</* ref "/about/_index" */>}} // Raises REF_NOT_FOUND error
|
||||
{{</* ref "/about/credits.md" */>}} // <- References /about/credits.md
|
||||
{{</* ref "/about" */>}} <-- References /about/_index.md
|
||||
{{</* ref "/about/_index" */>}} <-- Raises REF_NOT_FOUND error
|
||||
{{</* ref "/about/credits.md" */>}} <-- References /about/credits.md
|
||||
|
||||
{{</* ref "/products" */>}} // <- References /products/index.md
|
||||
{{</* ref "/products/index" */>}} // <- References /products/index.md
|
||||
{{</* ref "/products" */>}} <-- References /products/index.md
|
||||
{{</* ref "/products/index" */>}} <-- References /products/index.md
|
||||
```
|
||||
|
||||
To generate a hyperlink using `ref` or `relref` in Markdown:
|
||||
|
@ -146,7 +146,3 @@ 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/
|
||||
|
|
|
@ -45,7 +45,7 @@ project/
|
|||
Do not place CSV files in the data directory. Access CSV files as page, global, or remote resources.
|
||||
{{% /note %}}
|
||||
|
||||
See the documentation for the [`Data`] method on `Page` object for details and examples.
|
||||
See the documentation for the [`Data`] method on a `Site` object for details and examples.
|
||||
|
||||
[`Data`]: /methods/site/data/
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ path
|
|||
|
||||
(`map`) A map of sitemap options. See the [sitemap templates] page for details. Access these values from a template using the [`Sitemap`] method on a `Page` object.
|
||||
|
||||
[sitemap templates]: /templates/sitemap-template/
|
||||
[sitemap templates]: /templates/sitemap/
|
||||
[`sitemap`]: /methods/page/sitemap/
|
||||
|
||||
###### slug
|
||||
|
|
|
@ -59,7 +59,7 @@ A remote resource is a file on a remote server, accessible via HTTP or HTTPS. To
|
|||
|
||||
## Image rendering
|
||||
|
||||
Once you have accessed an image as either a page resource or a global resource, render it in your templates using the `Permalink`, `RelPermalink`, `Width`, and `Height` properties.
|
||||
Once you have accessed an image as a resource, render it in your templates using the `Permalink`, `RelPermalink`, `Width`, and `Height` properties.
|
||||
|
||||
Example 1: Throws an error if the resource is not found.
|
||||
|
||||
|
@ -105,7 +105,7 @@ 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, PNG, TIFF, and WebP images.
|
||||
{{% /note %}}
|
||||
|
||||
### Process
|
||||
|
@ -219,7 +219,7 @@ This method is fast, but if you also scale down your images, it would be good fo
|
|||
|
||||
Provides an [EXIF] object containing image metadata.
|
||||
|
||||
You may access EXIF data in JPEG and TIFF images. To prevent errors when processing images without EXIF data, wrap the access in a [`with`] statement.
|
||||
You may access EXIF data in JPEG, PNG, TIFF, and WebP images. To prevent errors when processing images without EXIF data, wrap the access in a [`with`] statement.
|
||||
|
||||
```go-html-template
|
||||
{{ with $image.Exif }}
|
||||
|
|
|
@ -227,7 +227,7 @@ Hugo provides two methods to localize your menu entries. See [multilingual].
|
|||
See [menu templates].
|
||||
|
||||
[localize]: /content-management/multilingual/#menus
|
||||
[menu templates]: /templates/menu-templates/
|
||||
[menu templates]: /templates/menu/
|
||||
[multilingual]: /content-management/multilingual/#menus
|
||||
[section]: /getting-started/glossary/#section
|
||||
[template]: /templates/menu-templates/
|
||||
[template]: /templates/menu/
|
||||
|
|
|
@ -92,7 +92,7 @@ languageName
|
|||
: (`string`) The language name, typically used when rendering a language switcher.
|
||||
|
||||
title
|
||||
: (`string`) The site title for this langauge (optional).
|
||||
: (`string`) The site title for this language (optional).
|
||||
|
||||
weight
|
||||
: (`int`) The language weight. When set to a non-zero value, this is the primary sort criteria for this language.
|
||||
|
@ -322,7 +322,7 @@ To create a list of links to translated content, use a template similar to the f
|
|||
{{ end }}
|
||||
{{< /code >}}
|
||||
|
||||
The above can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template, whether a [single content page][contenttemplate] or the [homepage]. It will not print anything if there are no translations for a given page.
|
||||
The above can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template. It will not print anything if there are no translations for a given page.
|
||||
|
||||
The above also uses the [`i18n` function][i18func] described in the next section.
|
||||
|
||||
|
@ -564,7 +564,7 @@ products = 'Produkte'
|
|||
services = 'Leistungen'
|
||||
{{< / code-toggle >}}
|
||||
|
||||
[example menu template]: /templates/menu-templates/#example
|
||||
[example menu template]: /templates/menu/#example
|
||||
[automatically]: /content-management/menus/#define-automatically
|
||||
[in front matter]: /content-management/menus/#define-in-front-matter
|
||||
[in site configuration]: /content-management/menus/#define-in-site-configuration
|
||||
|
@ -615,10 +615,8 @@ hugo new content content/de/post/test.md
|
|||
|
||||
[`abslangurl`]: /functions/urls/abslangurl/
|
||||
[config]: /getting-started/configuration/
|
||||
[contenttemplate]: /templates/single-page-templates/
|
||||
[go-i18n-source]: https://github.com/nicksnyder/go-i18n
|
||||
[go-i18n]: https://github.com/nicksnyder/go-i18n
|
||||
[homepage]: /templates/homepage/
|
||||
[Hugo Multilingual Part 1: Content translation]: https://regisphilibert.com/blog/2018/08/hugo-multilingual-part-1-managing-content-translation/
|
||||
[i18func]: /functions/lang/translate/
|
||||
[lang.FormatAccounting]: /functions/lang/formataccounting/
|
||||
|
@ -630,5 +628,4 @@ hugo new content content/de/post/test.md
|
|||
[menus]: /content-management/menus/
|
||||
[OS environment]: /getting-started/configuration/#configure-with-environment-variables
|
||||
[`rellangurl`]: /functions/urls/rellangurl/
|
||||
[single page templates]: /templates/single-page-templates/
|
||||
[`time.Format`]: /functions/time/format/
|
||||
|
|
|
@ -71,13 +71,13 @@ The following demonstrates the relationships between your content organization a
|
|||
|
||||
### Index pages: `_index.md`
|
||||
|
||||
`_index.md` has a special role in Hugo. It allows you to add front matter and content to your [list templates][lists]. These templates include those for [section templates], [taxonomy templates], [taxonomy terms templates], and your [homepage template].
|
||||
`_index.md` has a special role in Hugo. It allows you to add front matter and content to `home`, `section`, `taxonomy`, and `term` pages.
|
||||
|
||||
{{% note %}}
|
||||
**Tip:** You can get a reference to the content and metadata in `_index.md` using the [`.Site.GetPage` function](/methods/page/getpage).
|
||||
{{% /note %}}
|
||||
|
||||
You can create one `_index.md` for your homepage and one in each of your content sections, taxonomies, and taxonomy terms. The following shows typical placement of an `_index.md` that would contain content and front matter for a `posts` section list page on a Hugo website:
|
||||
You can create one `_index.md` for your home page and one in each of your content sections, taxonomies, and terms. The following shows typical placement of an `_index.md` that would contain content and front matter for a `posts` section list page on a Hugo website:
|
||||
|
||||
```txt
|
||||
. url
|
||||
|
@ -106,7 +106,7 @@ The [sections] can be nested as deeply as you want. The important thing to under
|
|||
|
||||
### Single pages in sections
|
||||
|
||||
Single content files in each of your sections will be rendered as [single page templates][singles]. Here is an example of a single `post` within `posts`:
|
||||
Single content files in each of your sections will be rendered by a [single template]. Here is an example of a single `post` within `posts`:
|
||||
|
||||
```txt
|
||||
path ("posts/my-first-hugo-post.md")
|
||||
|
@ -156,14 +156,7 @@ The `url` is the entire URL path, defined by the file path and optionally overri
|
|||
[formats]: /content-management/formats/
|
||||
[front matter]: /content-management/front-matter/
|
||||
[getpage]: /methods/page/getpage/
|
||||
[homepage template]: /templates/homepage/
|
||||
[homepage]: /templates/homepage/
|
||||
[lists]: /templates/lists/
|
||||
[pretty]: /content-management/urls/#appearance
|
||||
[section templates]: /templates/section-templates/
|
||||
[sections]: /content-management/sections/
|
||||
[singles]: /templates/single-page-templates/
|
||||
[taxonomy templates]: /templates/taxonomy-templates/
|
||||
[taxonomy terms templates]: /templates/taxonomy-templates/
|
||||
[types]: /content-management/types/
|
||||
[single template]: /templates/types/#single
|
||||
[urls]: /content-management/urls/
|
||||
|
|
|
@ -50,11 +50,17 @@ Page bundle characteristics vary by bundle type.
|
|||
| Index file | index.md | _index.md |
|
||||
| Example | content/about/index.md | content/posts/_index.md |
|
||||
| [Page kinds] | `page` | `home`, `section`, `taxonomy`, or `term` |
|
||||
| Layout type | [single] | [list] |
|
||||
| Template types | [single] | [home], [section], [taxonomy], or [term] |
|
||||
| Descendant pages | None | Zero or more |
|
||||
| Resource location | Adjacent to the index file or in a nested subdirectory | Same as a leaf bundles, but excludes descendant bundles |
|
||||
| [Resource types] | `page`, `image`, `video`, etc. | all but `page` |
|
||||
|
||||
[single]: /templates/types/#single
|
||||
[home]: /templates/types/#home
|
||||
[section]: /templates/types/#section
|
||||
[taxonomy]: /templates/types/#taxonomy
|
||||
[term]: /templates/types/#term
|
||||
|
||||
Files with [resource type] `page` include content written in Markdown, HTML, AsciiDoc, Pandoc, reStructuredText, and Emacs Org Mode. In a leaf bundle, excluding the index file, these files are only accessible as page resources. In a branch bundle, these files are only accessible as content pages.
|
||||
|
||||
## Leaf bundles
|
||||
|
@ -149,9 +155,7 @@ Use [build options] in front matter to create an unpublished leaf or branch bund
|
|||
|
||||
[`Resources`]: /methods/page/resources/
|
||||
[build options]: content-management/build-options/
|
||||
[list]: /templates/lists/
|
||||
[page kinds]: /getting-started/glossary/#page-kind
|
||||
[page resources]: /content-management/page-resources/
|
||||
[resource type]: /getting-started/glossary/#resource-type
|
||||
[resource types]: /getting-started/glossary/#resource-type
|
||||
[single]: /templates/single-page-templates/
|
||||
|
|
|
@ -16,7 +16,7 @@ Hugo uses a set of factors to identify a page's related content based on front m
|
|||
|
||||
## List related content
|
||||
|
||||
To list up to 5 related pages (which share the same _date_ or _keyword_ parameters) is as simple as including something similar to this partial in your single page template:
|
||||
To list up to 5 related pages (which share the same _date_ or _keyword_ parameters) is as simple as including something similar to this partial in your template:
|
||||
|
||||
{{< code file=layouts/partials/related.html >}}
|
||||
{{ $related := .Site.RegularPages.Related . | first 5 }}
|
||||
|
|
|
@ -90,13 +90,13 @@ Hugo has a defined [lookup order] to determine which template to use when render
|
|||
|
||||
With the file structure from the [example above](#overview):
|
||||
|
||||
Content directory|List page template
|
||||
Content directory|Section template
|
||||
:--|:--
|
||||
content/products|layouts/products/list.html
|
||||
content/products/product-1|layouts/products/list.html
|
||||
content/products/product-1/benefits|layouts/products/list.html
|
||||
|
||||
Content directory|Single page template
|
||||
Content directory|Single template
|
||||
:--|:--
|
||||
content/products|layouts/products/single.html
|
||||
content/products/product-1|layouts/products/single.html
|
||||
|
@ -159,6 +159,6 @@ Home » Products » Product 1 » Benefits » Benefit 1
|
|||
[archetype]: /content-management/archetypes/
|
||||
[content type]: /content-management/types/
|
||||
[directory structure]: /getting-started/directory-structure/
|
||||
[section templates]: /templates/section-templates/
|
||||
[section templates]: /templates/types/#section
|
||||
[leaf bundles]: /content-management/page-bundles/#leaf-bundles
|
||||
[branch bundles]: /content-management/page-bundles/#branch-bundles
|
||||
|
|
|
@ -469,9 +469,9 @@ To learn how to configure your Hugo site to meet the new EU privacy regulation,
|
|||
To learn more about creating custom shortcodes, see the [shortcode template documentation].
|
||||
|
||||
[privacy protections]: /about/privacy/
|
||||
[partials]: /templates/partials/
|
||||
[partials]: /templates/partial/
|
||||
[quickstart]: /getting-started/quick-start/
|
||||
[sctemps]: /templates/shortcode-templates/
|
||||
[shortcode template documentation]: /templates/shortcode-templates/
|
||||
[sctemps]: /templates/shortcode/
|
||||
[shortcode template documentation]: /templates/shortcode/
|
||||
[Vimeo]: https://vimeo.com/
|
||||
[YouTube Videos]: https://www.youtube.com/
|
||||
|
|
|
@ -41,7 +41,7 @@ Options:
|
|||
* `linenostart=199`: starts the line number count from 199.
|
||||
* `anchorlinenos`: Configure anchors on line numbers. Valid values are `true` or `false`;
|
||||
* `lineanchors`: Configure a prefix for the anchors on line numbers. Will be suffixed with `-`, so linking to the line number 1 with the option `lineanchors=prefix` adds the anchor `prefix-1` to the page.
|
||||
* `hl_inline` Highlight inside a `<code>` (inline HTML element) tag. Valid values are `true` or `false`. The `code` tag will get a class with name `code-inline`. {{< new-in 0.101.0 >}}
|
||||
* `hl_inline` Highlight inside a `<code>` (inline HTML element) tag. Valid values are `true` or `false`. The `code` tag will get a class with name `code-inline`.
|
||||
|
||||
### Example: highlight shortcode
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ disableKinds = ["taxonomy","term"]
|
|||
|
||||
When taxonomies are used---and [taxonomy templates] are provided---Hugo will automatically create both a page listing all the taxonomy's terms and individual pages with lists of content associated with each term. For example, a `categories` taxonomy declared in your configuration and used in your content front matter will create the following pages:
|
||||
|
||||
* A single page at `example.com/categories/` that lists all the [terms within the taxonomy]
|
||||
* A single page at `example.com/categories/` that lists all the terms within the taxonomy
|
||||
* [Individual taxonomy list pages][taxonomy templates] (e.g., `/categories/development/`) for each of the terms that shows a listing of all pages marked as part of that taxonomy within any content file's [front matter]
|
||||
|
||||
## Configure taxonomies
|
||||
|
@ -142,7 +142,7 @@ categories = ['Category A','Category B']
|
|||
|
||||
## Order taxonomies
|
||||
|
||||
A content file can assign weight for each of its associate taxonomies. Taxonomic weight can be used for sorting or ordering content in [taxonomy list templates] and is declared in a content file's [front matter]. The convention for declaring taxonomic weight is `taxonomyname_weight`.
|
||||
A content file can assign weight for each of its associate taxonomies. Taxonomic weight can be used for sorting or ordering content in [taxonomy templates] and is declared in a content file's [front matter]. The convention for declaring taxonomic weight is `taxonomyname_weight`.
|
||||
|
||||
The following show a piece of content that has a weight of 22, which can be used for ordering purposes when rendering the pages assigned to the "a", "b" and "c" values of the `tags` taxonomy. It has also been assigned the weight of 44 when rendering the "d" category page.
|
||||
|
||||
|
@ -171,7 +171,5 @@ wikipedia: "https://en.wikipedia.org/wiki/Bruce_Willis"
|
|||
[content type]: /content-management/types/
|
||||
[documentation on archetypes]: /content-management/archetypes/
|
||||
[front matter]: /content-management/front-matter/
|
||||
[taxonomy list templates]: /templates/taxonomy-templates/#taxonomy-templates
|
||||
[taxonomy templates]: /templates/taxonomy-templates/
|
||||
[terms within the taxonomy]: /templates/taxonomy-templates/#term-templates
|
||||
[taxonomy templates]: /templates/types/#taxonomy
|
||||
[site configuration]: /getting-started/configuration/
|
||||
|
|
|
@ -16,5 +16,5 @@ A **content type** is a way to organize your content. Hugo resolves the content
|
|||
|
||||
A content type is used to
|
||||
|
||||
- Determine how the content is rendered. See [Template Lookup Order](/templates/lookup-order/) and [Content Views](/templates/views) for more.
|
||||
- Determine how the content is rendered. See [Template Lookup Order](/templates/lookup-order/) and [Content Views](/templates/content-view) for more.
|
||||
- Determine which [archetype](/content-management/archetypes/) template to use for new content.
|
||||
|
|
|
@ -85,6 +85,19 @@ multilingual|`about`|`https://example.org/de/about/`
|
|||
|
||||
If you set both `slug` and `url` in front matter, the `url` value takes precedence.
|
||||
|
||||
#### Permalinks tokens in front matter
|
||||
|
||||
{{< new-in "0.131.0" >}}
|
||||
|
||||
You can also use [Permalinks tokens](#tokens) in the `url` front matter. This is typically used in `cascade` sections:
|
||||
|
||||
{{< code-toggle file=content/foo/bar/_index.md fm=true >}}
|
||||
title ="Bar"
|
||||
[[cascade]]
|
||||
url = "/:sections[last]/:slug"
|
||||
{{< /code-toggle >}}
|
||||
|
||||
|
||||
## Site configuration
|
||||
|
||||
### Permalinks
|
||||
|
@ -233,7 +246,9 @@ public/
|
|||
|
||||
#### Tokens
|
||||
|
||||
Use these tokens when defining the URL pattern.
|
||||
Use these tokens when defining the URL pattern. These can both be used in the `permalinks` configuration and in the front matter [url](#permalinks-tokens-in-front-matter).
|
||||
|
||||
`:filename`
|
||||
|
||||
`:year`
|
||||
: The 4-digit year as defined in the front matter `date` field.
|
||||
|
|
|
@ -158,7 +158,7 @@ CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@latest
|
|||
To build and install a specific release:
|
||||
|
||||
```sh
|
||||
CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@v0.126.0
|
||||
CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@v0.128.0
|
||||
```
|
||||
|
||||
To build and install at the latest commit on the master branch:
|
||||
|
|
|
@ -44,6 +44,8 @@ Although we do not strictly adhere to the [Microsoft Writing Style Guide], it is
|
|||
Please link to the [glossary of terms] when necessary, and use the terms consistently throughout the documentation. Of special note:
|
||||
|
||||
- The term "front matter" is two words unless you are referring to the configuration key
|
||||
- The term "home page" is two words
|
||||
- The term "website" is one word
|
||||
- The term "standalone" is one word, not hyphenated
|
||||
- Use the word "map" instead of "dictionary"
|
||||
- Use the word "flag" instead of "option" when referring to a command line flag
|
||||
|
|
|
@ -35,7 +35,7 @@ The template above is rendered to:
|
|||
|
||||
## Example of `after` with `first`: 2nd–4th most recent articles
|
||||
|
||||
You can use `after` in combination with the [`first`] function and Hugo's [powerful sorting methods][lists]. Let's assume you have a list page at `example.com/articles`. You have 10 articles, but you want your templating for the [list/section page] to show only two rows:
|
||||
You can use `after` in combination with the [`first`] function and Hugo's [powerful sorting methods](/quick-reference/page-collections/#sort). Let's assume you have a `section` page at `example.com/articles`. You have 10 articles, but you want your template to show only two rows:
|
||||
|
||||
1. The top row is titled "Featured" and shows only the most recently published article (i.e. by `publishdate` in the content files' front matter).
|
||||
2. The second row is titled "Recent Articles" and shows only the 2nd- to 4th-most recently published articles.
|
||||
|
@ -66,6 +66,4 @@ You can use `after` in combination with the [`first`] function and Hugo's [power
|
|||
{{< /code >}}
|
||||
|
||||
[`first`]: /functions/collections/first/
|
||||
[list/section page]: /templates/section-templates/
|
||||
[lists]: /templates/lists/#sort-content
|
||||
[`slice`]: /functions/collections/slice/
|
||||
|
|
|
@ -28,4 +28,4 @@ aliases: [/functions/group]
|
|||
{{ end }}
|
||||
```
|
||||
|
||||
The page group you get from `group` is of the same type you get from the built-in [group methods](/templates/lists#group-content) in Hugo. The above example can be [paginated](/templates/pagination/#list-paginator-pages).
|
||||
The page group you get from `group` is of the same type you get from the built-in [group methods](/quick-reference/page-collections/#group) in Hugo. The example above can be [paginated](/templates/pagination/).
|
||||
|
|
|
@ -25,6 +25,3 @@ A useful example is to use it as `AND` filters when combined with where:
|
|||
The above fetches regular pages not of `page` or `about` type unless they are pinned. And finally, we exclude all pages with no `images` set in Page parameters.
|
||||
|
||||
See [union](/functions/collections/union) for `OR`.
|
||||
|
||||
[partials]: /templates/partials/
|
||||
[single]: /templates/single-page-templates/
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
---
|
||||
title: crypto.FNV32a
|
||||
description: Returns the FNV (Fowler–Noll–Vo) 32-bit hash of a given string.
|
||||
description: Returns the 32-bit FNV (Fowler–Noll–Vo) non-cryptographic hash of the given string.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: []
|
||||
related:
|
||||
- functions/hash/Xxhash
|
||||
- functions/crypto/HMAC
|
||||
- functions/crypto/MD5
|
||||
- functions/crypto/SHA1
|
||||
- functions/crypto/SHA256
|
||||
returnType: int
|
||||
signatures: [crypto.FNV32a STRING]
|
||||
aliases: [/functions/crypto.fnv32a]
|
||||
expiryDate: 2025-07-31 # deprecated 2024-07-31
|
||||
---
|
||||
|
||||
{{< new-in 0.98.0 >}}
|
||||
{{% deprecated-in 0.129.0 %}}
|
||||
Use [`hash.FNV32a`] instead.
|
||||
|
||||
This function calculates the 32-bit [FNV1a hash](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1a_hash) of a given string according to the [specification](https://datatracker.ietf.org/doc/html/draft-eastlake-fnv-12):
|
||||
[`hash.FNV32a`]: /functions/hash/FNV32a/
|
||||
{{% /deprecated-in %}}
|
||||
|
||||
```go-html-template
|
||||
{{ crypto.FNV32a "Hello world" }} → 1498229191
|
||||
|
|
129
docs/content/en/functions/css/PostCSS.md
Normal file
129
docs/content/en/functions/css/PostCSS.md
Normal file
|
@ -0,0 +1,129 @@
|
|||
---
|
||||
title: css.PostCSS
|
||||
description: Processes the given resource with PostCSS using any PostCSS plugin.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [postCSS]
|
||||
related:
|
||||
- functions/css/Sass
|
||||
- functions/css/TailwindCSS
|
||||
returnType: resource.Resource
|
||||
signatures: ['css.PostCSS [OPTIONS] RESOURCE']
|
||||
toc: true
|
||||
---
|
||||
|
||||
{{< new-in 0.128.0 >}}
|
||||
|
||||
```go-html-template
|
||||
{{ with resources.Get "css/main.css" | postCSS }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
## Setup
|
||||
|
||||
Follow the steps below to transform CSS using any of the available [PostCSS plugins].
|
||||
|
||||
Step 1
|
||||
: Install [Node.js].
|
||||
|
||||
Step 2
|
||||
: Install the required Node.js packages in the root of your project. For example, to add vendor prefixes to your CSS rules:
|
||||
|
||||
```sh
|
||||
npm i -D postcss postcss-cli autoprefixer
|
||||
```
|
||||
|
||||
Step 3
|
||||
: Create a PostCSS configuration file in the root of your project. You must name this file `postcss.config.js` or another [supported file name]. For example:
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
plugins: [
|
||||
require('autoprefixer')
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
{{% include "functions/resources/_common/postcss-windows-warning.md" %}}
|
||||
{{% /note %}}
|
||||
|
||||
Step 4
|
||||
: Place your CSS file within the `assets/css` directory.
|
||||
|
||||
Step 5
|
||||
: Process the resource with PostCSS:
|
||||
|
||||
```go-html-template
|
||||
{{ with resources.Get "css/main.css" | postCSS }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
The `css.PostCSS` method takes an optional map of options.
|
||||
|
||||
config
|
||||
: (`string`) The directory that contains the PostCSS configuration file. Default is the root of the project directory.
|
||||
|
||||
noMap
|
||||
: (`bool`) Default is `false`. If `true`, disables inline sourcemaps.
|
||||
|
||||
inlineImports
|
||||
: (`bool`) Default is `false`. Enable inlining of @import statements. It does so recursively, but will only import a file once. URL imports (e.g. `@import url('https://fonts.googleapis.com/css?family=Open+Sans&display=swap');`) and imports with media queries will be ignored. Note that this import routine does not care about the CSS spec, so you can have @import anywhere in the file. Hugo will look for imports relative to the module mount and will respect theme overrides.
|
||||
|
||||
skipInlineImportsNotFound
|
||||
: (`bool`) Default is `false`. Before Hugo 0.99.0 when `inlineImports` was enabled and we failed to resolve an import, we logged it as a warning. We now fail the build. If you have regular CSS imports in your CSS that you want to preserve, you can either use imports with URL or media queries (Hugo does not try to resolve those) or set `skipInlineImportsNotFound` to true.
|
||||
|
||||
```go-html-template
|
||||
{{ $opts := dict "config" "config-directory" "noMap" true }}
|
||||
{{ with resources.Get "css/main.css" | postCSS $opts }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
## No configuration file
|
||||
|
||||
To avoid using a PostCSS configuration file, you can specify a minimal configuration using the options map.
|
||||
|
||||
use
|
||||
: (`string`) A space-delimited list of PostCSS plugins to use.
|
||||
|
||||
parser
|
||||
: (`string`) A custom PostCSS parser.
|
||||
|
||||
stringifier
|
||||
: (`string`) A custom PostCSS stringifier.
|
||||
|
||||
syntax
|
||||
: (`string`) Custom postcss syntax.
|
||||
|
||||
```go-html-template
|
||||
{{ $opts := dict "use" "autoprefixer postcss-color-alpha" }}
|
||||
{{ with resources.Get "css/main.css" | postCSS $opts }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
## Check environment
|
||||
|
||||
The current Hugo environment name (set by `--environment` or in configuration or OS environment) is available in the Node context, which allows constructs like this:
|
||||
|
||||
```js
|
||||
const autoprefixer = require('autoprefixer');
|
||||
const purgecss = require('@fullhuman/postcss-purgecss');
|
||||
module.exports = {
|
||||
plugins: [
|
||||
autoprefixer,
|
||||
process.env.HUGO_ENVIRONMENT !== 'development' ? purgecss : null
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
[node.js]: https://nodejs.org/en/download
|
||||
[postcss plugins]: https://www.postcss.parts/
|
||||
[supported file name]: https://github.com/postcss/postcss-load-config#usage
|
||||
[transpile to CSS]: /functions/css/sass/
|
226
docs/content/en/functions/css/Sass.md
Normal file
226
docs/content/en/functions/css/Sass.md
Normal file
|
@ -0,0 +1,226 @@
|
|||
---
|
||||
title: css.Sass
|
||||
description: Transpiles Sass to CSS.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [toCSS]
|
||||
related:
|
||||
- functions/resources/Fingerprint
|
||||
- functions/resources/Minify
|
||||
- functions/css/PostCSS
|
||||
- functions/resources/PostProcess
|
||||
returnType: resource.Resource
|
||||
signatures: ['css.Sass [OPTIONS] RESOURCE']
|
||||
toc: true
|
||||
---
|
||||
|
||||
{{< new-in 0.128.0 >}}
|
||||
|
||||
```go-html-template
|
||||
{{ with resources.Get "sass/main.scss" }}
|
||||
{{ $opts := dict "transpiler" "libsass" "targetPath" "css/style.css" }}
|
||||
{{ with . | toCSS $opts }}
|
||||
{{ if hugo.IsDevelopment }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
{{ else }}
|
||||
{{ with . | minify | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Transpile Sass to CSS using the LibSass transpiler included in Hugo's extended edition, or [install Dart Sass](#dart-sass) to use the latest features of the Sass language.
|
||||
|
||||
Sass has two forms of syntax: [SCSS] and [indented]. Hugo supports both.
|
||||
|
||||
[scss]: https://sass-lang.com/documentation/syntax#scss
|
||||
[indented]: https://sass-lang.com/documentation/syntax#the-indented-syntax
|
||||
|
||||
## Options
|
||||
|
||||
transpiler
|
||||
: (`string`) The transpiler to use, either `libsass` (default) or `dartsass`. Hugo's extended edition includes the LibSass transpiler. To use the Dart Sass transpiler, see the [installation instructions](#dart-sass) below.
|
||||
|
||||
targetPath
|
||||
: (`string`) If not set, the transformed resource's target path will be the original path of the asset file with its extension replaced by `.css`.
|
||||
|
||||
vars
|
||||
: (`map`) A map of key-value pairs that will be available in the `hugo:vars` namespace. Useful for [initializing Sass variables from Hugo templates](https://discourse.gohugo.io/t/42053/).
|
||||
|
||||
```scss
|
||||
// LibSass
|
||||
@import "hugo:vars";
|
||||
|
||||
// Dart Sass
|
||||
@use "hugo:vars" as v;
|
||||
```
|
||||
|
||||
outputStyle
|
||||
: (`string`) Output styles available to LibSass include `nested` (default), `expanded`, `compact`, and `compressed`. Output styles available to Dart Sass include `expanded` (default) and `compressed`.
|
||||
|
||||
precision
|
||||
: (`int`) Precision of floating point math. Not applicable to Dart Sass.
|
||||
|
||||
enableSourceMap
|
||||
: (`bool`) If `true`, generates a source map.
|
||||
|
||||
sourceMapIncludeSources
|
||||
: (`bool`) If `true`, embeds sources in the generated source map. Not applicable to LibSass.
|
||||
|
||||
includePaths
|
||||
: (`slice`) A slice of paths, relative to the project root, that the transpiler will use when resolving `@use` and `@import` statements.
|
||||
|
||||
```go-html-template
|
||||
{{ $opts := dict
|
||||
"transpiler" "dartsass"
|
||||
"targetPath" "css/style.css"
|
||||
"vars" site.Params.styles
|
||||
"enableSourceMap" (not hugo.IsProduction)
|
||||
"includePaths" (slice "node_modules/bootstrap/scss")
|
||||
}}
|
||||
{{ with resources.Get "sass/main.scss" | toCSS $opts | minify | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
## Dart Sass
|
||||
|
||||
The extended version of Hugo includes [LibSass] to transpile Sass to CSS. In 2020, the Sass team deprecated LibSass in favor of [Dart Sass].
|
||||
|
||||
Use the latest features of the Sass language by installing Dart Sass in your development and production environments.
|
||||
|
||||
### Installation overview
|
||||
|
||||
Dart Sass is compatible with Hugo v0.114.0 and later.
|
||||
|
||||
If you have been using Embedded Dart Sass[^1] with Hugo v0.113.0 and earlier, uninstall Embedded Dart Sass, then install Dart Sass. If you have installed both, Hugo will use Dart Sass.
|
||||
|
||||
If you install Hugo as a [Snap package] there is no need to install Dart Sass. The Hugo Snap package includes Dart Sass.
|
||||
|
||||
[^1]: In 2023, the Sass team deprecated Embedded Dart Sass in favor of Dart Sass.
|
||||
|
||||
### Installing in a development environment
|
||||
|
||||
When you install Dart Sass somewhere in your PATH, Hugo will find it.
|
||||
|
||||
OS|Package manager|Site|Installation
|
||||
:--|:--|:--|:--
|
||||
Linux|Homebrew|[brew.sh]|`brew install sass/sass/sass`
|
||||
Linux|Snap|[snapcraft.io]|`sudo snap install dart-sass`
|
||||
macOS|Homebrew|[brew.sh]|`brew install sass/sass/sass`
|
||||
Windows|Chocolatey|[chocolatey.org]|`choco install sass`
|
||||
Windows|Scoop|[scoop.sh]|`scoop install sass`
|
||||
|
||||
You may also install [prebuilt binaries] for Linux, macOS, and Windows.
|
||||
|
||||
Run `hugo env` to list the active transpilers.
|
||||
|
||||
### Installing in a production environment
|
||||
|
||||
For [CI/CD] deployments (e.g., GitHub Pages, GitLab Pages, Netlify, etc.) you must edit the workflow to install Dart Sass before Hugo builds the site[^2]. Some providers allow you to use one of the package managers above, or you can download and extract one of the prebuilt binaries.
|
||||
|
||||
[^2]: You do not have to do this if (a) you have not modified the assets cache location, and (b) you have not set `useResourceCacheWhen` to `never` in your [site configuration], and (c) you add and commit your resources directory to your repository.
|
||||
|
||||
#### GitHub Pages
|
||||
|
||||
To install Dart Sass for your builds on GitHub Pages, add this step to the GitHub Pages workflow file:
|
||||
|
||||
```yaml
|
||||
- name: Install Dart Sass
|
||||
run: sudo snap install dart-sass
|
||||
```
|
||||
|
||||
If you are using GitHub Pages for the first time with your repository, GitHub provides a [starter workflow] for Hugo that includes Dart Sass. This is the simplest way to get started.
|
||||
|
||||
#### GitLab Pages
|
||||
|
||||
To install Dart Sass for your builds on GitLab Pages, the `.gitlab-ci.yml` file should look something like this:
|
||||
|
||||
```yaml
|
||||
variables:
|
||||
HUGO_VERSION: 0.128.0
|
||||
DART_SASS_VERSION: 1.77.5
|
||||
GIT_DEPTH: 0
|
||||
GIT_STRATEGY: clone
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
TZ: America/Los_Angeles
|
||||
image:
|
||||
name: golang:1.20-buster
|
||||
pages:
|
||||
script:
|
||||
# Install Dart Sass
|
||||
- curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
|
||||
- tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
|
||||
- cp -r dart-sass/* /usr/local/bin
|
||||
- rm -rf dart-sass*
|
||||
# Install Hugo
|
||||
- curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
|
||||
- apt install -y ./hugo_extended_${HUGO_VERSION}_linux-amd64.deb
|
||||
- rm hugo_extended_${HUGO_VERSION}_linux-amd64.deb
|
||||
# Build
|
||||
- hugo --gc --minify
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
```
|
||||
|
||||
#### Netlify
|
||||
|
||||
To install Dart Sass for your builds on Netlify, the `netlify.toml` file should look something like this:
|
||||
|
||||
```toml
|
||||
[build.environment]
|
||||
HUGO_VERSION = "0.128.0"
|
||||
DART_SASS_VERSION = "1.77.5"
|
||||
TZ = "America/Los_Angeles"
|
||||
|
||||
[build]
|
||||
publish = "public"
|
||||
command = """\
|
||||
curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \
|
||||
tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \
|
||||
rm dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \
|
||||
export PATH=/opt/build/repo/dart-sass:$PATH && \
|
||||
hugo --gc --minify \
|
||||
"""
|
||||
```
|
||||
|
||||
### Example
|
||||
|
||||
To transpile with Dart Sass, set `transpiler` to `dartsass` in the options map passed to `css.Sass`. For example:
|
||||
|
||||
```go-html-template
|
||||
{{ with resources.Get "sass/main.scss" }}
|
||||
{{ $opts := dict "transpiler" "dartsass" "targetPath" "css/style.css" }}
|
||||
{{ with . | toCSS $opts }}
|
||||
{{ if hugo.IsDevelopment }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
{{ else }}
|
||||
{{ with . | minify | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
### Miscellaneous
|
||||
|
||||
If you build Hugo from source and run `mage test -v`, the test will fail if you install Dart Sass as a Snap package. This is due to the Snap package's strict confinement model.
|
||||
|
||||
[brew.sh]: https://brew.sh/
|
||||
[chocolatey.org]: https://community.chocolatey.org/packages/sass
|
||||
[ci/cd]: https://en.wikipedia.org/wiki/CI/CD
|
||||
[dart sass]: https://sass-lang.com/dart-sass
|
||||
[libsass]: https://sass-lang.com/libsass
|
||||
[prebuilt binaries]: https://github.com/sass/dart-sass/releases/latest
|
||||
[scoop.sh]: https://scoop.sh/#/apps?q=sass
|
||||
[site configuration]: /getting-started/configuration/#configure-build
|
||||
[snap package]: /installation/linux/#snap
|
||||
[snapcraft.io]: https://snapcraft.io/dart-sass
|
||||
[starter workflow]: https://github.com/actions/starter-workflows/blob/main/pages/hugo.yml
|
86
docs/content/en/functions/css/TailwindCSS.md
Normal file
86
docs/content/en/functions/css/TailwindCSS.md
Normal file
|
@ -0,0 +1,86 @@
|
|||
---
|
||||
title: css.TailwindCSS
|
||||
description: Processes the given resource with the Tailwind CSS CLI.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: []
|
||||
related:
|
||||
- functions/resources/Fingerprint
|
||||
- functions/resources/Minify
|
||||
- functions/css/PostCSS
|
||||
returnType: resource.Resource
|
||||
signatures: ['css.TailwindCSS [OPTIONS] RESOURCE']
|
||||
toc: true
|
||||
---
|
||||
|
||||
{{< new-in 0.128.0 >}}
|
||||
|
||||
<!-- TODO remove this admonition when feature is stable. -->
|
||||
|
||||
{{% note %}}
|
||||
This is an experimental feature pending the release of TailwindCSS v4.0.
|
||||
|
||||
The functionality, configuration requirements, and documentation are subject to change at any time and may be not compatible with prior releases.
|
||||
{{% /note %}}
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To use this function you must install the Tailwind CSS CLI v4.0 or later. You may install the CLI as an npm package or as a standalone executable. See the [Tailwind CSS documentation] for details.
|
||||
|
||||
[Tailwind CSS documentation]: https://tailwindcss.com/docs/installation
|
||||
|
||||
{{% note %}}
|
||||
Use npm to install the CLI prior to the v4.0 release of Tailwind CSS.
|
||||
|
||||
`npm install --save-dev tailwindcss@next @tailwindcss/cli@next`
|
||||
{{% /note %}}
|
||||
|
||||
## Options
|
||||
|
||||
minify
|
||||
: (`bool`) Whether to optimize and minify the output. Default is `false`.
|
||||
|
||||
optimize
|
||||
: (`bool`) Whether to optimize the output without minifying. Default is `false`.
|
||||
|
||||
inlineImports
|
||||
: (`bool`) Whether to enable inlining of `@import` statements. Inlining is performed recursively, but currently once only per file. It is not possible to import the same file in different scopes (root, media query, etc.). Note that this import routine does not care about the CSS specification, so you can have `@import` statements anywhere in the file. Default is `false`.
|
||||
|
||||
skipInlineImportsNotFound
|
||||
: (`bool`) When `inlineImports` is enabled, we fail the build if an import cannot be resolved. Enable this option to allow the build to continue and leave the import statement in place. Note that the inline importer does not process URL location or imports with media queries, so those will be left as-is even without enabling this option. Default is `false`.
|
||||
|
||||
## Example
|
||||
|
||||
Define a [cache buster] in your site configuration:
|
||||
|
||||
[cache buster]: /getting-started/configuration/#configure-cache-busters
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[[build.cachebusters]]
|
||||
source = 'layouts/.*'
|
||||
target = 'css'
|
||||
{{< /code-toggle >}}
|
||||
|
||||
Process the resource:
|
||||
|
||||
```go-html-template
|
||||
{{ with resources.Get "css/main.css" }}
|
||||
{{ $opts := dict "minify" true }}
|
||||
{{ with . | css.TailwindCSS $opts }}
|
||||
{{ if hugo.IsDevelopment }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
{{ else }}
|
||||
{{ with . | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
The example above publishes the minified CSS file to public/css/main.css.
|
||||
|
||||
See [this repository] for more information about the integration with Tailwind CSS v4.0.
|
||||
|
||||
[this repository]: https://github.com/bep/hugo-testing-tailwindcss-v4
|
12
docs/content/en/functions/css/_index.md
Normal file
12
docs/content/en/functions/css/_index.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
title: CSS functions
|
||||
linkTitle: css
|
||||
description: Template functions to work with CSS and Sass files.
|
||||
categories: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: functions
|
||||
---
|
||||
|
||||
Use these functions to work with CSS and Sass files.
|
|
@ -13,6 +13,7 @@ action:
|
|||
returnType: '[][]string'
|
||||
signatures: ['data.GetCSV SEPARATOR INPUT... [OPTIONS]']
|
||||
toc: true
|
||||
expiryDate: 2025-02-19 # deprecated 2024-02-19
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.123.0 %}}
|
||||
|
|
|
@ -13,6 +13,7 @@ action:
|
|||
returnType: any
|
||||
signatures: ['data.GetJSON INPUT... [OPTIONS]']
|
||||
toc: true
|
||||
expiryDate: 2025-02-19 # deprecated 2024-02-19
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.123.0 %}}
|
||||
|
|
|
@ -58,7 +58,7 @@ content/
|
|||
└── _index.md <-- title is "My Home Page"
|
||||
```
|
||||
|
||||
And this code in the home page template:
|
||||
And this code in the home template:
|
||||
|
||||
```go-html-template
|
||||
{{ range site.Sections }}
|
||||
|
@ -76,7 +76,7 @@ My Home Page
|
|||
My Home Page
|
||||
```
|
||||
|
||||
In the example above, the global `page` function accesses the `Page` object passed into the home page template; it does not access the `Page` object of the iterated pages.
|
||||
In the example above, the global `page` function accesses the `Page` object passed into the home template; it does not access the `Page` object of the iterated pages.
|
||||
|
||||
### Be aware of caching
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ Hugo renders:
|
|||
|
||||
See additional examples in the [partial templates] section.
|
||||
|
||||
[partial templates]: /templates/partials/#returning-a-value-from-a-partial
|
||||
[partial templates]: /templates/partial/#returning-a-value-from-a-partial
|
||||
|
||||
## Usage
|
||||
|
||||
|
|
|
@ -45,5 +45,5 @@ The example above can be rewritten using an [inline partial] template:
|
|||
{{% include "functions/go-template/_common/text-template.md" %}}
|
||||
|
||||
[`partial`]: /functions/partials/include/
|
||||
[inline partial]: /templates/partials/#inline-partials
|
||||
[inline partial]: /templates/partial/#inline-partials
|
||||
[embedded templates]: /templates/embedded/
|
||||
|
|
21
docs/content/en/functions/hash/FNV32a.md
Normal file
21
docs/content/en/functions/hash/FNV32a.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
title: hash.FNV32a
|
||||
description: Returns the 32-bit FNV (Fowler–Noll–Vo) non-cryptographic hash of the given string.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: []
|
||||
related:
|
||||
- functions/hash/Xxhash
|
||||
- functions/crypto/HMAC
|
||||
- functions/crypto/MD5
|
||||
- functions/crypto/SHA1
|
||||
- functions/crypto/SHA256
|
||||
returnType: int
|
||||
signatures: [hash.FNV32a STRING]
|
||||
aliases: [/functions/crypto.fnv32a]
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
{{ hash.FNV32a "Hello world" }} → 1498229191
|
||||
```
|
20
docs/content/en/functions/hash/XxHash.md
Normal file
20
docs/content/en/functions/hash/XxHash.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
title: hash.XxHash
|
||||
description: Returns the 64-bit xxHash non-cryptographic hash of the given string.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [xxhash]
|
||||
related:
|
||||
- functions/hash/FNV32a
|
||||
- functions/crypto/HMAC
|
||||
- functions/crypto/MD5
|
||||
- functions/crypto/SHA1
|
||||
- functions/crypto/SHA256
|
||||
returnType: string
|
||||
signatures: [hash.XxHash STRING]
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
{{ hash.XxHash "Hello world" }} → c500b0c912b376d8
|
||||
```
|
12
docs/content/en/functions/hash/_index.md
Normal file
12
docs/content/en/functions/hash/_index.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
title: Hash functions
|
||||
linkTitle: hash
|
||||
description: Template functions to create non-cryptographic hashes.
|
||||
categories: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: functions
|
||||
---
|
||||
|
||||
Use these functions to create non-cryptographic hashes.
|
|
@ -11,5 +11,5 @@ action:
|
|||
---
|
||||
|
||||
```go-html-template
|
||||
{{ hugo.Generator }} → <meta name="generator" content="Hugo 0.126.0">
|
||||
{{ hugo.Generator }} → <meta name="generator" content="Hugo 0.128.0">
|
||||
```
|
||||
|
|
|
@ -10,8 +10,6 @@ action:
|
|||
signatures: [hugo.GoVersion]
|
||||
---
|
||||
|
||||
{{< new-in 0.101.0 >}}
|
||||
|
||||
```go-html-template
|
||||
{{ hugo.GoVersion }} → go1.21.1
|
||||
```
|
||||
|
|
|
@ -11,5 +11,5 @@ action:
|
|||
---
|
||||
|
||||
```go-html-template
|
||||
{{ hugo.Version }} → 0.126.0
|
||||
{{ hugo.Version }} → 0.128.0
|
||||
```
|
||||
|
|
90
docs/content/en/functions/js/Babel.md
Normal file
90
docs/content/en/functions/js/Babel.md
Normal file
|
@ -0,0 +1,90 @@
|
|||
---
|
||||
title: js.Babel
|
||||
description: Compiles the given JavaScript resource with Babel.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [babel]
|
||||
related:
|
||||
- functions/js/Build
|
||||
- functions/resources/Fingerprint
|
||||
- functions/resources/Minify
|
||||
returnType: resource.Resource
|
||||
signatures: ['js.Babel [OPTIONS] RESOURCE']
|
||||
toc: true
|
||||
---
|
||||
|
||||
{{< new-in 0.128.0 >}}
|
||||
|
||||
```go-html-template
|
||||
{{ with resources.Get "js/main.js" }}
|
||||
{{ if hugo.IsDevelopment }}
|
||||
{{ with . | babel }}
|
||||
<script src="{{ .RelPermalink }}"></script>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ $opts := dict "minified" true }}
|
||||
{{ with . | babel $opts | fingerprint }}
|
||||
<script src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
## Setup
|
||||
|
||||
Step 1
|
||||
: Install [Node.js](https://nodejs.org/en/download)
|
||||
|
||||
Step 2
|
||||
: Install the required Node.js packages in the root of your project.
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/core @babel/cli
|
||||
```
|
||||
|
||||
Step 3
|
||||
: Add the babel executable to Hugo's `security.exec.allow` list in your site configuration:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[security.exec]
|
||||
allow = ['^(dart-)?sass(-embedded)?$', '^go$', '^npx$', '^postcss$', '^babel$']
|
||||
{{< /code-toggle >}}
|
||||
|
||||
## Configuration
|
||||
|
||||
We add the main project's `node_modules` to `NODE_PATH` when running Babel and similar tools. There are some known [issues](https://github.com/babel/babel/issues/5618) with Babel in this area, so if you have a `babel.config.js` living in a Hugo Module (and not in the project itself), we recommend using `require` to load the presets/plugins, e.g.:
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
require("@babel/preset-env"),
|
||||
{
|
||||
useBuiltIns: "entry",
|
||||
corejs: 3,
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
config
|
||||
: (`string`) Path to the Babel configuration file. Hugo will, by default, look for a `babel.config.js` in your project. More information on these configuration files can be found here: [babel configuration](https://babeljs.io/docs/en/configuration).
|
||||
|
||||
minified
|
||||
: (`bool`) Save as many bytes as possible when printing
|
||||
|
||||
noComments
|
||||
: (`bool`) Write comments to generated output (true by default)
|
||||
|
||||
compact
|
||||
: (`bool`) Do not include superfluous whitespace characters and line terminators. Defaults to `auto` if not set.
|
||||
|
||||
verbose
|
||||
: (`bool`) Log everything
|
||||
|
||||
sourceMap
|
||||
: (`string`) Output `inline` or `external` sourcemap from the babel compile. External sourcemaps will be written to the target with the output file name + ".map". Input sourcemaps can be read from js.Build and node modules and combined into the output sourcemaps.
|
|
@ -6,7 +6,7 @@ keywords: []
|
|||
action:
|
||||
aliases: []
|
||||
related:
|
||||
- functions/resources/Babel
|
||||
- functions/js/Babel
|
||||
- functions/resources/Fingerprint
|
||||
- functions/resources/Minify
|
||||
returnType: resource.Resource
|
||||
|
@ -88,8 +88,8 @@ module.exports = window.ReactDOM;
|
|||
With the above, these imports should work in both scenarios:
|
||||
|
||||
```js
|
||||
import * as React from 'react'
|
||||
import * as ReactDOM from 'react-dom';
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom/client';
|
||||
```
|
||||
|
||||
target
|
||||
|
|
|
@ -45,7 +45,7 @@ The "breadcrumbs" partial renders [breadcrumb navigation], and needs to receive
|
|||
The "footer" partial renders the site footer. In this contrived example, the footer does not need access to the current page, so we can omit context:
|
||||
|
||||
```go-html-template
|
||||
{{ partial "breadcrumbs.html" }}
|
||||
{{ partial "footer.html" }}
|
||||
```
|
||||
|
||||
You can pass anything in context: a page, a page collection, a scalar value, a slice, or a map. In this example we pass the current page and three scalar values:
|
||||
|
|
|
@ -17,8 +17,6 @@ action:
|
|||
aliases: [/functions/path.basename]
|
||||
---
|
||||
|
||||
{{< new-in 0.101.0 >}}
|
||||
|
||||
```go-html-template
|
||||
{{ path.BaseName "a/news.html" }} → news
|
||||
{{ path.BaseName "news.html" }} → news
|
||||
|
|
|
@ -4,7 +4,6 @@ description: Compiles the given JavaScript resource with Babel.
|
|||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [babel]
|
||||
related:
|
||||
- functions/js/Build
|
||||
- functions/resources/Fingerprint
|
||||
|
@ -12,8 +11,15 @@ action:
|
|||
returnType: resource.Resource
|
||||
signatures: ['resources.Babel [OPTIONS] RESOURCE']
|
||||
toc: true
|
||||
expiryDate: 2025-06-24 # deprecated 2024-06-24
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.128.0 %}}
|
||||
Use [js.Babel] instead.
|
||||
|
||||
[js.Babel]: /functions/js/babel/
|
||||
{{% /deprecated-in %}}
|
||||
|
||||
```go-html-template
|
||||
{{ with resources.Get "js/main.js" }}
|
||||
{{ if hugo.IsDevelopment }}
|
||||
|
|
|
@ -26,7 +26,7 @@ The [media type] is typically one of `image`, `text`, `audio`, `video`, or `appl
|
|||
{{% note %}}
|
||||
This function operates on global resources. A global resource is a file within the assets directory, or within any directory mounted to the assets directory.
|
||||
|
||||
For page resources, use the [`Resources.ByType`] method on the Page object.
|
||||
For page resources, use the [`Resources.ByType`] method on a `Page` object.
|
||||
|
||||
[`Resources.ByType`]: /methods/page/resources/
|
||||
{{% /note %}}
|
||||
|
|
|
@ -9,8 +9,6 @@ action:
|
|||
signatures: [resources.Copy TARGETPATH RESOURCE]
|
||||
---
|
||||
|
||||
{{< new-in 0.100.0 >}}
|
||||
|
||||
```go-html-template
|
||||
{{ with resources.Get "images/a.jpg" }}
|
||||
{{ with resources.Copy "img/new-image-name.jpg" . }}
|
||||
|
|
|
@ -6,12 +6,11 @@ keywords: []
|
|||
action:
|
||||
aliases: [fingerprint]
|
||||
related:
|
||||
- functions/js/Build
|
||||
- functions/resources/Babel
|
||||
- functions/resources/Minify
|
||||
- functions/resources/PostCSS
|
||||
- functions/resources/PostProcess
|
||||
- functions/resources/ToCSS
|
||||
- functions/css/Sass
|
||||
- functions/css/TailwindCSS
|
||||
- functions/js/Build
|
||||
- functions/js/Babel
|
||||
returnType: resource.Resource
|
||||
signatures: ['resources.Fingerprint [ALGORITHM] RESOURCE']
|
||||
---
|
||||
|
|
|
@ -24,7 +24,7 @@ Let's say you need to publish a file named "site.json" in the root of your publi
|
|||
```json
|
||||
{
|
||||
"build_date": "2024-02-19T12:27:05-08:00",
|
||||
"hugo_version": "0.126.0",
|
||||
"hugo_version": "0.128.0",
|
||||
"last_modified": "2024-02-19T12:01:42-08:00"
|
||||
}
|
||||
```
|
||||
|
|
|
@ -24,7 +24,7 @@ action:
|
|||
{{% note %}}
|
||||
This function operates on global resources. A global resource is a file within the assets directory, or within any directory mounted to the assets directory.
|
||||
|
||||
For page resources, use the [`Resources.Get`] method on the Page object.
|
||||
For page resources, use the [`Resources.Get`] method on a `Page` object.
|
||||
|
||||
[`Resources.Get`]: /methods/page/resources/
|
||||
{{% /note %}}
|
||||
|
|
|
@ -24,7 +24,7 @@ action:
|
|||
{{% note %}}
|
||||
This function operates on global resources. A global resource is a file within the assets directory, or within any directory mounted to the assets directory.
|
||||
|
||||
For page resources, use the [`Resources.GetMatch`] method on the Page object.
|
||||
For page resources, use the [`Resources.GetMatch`] method on a `Page` object.
|
||||
|
||||
[`Resources.GetMatch`]: /methods/page/resources/
|
||||
{{% /note %}}
|
||||
|
|
|
@ -24,7 +24,7 @@ action:
|
|||
{{% note %}}
|
||||
This function operates on global resources. A global resource is a file within the assets directory, or within any directory mounted to the assets directory.
|
||||
|
||||
For page resources, use the [`Resources.Match`] method on the Page object.
|
||||
For page resources, use the [`Resources.Match`] method on a `Page` object.
|
||||
|
||||
[`Resources.Match`]: /methods/page/resources/
|
||||
{{% /note %}}
|
||||
|
|
|
@ -6,11 +6,11 @@ keywords: []
|
|||
action:
|
||||
aliases: [minify]
|
||||
related:
|
||||
- functions/js/Build
|
||||
- functions/resources/Babel
|
||||
- functions/resources/Fingerprint
|
||||
- functions/resources/PostCSS
|
||||
- functions/resources/ToCSS
|
||||
- functions/css/Sass
|
||||
- functions/css/TailwindCSS
|
||||
- functions/js/Build
|
||||
- functions/js/Babel
|
||||
returnType: resource.Resource
|
||||
signatures: [resources.Minify RESOURCE]
|
||||
---
|
||||
|
|
|
@ -4,17 +4,23 @@ description: Processes the given resource with PostCSS using any PostCSS plugin.
|
|||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [postCSS]
|
||||
related:
|
||||
- functions/resources/Fingerprint
|
||||
- functions/resources/Minify
|
||||
- functions/resources/PostProcess
|
||||
- functions/resources/ToCSS
|
||||
- functions/css/Sass
|
||||
returnType: resource.Resource
|
||||
signatures: ['resources.PostCSS [OPTIONS] RESOURCE']
|
||||
toc: true
|
||||
expiryDate: 2025-06-24 # deprecated 2024-06-24
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.128.0 %}}
|
||||
Use [css.PostCSS] instead.
|
||||
|
||||
[css.PostCSS]: /functions/css/postcss/
|
||||
{{% /deprecated-in %}}
|
||||
|
||||
```go-html-template
|
||||
{{ with resources.Get "css/main.css" | postCSS }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
|
@ -126,4 +132,4 @@ module.exports = {
|
|||
[node.js]: https://nodejs.org/en/download
|
||||
[postcss plugins]: https://www.postcss.parts/
|
||||
[supported file name]: https://github.com/postcss/postcss-load-config#usage
|
||||
[transpile to CSS]: /functions/resources/tocss.md
|
||||
[transpile to CSS]: /functions/css/sass/
|
||||
|
|
|
@ -6,10 +6,8 @@ keywords: []
|
|||
action:
|
||||
aliases: []
|
||||
related:
|
||||
- functions/resources/Fingerprint
|
||||
- functions/resources/Minify
|
||||
- functions/resources/PostCSS
|
||||
- functions/resources/ToCSS
|
||||
- functions/css/PostCSS
|
||||
- functions/css/Sass
|
||||
returnType: postpub.PostPublishedResource
|
||||
signatures: [resources.PostProcess RESOURCE]
|
||||
toc: true
|
||||
|
@ -149,7 +147,7 @@ You cannot manipulate the values returned from the resource’s methods. For exa
|
|||
|
||||
```go-html-template
|
||||
{{ $css := resources.Get "css/main.css" }}
|
||||
{{ $css = $css | resources.PostCSS | minify | fingerprint | resources.PostProcess }}
|
||||
{{ $css = $css | css.PostCSS | minify | fingerprint | resources.PostProcess }}
|
||||
{{ $css.RelPermalink | strings.ToUpper }}
|
||||
```
|
||||
|
||||
|
|
|
@ -4,17 +4,23 @@ description: Transpiles Sass to CSS.
|
|||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [toCSS]
|
||||
related:
|
||||
- functions/resources/Fingerprint
|
||||
- functions/resources/Minify
|
||||
- functions/resources/PostCSS
|
||||
- functions/css/PostCSS
|
||||
- functions/resources/PostProcess
|
||||
returnType: resource.Resource
|
||||
signatures: ['resources.ToCSS [OPTIONS] RESOURCE']
|
||||
toc: true
|
||||
expiryDate: 2025-06-24 # deprecated 2024-06-24
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.128.0 %}}
|
||||
Use [css.Sass] instead.
|
||||
|
||||
[css.Sass]: /functions/css/sass/
|
||||
{{% /deprecated-in %}}
|
||||
|
||||
```go-html-template
|
||||
{{ with resources.Get "sass/main.scss" }}
|
||||
{{ $opts := dict "transpiler" "libsass" "targetPath" "css/style.css" }}
|
||||
|
@ -76,7 +82,7 @@ includePaths
|
|||
"transpiler" "dartsass"
|
||||
"targetPath" "css/style.css"
|
||||
"vars" site.Params.styles
|
||||
"enableSourceMap" (not hugo.IsProduction)
|
||||
"enableSourceMap" (not hugo.IsProduction)
|
||||
"includePaths" (slice "node_modules/bootstrap/scss")
|
||||
}}
|
||||
{{ with resources.Get "sass/main.scss" | toCSS $opts | minify | fingerprint }}
|
||||
|
@ -139,8 +145,8 @@ To install Dart Sass for your builds on GitLab Pages, the `.gitlab-ci.yml` file
|
|||
|
||||
```yaml
|
||||
variables:
|
||||
HUGO_VERSION: 0.126.0
|
||||
DART_SASS_VERSION: 1.77.1
|
||||
HUGO_VERSION: 0.128.0
|
||||
DART_SASS_VERSION: 1.77.5
|
||||
GIT_DEPTH: 0
|
||||
GIT_STRATEGY: clone
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
|
@ -173,8 +179,8 @@ To install Dart Sass for your builds on Netlify, the `netlify.toml` file should
|
|||
|
||||
```toml
|
||||
[build.environment]
|
||||
HUGO_VERSION = "0.126.0"
|
||||
DART_SASS_VERSION = "1.77.1"
|
||||
HUGO_VERSION = "0.128.0"
|
||||
DART_SASS_VERSION = "1.77.5"
|
||||
TZ = "America/Los_Angeles"
|
||||
|
||||
[build]
|
||||
|
|
|
@ -30,4 +30,4 @@ Use `strings.Diff` to compare two strings and render a highlighted diff:
|
|||
|
||||
Rendered:
|
||||
|
||||
![sreen capture](diff-screen-capture.png)
|
||||
![screen capture](diff-screen-capture.png)
|
||||
|
|
95
docs/content/en/functions/templates/Defer.md
Normal file
95
docs/content/en/functions/templates/Defer.md
Normal file
|
@ -0,0 +1,95 @@
|
|||
---
|
||||
title: templates.Defer
|
||||
description: Defer execution of a template until after all sites and output formats have been rendered.
|
||||
categories: []
|
||||
keywords: []
|
||||
toc: true
|
||||
action:
|
||||
aliases: []
|
||||
related: []
|
||||
returnType: string
|
||||
signatures: [templates.Defer OPTIONS]
|
||||
aliases: [/functions/templates.defer]
|
||||
---
|
||||
|
||||
{{< new-in "0.128.0" >}}
|
||||
|
||||
In some rare use cases, you may need to defer the execution of a template until after all sites and output formats have been rendered. One such example could be [TailwindCSS](/functions/css/tailwindcss/) using the output of [hugo_stats.json](/getting-started/configuration/#configure-build) to determine which classes and other HTML identifiers are being used in the final output:
|
||||
|
||||
```go-html-template
|
||||
{{ with (templates.Defer (dict "key" "global")) }}
|
||||
{{ $t := debug.Timer "tailwindcss" }}
|
||||
{{ with resources.Get "css/styles.css" }}
|
||||
{{ $opts := dict
|
||||
"inlineImports" true
|
||||
"optimize" hugo.IsProduction
|
||||
}}
|
||||
{{ with . | css.TailwindCSS $opts }}
|
||||
{{ if hugo.IsDevelopment }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" />
|
||||
{{ else }}
|
||||
{{ with . | minify | fingerprint }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ .RelPermalink }}"
|
||||
integrity="{{ .Data.Integrity }}"
|
||||
crossorigin="anonymous" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $t.Stop }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
This function only works in combination with the `with` keyword.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
{{% note %}}
|
||||
Variables defined on the outside are not visible on the inside and vice versa. To pass in data, use the `data` [option](#options).
|
||||
{{% /note %}}
|
||||
|
||||
For the above to work well when running the server (or `hugo -w`), you want to have a configuration similar to this:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[module]
|
||||
[[module.mounts]]
|
||||
source = "hugo_stats.json"
|
||||
target = "assets/notwatching/hugo_stats.json"
|
||||
disableWatch = true
|
||||
[build.buildStats]
|
||||
enable = true
|
||||
[[build.cachebusters]]
|
||||
source = "assets/notwatching/hugo_stats\\.json"
|
||||
target = "styles\\.css"
|
||||
[[build.cachebusters]]
|
||||
source = "(postcss|tailwind)\\.config\\.js"
|
||||
target = "css"
|
||||
{{< /code-toggle >}}
|
||||
|
||||
## Options
|
||||
|
||||
The `templates.Defer` function takes a single argument, a map with the following optional keys:
|
||||
|
||||
key (`string`)
|
||||
: The key to use for the deferred template. This will, combined with a hash of the template content, be used as a cache key. If this is not set, Hugo will execute the deferred template on every render. This is not what you want for shared resources like CSS and JavaScript.
|
||||
|
||||
data (`map`)
|
||||
: Optional map to pass as data to the deferred template. This will be available in the deferred template as `.` or `$`.
|
||||
|
||||
|
||||
```go-html-template
|
||||
Language Outside: {{ site.Language.Lang }}
|
||||
Page Outside: {{ .RelPermalink }}
|
||||
I18n Outside: {{ i18n "hello" }}
|
||||
{{ $data := (dict "page" . )}}
|
||||
{{ with (templates.Defer (dict "data" $data )) }}
|
||||
Language Inside: {{ site.Language.Lang }}
|
||||
Page Inside: {{ .page.RelPermalink }}
|
||||
I18n Inside: {{ i18n "hello" }}
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
The [Output Format](/templates/output-formats/), [Site](/methods/page/site/), and [language](/methods/site/language) will be the same, even if the execution is deferred. In the example above, this means that the `site.Language.Lang` and `.RelPermalink` will be the same on the inside and the outside of the deferred template.
|
|
@ -26,5 +26,5 @@ I :heart: Hugo!
|
|||
|
||||
[configuration]: /getting-started/configuration/
|
||||
[emoji shortcodes]: /quick-reference/emojis/
|
||||
[sc]: /templates/shortcode-templates/
|
||||
[sc]: /templates/shortcode/
|
||||
[scsource]: https://github.com/gohugoio/hugo/tree/master/docs/layouts/shortcodes
|
||||
|
|
|
@ -84,25 +84,45 @@ typographer|[Goldmark Extensions: Typographer]|:heavy_check_mark:
|
|||
[PHP Markdown Extra: Definition lists]: https://michelf.ca/projects/php-markdown/extra/#def-list
|
||||
[PHP Markdown Extra: Footnotes]: https://michelf.ca/projects/php-markdown/extra/#footnotes
|
||||
|
||||
#### Extras extension
|
||||
#### Extras
|
||||
|
||||
{{< new-in 0.126.0 >}}
|
||||
|
||||
Configure the extras extension to enable [inserted text], [mark text], [subscript], and [superscript] elements in Markdown.
|
||||
Enable [deleted text], [inserted text], [mark text], [subscript], and [superscript] elements in Markdown.
|
||||
|
||||
Element|Markdown|Rendered
|
||||
:--|:--|:--
|
||||
Inserted text|`++foo++`|`<ins>foo</ins>`
|
||||
Mark text|`==bar==`|`<mark>bar</mark>`
|
||||
Deleted text|`~~foo~~`|`<del>foo</del>`
|
||||
Inserted text|`++bar++`|`<ins>bar</ins>`
|
||||
Mark text|`==baz==`|`<mark>baz</mark>`
|
||||
Subscript|`H~2~O`|`H<sub>2</sub>O`
|
||||
Superscript|`1^st^`|`1<sup>st</sup>`
|
||||
|
||||
[deleted text]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/del
|
||||
[inserted text]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ins
|
||||
[mark text]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark
|
||||
[subscript]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub
|
||||
[superscript]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup
|
||||
|
||||
#### Passthrough extension
|
||||
To avoid a conflict when enabling the Hugo Goldmark Extras subscript extension, if you want to render subscript and strikethrough text concurrently you must:
|
||||
|
||||
1. Disable the Goldmark strikethrough extension
|
||||
2. Enable the Hugo Goldmark Extras delete extension
|
||||
|
||||
For example:
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[markup.goldmark.extensions]
|
||||
strikethrough = false
|
||||
|
||||
[markup.goldmark.extensions.extras.delete]
|
||||
enable = true
|
||||
|
||||
[markup.goldmark.extensions.extras.subscript]
|
||||
enable = true
|
||||
{{< /code-toggle >}}
|
||||
|
||||
#### Passthrough
|
||||
|
||||
{{< new-in 0.122.0 >}}
|
||||
|
||||
|
@ -110,7 +130,7 @@ Enable the passthrough extension to include mathematical equations and expressio
|
|||
|
||||
[mathematics in Markdown]: content-management/mathematics/
|
||||
|
||||
#### Typographer extension
|
||||
#### Typographer
|
||||
|
||||
The Typographer extension replaces certain character combinations with HTML entities as specified below:
|
||||
|
||||
|
|
|
@ -378,13 +378,9 @@ Module configuration see [module configuration](/hugo-modules/configuration/).
|
|||
|
||||
See [custom output formats].
|
||||
|
||||
###### paginate
|
||||
###### pagination
|
||||
|
||||
(`int`) Default number of elements per page in [pagination](/templates/pagination/). Default is `10`.
|
||||
|
||||
###### paginatePath
|
||||
|
||||
(`string`) The path element used during pagination (`https://example.org/page/2`). Default is `page`.
|
||||
See [configure pagination](/templates/pagination/#configuration).
|
||||
|
||||
###### permalinks
|
||||
|
||||
|
@ -442,7 +438,7 @@ See [Segments](#configure-segments).
|
|||
|
||||
###### sitemap
|
||||
|
||||
Default [sitemap configuration](/templates/sitemap-template/#configuration).
|
||||
Default [sitemap configuration](/templates/sitemap/#configuration).
|
||||
|
||||
###### summaryLength
|
||||
|
||||
|
@ -962,4 +958,3 @@ Some use cases for this feature:
|
|||
[kind]: /getting-started/glossary/#page-kind
|
||||
[output format]: /getting-started/glossary/#output-format
|
||||
[type]: /getting-started/glossary/#content-type
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ A classification of content inferred from the top-level directory name or the `t
|
|||
|
||||
###### content view
|
||||
|
||||
A template called with the `.Page.Render` method. See [details](/templates/views/).
|
||||
A template called with the `.Page.Render` method. See [details](/templates/content-view/).
|
||||
|
||||
###### context
|
||||
|
||||
|
@ -132,7 +132,6 @@ To determine the current environment within a template, use the [`hugo.Environme
|
|||
|
||||
A predefined key-value pair in front matter such as `date` or `title`. See also [parameter](#parameter).
|
||||
|
||||
|
||||
###### flag
|
||||
|
||||
An option passed to a command-line program, beginning with one or two hyphens. See [details](/commands/hugo/).
|
||||
|
@ -212,6 +211,10 @@ A directory that contains an index.md file and zero or more [resources](#resourc
|
|||
|
||||
Any [page kind](#page-kind) that receives a page [collection](#collection) in [context](#context). This includes the home page, [section pages](#section-page), [taxonomy pages](#taxonomy-page), and [term pages](#term-page).
|
||||
|
||||
###### list template
|
||||
|
||||
Any template that renders a [list page](#list-page). This includes [home](/templates/types/#home), [section](/templates/types/#section), [taxonomy](/templates/types/#taxonomy), and [term](/templates/types/#term) templates.
|
||||
|
||||
###### localization
|
||||
|
||||
Adaptation of a site to meet language and regional requirements. This includes translations, language-specific media, date and currency formats, etc. See [details](/content-management/multilingual/) and the [W3C definition](https://www.w3.org/International/questions/qa-i18n). Abbreviated l10n.
|
||||
|
@ -256,7 +259,7 @@ A data structure with or without associated [methods](#method).
|
|||
|
||||
###### ordered taxonomy
|
||||
|
||||
Created by invoking the [`Alphabetical`] or [`ByCount`] method on a [taxonomy object](#taxonomy-object), which is a [map](#map), an ordered taxonomy is a [slice](#slice), where each element is an object that contains the [term](#term) and a slice of its [weighted pages](#weighted-page).
|
||||
Created by invoking the [`Alphabetical`] or [`ByCount`] method on a [`Taxonomy`](#taxonomy-object) object, which is a [map](#map), an ordered taxonomy is a [slice](#slice), where each element is an object that contains the [term](#term) and a slice of its [weighted pages](#weighted-page).
|
||||
|
||||
[`Alphabetical`]: /methods/taxonomy/alphabetical/
|
||||
[`ByCount`]: /methods/taxonomy/bycount/
|
||||
|
@ -271,7 +274,7 @@ A directory that encapsulates both content and associated [resources](#resource)
|
|||
|
||||
###### page collection
|
||||
|
||||
A slice of page objects.
|
||||
A slice of `Page` objects.
|
||||
|
||||
###### page kind
|
||||
|
||||
|
@ -287,15 +290,19 @@ A file within a [page bundle](#page-bundle). Capture one or more page resources
|
|||
|
||||
###### pager
|
||||
|
||||
Created during [pagination](#pagination), a pager contains a subset of a section list, and navigation links to other pagers.
|
||||
Created during [pagination](#pagination), a pager contains a subset of a list page and navigation links to other pagers.
|
||||
|
||||
###### paginate
|
||||
|
||||
To split a [section](#section) list into two or more [pagers](#pager) See [details](/templates/pagination/).
|
||||
To split a list page into two or more subsets.
|
||||
|
||||
###### pagination
|
||||
|
||||
The process of [paginating](#paginate) a [section](#section) list.
|
||||
The process of [paginating](#paginate) a list page. See [details](/templates/pagination/).
|
||||
|
||||
###### paginator
|
||||
|
||||
A collection of [pagers](#pager).
|
||||
|
||||
###### parameter
|
||||
|
||||
|
@ -394,7 +401,7 @@ Raw string literals are character sequences between backticks, as in \`bar\`. Wi
|
|||
|
||||
###### taxonomic weight
|
||||
|
||||
Defined in front matter and unique to each taxonomy, this [weight](#weight) determines the sort order of page collections contained within a [taxonomy object](#taxonomy-object). See [details](/templates/taxonomy-templates/#assign-weight).
|
||||
Defined in front matter and unique to each taxonomy, this [weight](#weight) determines the sort order of page collections contained within a [`Taxonomy`](#taxonomy-object) object. See [details](/content-management/taxonomies/#order-taxonomies).
|
||||
|
||||
###### taxonomy
|
||||
|
||||
|
@ -454,7 +461,7 @@ Used to position an element within a collection sorted by weight. Assign weights
|
|||
|
||||
###### weighted page
|
||||
|
||||
Contained within a [taxonomy object](#taxonomy-object), a weighted page is a [map](#map) with two elements: a `Page` object, and its [taxonomic weight](#taxonomic-weight) as defined in front matter. Access the elements using the `Page` and `Weight` keys.
|
||||
Contained within a [`Taxonomy`](#taxonomy-object) object, a weighted page is a [map](#map) with two elements: a `Page` object, and its [taxonomic weight](#taxonomic-weight) as defined in front matter. Access the elements using the `Page` and `Weight` keys.
|
||||
|
||||
###### zero time
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ Add the following content. Replace the `USER`, `HOST`, and `DIR` values with you
|
|||
#!/bin/sh
|
||||
USER=my-user
|
||||
HOST=my-server.com
|
||||
DIR=my/directory/to/topologix.fr/ # the directory where your web site files should go
|
||||
DIR=my/directory/to/topologix.fr/ # the directory where your website files should go
|
||||
|
||||
hugo && rsync -avz --delete public/ ${USER}@${HOST}:~/${DIR} # this will delete everything on the server that's not in the local public folder
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ jobs:
|
|||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
HUGO_VERSION: 0.127.0
|
||||
HUGO_VERSION: 0.128.0
|
||||
steps:
|
||||
- name: Install Hugo CLI
|
||||
run: |
|
||||
|
@ -112,14 +112,13 @@ jobs:
|
|||
fetch-depth: 0
|
||||
- name: Setup Pages
|
||||
id: pages
|
||||
uses: actions/configure-pages@v4
|
||||
uses: actions/configure-pages@v5
|
||||
- name: Install Node.js dependencies
|
||||
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
|
||||
- name: Build with Hugo
|
||||
env:
|
||||
# For maximum backward compatibility with Hugo modules
|
||||
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
|
||||
HUGO_ENVIRONMENT: production
|
||||
HUGO_ENV: production
|
||||
TZ: America/Los_Angeles
|
||||
run: |
|
||||
hugo \
|
||||
|
|
|
@ -27,8 +27,8 @@ Define your [CI/CD](https://docs.gitlab.com/ee/ci/quick_start/) jobs by creating
|
|||
|
||||
{{< code file=.gitlab-ci.yml copy=true >}}
|
||||
variables:
|
||||
DART_SASS_VERSION: 1.77.1
|
||||
HUGO_VERSION: 0.126.0
|
||||
DART_SASS_VERSION: 1.77.5
|
||||
HUGO_VERSION: 0.128.0
|
||||
NODE_VERSION: 20.x
|
||||
GIT_DEPTH: 0
|
||||
GIT_STRATEGY: clone
|
||||
|
|
|
@ -101,7 +101,7 @@ Create a new file named netlify.toml in the root of your project directory. In i
|
|||
|
||||
{{< code file=netlify.toml >}}
|
||||
[build.environment]
|
||||
HUGO_VERSION = "0.126.0"
|
||||
HUGO_VERSION = "0.128.0"
|
||||
TZ = "America/Los_Angeles"
|
||||
|
||||
[build]
|
||||
|
@ -113,8 +113,8 @@ If your site requires Dart Sass to transpile Sass to CSS, the configuration file
|
|||
|
||||
{{< code file=netlify.toml >}}
|
||||
[build.environment]
|
||||
HUGO_VERSION = "0.126.0"
|
||||
DART_SASS_VERSION = "1.77.1"
|
||||
HUGO_VERSION = "0.128.0"
|
||||
DART_SASS_VERSION = "1.77.5"
|
||||
TZ = "America/Los_Angeles"
|
||||
|
||||
[build]
|
||||
|
|
|
@ -25,25 +25,25 @@ workspace = 'off'
|
|||
{{< /code-toggle >}}
|
||||
|
||||
noProxy
|
||||
: Comma separated glob list matching paths that should not use the proxy configured above.
|
||||
: (`string`) Comma separated glob list matching paths that should not use the proxy configured above.
|
||||
|
||||
noVendor
|
||||
: A optional Glob pattern matching module paths to skip when vendoring, e.g. "github.com/**"
|
||||
: (`string`) A optional Glob pattern matching module paths to skip when vendoring, e.g. "github.com/**"
|
||||
|
||||
private
|
||||
: Comma separated glob list matching paths that should be treated as private.
|
||||
: (`string`) Comma separated glob list matching paths that should be treated as private.
|
||||
|
||||
proxy
|
||||
: Defines the proxy server to use to download remote modules. Default is `direct`, which means "git clone" and similar.
|
||||
: (`string`) Defines the proxy server to use to download remote modules. Default is `direct`, which means "git clone" and similar.
|
||||
|
||||
vendorClosest
|
||||
: When enabled, we will pick the vendored module closest to the module using it. The default behavior is to pick the first. Note that there can still be only one dependency of a given module path, so once it is in use it cannot be redefined.
|
||||
: (`bool`) When enabled, we will pick the vendored module closest to the module using it. The default behavior is to pick the first. Note that there can still be only one dependency of a given module path, so once it is in use it cannot be redefined. Default is `false`.
|
||||
|
||||
workspace
|
||||
: The workspace file to use. This enables Go workspace mode. Note that this can also be set via OS env, e.g. `export HUGO_MODULE_WORKSPACE=/my/hugo.work` This only works with Go 1.18+. In Hugo `v0.109.0` we changed the default to `off` and we now resolve any relative work file names relative to the working directory.
|
||||
: (`string`) The workspace file to use. This enables Go workspace mode. Note that this can also be set via OS env, e.g. `export HUGO_MODULE_WORKSPACE=/my/hugo.work` This only works with Go 1.18+. In Hugo `v0.109.0` we changed the default to `off` and we now resolve any relative work file names relative to the working directory.
|
||||
|
||||
replacements
|
||||
: A comma-separated list of mappings from module paths to directories, e.g. `github.com/bep/my-theme -> ../..,github.com/bep/shortcodes -> /some/path`. This is mostly useful for temporary local development of a module, in which case you might want to save it as an environment variable, e.g: `env HUGO_MODULE_REPLACEMENTS="github.com/bep/my-theme -> ../.."`. Relative paths are relative to [themesDir](/getting-started/configuration/#all-configuration-settings). Absolute paths are allowed.
|
||||
: (`string`) A comma-separated list of mappings from module paths to directories, e.g. `github.com/bep/my-theme -> ../..,github.com/bep/shortcodes -> /some/path`. This is mostly useful for temporary local development of a module, in which case you might want to save it as an environment variable, e.g: `env HUGO_MODULE_REPLACEMENTS="github.com/bep/my-theme -> ../.."`. Relative paths are relative to [themesDir](/getting-started/configuration/#all-configuration-settings). Absolute paths are allowed.
|
||||
|
||||
Note that the above terms maps directly to their counterparts in Go Modules. Some of these setting may be natural to set as OS environment variables. To set the proxy server to use, as an example:
|
||||
|
||||
|
@ -69,13 +69,13 @@ If your module requires a particular version of Hugo to work, you can indicate t
|
|||
Any of the above can be omitted.
|
||||
|
||||
min
|
||||
: The minimum Hugo version supported, e.g. `0.55.0`
|
||||
: (`string`) The minimum Hugo version supported, e.g. `0.55.0`
|
||||
|
||||
max
|
||||
: The maximum Hugo version supported, e.g. `0.55.0`
|
||||
: (`string`) The maximum Hugo version supported, e.g. `0.55.0`
|
||||
|
||||
extended
|
||||
: Whether the extended version of Hugo is required.
|
||||
: (`bool`) Whether the extended version of Hugo is required.
|
||||
|
||||
## Module configuration: imports
|
||||
|
||||
|
@ -120,7 +120,8 @@ When the `mounts` configuration was introduced in Hugo 0.56.0, we were careful t
|
|||
When you add a mount, the default mount for the concerned target root is ignored: be sure to explicitly add it.
|
||||
{{% /note %}}
|
||||
|
||||
**Default mounts**
|
||||
### Default mounts
|
||||
|
||||
{{< code-toggle file=hugo >}}
|
||||
[module]
|
||||
[[module.mounts]]
|
||||
|
@ -147,25 +148,30 @@ When you add a mount, the default mount for the concerned target root is ignored
|
|||
{{< /code-toggle >}}
|
||||
|
||||
source
|
||||
: The source directory of the mount. For the main project, this can be either project-relative or absolute. For other modules it must be project-relative.
|
||||
: (`string`) The source directory of the mount. For the main project, this can be either project-relative or absolute. For other modules it must be project-relative.
|
||||
|
||||
target
|
||||
: Where it should be mounted into Hugo's virtual filesystem. It must start with one of Hugo's component folders: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, or `archetypes`. E.g. `content/blog`.
|
||||
: (`string`) Where it should be mounted into Hugo's virtual filesystem. It must start with one of Hugo's component folders: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, or `archetypes`. E.g. `content/blog`.
|
||||
|
||||
disableWatch
|
||||
{{< new-in 0.128.0 >}}
|
||||
: (`bool`) Whether to disable watching in watch mode for this mount. Default is `false`.
|
||||
|
||||
lang
|
||||
: The language code, e.g. "en". Only relevant for `content` mounts, and `static` mounts when in multihost mode.
|
||||
: (`string`) The language code, e.g. "en". Only relevant for `content` mounts, and `static` mounts when in multihost mode.
|
||||
|
||||
includeFiles (string or slice)
|
||||
: One or more [glob](https://github.com/gobwas/glob) patterns matching files or directories to include. If `excludeFiles` is not set, the files matching `includeFiles` will be the files mounted.
|
||||
includeFiles
|
||||
: (`string` or `string slice`) One or more [glob](https://github.com/gobwas/glob) patterns matching files or directories to include. If `excludeFiles` is not set, the files matching `includeFiles` will be the files mounted.
|
||||
|
||||
The glob patterns are matched to the file names starting from the `source` root, they should have Unix styled slashes even on Windows, `/` matches the mount root and `**` can be used as a super-asterisk to match recursively down all directories, e.g `/posts/**.jpg`.
|
||||
|
||||
The search is case-insensitive.
|
||||
|
||||
excludeFiles (string or slice)
|
||||
: One or more glob patterns matching files to exclude.
|
||||
excludeFiles
|
||||
: (`string` or `string slice`) One or more glob patterns matching files to exclude.
|
||||
|
||||
### Example
|
||||
|
||||
**Example**
|
||||
{{< code-toggle file=hugo >}}
|
||||
[module]
|
||||
[[module.mounts]]
|
||||
|
|
|
@ -11,12 +11,12 @@ weight: 70
|
|||
function:
|
||||
aliases: [babel]
|
||||
returnType: resource.Resource
|
||||
signatures: ['resources.Babel [OPTIONS] RESOURCE']
|
||||
signatures: ['js.Babel [OPTIONS] RESOURCE']
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
||||
Any JavaScript resource file can be transpiled to another JavaScript version using `resources.Babel` which takes for argument the resource object and an optional dict of options listed below. Babel uses the [babel cli](https://babeljs.io/docs/en/babel-cli).
|
||||
Any JavaScript resource file can be transpiled to another JavaScript version using `js.Babel` which takes for argument the resource object and an optional dict of options listed below. Babel uses the [babel cli](https://babeljs.io/docs/en/babel-cli).
|
||||
|
||||
{{% note %}}
|
||||
Hugo Pipe's Babel requires the `@babel/cli` and `@babel/core` JavaScript packages to be installed in the project or globally (`npm install -g @babel/cli @babel/core`) along with any Babel plugin(s) or preset(s) used (e.g., `npm install @babel/preset-env --save-dev`).
|
||||
|
|
|
@ -62,7 +62,7 @@ Hugo publishes assets to the `publishDir` (typically `public`) when you invoke `
|
|||
For improved readability, the Hugo Pipes examples of this documentation will be written using [Go Pipes](/templates/introduction/#pipes):
|
||||
|
||||
```go-html-template
|
||||
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }}
|
||||
{{ $style := resources.Get "sass/main.scss" | css.Sass | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $style.Permalink }}">
|
||||
```
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ toc: true
|
|||
action:
|
||||
aliases: [postCSS]
|
||||
returnType: resource.Resource
|
||||
signatures: ['resources.PostCSS [OPTIONS] RESOURCE']
|
||||
signatures: ['css.PostCSS [OPTIONS] RESOURCE']
|
||||
---
|
||||
|
||||
## Setup
|
||||
|
@ -50,7 +50,7 @@ Step 4
|
|||
: Place your CSS file within the `assets` directory.
|
||||
|
||||
Step 5
|
||||
: Capture the CSS file as a resource and pipe it through `resources.PostCSS` (alias `postCSS`):
|
||||
: Capture the CSS file as a resource and pipe it through `css.PostCSS` (alias `postCSS`):
|
||||
|
||||
{{< code file=layouts/partials/css.html >}}
|
||||
{{ with resources.Get "css/main.css" | postCSS }}
|
||||
|
@ -68,7 +68,7 @@ If starting with a Sass file within the `assets` directory:
|
|||
|
||||
## Options
|
||||
|
||||
The `resources.PostCSS` method takes an optional map of options.
|
||||
The `css.PostCSS` method takes an optional map of options.
|
||||
|
||||
config
|
||||
: (`string`) The directory that contains the PostCSS configuration file. Default is the root of the project directory.
|
||||
|
@ -82,8 +82,8 @@ URL imports (e.g. `@import url('https://fonts.googleapis.com/css?family=Open+San
|
|||
Note that this import routine does not care about the CSS spec, so you can have @import anywhere in the file.
|
||||
Hugo will look for imports relative to the module mount and will respect theme overrides.
|
||||
|
||||
skipInlineImportsNotFound {{< new-in 0.99.0 >}}
|
||||
: (`bool`) Default is `false`. Before Hugo 0.99.0 when `inlineImports` was enabled and we failed to resolve an import, we logged it as a warning. We now fail the build. If you have regular CSS imports in your CSS that you want to preserve, you can either use imports with URL or media queries (Hugo does not try to resolve those) or set `skipInlineImportsNotFound` to true.
|
||||
skipInlineImportsNotFound
|
||||
: (`bool`) Default is `false`. If you have regular CSS imports in your CSS that you want to preserve, you can either use imports with URL or media queries (Hugo does not try to resolve those) or set `skipInlineImportsNotFound` to true.
|
||||
|
||||
{{< code file=layouts/partials/css.html >}}
|
||||
{{ $opts := dict "config" "config-directory" "noMap" true }}
|
||||
|
|
|
@ -27,7 +27,7 @@ There are currently two limitations to this:
|
|||
|
||||
```go-html-template
|
||||
{{ $css := resources.Get "css/main.css" }}
|
||||
{{ $css = $css | resources.PostCSS | minify | fingerprint | resources.PostProcess }}
|
||||
{{ $css = $css | css.PostCSS | minify | fingerprint | resources.PostProcess }}
|
||||
{{ $css.RelPermalink | upper }}
|
||||
```
|
||||
|
||||
|
@ -70,7 +70,7 @@ Note that in the example above, the "CSS purge step" will only be applied to the
|
|||
|
||||
```go-html-template
|
||||
{{ $css := resources.Get "css/main.css" }}
|
||||
{{ $css = $css | resources.PostCSS }}
|
||||
{{ $css = $css | css.PostCSS }}
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $css = $css | minify | fingerprint | resources.PostProcess }}
|
||||
{{ end }}
|
||||
|
|
|
@ -34,5 +34,5 @@ body{
|
|||
|
||||
```go-html-template
|
||||
{{ $sassTemplate := resources.Get "sass/template.scss" }}
|
||||
{{ $style := $sassTemplate | resources.ExecuteAsTemplate "main.scss" . | resources.ToCSS }}
|
||||
{{ $style := $sassTemplate | resources.ExecuteAsTemplate "main.scss" . | css.Sass }}
|
||||
```
|
||||
|
|
|
@ -13,7 +13,7 @@ weight: 30
|
|||
action:
|
||||
aliases: [toCSS]
|
||||
returnType: resource.Resource
|
||||
signatures: ['resources.ToCSS [OPTIONS] RESOURCE']
|
||||
signatures: ['css.Sass [OPTIONS] RESOURCE']
|
||||
toc: true
|
||||
aliases: [/hugo-pipes/transform-to-css/]
|
||||
---
|
||||
|
@ -73,7 +73,7 @@ includePaths
|
|||
"transpiler" "dartsass"
|
||||
"targetPath" "css/style.css"
|
||||
"vars" site.Params.styles
|
||||
"enableSourceMap" (not hugo.IsProduction)
|
||||
"enableSourceMap" (not hugo.IsProduction)
|
||||
"includePaths" (slice "node_modules/bootstrap/scss")
|
||||
}}
|
||||
{{ with resources.Get "sass/main.scss" | toCSS $opts | minify | fingerprint }}
|
||||
|
@ -136,8 +136,8 @@ To install Dart Sass for your builds on GitLab Pages, the `.gitlab-ci.yml` file
|
|||
|
||||
```yaml
|
||||
variables:
|
||||
HUGO_VERSION: 0.126.0
|
||||
DART_SASS_VERSION: 1.77.1
|
||||
HUGO_VERSION: 0.128.0
|
||||
DART_SASS_VERSION: 1.77.5
|
||||
GIT_DEPTH: 0
|
||||
GIT_STRATEGY: clone
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
|
@ -170,8 +170,8 @@ To install Dart Sass for your builds on Netlify, the `netlify.toml` file should
|
|||
|
||||
```toml
|
||||
[build.environment]
|
||||
HUGO_VERSION = "0.122.2"
|
||||
DART_SASS_VERSION = "1.77.1"
|
||||
HUGO_VERSION = "0.128.0"
|
||||
DART_SASS_VERSION = "1.77.5"
|
||||
TZ = "America/Los_Angeles"
|
||||
|
||||
[build]
|
||||
|
@ -187,7 +187,7 @@ command = """\
|
|||
|
||||
### Example
|
||||
|
||||
To transpile with Dart Sass, set `transpiler` to `dartsass` in the options map passed to `resources.ToCSS`. For example:
|
||||
To transpile with Dart Sass, set `transpiler` to `dartsass` in the options map passed to `css.Sass`. For example:
|
||||
|
||||
```go-html-template
|
||||
{{ $opts := dict "transpiler" "dartsass" "targetPath" "css/style.css" }}
|
||||
|
|
|
@ -21,4 +21,4 @@ Use this method with the [`IsMenuCurrent`] and [`HasMenuCurrent`] methods on a `
|
|||
|
||||
[`HasMenuCurrent`]: /methods/page/hasmenucurrent/
|
||||
[`IsMenuCurrent`]: /methods/page/ismenucurrent/
|
||||
[this example]: /templates/menu-templates/#example
|
||||
[this example]: /templates/menu/#example
|
||||
|
|
|
@ -49,5 +49,5 @@ See the [menu templates] section for more information.
|
|||
[`LinkTitle`]: /methods/page/linktitle/
|
||||
[`RelPermalink`]: /methods/page/relpermalink/
|
||||
[define menu entries]: /content-management/menus/
|
||||
[menu templates]: /templates/menu-templates/#page-references
|
||||
[menu templates]: /templates/menu/#page-references
|
||||
[methods]: /methods/page/
|
||||
|
|
|
@ -57,6 +57,6 @@ Hugo renders:
|
|||
|
||||
See the [menu templates] section for more information.
|
||||
|
||||
[menu templates]: /templates/menu-templates/#menu-entry-parameters
|
||||
[menu templates]: /templates/menu/#menu-entry-parameters
|
||||
[in front matter]: /content-management/menus/#define-in-front-matter
|
||||
[in site configuration]: /content-management/menus/
|
||||
|
|
|
@ -65,14 +65,14 @@ Plural
|
|||
```
|
||||
|
||||
Terms
|
||||
: (`page.Taxonomy`) Returns the taxonomy object, consisting of a map of terms and the [weighted pages] associated with each term.
|
||||
: (`page.Taxonomy`) Returns the `Taxonomy` object, consisting of a map of terms and the [weighted pages] associated with each term.
|
||||
|
||||
```go-html-template
|
||||
{{ $taxonomyObject := .Data.Terms }}
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
Once you have captured the taxonomy object, use any of the [taxonomy methods] to sort, count, or capture a subset of its weighted pages.
|
||||
Once you have captured the `Taxonomy` object, use any of the [taxonomy methods] to sort, count, or capture a subset of its weighted pages.
|
||||
|
||||
[taxonomy methods]: /methods/taxonomy/
|
||||
{{% /note %}}
|
||||
|
@ -106,6 +106,6 @@ Term
|
|||
|
||||
Learn more about [term templates].
|
||||
|
||||
[taxonomy templates]: /templates/taxonomy-templates/
|
||||
[term templates]: /templates/taxonomy-templates/
|
||||
[taxonomy templates]: /templates/types/#taxonomy
|
||||
[term templates]: /templates/types/#term
|
||||
[weighted pages]: /getting-started/glossary/#weighted-page
|
||||
|
|
|
@ -9,7 +9,7 @@ action:
|
|||
signatures: [PAGE1.Eq PAGE2]
|
||||
---
|
||||
|
||||
In this contrived example from a single page template, we list all pages in the current section except for the current page.
|
||||
In this contrived example from a single template, we list all pages in the current section except for the current page.
|
||||
|
||||
```go-html-template
|
||||
{{ $currentPage := . }}
|
||||
|
|
|
@ -36,9 +36,9 @@ content/
|
|||
└── _index.md
|
||||
```
|
||||
|
||||
The examples below depict the result of rendering works/paintings/the-mona-lisa.md with a single page template:
|
||||
The examples below depict the result of rendering works/paintings/the-mona-lisa.md:
|
||||
|
||||
```go-html-template
|
||||
{{< code file=layouts/works/single.html >}}
|
||||
{{ with .GetPage "starry-night" }}
|
||||
{{ .Title }} → Starry Night
|
||||
{{ end }}
|
||||
|
@ -62,4 +62,4 @@ The examples below depict the result of rendering works/paintings/the-mona-lisa.
|
|||
{{ with .GetPage "/works/sculptures/david" }}
|
||||
{{ .Title }} → David
|
||||
{{ end }}
|
||||
```
|
||||
{{< /code >}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: HasMenuCurrent
|
||||
description: Reports whether the given page object matches the page object associated with one of the child menu entries under the given menu entry in the given menu.
|
||||
description: Reports whether the given Page object matches the Page object associated with one of the child menu entries under the given menu entry in the given menu.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
|
@ -11,7 +11,7 @@ action:
|
|||
aliases: [/functions/hasmenucurrent]
|
||||
---
|
||||
|
||||
If the page object associated with the menu entry is a section, this method also returns `true` for any descendant of that section.
|
||||
If the `Page` object associated with the menu entry is a section, this method also returns `true` for any descendant of that section.
|
||||
|
||||
```go-html-template
|
||||
{{ $currentPage := . }}
|
||||
|
@ -28,4 +28,4 @@ If the page object associated with the menu entry is a section, this method also
|
|||
|
||||
See [menu templates] for a complete example.
|
||||
|
||||
[menu templates]: /templates/menu-templates/#example
|
||||
[menu templates]: /templates/menu/#example
|
||||
|
|
|
@ -17,7 +17,7 @@ action:
|
|||
toc: true
|
||||
---
|
||||
|
||||
The `InSection` method on a page object reports whether the given page is in the given section. Note that the method returns `true` when comparing a page to a sibling.
|
||||
The `InSection` method on a `Page` object reports whether the given page is in the given section. Note that the method returns `true` when comparing a page to a sibling.
|
||||
|
||||
{{% include "methods/page/_common/definition-of-section.md" %}}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: IsMenuCurrent
|
||||
description: Reports whether the given page object matches the page object associated with the given menu entry in the given menu.
|
||||
description: Reports whether the given Page object matches the Page object associated with the given menu entry in the given menu.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
|
@ -26,4 +26,4 @@ aliases: [/functions/ismenucurrent]
|
|||
|
||||
See [menu templates] for a complete example.
|
||||
|
||||
[menu templates]: /templates/menu-templates/#example
|
||||
[menu templates]: /templates/menu/#example
|
||||
|
|
|
@ -12,7 +12,9 @@ action:
|
|||
|
||||
[Pagination] is the process of splitting a list page into two or more pagers, where each pager contains a subset of the page collection and navigation links to other pagers.
|
||||
|
||||
By default, the number of elements on each pager is determined by the value of the `paginate` setting in your site configuration. The default value is `10`. Override the value in your site configuration by providing a second argument, an integer, when calling the `Paginate` method.
|
||||
By default, the number of elements on each pager is determined by your [site configuration]. The default is `10`. Override that value by providing a second argument, an integer, when calling the `Paginate` method.
|
||||
|
||||
[site configuration]: /getting-started/configuration/#pagination
|
||||
|
||||
{{% note %}}
|
||||
There is also a `Paginator` method on `Page` objects, but it can neither filter nor sort the page collection.
|
||||
|
@ -20,7 +22,12 @@ There is also a `Paginator` method on `Page` objects, but it can neither filter
|
|||
The `Paginate` method is more flexible.
|
||||
{{% /note %}}
|
||||
|
||||
You can invoke pagination on the home page template, [`section`] templates, [`taxonomy`] templates, and [`term`] templates.
|
||||
You can invoke pagination on the [home template], [section templates], [taxonomy templates], and [term templates].
|
||||
|
||||
[home template]: /templates/types/#home
|
||||
[section templates]: /templates/types/#section
|
||||
[taxonomy templates]: /templates/types/#taxonomy
|
||||
[term templates]: /templates/types/#term
|
||||
|
||||
{{< code file=layouts/_default/list.html >}}
|
||||
{{ $pages := where .Site.RegularPages "Section" "articles" }}
|
||||
|
@ -37,14 +44,8 @@ In the example above, we:
|
|||
2. Sort the collection by title
|
||||
3. Paginate the collection, with 7 elements per pager
|
||||
4. Range over the paginated page collection, rendering a link to each page
|
||||
5. Call the internal "pagination" template to create the navigation links between pagers.
|
||||
5. Call the embedded pagination template to create navigation links between pagers
|
||||
|
||||
{{% note %}}
|
||||
Please note that the results of pagination are cached. Once you have invoked either the `Paginator` or `Paginate` method, the paginated collection is immutable. Additional invocations of these methods will have no effect.
|
||||
{{% /note %}}
|
||||
|
||||
[context]: /getting-started/glossary/#context
|
||||
[pagination]: /templates/pagination/
|
||||
[`section`]: /getting-started/glossary/#section
|
||||
[`taxonomy`]: /getting-started/glossary/#taxonomy
|
||||
[`term`]: /getting-started/glossary/#term
|
||||
|
|
|
@ -10,9 +10,19 @@ action:
|
|||
signatures: [PAGE.Paginator]
|
||||
---
|
||||
|
||||
[Pagination] is the process of splitting a list page into two or more pagers, where each pager contains a subset of the page collection and navigation links to other pagers. The number of elements on each pager is determined by the value of the `paginate` setting in your site configuration. The default value is `10`.
|
||||
[Pagination] is the process of splitting a list page into two or more pagers, where each pager contains a subset of the page collection and navigation links to other pagers.
|
||||
|
||||
You can invoke pagination on the home page template, [`section`] templates, [`taxonomy`] templates, and [`term`] templates. Each of these receive a collection of regular pages in [context]. When you invoke the `Paginator` method, it paginates the page collection received in context.
|
||||
The number of elements on each pager is determined by your [site configuration]. The default is `10`.
|
||||
|
||||
[site configuration]: /getting-started/configuration/#pagination
|
||||
|
||||
You can invoke pagination on the [home template], [section templates], [taxonomy templates], and [term templates]. Each of these receives a collection of regular pages in [context]. When you invoke the `Paginator` method, it paginates the page collection received in context.
|
||||
|
||||
[home template]: /templates/types/#home
|
||||
[section templates]: /templates/types/#section
|
||||
[taxonomy templates]: /templates/types/#taxonomy
|
||||
[term templates]: /templates/types/#term
|
||||
[context]: /getting-started/glossary/#context
|
||||
|
||||
{{< code file=layouts/_default/list.html >}}
|
||||
{{ range .Paginator.Pages }}
|
||||
|
@ -21,7 +31,7 @@ You can invoke pagination on the home page template, [`section`] templates, [`ta
|
|||
{{ template "_internal/pagination.html" . }}
|
||||
{{< /code >}}
|
||||
|
||||
In the example above, the internal "pagination" template creates the navigation links between pagers.
|
||||
In the example above, the embedded pagination template creates navigation links between pagers.
|
||||
|
||||
{{% note %}}
|
||||
Although simple to invoke, with the `Paginator` method you can neither filter nor sort the page collection. It acts upon the page collection received in context.
|
||||
|
@ -34,9 +44,3 @@ The [`Paginate`] method is more flexible, and strongly recommended.
|
|||
{{% note %}}
|
||||
Please note that the results of pagination are cached. Once you have invoked either the `Paginator` or `Paginate` method, the paginated collection is immutable. Additional invocations of these methods will have no effect.
|
||||
{{% /note %}}
|
||||
|
||||
[context]: /getting-started/glossary/#context
|
||||
[pagination]: /templates/pagination/
|
||||
[`section`]: /getting-started/glossary/#section
|
||||
[`taxonomy`]: /getting-started/glossary/#taxonomy
|
||||
[`term`]: /getting-started/glossary/#term
|
||||
|
|
|
@ -70,6 +70,6 @@ layouts/_default/li.html
|
|||
|
||||
See [content views] for more examples.
|
||||
|
||||
[content views]: /templates/views/
|
||||
[content views]: /templates/content-view/
|
||||
[`partial`]: /functions/partials/include/
|
||||
[content type]: /getting-started/glossary/#content-type
|
||||
|
|
|
@ -74,4 +74,4 @@ And this simplistic sitemap template:
|
|||
|
||||
The change frequency will be `hourly` for the news page, and `monthly` for other pages.
|
||||
|
||||
[sitemap templates]: /templates/sitemap-template/
|
||||
[sitemap templates]: /templates/sitemap/
|
||||
|
|
|
@ -7,6 +7,7 @@ keywords: []
|
|||
menu:
|
||||
docs:
|
||||
parent: methods
|
||||
aliases: [/variables/page/]
|
||||
---
|
||||
|
||||
Use these methods with a Page object.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: PageSize
|
||||
description: Returns the maximum number of pages per pager.
|
||||
description: Returns the number of pages per pager.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
|
@ -8,8 +8,20 @@ action:
|
|||
- methods/page/Paginate
|
||||
returnType: int
|
||||
signatures: [PAGER.PageSize]
|
||||
expiryDate: 2025-06-09 # deprecated 2024-06-09
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.128.0 %}}
|
||||
Use [`PAGER.PagerSize`] instead.
|
||||
|
||||
[`PAGER.PagerSize`]: /methods/pager/pagersize/
|
||||
{{% /deprecated-in %}}
|
||||
|
||||
The number of pages per pager is determined by the optional second argument passed to the [`Paginate`] method, falling back to the `pagerSize` as defined in your [site configuration].
|
||||
|
||||
[`Paginate`]: /methods/page/paginate/
|
||||
[site configuration]: /templates/pagination/#configuration
|
||||
|
||||
```go-html-template
|
||||
{{ $pages := where site.RegularPages "Type" "posts" }}
|
||||
{{ $paginator := .Paginate $pages }}
|
||||
|
|
31
docs/content/en/methods/pager/PagerSize.md
Normal file
31
docs/content/en/methods/pager/PagerSize.md
Normal file
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
title: PagerSize
|
||||
description: Returns the number of pages per pager.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
related:
|
||||
- methods/page/Paginate
|
||||
returnType: int
|
||||
signatures: [PAGER.PagerSize]
|
||||
---
|
||||
|
||||
{{< new-in 0.128.0 >}}
|
||||
|
||||
The number of pages per pager is determined by the optional second argument passed to the [`Paginate`] method, falling back to the `pagerSize` as defined in your [site configuration].
|
||||
|
||||
[`Paginate`]: /methods/page/paginate/
|
||||
[site configuration]: /templates/pagination/#configuration
|
||||
|
||||
```go-html-template
|
||||
{{ $pages := where site.RegularPages "Type" "posts" }}
|
||||
{{ $paginator := .Paginate $pages }}
|
||||
|
||||
{{ range $paginator.Pages }}
|
||||
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
|
||||
{{ end }}
|
||||
|
||||
{{ with $paginator }}
|
||||
{{ .PagerSize }}
|
||||
{{ end }}
|
||||
```
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Exif
|
||||
description: Applicable to JPEG and TIFF images, returns an EXIF object containing image metadata.
|
||||
description: Applicable to JPEG, PNG, TIFF, and WebP images, returns an EXIF object containing image metadata.
|
||||
categories: []
|
||||
keywords: []
|
||||
action:
|
||||
|
@ -10,7 +10,7 @@ action:
|
|||
toc: true
|
||||
---
|
||||
|
||||
Applicable to JPEG and TIFF images, the `Exif` method on an image `Resource` object returns an [EXIF] object containing image metadata.
|
||||
Applicable to JPEG, PNG, TIFF, and WebP images, the `Exif` method on an image `Resource` object returns an [EXIF] object containing image metadata.
|
||||
|
||||
## Methods
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ content/
|
|||
└── _index.md
|
||||
```
|
||||
|
||||
This home page template:
|
||||
This home template:
|
||||
|
||||
```go-html-template
|
||||
{{ with .Site.GetPage "/works/paintings" }}
|
||||
|
@ -96,7 +96,7 @@ content/
|
|||
└── _index.md
|
||||
```
|
||||
|
||||
In the home page template, use the `GetPage` method on a `Site` object to render all the images in the headless [page bundle]:
|
||||
In the home template, use the `GetPage` method on a `Site` object to render all the images in the headless [page bundle]:
|
||||
|
||||
```go-html-template
|
||||
{{ with .Site.GetPage "/headless" }}
|
||||
|
|
|
@ -7,6 +7,7 @@ action:
|
|||
related: []
|
||||
returnType: bool
|
||||
signatures: [SITE.IsMultiLingual]
|
||||
expiryDate: 2025-03-16 # deprecated 2024-03-16
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.124.0 %}}
|
||||
|
|
|
@ -7,6 +7,7 @@ action:
|
|||
related: []
|
||||
returnType: time.Time
|
||||
signatures: [SITE.LastChange]
|
||||
expiryDate: 2025-02-19 # deprecated 2024-02-19
|
||||
---
|
||||
|
||||
{{% deprecated-in 0.123.0 %}}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue