From 58029627df29c1c316c13ebb0e582a3664856deb Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sat, 22 Aug 2020 20:21:28 -0400 Subject: [PATCH 01/15] Fix erroneous example code piping to if Fixes #1192 --- content/en/templates/shortcode-templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/templates/shortcode-templates.md b/content/en/templates/shortcode-templates.md index ac0de0ab2..19ec6dea9 100644 --- a/content/en/templates/shortcode-templates.md +++ b/content/en/templates/shortcode-templates.md @@ -95,7 +95,7 @@ For the second position, you would just use: most helpful when the condition depends on either of the values, or both: ``` -{{ or .Get "title" | .Get "alt" | if }} alt="{{ with .Get "alt"}}{{.}}{{else}}{{.Get "title"}}{{end}}"{{ end }} +{{ if or (.Get "title") (.Get "alt") }} alt="{{ with .Get "alt"}}{{.}}{{else}}{{.Get "title"}}{{end}}"{{ end }} ``` #### `.Inner` From dfe28ceb54dfd5c24842d1c8e018cbd95270b373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20Mass=C3=A9?= Date: Tue, 25 Aug 2020 10:11:14 +0200 Subject: [PATCH 02/15] Improve mounts module config Improve docs as per this message https://discourse.gohugo.io/t/module-mounts-incompatible-with-postcss-import/26881/2 --- content/en/hugo-modules/configuration.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/content/en/hugo-modules/configuration.md b/content/en/hugo-modules/configuration.md index 4106b3937..c97e8d5a2 100644 --- a/content/en/hugo-modules/configuration.md +++ b/content/en/hugo-modules/configuration.md @@ -91,11 +91,14 @@ disable ## Module Config: mounts {{% note %}} -When the `mounts` config was introduced in Hugo 0.56.0, we were careful to preserve the existing `staticDir` and similar configuration to make sure all existing sites just continued to work. - -But you should not have both. So if you add a `mounts` section you should make it complete and remove the old `staticDir` etc. settings. +When the `mounts` config was introduced in Hugo 0.56.0, we were careful to preserve the existing `staticDir` and similar configuration to make sure all existing sites just continued to work. But you should not have both: if you add a `mounts` section you should remove the old `staticDir` etc. settings. {{% /note %}} +{{% warning %}} +When you add a mount, the default mount for the concerned target root is ignored: be sure to explicitly add it. +{{% /warning %}} + +**Default mounts** {{< code-toggle file="config">}} [module] [[module.mounts]] From f0882bc14ae1d667277f11291208cef185d394c7 Mon Sep 17 00:00:00 2001 From: Carlin MacKenzie Date: Tue, 25 Aug 2020 17:44:41 +0100 Subject: [PATCH 03/15] Remove note that has been outdated by v0.71.0 It's contradicted two lines above :) > You can also create type/section specific hooks in `layouts/[type/section]/_markup`, e.g.: `layouts/blog/_markup`.{{< new-in "0.71.0" >}} --- content/en/getting-started/configuration-markup.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/en/getting-started/configuration-markup.md b/content/en/getting-started/configuration-markup.md index 99d1e989d..8b2011f8b 100644 --- a/content/en/getting-started/configuration-markup.md +++ b/content/en/getting-started/configuration-markup.md @@ -95,7 +95,7 @@ The features currently supported are: * `link` * `heading` {{< new-in "0.71.0" >}} -You can define [Output-Format-](/templates/output-formats) and [language-](/content-management/multilingual/)specific templates if needed.[^hooktemplate] Your `layouts` folder may look like this: +You can define [Output-Format-](/templates/output-formats) and [language-](/content-management/multilingual/)specific templates if needed. Your `layouts` folder may look like this: ```bash layouts @@ -194,5 +194,3 @@ The rendered html will be ```html

Section A

