mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
Reduce number of site audit warnings
This commit is contained in:
@@ -13,6 +13,8 @@ toc: true
|
||||
aliases: [/content/summaries/,/content-management/content-summaries/]
|
||||
---
|
||||
|
||||
<!--more-->
|
||||
|
||||
With the use of the `.Summary` [page variable][pagevariables], Hugo generates summaries of content to use as a short version in summary views.
|
||||
|
||||
## Summary splitting options
|
||||
@@ -37,7 +39,7 @@ The Hugo-defined summaries are set to use word count calculated by splitting the
|
||||
|
||||
### Manual summary splitting
|
||||
|
||||
Alternatively, you may add the <code><!--more--></code> summary divider where you want to split the article.
|
||||
Alternatively, you may add the `<!--more-->` summary divider where you want to split the article.
|
||||
|
||||
For [Org mode content][org], use `# more` where you want to split the article.
|
||||
|
||||
@@ -51,10 +53,10 @@ Pros
|
||||
: Freedom, precision, and improved rendering. All HTML tags and formatting are preserved.
|
||||
|
||||
Cons
|
||||
: Extra work for content authors, since they need to remember to type <code><!--more--></code> (or `# more` for [org content][org]) in each content file. This can be automated by adding the summary divider below the front matter of an [archetype](/content-management/archetypes/).
|
||||
: Extra work for content authors, since they need to remember to type `<!--more-->` (or `# more` for [org content][org]) in each content file. This can be automated by adding the summary divider below the front matter of an [archetype](/content-management/archetypes/).
|
||||
|
||||
{{% note %}}
|
||||
Be careful to enter <code><!--more--></code> exactly; i.e., all lowercase and with no whitespace.
|
||||
Be careful to enter `<!--more-->` exactly; i.e., all lowercase and with no whitespace.
|
||||
{{% /note %}}
|
||||
|
||||
### Front matter summary
|
||||
@@ -71,12 +73,12 @@ Cons
|
||||
|
||||
Because there are multiple ways in which a summary can be specified it is useful to understand the order of selection Hugo follows when deciding on the text to be returned by `.Summary`. It is as follows:
|
||||
|
||||
1. If there is a <code><!--more--></code> summary divider present in the article the text up to the divider will be provided as per the manual summary split method
|
||||
1. If there is a `<!--more-->`> summary divider present in the article the text up to the divider will be provided as per the manual summary split method
|
||||
2. If there is a `summary` variable in the article front matter the value of the variable will be provided as per the front matter summary method
|
||||
3. The text at the start of the article will be provided as per the automatic summary split method
|
||||
|
||||
{{% note %}}
|
||||
Hugo uses the _first_ of the above steps that returns text. So if, for example, your article has both `summary` variable in its front matter and a <code><!--more--></code> summary divider Hugo will use the manual summary split method.
|
||||
Hugo uses the _first_ of the above steps that returns text. So if, for example, your article has both `summary` variable in its front matter and a `<!--more-->` summary divider Hugo will use the manual summary split method.
|
||||
{{% /note %}}
|
||||
|
||||
## Example: first 10 articles with summaries
|
||||
|
||||
@@ -25,9 +25,9 @@ In this context, *safe* means CSS content that matches any of the following:
|
||||
|
||||
Example: Given `style = "color: red;"` defined in the front matter of your `.md` file:
|
||||
|
||||
* <span class="good">`<p style="{{ .Params.style | safeCSS }}">…</p>` → `<p style="color: red;">…</p>`</span>
|
||||
* <span class="bad">`<p style="{{ .Params.style }}">…</p>` → `<p style="ZgotmplZ">…</p>`</span>
|
||||
* `<p style="{{ .Params.style | safeCSS }}">…</p>` → `<p style="color: red;">…</p>`
|
||||
* `<p style="{{ .Params.style }}">…</p>` → `<p style="ZgotmplZ">…</p>`
|
||||
|
||||
{{% note %}}
|
||||
"ZgotmplZ" is a special value that indicates that unsafe content reached a CSS or URL context.
|
||||
`ZgotmplZ` is a special value that indicates that unsafe content reached a CSS or URL context.
|
||||
{{% /note %}}
|
||||
|
||||
@@ -22,5 +22,5 @@ Template authors are responsible for ensuring that typed expressions do not brea
|
||||
|
||||
Example: Given `hash = "619c16f"` defined in the front matter of your `.md` file:
|
||||
|
||||
* <span class="good">`<script>var form_{{ .Params.hash | safeJS }};…</script>` → `<script>var form_619c16f;…</script>`</span>
|
||||
* <span class="bad">`<script>var form_{{ .Params.hash }};…</script>` → `<script>var form_"619c16f";…</script>`</span>
|
||||
* `<script>var form_{{ .Params.hash | safeJS }};…</script>` → `<script>var form_619c16f;…</script>`
|
||||
* `<script>var form_{{ .Params.hash }};…</script>` → `<script>var form_"619c16f";…</script>`
|
||||
|
||||
@@ -15,7 +15,12 @@ aliases: [/functions/emojify]
|
||||
|
||||
See the list of [emoji shortcodes] for available emoticons.
|
||||
|
||||
The `emojify` function can be called in your templates but not directly in your content files by default. For emojis in content files, set `enableEmoji` to `true` in your site's [configuration]. Then you can write emoji shorthand directly into your content files; e.g. <code>I :</code><code>heart</code><code>: Hugo!</code>:
|
||||
The `emojify` function can be called in your templates but not directly in your content files by default. For emojis in content files, set `enableEmoji` to `true` in your site's [configuration]. Then you can write emoji shorthand directly into your content files;
|
||||
|
||||
|
||||
```text
|
||||
I :heart: Hugo!
|
||||
```
|
||||
|
||||
I :heart: Hugo!
|
||||
|
||||
|
||||
@@ -9,10 +9,9 @@ menu:
|
||||
weight: 60
|
||||
weight: 60
|
||||
type: glossary
|
||||
# Use level 3 headings for each term in the glossary.
|
||||
---
|
||||
|
||||
<!-- Use level 3 headings for each term in the glossary. -->
|
||||
|
||||
### action
|
||||
|
||||
See [template action](#template-action).
|
||||
|
||||
@@ -90,7 +90,7 @@ defines
|
||||
format
|
||||
: (`string`) The output format.
|
||||
One of: `iife`, `cjs`, `esm`.
|
||||
Default is `iife`, a self-executing function, suitable for inclusion as a <script> tag.
|
||||
Default is `iife`, a self-executing function, suitable for inclusion as a `<script>` tag.
|
||||
|
||||
sourceMap
|
||||
: (`string`) Whether to generate `inline` or `external` source maps from esbuild. External source maps will be written to the target with the output file name + ".map". Input source maps can be read from js.Build and node modules and combined into the output source maps. By default, source maps are not created.
|
||||
|
||||
@@ -73,7 +73,7 @@ GitHub [custom emoji] are not supported.
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#introduction) | :grinning: | `:grinning:` | :smiley: | `:smiley:` | [top](#introduction) |
|
||||
| [top](#introduction) | :smile: | `:smile:` | :grin: | `:grin:` | [top](#introduction) |
|
||||
| [top](#introduction) | :laughing: | `:laughing:` <br /> `:satisfied:` | :sweat_smile: | `:sweat_smile:` | [top](#introduction) |
|
||||
| [top](#introduction) | :laughing: | `:laughing:` `:satisfied:` | :sweat_smile: | `:sweat_smile:` | [top](#introduction) |
|
||||
| [top](#introduction) | :rofl: | `:rofl:` | :joy: | `:joy:` | [top](#introduction) |
|
||||
| [top](#introduction) | :slightly_smiling_face: | `:slightly_smiling_face:` | :upside_down_face: | `:upside_down_face:` | [top](#introduction) |
|
||||
| [top](#introduction) | :wink: | `:wink:` | :blush: | `:blush:` | [top](#introduction) |
|
||||
@@ -169,7 +169,7 @@ GitHub [custom emoji] are not supported.
|
||||
|
||||
| | ico | shortcode | ico | shortcode | |
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#introduction) | :triumph: | `:triumph:` | :pout: | `:pout:` <br /> `:rage:` | [top](#introduction) |
|
||||
| [top](#introduction) | :triumph: | `:triumph:` | :pout: | `:pout:` `:rage:` | [top](#introduction) |
|
||||
| [top](#introduction) | :angry: | `:angry:` | :cursing_face: | `:cursing_face:` | [top](#introduction) |
|
||||
| [top](#introduction) | :smiling_imp: | `:smiling_imp:` | :imp: | `:imp:` | [top](#introduction) |
|
||||
| [top](#introduction) | :skull: | `:skull:` | :skull_and_crossbones: | `:skull_and_crossbones:` | [top](#introduction) |
|
||||
@@ -178,7 +178,7 @@ GitHub [custom emoji] are not supported.
|
||||
|
||||
| | ico | shortcode | ico | shortcode | |
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#introduction) | :hankey: | `:hankey:` <br /> `:poop:` <br /> `:shit:` | :clown_face: | `:clown_face:` | [top](#introduction) |
|
||||
| [top](#introduction) | :hankey: | `:hankey:` `:poop:` `:shit:` | :clown_face: | `:clown_face:` | [top](#introduction) |
|
||||
| [top](#introduction) | :japanese_ogre: | `:japanese_ogre:` | :japanese_goblin: | `:japanese_goblin:` | [top](#introduction) |
|
||||
| [top](#introduction) | :ghost: | `:ghost:` | :alien: | `:alien:` | [top](#introduction) |
|
||||
| [top](#introduction) | :space_invader: | `:space_invader:` | :robot: | `:robot:` | [top](#introduction) |
|
||||
@@ -221,7 +221,7 @@ GitHub [custom emoji] are not supported.
|
||||
| | ico | shortcode | ico | shortcode | |
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#introduction) | :kiss: | `:kiss:` | :100: | `:100:` | [top](#introduction) |
|
||||
| [top](#introduction) | :anger: | `:anger:` | :boom: | `:boom:` <br /> `:collision:` | [top](#introduction) |
|
||||
| [top](#introduction) | :anger: | `:anger:` | :boom: | `:boom:` `:collision:` | [top](#introduction) |
|
||||
| [top](#introduction) | :dizzy: | `:dizzy:` | :sweat_drops: | `:sweat_drops:` | [top](#introduction) |
|
||||
| [top](#introduction) | :dash: | `:dash:` | :hole: | `:hole:` | [top](#introduction) |
|
||||
| [top](#introduction) | :speech_balloon: | `:speech_balloon:` | :eye_speech_bubble: | `:eye_speech_bubble:` | [top](#introduction) |
|
||||
@@ -252,7 +252,7 @@ GitHub [custom emoji] are not supported.
|
||||
| | ico | shortcode | ico | shortcode | |
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#people--body) | :wave: | `:wave:` | :raised_back_of_hand: | `:raised_back_of_hand:` | [top](#introduction) |
|
||||
| [top](#people--body) | :raised_hand_with_fingers_splayed: | `:raised_hand_with_fingers_splayed:` | :hand: | `:hand:` <br /> `:raised_hand:` | [top](#introduction) |
|
||||
| [top](#people--body) | :raised_hand_with_fingers_splayed: | `:raised_hand_with_fingers_splayed:` | :hand: | `:hand:` `:raised_hand:` | [top](#introduction) |
|
||||
| [top](#people--body) | :vulcan_salute: | `:vulcan_salute:` | | | [top](#introduction) |
|
||||
|
||||
### Hand Fingers Partial
|
||||
@@ -269,15 +269,15 @@ GitHub [custom emoji] are not supported.
|
||||
| | ico | shortcode | ico | shortcode | |
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#people--body) | :point_left: | `:point_left:` | :point_right: | `:point_right:` | [top](#introduction) |
|
||||
| [top](#people--body) | :point_up_2: | `:point_up_2:` | :fu: | `:fu:` <br /> `:middle_finger:` | [top](#introduction) |
|
||||
| [top](#people--body) | :point_up_2: | `:point_up_2:` | :fu: | `:fu:` `:middle_finger:` | [top](#introduction) |
|
||||
| [top](#people--body) | :point_down: | `:point_down:` | :point_up: | `:point_up:` | [top](#introduction) |
|
||||
|
||||
### Hand Fingers Closed
|
||||
|
||||
| | ico | shortcode | ico | shortcode | |
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#people--body) | :+1: | `:+1:` <br /> `:thumbsup:` | :-1: | `:-1:` <br /> `:thumbsdown:` | [top](#introduction) |
|
||||
| [top](#people--body) | :fist: | `:fist:` <br /> `:fist_raised:` | :facepunch: | `:facepunch:` <br /> `:fist_oncoming:` <br /> `:punch:` | [top](#introduction) |
|
||||
| [top](#people--body) | :+1: | `:+1:` `:thumbsup:` | :-1: | `:-1:` `:thumbsdown:` | [top](#introduction) |
|
||||
| [top](#people--body) | :fist: | `:fist:` `:fist_raised:` | :facepunch: | `:facepunch:` `:fist_oncoming:` `:punch:` | [top](#introduction) |
|
||||
| [top](#people--body) | :fist_left: | `:fist_left:` | :fist_right: | `:fist_right:` | [top](#introduction) |
|
||||
|
||||
### Hands
|
||||
@@ -324,7 +324,7 @@ GitHub [custom emoji] are not supported.
|
||||
| [top](#people--body) | :person_red_hair: | `:person_red_hair:` | :curly_haired_woman: | `:curly_haired_woman:` | [top](#introduction) |
|
||||
| [top](#people--body) | :person_curly_hair: | `:person_curly_hair:` | :white_haired_woman: | `:white_haired_woman:` | [top](#introduction) |
|
||||
| [top](#people--body) | :person_white_hair: | `:person_white_hair:` | :bald_woman: | `:bald_woman:` | [top](#introduction) |
|
||||
| [top](#people--body) | :person_bald: | `:person_bald:` | :blond_haired_woman: | `:blond_haired_woman:` <br /> `:blonde_woman:` | [top](#introduction) |
|
||||
| [top](#people--body) | :person_bald: | `:person_bald:` | :blond_haired_woman: | `:blond_haired_woman:` `:blonde_woman:` | [top](#introduction) |
|
||||
| [top](#people--body) | :blond_haired_man: | `:blond_haired_man:` | :older_adult: | `:older_adult:` | [top](#introduction) |
|
||||
| [top](#people--body) | :older_man: | `:older_man:` | :older_woman: | `:older_woman:` | [top](#introduction) |
|
||||
|
||||
@@ -335,11 +335,11 @@ GitHub [custom emoji] are not supported.
|
||||
| [top](#people--body) | :frowning_person: | `:frowning_person:` | :frowning_man: | `:frowning_man:` | [top](#introduction) |
|
||||
| [top](#people--body) | :frowning_woman: | `:frowning_woman:` | :pouting_face: | `:pouting_face:` | [top](#introduction) |
|
||||
| [top](#people--body) | :pouting_man: | `:pouting_man:` | :pouting_woman: | `:pouting_woman:` | [top](#introduction) |
|
||||
| [top](#people--body) | :no_good: | `:no_good:` | :ng_man: | `:ng_man:` <br /> `:no_good_man:` | [top](#introduction) |
|
||||
| [top](#people--body) | :ng_woman: | `:ng_woman:` <br /> `:no_good_woman:` | :ok_person: | `:ok_person:` | [top](#introduction) |
|
||||
| [top](#people--body) | :no_good: | `:no_good:` | :ng_man: | `:ng_man:` `:no_good_man:` | [top](#introduction) |
|
||||
| [top](#people--body) | :ng_woman: | `:ng_woman:` `:no_good_woman:` | :ok_person: | `:ok_person:` | [top](#introduction) |
|
||||
| [top](#people--body) | :ok_man: | `:ok_man:` | :ok_woman: | `:ok_woman:` | [top](#introduction) |
|
||||
| [top](#people--body) | :information_desk_person: | `:information_desk_person:` <br /> `:tipping_hand_person:` | :sassy_man: | `:sassy_man:` <br /> `:tipping_hand_man:` | [top](#introduction) |
|
||||
| [top](#people--body) | :sassy_woman: | `:sassy_woman:` <br /> `:tipping_hand_woman:` | :raising_hand: | `:raising_hand:` | [top](#introduction) |
|
||||
| [top](#people--body) | :information_desk_person: | `:information_desk_person:` `:tipping_hand_person:` | :sassy_man: | `:sassy_man:` `:tipping_hand_man:` | [top](#introduction) |
|
||||
| [top](#people--body) | :sassy_woman: | `:sassy_woman:` `:tipping_hand_woman:` | :raising_hand: | `:raising_hand:` | [top](#introduction) |
|
||||
| [top](#people--body) | :raising_hand_man: | `:raising_hand_man:` | :raising_hand_woman: | `:raising_hand_woman:` | [top](#introduction) |
|
||||
| [top](#people--body) | :deaf_person: | `:deaf_person:` | :deaf_man: | `:deaf_man:` | [top](#introduction) |
|
||||
| [top](#people--body) | :deaf_woman: | `:deaf_woman:` | :bow: | `:bow:` | [top](#introduction) |
|
||||
@@ -376,7 +376,7 @@ GitHub [custom emoji] are not supported.
|
||||
| [top](#people--body) | :astronaut: | `:astronaut:` | :man_astronaut: | `:man_astronaut:` | [top](#introduction) |
|
||||
| [top](#people--body) | :woman_astronaut: | `:woman_astronaut:` | :firefighter: | `:firefighter:` | [top](#introduction) |
|
||||
| [top](#people--body) | :man_firefighter: | `:man_firefighter:` | :woman_firefighter: | `:woman_firefighter:` | [top](#introduction) |
|
||||
| [top](#people--body) | :cop: | `:cop:` <br /> `:police_officer:` | :policeman: | `:policeman:` | [top](#introduction) |
|
||||
| [top](#people--body) | :cop: | `:cop:` `:police_officer:` | :policeman: | `:policeman:` | [top](#introduction) |
|
||||
| [top](#people--body) | :policewoman: | `:policewoman:` | :detective: | `:detective:` | [top](#introduction) |
|
||||
| [top](#people--body) | :male_detective: | `:male_detective:` | :female_detective: | `:female_detective:` | [top](#introduction) |
|
||||
| [top](#people--body) | :guard: | `:guard:` | :guardsman: | `:guardsman:` | [top](#introduction) |
|
||||
@@ -388,7 +388,7 @@ GitHub [custom emoji] are not supported.
|
||||
| [top](#people--body) | :man_with_gua_pi_mao: | `:man_with_gua_pi_mao:` | :woman_with_headscarf: | `:woman_with_headscarf:` | [top](#introduction) |
|
||||
| [top](#people--body) | :person_in_tuxedo: | `:person_in_tuxedo:` | :man_in_tuxedo: | `:man_in_tuxedo:` | [top](#introduction) |
|
||||
| [top](#people--body) | :woman_in_tuxedo: | `:woman_in_tuxedo:` | :person_with_veil: | `:person_with_veil:` | [top](#introduction) |
|
||||
| [top](#people--body) | :man_with_veil: | `:man_with_veil:` | :bride_with_veil: | `:bride_with_veil:` <br /> `:woman_with_veil:` | [top](#introduction) |
|
||||
| [top](#people--body) | :man_with_veil: | `:man_with_veil:` | :bride_with_veil: | `:bride_with_veil:` `:woman_with_veil:` | [top](#introduction) |
|
||||
| [top](#people--body) | :pregnant_woman: | `:pregnant_woman:` | :breast_feeding: | `:breast_feeding:` | [top](#introduction) |
|
||||
| [top](#people--body) | :woman_feeding_baby: | `:woman_feeding_baby:` | :man_feeding_baby: | `:man_feeding_baby:` | [top](#introduction) |
|
||||
| [top](#people--body) | :person_feeding_baby: | `:person_feeding_baby:` | | | [top](#introduction) |
|
||||
@@ -430,8 +430,8 @@ GitHub [custom emoji] are not supported.
|
||||
| [top](#people--body) | :person_in_motorized_wheelchair: | `:person_in_motorized_wheelchair:` | :man_in_motorized_wheelchair: | `:man_in_motorized_wheelchair:` | [top](#introduction) |
|
||||
| [top](#people--body) | :woman_in_motorized_wheelchair: | `:woman_in_motorized_wheelchair:` | :person_in_manual_wheelchair: | `:person_in_manual_wheelchair:` | [top](#introduction) |
|
||||
| [top](#people--body) | :man_in_manual_wheelchair: | `:man_in_manual_wheelchair:` | :woman_in_manual_wheelchair: | `:woman_in_manual_wheelchair:` | [top](#introduction) |
|
||||
| [top](#people--body) | :runner: | `:runner:` <br /> `:running:` | :running_man: | `:running_man:` | [top](#introduction) |
|
||||
| [top](#people--body) | :running_woman: | `:running_woman:` | :dancer: | `:dancer:` <br /> `:woman_dancing:` | [top](#introduction) |
|
||||
| [top](#people--body) | :runner: | `:runner:` `:running:` | :running_man: | `:running_man:` | [top](#introduction) |
|
||||
| [top](#people--body) | :running_woman: | `:running_woman:` | :dancer: | `:dancer:` `:woman_dancing:` | [top](#introduction) |
|
||||
| [top](#people--body) | :man_dancing: | `:man_dancing:` | :business_suit_levitating: | `:business_suit_levitating:` | [top](#introduction) |
|
||||
| [top](#people--body) | :dancers: | `:dancers:` | :dancing_men: | `:dancing_men:` | [top](#introduction) |
|
||||
| [top](#people--body) | :dancing_women: | `:dancing_women:` | :sauna_person: | `:sauna_person:` | [top](#introduction) |
|
||||
@@ -451,8 +451,8 @@ GitHub [custom emoji] are not supported.
|
||||
| [top](#people--body) | :rowboat: | `:rowboat:` | :rowing_man: | `:rowing_man:` | [top](#introduction) |
|
||||
| [top](#people--body) | :rowing_woman: | `:rowing_woman:` | :swimmer: | `:swimmer:` | [top](#introduction) |
|
||||
| [top](#people--body) | :swimming_man: | `:swimming_man:` | :swimming_woman: | `:swimming_woman:` | [top](#introduction) |
|
||||
| [top](#people--body) | :bouncing_ball_person: | `:bouncing_ball_person:` | :basketball_man: | `:basketball_man:` <br /> `:bouncing_ball_man:` | [top](#introduction) |
|
||||
| [top](#people--body) | :basketball_woman: | `:basketball_woman:` <br /> `:bouncing_ball_woman:` | :weight_lifting: | `:weight_lifting:` | [top](#introduction) |
|
||||
| [top](#people--body) | :bouncing_ball_person: | `:bouncing_ball_person:` | :basketball_man: | `:basketball_man:` `:bouncing_ball_man:` | [top](#introduction) |
|
||||
| [top](#people--body) | :basketball_woman: | `:basketball_woman:` `:bouncing_ball_woman:` | :weight_lifting: | `:weight_lifting:` | [top](#introduction) |
|
||||
| [top](#people--body) | :weight_lifting_man: | `:weight_lifting_man:` | :weight_lifting_woman: | `:weight_lifting_woman:` | [top](#introduction) |
|
||||
| [top](#people--body) | :bicyclist: | `:bicyclist:` | :biking_man: | `:biking_man:` | [top](#introduction) |
|
||||
| [top](#people--body) | :biking_woman: | `:biking_woman:` | :mountain_bicyclist: | `:mountain_bicyclist:` | [top](#introduction) |
|
||||
@@ -552,7 +552,7 @@ GitHub [custom emoji] are not supported.
|
||||
| [top](#animals--nature) | :koala: | `:koala:` | :panda_face: | `:panda_face:` | [top](#introduction) |
|
||||
| [top](#animals--nature) | :sloth: | `:sloth:` | :otter: | `:otter:` | [top](#introduction) |
|
||||
| [top](#animals--nature) | :skunk: | `:skunk:` | :kangaroo: | `:kangaroo:` | [top](#introduction) |
|
||||
| [top](#animals--nature) | :badger: | `:badger:` | :feet: | `:feet:` <br /> `:paw_prints:` | [top](#introduction) |
|
||||
| [top](#animals--nature) | :badger: | `:badger:` | :feet: | `:feet:` `:paw_prints:` | [top](#introduction) |
|
||||
|
||||
### Animal Bird
|
||||
|
||||
@@ -588,7 +588,7 @@ GitHub [custom emoji] are not supported.
|
||||
| | ico | shortcode | ico | shortcode | |
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#animals--nature) | :whale: | `:whale:` | :whale2: | `:whale2:` | [top](#introduction) |
|
||||
| [top](#animals--nature) | :dolphin: | `:dolphin:` <br /> `:flipper:` | :seal: | `:seal:` | [top](#introduction) |
|
||||
| [top](#animals--nature) | :dolphin: | `:dolphin:` `:flipper:` | :seal: | `:seal:` | [top](#introduction) |
|
||||
| [top](#animals--nature) | :fish: | `:fish:` | :tropical_fish: | `:tropical_fish:` | [top](#introduction) |
|
||||
| [top](#animals--nature) | :blowfish: | `:blowfish:` | :shark: | `:shark:` | [top](#introduction) |
|
||||
| [top](#animals--nature) | :octopus: | `:octopus:` | :shell: | `:shell:` | [top](#introduction) |
|
||||
@@ -599,7 +599,7 @@ GitHub [custom emoji] are not supported.
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#animals--nature) | :snail: | `:snail:` | :butterfly: | `:butterfly:` | [top](#introduction) |
|
||||
| [top](#animals--nature) | :bug: | `:bug:` | :ant: | `:ant:` | [top](#introduction) |
|
||||
| [top](#animals--nature) | :bee: | `:bee:` <br /> `:honeybee:` | :beetle: | `:beetle:` | [top](#introduction) |
|
||||
| [top](#animals--nature) | :bee: | `:bee:` `:honeybee:` | :beetle: | `:beetle:` | [top](#introduction) |
|
||||
| [top](#animals--nature) | :lady_beetle: | `:lady_beetle:` | :cricket: | `:cricket:` | [top](#introduction) |
|
||||
| [top](#animals--nature) | :cockroach: | `:cockroach:` | :spider: | `:spider:` | [top](#introduction) |
|
||||
| [top](#animals--nature) | :spider_web: | `:spider_web:` | :scorpion: | `:scorpion:` | [top](#introduction) |
|
||||
@@ -644,7 +644,7 @@ GitHub [custom emoji] are not supported.
|
||||
| | ico | shortcode | ico | shortcode | |
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#food--drink) | :grapes: | `:grapes:` | :melon: | `:melon:` | [top](#introduction) |
|
||||
| [top](#food--drink) | :watermelon: | `:watermelon:` | :mandarin: | `:mandarin:` <br /> `:orange:` <br /> `:tangerine:` | [top](#introduction) |
|
||||
| [top](#food--drink) | :watermelon: | `:watermelon:` | :mandarin: | `:mandarin:` `:orange:` `:tangerine:` | [top](#introduction) |
|
||||
| [top](#food--drink) | :lemon: | `:lemon:` | :banana: | `:banana:` | [top](#introduction) |
|
||||
| [top](#food--drink) | :pineapple: | `:pineapple:` | :mango: | `:mango:` | [top](#introduction) |
|
||||
| [top](#food--drink) | :apple: | `:apple:` | :green_apple: | `:green_apple:` | [top](#introduction) |
|
||||
@@ -743,7 +743,7 @@ GitHub [custom emoji] are not supported.
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#food--drink) | :chopsticks: | `:chopsticks:` | :plate_with_cutlery: | `:plate_with_cutlery:` | [top](#introduction) |
|
||||
| [top](#food--drink) | :fork_and_knife: | `:fork_and_knife:` | :spoon: | `:spoon:` | [top](#introduction) |
|
||||
| [top](#food--drink) | :hocho: | `:hocho:` <br /> `:knife:` | :amphora: | `:amphora:` | [top](#introduction) |
|
||||
| [top](#food--drink) | :hocho: | `:hocho:` `:knife:` | :amphora: | `:amphora:` | [top](#introduction) |
|
||||
|
||||
## Travel & Places
|
||||
|
||||
@@ -833,7 +833,7 @@ GitHub [custom emoji] are not supported.
|
||||
| [top](#travel--places) | :ambulance: | `:ambulance:` | :fire_engine: | `:fire_engine:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :police_car: | `:police_car:` | :oncoming_police_car: | `:oncoming_police_car:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :taxi: | `:taxi:` | :oncoming_taxi: | `:oncoming_taxi:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :car: | `:car:` <br /> `:red_car:` | :oncoming_automobile: | `:oncoming_automobile:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :car: | `:car:` `:red_car:` | :oncoming_automobile: | `:oncoming_automobile:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :blue_car: | `:blue_car:` | :pickup_truck: | `:pickup_truck:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :truck: | `:truck:` | :articulated_lorry: | `:articulated_lorry:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :tractor: | `:tractor:` | :racing_car: | `:racing_car:` | [top](#introduction) |
|
||||
@@ -852,7 +852,7 @@ GitHub [custom emoji] are not supported.
|
||||
|
||||
| | ico | shortcode | ico | shortcode | |
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#travel--places) | :anchor: | `:anchor:` | :boat: | `:boat:` <br /> `:sailboat:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :anchor: | `:anchor:` | :boat: | `:boat:` `:sailboat:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :canoe: | `:canoe:` | :speedboat: | `:speedboat:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :passenger_ship: | `:passenger_ship:` | :ferry: | `:ferry:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :motor_boat: | `:motor_boat:` | :ship: | `:ship:` | [top](#introduction) |
|
||||
@@ -901,7 +901,7 @@ GitHub [custom emoji] are not supported.
|
||||
| | ico | shortcode | ico | shortcode | |
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#travel--places) | :new_moon: | `:new_moon:` | :waxing_crescent_moon: | `:waxing_crescent_moon:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :first_quarter_moon: | `:first_quarter_moon:` | :moon: | `:moon:` <br /> `:waxing_gibbous_moon:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :first_quarter_moon: | `:first_quarter_moon:` | :moon: | `:moon:` `:waxing_gibbous_moon:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :full_moon: | `:full_moon:` | :waning_gibbous_moon: | `:waning_gibbous_moon:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :last_quarter_moon: | `:last_quarter_moon:` | :waning_crescent_moon: | `:waning_crescent_moon:` | [top](#introduction) |
|
||||
| [top](#travel--places) | :crescent_moon: | `:crescent_moon:` | :new_moon_with_face: | `:new_moon_with_face:` | [top](#introduction) |
|
||||
@@ -1030,7 +1030,7 @@ GitHub [custom emoji] are not supported.
|
||||
| [top](#objects) | :eyeglasses: | `:eyeglasses:` | :dark_sunglasses: | `:dark_sunglasses:` | [top](#introduction) |
|
||||
| [top](#objects) | :goggles: | `:goggles:` | :lab_coat: | `:lab_coat:` | [top](#introduction) |
|
||||
| [top](#objects) | :safety_vest: | `:safety_vest:` | :necktie: | `:necktie:` | [top](#introduction) |
|
||||
| [top](#objects) | :shirt: | `:shirt:` <br /> `:tshirt:` | :jeans: | `:jeans:` | [top](#introduction) |
|
||||
| [top](#objects) | :shirt: | `:shirt:` `:tshirt:` | :jeans: | `:jeans:` | [top](#introduction) |
|
||||
| [top](#objects) | :scarf: | `:scarf:` | :gloves: | `:gloves:` | [top](#introduction) |
|
||||
| [top](#objects) | :coat: | `:coat:` | :socks: | `:socks:` | [top](#introduction) |
|
||||
| [top](#objects) | :dress: | `:dress:` | :kimono: | `:kimono:` | [top](#introduction) |
|
||||
@@ -1040,7 +1040,7 @@ GitHub [custom emoji] are not supported.
|
||||
| [top](#objects) | :purse: | `:purse:` | :handbag: | `:handbag:` | [top](#introduction) |
|
||||
| [top](#objects) | :pouch: | `:pouch:` | :shopping: | `:shopping:` | [top](#introduction) |
|
||||
| [top](#objects) | :school_satchel: | `:school_satchel:` | :thong_sandal: | `:thong_sandal:` | [top](#introduction) |
|
||||
| [top](#objects) | :mans_shoe: | `:mans_shoe:` <br /> `:shoe:` | :athletic_shoe: | `:athletic_shoe:` | [top](#introduction) |
|
||||
| [top](#objects) | :mans_shoe: | `:mans_shoe:` `:shoe:` | :athletic_shoe: | `:athletic_shoe:` | [top](#introduction) |
|
||||
| [top](#objects) | :hiking_boot: | `:hiking_boot:` | :flat_shoe: | `:flat_shoe:` | [top](#introduction) |
|
||||
| [top](#objects) | :high_heel: | `:high_heel:` | :sandal: | `:sandal:` | [top](#introduction) |
|
||||
| [top](#objects) | :ballet_shoes: | `:ballet_shoes:` | :boot: | `:boot:` | [top](#introduction) |
|
||||
@@ -1086,7 +1086,7 @@ GitHub [custom emoji] are not supported.
|
||||
| | ico | shortcode | ico | shortcode | |
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#objects) | :iphone: | `:iphone:` | :calling: | `:calling:` | [top](#introduction) |
|
||||
| [top](#objects) | :phone: | `:phone:` <br /> `:telephone:` | :telephone_receiver: | `:telephone_receiver:` | [top](#introduction) |
|
||||
| [top](#objects) | :phone: | `:phone:` `:telephone:` | :telephone_receiver: | `:telephone_receiver:` | [top](#introduction) |
|
||||
| [top](#objects) | :pager: | `:pager:` | :fax: | `:fax:` | [top](#introduction) |
|
||||
|
||||
### Computer
|
||||
@@ -1112,14 +1112,14 @@ GitHub [custom emoji] are not supported.
|
||||
| [top](#objects) | :vhs: | `:vhs:` | :mag: | `:mag:` | [top](#introduction) |
|
||||
| [top](#objects) | :mag_right: | `:mag_right:` | :candle: | `:candle:` | [top](#introduction) |
|
||||
| [top](#objects) | :bulb: | `:bulb:` | :flashlight: | `:flashlight:` | [top](#introduction) |
|
||||
| [top](#objects) | :izakaya_lantern: | `:izakaya_lantern:` <br /> `:lantern:` | :diya_lamp: | `:diya_lamp:` | [top](#introduction) |
|
||||
| [top](#objects) | :izakaya_lantern: | `:izakaya_lantern:` `:lantern:` | :diya_lamp: | `:diya_lamp:` | [top](#introduction) |
|
||||
|
||||
### Book Paper
|
||||
|
||||
| | ico | shortcode | ico | shortcode | |
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#objects) | :notebook_with_decorative_cover: | `:notebook_with_decorative_cover:` | :closed_book: | `:closed_book:` | [top](#introduction) |
|
||||
| [top](#objects) | :book: | `:book:` <br /> `:open_book:` | :green_book: | `:green_book:` | [top](#introduction) |
|
||||
| [top](#objects) | :book: | `:book:` `:open_book:` | :green_book: | `:green_book:` | [top](#introduction) |
|
||||
| [top](#objects) | :blue_book: | `:blue_book:` | :orange_book: | `:orange_book:` | [top](#introduction) |
|
||||
| [top](#objects) | :books: | `:books:` | :notebook: | `:notebook:` | [top](#introduction) |
|
||||
| [top](#objects) | :ledger: | `:ledger:` | :page_with_curl: | `:page_with_curl:` | [top](#introduction) |
|
||||
@@ -1142,7 +1142,7 @@ GitHub [custom emoji] are not supported.
|
||||
|
||||
| | ico | shortcode | ico | shortcode | |
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#objects) | :envelope: | `:envelope:` | :e-mail: | `:e-mail:` <br /> `:email:` | [top](#introduction) |
|
||||
| [top](#objects) | :envelope: | `:envelope:` | :e-mail: | `:e-mail:` `:email:` | [top](#introduction) |
|
||||
| [top](#objects) | :incoming_envelope: | `:incoming_envelope:` | :envelope_with_arrow: | `:envelope_with_arrow:` | [top](#introduction) |
|
||||
| [top](#objects) | :outbox_tray: | `:outbox_tray:` | :inbox_tray: | `:inbox_tray:` | [top](#introduction) |
|
||||
| [top](#objects) | :package: | `:package:` | :mailbox: | `:mailbox:` | [top](#introduction) |
|
||||
@@ -1157,7 +1157,7 @@ GitHub [custom emoji] are not supported.
|
||||
| [top](#objects) | :pencil2: | `:pencil2:` | :black_nib: | `:black_nib:` | [top](#introduction) |
|
||||
| [top](#objects) | :fountain_pen: | `:fountain_pen:` | :pen: | `:pen:` | [top](#introduction) |
|
||||
| [top](#objects) | :paintbrush: | `:paintbrush:` | :crayon: | `:crayon:` | [top](#introduction) |
|
||||
| [top](#objects) | :memo: | `:memo:` <br /> `:pencil:` | | | [top](#introduction) |
|
||||
| [top](#objects) | :memo: | `:memo:` `:pencil:` | | | [top](#introduction) |
|
||||
|
||||
### Office
|
||||
|
||||
@@ -1363,7 +1363,7 @@ GitHub [custom emoji] are not supported.
|
||||
| - | :-: | - | :-: | - | - |
|
||||
| [top](#symbols) | :bangbang: | `:bangbang:` | :interrobang: | `:interrobang:` | [top](#introduction) |
|
||||
| [top](#symbols) | :question: | `:question:` | :grey_question: | `:grey_question:` | [top](#introduction) |
|
||||
| [top](#symbols) | :grey_exclamation: | `:grey_exclamation:` | :exclamation: | `:exclamation:` <br /> `:heavy_exclamation_mark:` | [top](#introduction) |
|
||||
| [top](#symbols) | :grey_exclamation: | `:grey_exclamation:` | :exclamation: | `:exclamation:` `:heavy_exclamation_mark:` | [top](#introduction) |
|
||||
| [top](#symbols) | :wavy_dash: | `:wavy_dash:` | | | [top](#introduction) |
|
||||
|
||||
### Currency
|
||||
@@ -1502,11 +1502,11 @@ GitHub [custom emoji] are not supported.
|
||||
| [top](#flags) | :ecuador: | `:ecuador:` | :estonia: | `:estonia:` | [top](#introduction) |
|
||||
| [top](#flags) | :egypt: | `:egypt:` | :western_sahara: | `:western_sahara:` | [top](#introduction) |
|
||||
| [top](#flags) | :eritrea: | `:eritrea:` | :es: | `:es:` | [top](#introduction) |
|
||||
| [top](#flags) | :ethiopia: | `:ethiopia:` | :eu: | `:eu:` <br /> `:european_union:` | [top](#introduction) |
|
||||
| [top](#flags) | :ethiopia: | `:ethiopia:` | :eu: | `:eu:` `:european_union:` | [top](#introduction) |
|
||||
| [top](#flags) | :finland: | `:finland:` | :fiji: | `:fiji:` | [top](#introduction) |
|
||||
| [top](#flags) | :falkland_islands: | `:falkland_islands:` | :micronesia: | `:micronesia:` | [top](#introduction) |
|
||||
| [top](#flags) | :faroe_islands: | `:faroe_islands:` | :fr: | `:fr:` | [top](#introduction) |
|
||||
| [top](#flags) | :gabon: | `:gabon:` | :gb: | `:gb:` <br /> `:uk:` | [top](#introduction) |
|
||||
| [top](#flags) | :gabon: | `:gabon:` | :gb: | `:gb:` `:uk:` | [top](#introduction) |
|
||||
| [top](#flags) | :grenada: | `:grenada:` | :georgia: | `:georgia:` | [top](#introduction) |
|
||||
| [top](#flags) | :french_guiana: | `:french_guiana:` | :guernsey: | `:guernsey:` | [top](#introduction) |
|
||||
| [top](#flags) | :ghana: | `:ghana:` | :gibraltar: | `:gibraltar:` | [top](#introduction) |
|
||||
|
||||
@@ -10,8 +10,6 @@ menu:
|
||||
weight: 190
|
||||
toc: true
|
||||
---
|
||||
<!-- reference: https://discourse.gohugo.io/t/lookup-order-for-partials/5705/6
|
||||
code: https://github.com/gohugoio/hugo/blob/e445c35d6a0c7f5fc2f90f31226cd1d46e048bbc/tpl/template_embedded.go#L147 -->
|
||||
|
||||
{{% note %}}
|
||||
While the following internal templates are called similar to partials, they do *not* observe the partial template lookup order.
|
||||
|
||||
@@ -466,9 +466,9 @@ Which then outputs:
|
||||
|
||||
Go considers the following characters _whitespace_:
|
||||
|
||||
* <kbd>space</kbd>
|
||||
* horizontal <kbd>tab</kbd>
|
||||
* carriage <kbd>return</kbd>
|
||||
* space
|
||||
* horizontal tab
|
||||
* carriage return
|
||||
* newline
|
||||
|
||||
## Comments
|
||||
|
||||
@@ -12,9 +12,6 @@ toc: true
|
||||
aliases: [/taxonomies/displaying/,/templates/terms/,/indexes/displaying/,/taxonomies/templates/,/indexes/ordering/, /templates/taxonomies/, /templates/taxonomy/]
|
||||
---
|
||||
|
||||
<!-- NOTE! Check on https://github.com/gohugoio/hugo/issues/2826 for shifting of terms' pages to .Data.Pages AND
|
||||
https://discourse.gohugo.io/t/how-to-specify-category-slug/4856/15 for original discussion.-->
|
||||
|
||||
Hugo includes support for user-defined groupings of content called **taxonomies**. Taxonomies are classifications that demonstrate logical relationships between content. See [Taxonomies under Content Management](/content-management/taxonomies) if you are unfamiliar with how Hugo leverages this powerful feature.
|
||||
|
||||
Hugo provides multiple ways to use taxonomies throughout your project templates:
|
||||
@@ -118,8 +115,6 @@ If you need to display custom metadata for each taxonomy term, you will need to
|
||||
</ul>
|
||||
```
|
||||
|
||||
<!-- Begin /taxonomies/ordering/ -->
|
||||
|
||||
## Order taxonomies
|
||||
|
||||
Taxonomies can be ordered by either alphabetical key or by the number of content pieces assigned to that key.
|
||||
@@ -134,8 +129,6 @@ Taxonomies can be ordered by either alphabetical key or by the number of content
|
||||
</ul>
|
||||
```
|
||||
|
||||
<!-- [See Also Taxonomy Lists](/templates/list/) -->
|
||||
|
||||
## Order content within taxonomies
|
||||
|
||||
Hugo uses both `date` and `weight` to order content within taxonomies.
|
||||
@@ -170,8 +163,6 @@ With this the same piece of content can appear in different positions in differe
|
||||
|
||||
Currently taxonomies only support the default ordering of content which is weight -> date.
|
||||
|
||||
<!-- Begin /taxonomies/templates/ -->
|
||||
|
||||
There are two different templates that the use of taxonomies will require you to provide.
|
||||
|
||||
Both templates are covered in detail in the templates section.
|
||||
@@ -181,8 +172,6 @@ A [list template](/templates/lists/) is any template that will be used to render
|
||||
A [taxonomy template](/templates/taxonomy-templates/) is a template used to
|
||||
generate the list of terms for a given template.
|
||||
|
||||
<!-- Begin /taxonomies/displaying/ -->
|
||||
|
||||
There are four common ways you can display the data in your
|
||||
taxonomies in addition to the automatic taxonomy pages created by hugo
|
||||
using the [list templates](/templates/lists/):
|
||||
|
||||
@@ -0,0 +1,374 @@
|
||||
{{- /*
|
||||
Renders the given image using the given filter, if any.
|
||||
|
||||
@param {string} src The path to the image which must be a remote, page, or global resource.
|
||||
@param {string} [filter] The filter to apply to the image (case-insensitive).
|
||||
@param {string} [filterArgs] A comma-delimited list of arguments to pass to the filter.
|
||||
@param {bool} [example=false] If true, renders a before/after example.
|
||||
@param {int} [exampleWidth=384] Image width, in pixels, when rendering a before/after example.
|
||||
|
||||
@returns {template.HTML}
|
||||
|
||||
@examples
|
||||
|
||||
{{< img src="zion-national-park.jpg" >}}
|
||||
|
||||
{{< img src="zion-national-park.jpg" alt="Zion National Park" >}}
|
||||
|
||||
{{< img
|
||||
src="zion-national-park.jpg"
|
||||
alt="Zion National Park"
|
||||
filter="grayscale"
|
||||
>}}
|
||||
|
||||
{{< img
|
||||
src="zion-national-park.jpg"
|
||||
alt="Zion National Park"
|
||||
filter="process"
|
||||
filterArgs="resize 400x webp"
|
||||
>}}
|
||||
|
||||
{{< img
|
||||
src="zion-national-park.jpg"
|
||||
alt="Zion National Park"
|
||||
filter="colorize"
|
||||
filterArgs="180,50,20"
|
||||
>}}
|
||||
|
||||
{{< img
|
||||
src="zion-national-park.jpg"
|
||||
alt="Zion National Park"
|
||||
filter="grayscale"
|
||||
example=true
|
||||
>}}
|
||||
|
||||
{{< img
|
||||
src="zion-national-park.jpg"
|
||||
alt="Zion National Park"
|
||||
filter="grayscale"
|
||||
example=true
|
||||
exampleWidth=400
|
||||
>}}
|
||||
|
||||
When using the text filter, provide the arguments in this order:
|
||||
|
||||
0. The text
|
||||
1. The horizontal offset, in pixels, relative to the left of the image (default 20)
|
||||
2. The vertical offset, in pixels, relative to the top of the image (default 20)
|
||||
3. The font size in pixels (default 64)
|
||||
4. The line height (default 1.2)
|
||||
5. The font color (default #ffffff)
|
||||
|
||||
{{< img
|
||||
src="images/examples/zion-national-park.jpg"
|
||||
alt="Zion National Park"
|
||||
filter="Text"
|
||||
filterArgs="Zion National Park,25,250,56"
|
||||
example=true
|
||||
>}}
|
||||
|
||||
When using the padding filter, provide all arguments in this order:
|
||||
|
||||
0. Padding top
|
||||
1. Padding right
|
||||
2. Padding bottom
|
||||
3. Padding right
|
||||
4. Canvas color
|
||||
|
||||
{{< img
|
||||
src="images/examples/zion-national-park.jpg"
|
||||
alt="Zion National Park"
|
||||
filter="Padding"
|
||||
filterArgs="20,50,20,50,#0705"
|
||||
example=true
|
||||
>}}
|
||||
|
||||
*/}}
|
||||
|
||||
{{- /* Initialize. */}}
|
||||
{{- $alt := "" }}
|
||||
{{- $src := "" }}
|
||||
{{- $filter := "" }}
|
||||
{{- $filterArgs := slice }}
|
||||
{{- $example := false }}
|
||||
{{- $exampleWidth := 384 }}
|
||||
|
||||
{{- /* Default values to use with the text filter. */}}
|
||||
{{ $textFilterOpts := dict
|
||||
"xOffset" 20
|
||||
"yOffset" 20
|
||||
"fontSize" 64
|
||||
"lineHeight" 1.2
|
||||
"fontColor" "#ffffff"
|
||||
"fontPath" "https://github.com/google/fonts/raw/main/apache/roboto/static/Roboto-Regular.ttf"
|
||||
}}
|
||||
|
||||
{{- /* Get and validate parameters. */}}
|
||||
{{- with .Get "alt" }}
|
||||
{{- $alt = .}}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Get "src" }}
|
||||
{{- $src = . }}
|
||||
{{- else }}
|
||||
{{- errorf "The %q shortcode requires a file parameter. See %s" .Name .Position }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Get "filter" }}
|
||||
{{- $filter = . | lower }}
|
||||
{{- end }}
|
||||
|
||||
{{- $validFilters := slice
|
||||
"brightness" "colorbalance" "colorize" "contrast" "gamma" "gaussianblur"
|
||||
"grayscale" "hue" "invert" "none" "opacity" "overlay" "padding" "pixelate"
|
||||
"process" "saturation" "sepia" "sigmoid" "text" "unsharpmask"
|
||||
}}
|
||||
|
||||
{{- with $filter }}
|
||||
{{- if not (in $validFilters .) }}
|
||||
{{- errorf "The filter passed to the %q shortcode is invalid. The filter must be one of %s. See %s" $.Name (delimit $validFilters ", " ", or ") $.Position }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Get "filterArgs" }}
|
||||
{{- $filterArgs = split . "," }}
|
||||
{{- $filterArgs = apply $filterArgs "trim" "." " " }}
|
||||
{{- end }}
|
||||
|
||||
{{- if in (slice "false" false 0) (.Get "example") }}
|
||||
{{- $example = false }}
|
||||
{{- else if in (slice "true" true 1) (.Get "example")}}
|
||||
{{- $example = true }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Get "exampleWidth" }}
|
||||
{{- $exampleWidth = . | int }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Get image. */}}
|
||||
{{- $ctx := dict "page" .Page "src" $src "name" .Name "position" .Position }}
|
||||
{{- $i := partial "inline/get-resource.html" $ctx }}
|
||||
|
||||
{{- /* Resize if rendering before/after examples. */}}
|
||||
{{- if $example }}
|
||||
{{- $i = $i.Resize (printf "%dx" $exampleWidth) }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Create filter. */}}
|
||||
{{- $f := "" }}
|
||||
{{- $ctx := dict "filter" $filter "args" $filterArgs "name" .Name "position" .Position }}
|
||||
{{- if eq $filter "brightness" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $filterArgs = apply $filterArgs "float" "." }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" -100 "max" 100) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $f = images.Brightness (index $filterArgs 0) }}
|
||||
{{- else if eq $filter "colorbalance" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 3) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $filterArgs = apply $filterArgs "float" "." }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "percentage red" "argValue" (index $filterArgs 0) "min" -100 "max" 500) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "percentage green" "argValue" (index $filterArgs 1) "min" -100 "max" 500) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "percentage blue" "argValue" (index $filterArgs 2) "min" -100 "max" 500) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $f = images.ColorBalance (index $filterArgs 0) (index $filterArgs 1) (index $filterArgs 2) }}
|
||||
{{- else if eq $filter "colorize" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 3) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $filterArgs = apply $filterArgs "float" "." }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "hue" "argValue" (index $filterArgs 0) "min" 0 "max" 360) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "saturation" "argValue" (index $filterArgs 1) "min" 0 "max" 100) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 2) "min" 0 "max" 100) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $f = images.Colorize (index $filterArgs 0) (index $filterArgs 1) (index $filterArgs 2) }}
|
||||
{{- else if eq $filter "contrast" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $filterArgs = apply $filterArgs "float" "." }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" -100 "max" 100) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $f = images.Contrast (index $filterArgs 0) }}
|
||||
{{- else if eq $filter "gamma" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $filterArgs = apply $filterArgs "float" "." }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "gamma" "argValue" (index $filterArgs 0) "min" 0 "max" 100) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $f = images.Gamma (index $filterArgs 0) }}
|
||||
{{- else if eq $filter "gaussianblur" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $filterArgs = apply $filterArgs "float" "." }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "sigma" "argValue" (index $filterArgs 0) "min" 0 "max" 1000) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $f = images.GaussianBlur (index $filterArgs 0) }}
|
||||
{{- else if eq $filter "grayscale" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 0) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $f = images.Grayscale }}
|
||||
{{- else if eq $filter "hue" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $filterArgs = apply $filterArgs "float" "." }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "shift" "argValue" (index $filterArgs 0) "min" -180 "max" 180) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $f = images.Hue (index $filterArgs 0) }}
|
||||
{{- else if eq $filter "invert" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 0) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $f = images.Invert }}
|
||||
{{- else if eq $filter "opacity" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $filterArgs = apply $filterArgs "float" "." }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "opacity" "argValue" (index $filterArgs 0) "min" 0 "max" 1) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $f = images.Opacity (index $filterArgs 0) }}
|
||||
{{- else if eq $filter "overlay" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 3) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $ctx := dict "src" (index $filterArgs 0) "name" .Name "position" .Position }}
|
||||
{{- $overlayImg := partial "inline/get-resource.html" $ctx }}
|
||||
{{- $f = images.Overlay $overlayImg (index $filterArgs 1 | float ) (index $filterArgs 2 | float) }}
|
||||
{{- else if eq $filter "padding" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 5) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $f = images.Padding
|
||||
(index $filterArgs 0 | int)
|
||||
(index $filterArgs 1 | int)
|
||||
(index $filterArgs 2 | int)
|
||||
(index $filterArgs 3 | int)
|
||||
(index $filterArgs 4)
|
||||
}}
|
||||
{{- else if eq $filter "pixelate" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $filterArgs = apply $filterArgs "float" "." }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "size" "argValue" (index $filterArgs 0) "min" 0 "max" 1000) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $f = images.Pixelate (index $filterArgs 0) }}
|
||||
{{- else if eq $filter "process" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $f = images.Process (index $filterArgs 0) }}
|
||||
{{- else if eq $filter "saturation" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $filterArgs = apply $filterArgs "float" "." }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" -100 "max" 500) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $f = images.Saturation (index $filterArgs 0) }}
|
||||
{{- else if eq $filter "sepia" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $filterArgs = apply $filterArgs "float" "." }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" 0 "max" 100) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $f = images.Sepia (index $filterArgs 0) }}
|
||||
{{- else if eq $filter "sigmoid" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 2) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $filterArgs = apply $filterArgs "float" "." }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "midpoint" "argValue" (index $filterArgs 0) "min" 0 "max" 1) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "factor" "argValue" (index $filterArgs 1) "min" -10 "max" 10) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $f = images.Sigmoid (index $filterArgs 0) (index $filterArgs 1) }}
|
||||
{{- else if eq $filter "text" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $ctx := dict "src" $textFilterOpts.fontPath "name" .Name "position" .Position }}
|
||||
{{- $font := or (partial "inline/get-resource.html" $ctx) }}
|
||||
{{- $fontSize := or (index $filterArgs 3 | int) $textFilterOpts.fontSize }}
|
||||
{{- $lineHeight := math.Max (or (index $filterArgs 4 | float) $textFilterOpts.lineHeight) 1 }}
|
||||
{{- $opts := dict
|
||||
"x" (or (index $filterArgs 1 | int) $textFilterOpts.xOffset)
|
||||
"y" (or (index $filterArgs 2 | int) $textFilterOpts.yOffset)
|
||||
"size" $fontSize
|
||||
"linespacing" (mul (sub $lineHeight 1) $fontSize)
|
||||
"color" (or (index $filterArgs 5) $textFilterOpts.fontColor)
|
||||
"font" $font
|
||||
}}
|
||||
{{- $f = images.Text (index $filterArgs 0) $opts }}
|
||||
{{- else if eq $filter "unsharpmask" }}
|
||||
{{- $ctx = merge $ctx (dict "argsRequired" 3) }}
|
||||
{{- template "validate-arg-count" $ctx }}
|
||||
{{- $filterArgs = apply $filterArgs "float" "." }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "sigma" "argValue" (index $filterArgs 0) "min" 0 "max" 500) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "amount" "argValue" (index $filterArgs 1) "min" 0 "max" 100) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $ctx = merge $ctx (dict "argName" "threshold" "argValue" (index $filterArgs 2) "min" 0 "max" 1) }}
|
||||
{{- template "validate-arg-value" $ctx }}
|
||||
{{- $f = images.UnsharpMask (index $filterArgs 0) (index $filterArgs 1) (index $filterArgs 2) }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Apply filter. */}}
|
||||
{{- $fi := $i }}
|
||||
{{- with $f }}
|
||||
{{- $fi = $i.Filter . }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Render. */}}
|
||||
{{- if $example }}
|
||||
<p>Original</p>
|
||||
<img class='di ba b--black-20' style="width: initial;" src="{{ $i.RelPermalink }}" alt="{{ $alt }}">
|
||||
<p>Processed</p>
|
||||
<img class='di ba b--black-20' style="width: initial;" src="{{ $fi.RelPermalink }}" alt="{{ $alt }}">
|
||||
{{- else -}}
|
||||
<img class='di' style="width: initial;" src="{{ $fi.RelPermalink }}" alt="{{ $alt }}">
|
||||
{{- end }}
|
||||
|
||||
{{- define "validate-arg-count" }}
|
||||
{{- $msg := "When using the %q filter, the %q shortcode requires an args parameter with %d %s. See %s" }}
|
||||
{{- if lt (len .args) .argsRequired }}
|
||||
{{- $text := "values" }}
|
||||
{{- if eq 1 .argsRequired }}
|
||||
{{- $text = "value" }}
|
||||
{{- end }}
|
||||
{{- errorf $msg .filter .name .argsRequired $text .position }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "validate-arg-value" }}
|
||||
{{- $msg := "The %q argument passed to the %q shortcode is invalid. Expected a value in the range [%v,%v], but received %v. See %s" }}
|
||||
{{- if or (lt .argValue .min) (gt .argValue .max) }}
|
||||
{{- errorf $msg .argName .name .min .max .argValue .position }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "partials/inline/get-resource.html" }}
|
||||
{{- $r := "" }}
|
||||
{{- $u := urls.Parse .src }}
|
||||
{{- $msg := "The %q shortcode was unable to resolve %s. See %s" }}
|
||||
{{- if $u.IsAbs }}
|
||||
{{- with resources.GetRemote $u.String }}
|
||||
{{- with .Err }}
|
||||
{{- errorf "%s" }}
|
||||
{{- else }}
|
||||
{{- /* This is a remote resource. */}}
|
||||
{{- $r = . }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- errorf $msg $.name $u.String $.position }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- with .page.Resources.Get (strings.TrimPrefix "./" $u.Path) }}
|
||||
{{- /* This is a page resource. */}}
|
||||
{{- $r = . }}
|
||||
{{- else }}
|
||||
{{- with resources.Get $u.Path }}
|
||||
{{- /* This is a global resource. */}}
|
||||
{{- $r = . }}
|
||||
{{- else }}
|
||||
{{- errorf $msg $.name $u.Path $.position }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $r}}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user