``` - -[^hooktemplate]: It's currently only possible to have one set of render hook templates, e.g. not per `Type` or `Section`. We may consider that in a future version. From 252435a950b7e94d3f0500cadb428bff73a44809 Mon Sep 17 00:00:00 2001 From: ngdangtu <68631458+ngdangtu-vn@users.noreply.github.com> Date: Thu, 27 Aug 2020 01:57:25 +0700 Subject: [PATCH 04/15] Rewrite Translation of Strings Let's make this item be more explicit... again? --- content/en/content-management/multilingual.md | 51 ++++++++++++++++--- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/content/en/content-management/multilingual.md b/content/en/content-management/multilingual.md index ccf794b2e..224f38d7a 100644 --- a/content/en/content-management/multilingual.md +++ b/content/en/content-management/multilingual.md @@ -316,44 +316,83 @@ See https://github.com/gohugoio/hugo/issues/3564 {{% /note %}} +### Query basic translation + From within your templates, use the `i18n` function like this: ``` {{ i18n "home" }} ``` -This uses a definition like this one in `i18n/en-US.toml`: +The function will search for the `"home"` id from `i18n/en-US.toml` file: ``` [home] other = "Home" ``` -Often you will want to use to the page variables in the translations strings. To do that, pass on the "." context when calling `i18n`: +The result will be + +``` +Home +``` + +### Query a flexible translation with variables + +Often you will want to use to the page variables in the translations strings. To do that, pass on the `.` context when calling `i18n`: ``` {{ i18n "wordCount" . }} ``` -This uses a definition like this one in `i18n/en-US.toml`: +The function will pass the `.` context to the `"wordCount"` id in `i18n/en-US.toml` file: ``` [wordCount] other = "This article has {{ .WordCount }} words." ``` -An example of singular and plural form: + +Assume `.WordCount` in the context has value is 101. The result will be: + +``` +This article has 101 words. +``` + +### Query a singular/plural translation + +In other to meet singular/plural requirement, you must pass a dictionary (map) data with a numeric `.Count` property to the `i18n` function. The below example uses `.ReadingTime` variable which has a built-in `.Count` property. + +``` +{{ i18n "readingTime" .ReadingTime }} +``` + +The function will read `.Count` from `.ReadingTime` and evaluate where the number is singular (`one`) or plural (`other`). After that, it will pass to `readingTime` id in `i18n/en-US.toml` file: ``` [readingTime] one = "One minute to read" other = "{{.Count}} minutes to read" ``` -And then in the template: + +Assume `.ReadingTime.Count` in the context has value is 525600. The result will be: ``` -{{ i18n "readingTime" .ReadingTime }} +525600 minutes to read ``` +If `.ReadingTime.Count` in the context has value is 1. The result is: + +``` +One minutes to read +``` + +In case you need to pass a custom data: (`"(dict Count" 25)` is minimum requirment) + +``` +{{ i18n "readingTime" (dict "Count" 25 "FirstArgument" true "SecondArgument" false "Etc" "so on, so far") }} +``` + + ## Customize Dates At the time of this writing, Go does not yet have support for internationalized locales for dates, but if you do some work, you can simulate it. For example, if you want to use French month names, you can add a data file like ``data/mois.yaml`` with this content: From 34f8de26de9a599e7cb5a09449fa0a20fd82721c Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Thu, 27 Aug 2020 15:55:07 -0400 Subject: [PATCH 05/15] Revise content-management/cross-references Closes #1199 --- .../en/content-management/cross-references.md | 87 ++++++++++++------- 1 file changed, 58 insertions(+), 29 deletions(-) diff --git a/content/en/content-management/cross-references.md b/content/en/content-management/cross-references.md index 21a73b861..9570a8fa4 100644 --- a/content/en/content-management/cross-references.md +++ b/content/en/content-management/cross-references.md @@ -15,31 +15,39 @@ aliases: [/extras/crossreferences/] toc: true --- - -The `ref` and `relref` shortcode resolves the absolute or relative permalink given a path to a document. +The `ref` and `relref` shortcodes display the absolute and relative permalinks to a document, respectively. ## Use `ref` and `relref` ```go-html-template +{{}} +{{}} {{}} -{{}} {{}} +{{}} {{}} {{}} +{{}} {{}} {{}} -{{}} +{{}} ``` -The single parameter to `ref` is a string with a content `documentname` (e.g., `about.md`) with or without an appended in-document `anchor` (`#who`) without spaces. Hugo is flexible in how we search for documents, so the file suffix may be omitted. +To generate a hyperlink using `ref` or `relref` in markdown: -**Paths without a leading `/` will first be tried resolved relative to the current page.** +```md +[About]({{}} "About Us") +``` -You will get an error if your document could not be uniquely resolved. The error behaviour can be configured, see below. +The `ref` and `relref` shortcodes require a single parameter: the path to a content document, with or without a file extension, with or without an anchor. + +**Paths without a leading `/` are first resolved relative to the current page, then to the remainder of the site. + +Hugo emits an error or warning if a document cannot be uniquely resolved. The error behavior is configurable; see below. ### Link to another language version -Link to another language version of a document, you need to use this syntax: +To link to another language version of a document, use this syntax: ```go-html-template {{}} @@ -47,45 +55,66 @@ Link to another language version of a document, you need to use this syntax: ### Get another Output Format -To link to a given Output Format of a document, you can use this syntax: +To link to another Output Format of a document, use this syntax: ```go-html-template {{}} ``` -### Anchors +### Heading IDs -When an `anchor` is provided by itself, the current page’s unique identifier will be appended; when an `anchor` is provided appended to `documentname`, the found page's unique identifier will be appended: +When using Markdown document types, Hugo generates element IDs for every heading on a page. For example: -```go-html-template -{{}} => #anchors:9decaf7 +```md +## Reference ``` -The above examples render as follows for this very page as well as a reference to the "Content" heading in the Hugo docs features pageyoursite +produces this HTML: -```go-html-template -{{}} => #who:9decaf7 -{{}} => /blog/post/#who:badcafe +```html +

Reference

``` -More information about document unique identifiers and headings can be found [below]({{< ref "#hugo-heading-anchors" >}}). - -## Hugo Heading Anchors - -When using Markdown document types, Hugo generates heading anchors automatically. The generated anchor for this section is `hugo-heading-anchors`. Because the heading anchors are generated automatically, Hugo takes some effort to ensure that heading anchors are unique both inside a document and across the entire site. - -Ensuring heading uniqueness across the site is accomplished with a unique identifier for each document based on its path. Unless a document is renamed or moved between sections *in the filesystem*, the unique identifier for the document will not change: `blog/post.md` will always have a unique identifier of `81df004c333b392d34a49fd3a91ba720`. - -`ref` and `relref` were added so you can make these reference links without having to know the document’s unique identifier. (The links in document tables of contents are automatically up-to-date with this value.) +Get the permalink to a heading by appending the ID to the path when using the `ref` or `relref` shortcodes: +```md +{{}} +{{}} ``` -{{}} -/content-management/cross-references/#hugo-heading-anchors:77cd9ea530577debf4ce0f28c8dca242 + +Generate a custom heading ID by including an attribute. For example: + +```md +## Reference A {#foo} +## Reference B {id="bar"} +``` + +produces this HTML: + +```html +

Reference A

+

Reference B

+``` + +Hugo will generate unique element IDs if the same heading appears more than once on a page. For example: + +```md +## Reference +## Reference +## Reference +``` + +produces this HTML: + +```html +

Reference

+

Reference

+

Reference

``` ## Ref and RelRef Configuration -The behaviour can, since Hugo 0.45, be configured in `config.toml`: +The behavior can, since Hugo 0.45, be configured in `config.toml`: refLinksErrorLevel ("ERROR") : When using `ref` or `relref` to resolve page links and a link cannot resolved, it will be logged with this log level. Valid values are `ERROR` (default) or `WARNING`. Any `ERROR` will fail the build (`exit -1`). From 42a19f479e00b3bf1297d400415889f76162b7b1 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sat, 29 Aug 2020 07:48:56 -0400 Subject: [PATCH 06/15] Fix example of output from urlize function Closes #1204 --- content/en/functions/urlize.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/content/en/functions/urlize.md b/content/en/functions/urlize.md index 0fd7c2295..0742dd029 100644 --- a/content/en/functions/urlize.md +++ b/content/en/functions/urlize.md @@ -53,8 +53,8 @@ The preceding partial would then output to the rendered page as follows, assumin {{< output file="/blog/greatest-city/index.html" >}}
-

The World's Greatest City

- +

The World's Greatest City

+
  • pizza @@ -70,4 +70,5 @@ The preceding partial would then output to the rendered page as follows, assumin {{< /output >}} + [singletemplate]: /templates/single-page-templates/ From 736bd59e0048eaa24773323fa261f9c7673afa96 Mon Sep 17 00:00:00 2001 From: Andrew Medworth Date: Mon, 31 Aug 2020 15:10:05 +0100 Subject: [PATCH 07/15] Clarify treatment of zero weights (#1207) * Clarify treatment of zero weights * than -> then * Remove null link to section and list pages --- content/en/templates/taxonomy-templates.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/content/en/templates/taxonomy-templates.md b/content/en/templates/taxonomy-templates.md index bef2d3226..15e0ff5c9 100644 --- a/content/en/templates/taxonomy-templates.md +++ b/content/en/templates/taxonomy-templates.md @@ -158,7 +158,11 @@ Hugo uses both `date` and `weight` to order content within taxonomies. Each piece of content in Hugo can optionally be assigned a date. It can also be assigned a weight for each taxonomy it is assigned to. -When iterating over content within taxonomies, the default sort is the same as that used for [section and list pages]() first by weight then by date. This means that if the weights for two pieces of content are the same, than the more recent content will be displayed first. The default weight for any piece of content is 0. +When iterating over content within taxonomies, the default sort is the same as that used for section and list pages first by weight then by date. This means that if the weights for two pieces of content are the same, then the more recent content will be displayed first. + +The default weight for any piece of content is 0. + +Weights of zero are treated specially: if two pages have unequal weights, and one of them is zero, then the zero-weighted page will always appear after the other one, regardless of the other's weight. Zero weights should thus be used with care: for example, if both positive and negative weights are used to extend a sequence in both directions, a zero-weighted page will appear not in the middle of the list, but at the end. ### Assign Weight From 2e701f8f38b9925b73960fd0af2e6d2d8d6ae312 Mon Sep 17 00:00:00 2001 From: Manas Marthi Date: Sun, 3 May 2020 00:36:23 +0100 Subject: [PATCH 08/15] Corrected the url for index function link /functions/index/ directs to _index.md . Replaced it with /functions/index-function/ --- content/en/templates/introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/templates/introduction.md b/content/en/templates/introduction.md index fb7d341df..43f88f147 100644 --- a/content/en/templates/introduction.md +++ b/content/en/templates/introduction.md @@ -646,7 +646,7 @@ Go allows you to do more than what's shown here. Using Hugo's [`where` function] [functions]: /functions/ "See the full list of Hugo's templating functions with a quick start reference guide and basic and advanced examples." [Go html/template]: https://golang.org/pkg/html/template/ "Godocs references for Go's html templating" [gohtmltemplate]: https://golang.org/pkg/html/template/ "Godocs references for Go's html templating" -[index]: /functions/index/ +[index]: /functions/index-function/ [math functions]: /functions/math/ [partials]: /templates/partials/ "Link to the partial templates page inside of the templating section of the Hugo docs" [internal_templates]: /templates/internal/ From cf87a5da2cad86ba6f9a679175b09683eba93585 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Wed, 2 Sep 2020 06:07:43 -0400 Subject: [PATCH 09/15] Update macOS tarball installation instructions (#1203) Closes #1202 --- content/en/getting-started/installing.md | 38 +++++++++++++++++------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/content/en/getting-started/installing.md b/content/en/getting-started/installing.md index f92ad21aa..28f34234c 100644 --- a/content/en/getting-started/installing.md +++ b/content/en/getting-started/installing.md @@ -261,7 +261,7 @@ Archive: hugo_X.Y_osx-64bit.tgz Hugo Static Site Generator v0.13 BuildDate: 2015-02-22T04:02:30-06:00 ``` -You may need to add your bin directory to your `PATH` variable. The `which` command will check for us. If it can find `hugo`, it will print the full path to it. Otherwise, it will not print anything. +You may need to add your bin directory to your `PATH` environment variable. The `which` command will check for us. If it can find `hugo`, it will print the full path to it. Otherwise, it will not print anything. ``` # check if hugo is in the path @@ -269,21 +269,37 @@ which hugo /Users/USERNAME/bin/hugo ``` -If `hugo` is not in your `PATH`, add it by updating your `~/.bash_profile` file. First, start up an editor: +If `hugo` is not in your `PATH`: -``` -nano ~/.bash_profile -``` +1. Determine your default shell (zsh or bash). -Add a line to update your `PATH` variable: + ``` + echo $SHELL + ``` -``` -export PATH=$PATH:$HOME/bin -``` +2. Edit your profile. -Then save the file by pressing Control-X, then Y to save the file and return to the prompt. + If your default shell is zsh: -Close the terminal and open a new terminal to pick up the changes to your profile. Verify your success by running the `which hugo` command again. + ``` + nano ~/.zprofile + ``` + + If your default shell is bash: + + ``` + nano ~/.bash_profile + ``` + +3. Insert a line to add `$HOME/bin` to your existing `PATH`. + + ``` + export PATH=$PATH:$HOME/bin + ``` + +4. Save the file by pressing Control-X, then Y. + +5. Close the terminal and open a new terminal to pick up the changes to your profile. Verify the change by running the `which hugo` command again. You've successfully installed Hugo. From a17e25d6f6d5323063f3f83d3b27485008d6e6d8 Mon Sep 17 00:00:00 2001 From: James Goldie Date: Sat, 5 Sep 2020 18:24:54 +1000 Subject: [PATCH 10/15] Update quick-start.md: move notice about drafts up --- content/en/getting-started/quick-start.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/content/en/getting-started/quick-start.md b/content/en/getting-started/quick-start.md index 0d79c3ed5..d5425062b 100644 --- a/content/en/getting-started/quick-start.md +++ b/content/en/getting-started/quick-start.md @@ -102,6 +102,10 @@ draft: true ``` +{{% note %}} +Drafts do not get deployed; once you finish a post, update the header of the post to say `draft: false`. More info [here](/getting-started/usage/#draft-future-and-expired-content). +{{% /note %}} + ## Step 5: Start the Hugo server Now, start the Hugo server with [drafts](/getting-started/usage/#draft-future-and-expired-content) enabled: @@ -171,6 +175,3 @@ hugo -D Output will be in `./public/` directory by default (`-d`/`--destination` flag to change it, or set `publishdir` in the config file). -{{% note %}} -Drafts do not get deployed; once you finish a post, update the header of the post to say `draft: false`. More info [here](/getting-started/usage/#draft-future-and-expired-content). -{{% /note %}} From d50aba8f064a48d000e2e7982268bc7b1db17138 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sat, 5 Sep 2020 10:21:10 -0400 Subject: [PATCH 11/15] Revise ref and relref function pages Closes #1212 --- content/en/functions/ref.md | 39 +++++++++++++++++----------- content/en/functions/relref.md | 46 +++++++++++++++++++++++----------- 2 files changed, 57 insertions(+), 28 deletions(-) diff --git a/content/en/functions/ref.md b/content/en/functions/ref.md index feac06c97..0ec249c61 100644 --- a/content/en/functions/ref.md +++ b/content/en/functions/ref.md @@ -1,17 +1,17 @@ --- title: ref linktitle: ref -description: Looks up a content page by logical name. +description: Returns the absolute permalink to a page. godocref: date: 2017-02-01 publishdate: 2017-02-01 -lastmod: 2019-12-28 +lastmod: 2020-09-05 categories: [functions] menu: docs: parent: "functions" keywords: [cross references, anchors] -signature: ["ref . CONTENT"] +signature: ["ref . PAGE"] workson: [] hugoversion: relatedfuncs: [relref] @@ -19,22 +19,33 @@ deprecated: false aliases: [] --- -`ref` and `relref` look up a content page by logical name (`ref`) or relative path (`relref`) to return the permalink: +This function takes two parameters: -``` +- The context of the page from which to resolve relative paths, typically the current page (`.`) +- The path to a page, with or without a file extension, with or without an anchor. A path without a leading `/` is first resolved relative to the given context, then to the remainder of the site. + +```go-html-template +{{ ref . "about" }} +{{ ref . "about#anchor" }} {{ ref . "about.md" }} +{{ ref . "about.md#anchor" }} +{{ ref . "#anchor" }} +{{ ref . "/blog/my-post" }} +{{ ref . "/blog/my-post.md" }} ``` -{{% note "Usage Note" %}} -`ref` looks up Hugo "Regular Pages" only. It can't be used for the homepage, section pages, etc. -{{% /note %}} +To return the absolute permalink to another language version of a page: -It is also possible to pass additional arguments to link to another language or an alternative output format. Therefore, pass a map of arguments instead of just the path. - -``` -{{ ref . (dict "path" "about.md" "lang" "ja" "outputFormat" "rss") }} +```go-html-template +{{ ref . (dict "path" "about.md" "lang" "fr") }} ``` -These functions are used in two of Hugo's built-in shortcodes. You can see basic usage examples of both `ref` and `relref` in the [shortcode documentation](/content-management/shortcodes/#ref-and-relref). +To return the absolute permalink to another Output Format of a page: -For an extensive explanation of how to leverage `ref` and `relref` for content management, see [Cross References](/content-management/cross-references/). +```go-html-template +{{ ref . (dict "path" "about.md" "outputFormat" "rss") }} +``` + +Hugo emits an error or warning if the page cannot be uniquely resolved. The error behavior is configurable; see [Ref and RelRef Configuration](/content-management/cross-references/#ref-and-relref-configuration). + +This function is used by Hugo's built-in [`ref`](/content-management/shortcodes/#ref-and-relref) shortcode. For a detailed explanation of how to leverage this shortcode for content management, see [Links and Cross References](/content-management/cross-references/). diff --git a/content/en/functions/relref.md b/content/en/functions/relref.md index fe5699053..18f65f1f8 100644 --- a/content/en/functions/relref.md +++ b/content/en/functions/relref.md @@ -1,17 +1,17 @@ --- title: relref -# linktitle: relref -description: Looks up a content page by relative path. +linktitle: relref +description: Returns the relative permalink to a page. godocref: date: 2017-02-01 publishdate: 2017-02-01 -lastmod: 2019-12-28 +lastmod: 2020-09-05 categories: [functions] menu: docs: parent: "functions" keywords: [cross references, anchors] -signature: ["relref . CONTENT"] +signature: ["relref . PAGE"] workson: [] hugoversion: relatedfuncs: [ref] @@ -19,22 +19,40 @@ deprecated: false aliases: [] --- -`ref` and `relref` look up a content page by logical name (`ref`) or relative path (`relref`) to return the permalink: +This function takes two parameters: -``` +- The context of the page from which to resolve relative paths, typically the current page (`.`) +- The path to a page, with or without a file extension, with or without an anchor. A path without a leading `/` is first resolved relative to the given context, then to the remainder of the site. + +```go-html-template +{{ relref . "about" }} +{{ relref . "about#anchor" }} {{ relref . "about.md" }} +{{ relref . "about.md#anchor" }} +{{ relref . "#anchor" }} +{{ relref . "/blog/my-post" }} +{{ relref . "/blog/my-post.md" }} ``` -{{% note "Usage Note" %}} -`relref` looks up Hugo "Regular Pages" only. It can't be used for the homepage, section pages, etc. -{{% /note %}} +The permalink returned is relative to the protocol+host portion of the baseURL specified in the site configuration. For example: -It is also possible to pass additional arguments to link to another language or an alternative output format. Therefore, pass a map of arguments instead of just the path. +Code|baseURL|Permalink +:--|:--|:-- +`{{ relref . "/about" }}`|`http://example.org/`|`/about/` +`{{ relref . "/about" }}`|`http://example.org/x/`|`/x/about/` -``` -{{ relref . (dict "path" "about.md" "lang" "ja" "outputFormat" "rss") }} +To return the relative permalink to another language version of a page: + +```go-html-template +{{ relref . (dict "path" "about.md" "lang" "fr") }} ``` -These functions are used in two of Hugo's built-in shortcodes. You can see basic usage examples of both `ref` and `relref` in the [shortcode documentation](/content-management/shortcodes/#ref-and-relref). +To return the relative permalink to another Output Format of a page: -For an extensive explanation of how to leverage `ref` and `relref` for content management, see [Cross References](/content-management/cross-references/). +```go-html-template +{{ relref . (dict "path" "about.md" "outputFormat" "rss") }} +``` + +Hugo emits an error or warning if the page cannot be uniquely resolved. The error behavior is configurable; see [Ref and RelRef Configuration](/content-management/cross-references/#ref-and-relref-configuration). + +This function is used by Hugo's built-in [`relref`](/content-management/shortcodes/#ref-and-relref) shortcode. For a detailed explanation of how to leverage this shortcode for content management, see [Links and Cross References](/content-management/cross-references/). From 0ae8f5c19c24d3ad2b38acc4e5f8a5f5f574e9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20=C3=85ne?= Date: Sat, 5 Sep 2020 21:52:18 +0200 Subject: [PATCH 12/15] Add instructions for using Macports Fix for #688, rewrite the text so it's clear that either MacPorts or Homebrew can be used to install Hugo. --- content/en/getting-started/quick-start.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/en/getting-started/quick-start.md b/content/en/getting-started/quick-start.md index d5425062b..28b6b039b 100644 --- a/content/en/getting-started/quick-start.md +++ b/content/en/getting-started/quick-start.md @@ -29,11 +29,13 @@ For other approaches learning Hugo like book or a video tutorial refer to the [e ## Step 1: Install Hugo {{% note %}} -`Homebrew`, a package manager for `macOS`, can be installed from [brew.sh](https://brew.sh/). See [install](/getting-started/installing) if you are running Windows etc. +`Homebrew` and `MacPorts`, package managers for `macOS`, can be installed from [brew.sh](https://brew.sh/) or [macports.org](https://www.macports.org/) respectively. See [install](/getting-started/installing) if you are running Windows etc. {{% /note %}} ```bash brew install hugo +# or +port install hugo ``` To verify your new install: From 5cd9ca4b23a27ea08c1e17d82765c40b07b0de79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20=C3=85ne?= Date: Sun, 6 Sep 2020 00:00:21 +0200 Subject: [PATCH 13/15] Mention MacPorts also on the Installing page (#1215) * Add instructions for using Macports Fix for #688, rewrite the text so it's clear that either MacPorts or Homebrew can be used to install Hugo. * Add MacPorts to Getting Started page * Update Pick Your Method section to include MacPorts --- content/en/getting-started/installing.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/content/en/getting-started/installing.md b/content/en/getting-started/installing.md index 28f34234c..ae3fe7f9a 100644 --- a/content/en/getting-started/installing.md +++ b/content/en/getting-started/installing.md @@ -58,6 +58,14 @@ brew install hugo For more detailed explanations, read the installation guides that follow for installing on macOS and Windows. +### MacPorts (macOS) + +If you are on macOS and using [MacPorts][macports], you can install Hugo with the following one-liner: + +{{< code file="install-with-macports.sh" >}} +port install hugo +{{< /code >}} + ### Homebrew (Linux) If you are using [Homebrew][linuxbrew] on Linux, you can install Hugo with the following one-liner: @@ -133,7 +141,7 @@ If you are a Windows user, substitute the `$HOME` environment variable above wit There are three ways to install Hugo on your Mac -1. The [Homebrew][brew] `brew` utility +1. A package manager, like [Homebrew][brew] (`brew`) or [MacPorts][macports] (`port`) 2. Distribution (i.e., tarball) 3. Building from Source @@ -143,7 +151,7 @@ There is no "best" way to install Hugo on your Mac. You should use the method th There are pros and cons to each of the aforementioned methods: -1. **Homebrew.** Homebrew is the simplest method and will require the least amount of work to maintain. The drawbacks aren't severe. The default package will be for the most recent release, so it will not have bug fixes until the next release (i.e., unless you install it with the `--HEAD` option). Hugo `brew` releases may lag a few days behind because it has to be coordinated with another team. Nevertheless, `brew` is the recommended installation method if you want to work from a stable, widely used source. Brew works well and is easy to update. +1. **Package Manager.** Using a package manager is the simplest method and will require the least amount of work to maintain. The drawbacks aren't severe. The default package will be for the most recent release, so it will not have bug fixes until the next release (i.e., unless you install it with the `--HEAD` option in Homebrew). Releases may lag a few days behind because it has to be coordinated with another team. Nevertheless, this is the recommended installation method if you want to work from a stable, widely used source. Package managers work well and they are easy to update. 2. **Tarball.** Downloading and installing from the tarball is also easy, although it requires a few more command line skills than does Homebrew. Updates are easy as well: you just repeat the process with the new binary. This gives you the flexibility to have multiple versions on your computer. If you don't want to use `brew`, then the tarball/binary is a good choice. @@ -532,6 +540,7 @@ Upgrading Hugo is as easy as downloading and replacing the executable you’ve p Now that you've installed Hugo, read the [Quick Start guide][quickstart] and explore the rest of the documentation. If you have questions, ask the Hugo community directly by visiting the [Hugo Discussion Forum][forum]. [brew]: https://brew.sh/ +[macports]: https://www.macports.org/ [Chocolatey]: https://chocolatey.org/ [content]: /content-management/ [@dhersam]: https://github.com/dhersam From a068bcf5cbc5faeaf8c9ad0165b2476a1f918efd Mon Sep 17 00:00:00 2001 From: lbischof <1837725+lbischof@users.noreply.github.com> Date: Sun, 6 Sep 2020 11:35:59 +0200 Subject: [PATCH 14/15] Ace and Amber support was removed with #6609 --- content/en/about/features.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/en/about/features.md b/content/en/about/features.md index 9c8fac4f4..11f9f65b7 100644 --- a/content/en/about/features.md +++ b/content/en/about/features.md @@ -51,13 +51,11 @@ toc: true * Integrated [Disqus][] comment support * Integrated [Google Analytics][] support * Automatic [RSS][] creation -* Support for [Go][], [Amber], and [Ace][] HTML templates +* Support for [Go][] HTML templates * [Syntax highlighting][] powered by [Chroma][] -[Ace]: /templates/alternatives/ [aliases]: /content-management/urls/#aliases -[Amber]: https://github.com/eknkc/amber [Chroma]: https://github.com/alecthomas/chroma [content summaries]: /content-management/summaries/ [content types]: /content-management/types/ From d3eb97a3328f5390801bbce017233ce895fc2d28 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Mon, 7 Sep 2020 08:23:08 -0400 Subject: [PATCH 15/15] Document .IsSection page variable * Document .IsSection page variable Closes #760 * Describe what it is rather than what it is not --- content/en/variables/page.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/en/variables/page.md b/content/en/variables/page.md index ec19f85c4..d108636d5 100644 --- a/content/en/variables/page.md +++ b/content/en/variables/page.md @@ -72,6 +72,9 @@ See [`.Scratch`](/functions/scratch/) for page-scoped, writable variables. .IsPage : always `true` for regular content pages. +.IsSection +: `true` if [`.Kind`](/templates/section-templates/#page-kinds) is `section`. + .IsTranslated : `true` if there are translations to display.