From d758ef94a7060477d553471d32d89e593b39ae9c Mon Sep 17 00:00:00 2001 From: Ricardo N Feliciano Date: Mon, 24 Sep 2018 18:06:29 -0400 Subject: [PATCH 1/5] hugolib: Introduce Page.NextPage and Page.PrevPage Introduce new page position variables in order to fix the ordering issue of `.Next` and `.Prev` while also allowing an upgrade path via deprecation. `.NextInSection` becomes `.NextPageInSection`. `.PrevInSection` becomes `.PrevPageInSection`. `.Next` becomes a function returning `.PrevPage`. `.Prev` becomes a function returning `.NextPage`. Fixes #1061 --- content/en/variables/page.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/content/en/variables/page.md b/content/en/variables/page.md index 7be94a67b..95c75dec8 100644 --- a/content/en/variables/page.md +++ b/content/en/variables/page.md @@ -96,11 +96,14 @@ See also `.ExpiryDate`, `.Date`, `.PublishDate`, and [`.GitInfo`][gitinfo]. .LinkTitle : access when creating links to the content. If set, Hugo will use the `linktitle` from the front matter before `title`. -.Next -: pointer to the following content (based on the `publishdate` field in front matter). +.Next (deprecated) +: In older Hugo versions this pointer went the wrong direction. Please use `.PrevPage` instead. + +.NextPage +: Pointer to the next [regular page](/variables/site/#site-pages) (sorted by Hugo's [default sort](/templates/lists#default-weight-date-linktitle-filepath)). Example: `{{if .NextPage}}{{.NextPage.Permalink}}{{end}}`. .NextInSection -: pointer to the following content within the same section (based on `publishdate` field in front matter). +: Pointer to the next [regular page](/variables/site/#site-pages) within the same section. Pages are sorted by Hugo's [default sort](/templates/lists#default-weight-date-linktitle-filepath). Example: `{{if .NextInSection}}{{.NextInSection.Permalink}}{{end}}`. .OutputFormats : contains all formats, including the current format, for a given page. Can be combined the with [`.Get` function](/functions/get/) to grab a specific format. (See [Output Formats](/templates/output-formats/).) @@ -118,11 +121,14 @@ See also `.ExpiryDate`, `.Date`, `.PublishDate`, and [`.GitInfo`][gitinfo]. .PlainWords : the Page content stripped of HTML as a `[]string` using Go's [`strings.Fields`](https://golang.org/pkg/strings/#Fields) to split `.Plain` into a slice. -.Prev -: Pointer to the previous content (based on `publishdate` in front matter). +.Prev (deprecated) +: In older Hugo versions this pointer went the wrong direction. Please use `.NextPage` instead. + +.PrevPage +: Pointer to the previous [regular page](/variables/site/#site-pages) (sorted by Hugo's [default sort](/templates/lists#default-weight-date-linktitle-filepath)). Example: `{{if .PrevPage}}{{.PrevPage.Permalink}}{{end}}`. .PrevInSection -: Pointer to the previous content within the same section (based on `publishdate` in front matter). For example, `{{if .PrevInSection}}{{.PrevInSection.Permalink}}{{end}}`. +: Pointer to the previous [regular page](/variables/site/#site-pages) within the same section. Pages are sorted by Hugo's [default sort](/templates/lists#default-weight-date-linktitle-filepath). Example: `{{if .PrevInSection}}{{.PrevInSection.Permalink}}{{end}}`. .PublishDate : the date on which the content was or will be published; `.Publishdate` pulls from the `publishdate` field in a content's front matter. See also `.ExpiryDate`, `.Date`, and `.Lastmod`. From fd1cde5ea27bad3dacefdcc396c64aa499e118ce Mon Sep 17 00:00:00 2001 From: Cameron Moore Date: Tue, 2 Oct 2018 09:41:48 -0500 Subject: [PATCH 2/5] tpl: Add a delimiter parameter to lang.NumFmt The original implementation of NumFmt did not take into account that the options delimiter (a space) could be a valid option. Adding a delim parameter seems like the simplest, safest, and most flexible way to solve this oversight in a backwards-compatible way. Fixes #5260 --- content/en/functions/NumFmt.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/content/en/functions/NumFmt.md b/content/en/functions/NumFmt.md index 795eaaea8..1bc07abd5 100644 --- a/content/en/functions/NumFmt.md +++ b/content/en/functions/NumFmt.md @@ -12,7 +12,7 @@ menu: docs: parent: "functions" toc: false -signature: ["lang.NumFmt PRECISION NUMBER [OPTIONS]"] +signature: ["lang.NumFmt PRECISION NUMBER [OPTIONS [DELIMITER]]"] workson: [] hugoversion: relatedfuncs: [] @@ -22,7 +22,9 @@ aliases: [] comments: --- -The default options value is `- . ,`. +The default options value is `- . ,`. The default delimiter within the options +value is a space. If you need to use a space as one of the options, set a +custom delimiter. Numbers greater than or equal to 5 are rounded up. For example, if precision is set to `0`, `1.5` becomes `2`, and `1.4` becomes `1`. @@ -31,5 +33,6 @@ Numbers greater than or equal to 5 are rounded up. For example, if precision is {{ lang.NumFmt 2 12345.6789 "- , ." }} → 12.345,68 {{ lang.NumFmt 0 -12345.6789 "- . ," }} → -12,346 {{ lang.NumFmt 6 -12345.6789 "- ." }} → -12345.678900 +{{ lang.NumFmt 6 -12345.6789 "-|.| " "|" }} → -1 2345.678900 {{ -98765.4321 | lang.NumFmt 2 }} → -98,765.43 ``` From ae40c89c75d8e18d2be38c325101f572272ec01a Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Wed, 10 Oct 2018 10:36:37 +0000 Subject: [PATCH 3/5] releaser: Bump versions for release of 0.49.1 [ci skip] --- config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.toml b/config.toml index 22790b8b5..f54bc7f92 100644 --- a/config.toml +++ b/config.toml @@ -69,7 +69,7 @@ twitter = "GoHugoIO" [params] description = "The world’s fastest framework for building websites" ## Used for views in rendered HTML (i.e., rather than using the .Hugo variable) - release = "0.49" + release = "0.49.1" ## Setting this to true will add a "noindex" to *EVERY* page on the site removefromexternalsearch = false ## Gh repo for site footer (include trailing slash) From bbee7e9d3e1352ee3703c9340c7a13efe7326bfb Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Wed, 10 Oct 2018 10:36:37 +0000 Subject: [PATCH 4/5] releaser: Add release notes to /docs for release of 0.49.1 [ci skip] --- content/en/news/0.49.1-relnotes/index.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 content/en/news/0.49.1-relnotes/index.md diff --git a/content/en/news/0.49.1-relnotes/index.md b/content/en/news/0.49.1-relnotes/index.md new file mode 100644 index 000000000..9327a7060 --- /dev/null +++ b/content/en/news/0.49.1-relnotes/index.md @@ -0,0 +1,24 @@ + +--- +date: 2018-10-10 +title: "0.49.1" +description: "0.49.1" +categories: ["Releases"] +images: +- images/blog/hugo-bug-poster.png + +--- + + + +This is a bug-fix release with a 2 related fixed. This was introduced in Hugo 0.49. The most notable error situation was that `resources.Concat` could fail in some situations. + + +* Fix handling of different interface types in Slice [e2201ef1](https://github.com/gohugoio/hugo/commit/e2201ef15fdefe257ad284b2df4ccc8f8c38fac2) [@bep](https://github.com/bep) [#5269](https://github.com/gohugoio/hugo/issues/5269) + +* Improve append in Scratch [23f48c30](https://github.com/gohugoio/hugo/commit/23f48c300cb5ffe0fe43c88464f38c68831a17ad) [@bep](https://github.com/bep) [#5275](https://github.com/gohugoio/hugo/issues/5275) + + + + + From 74d2f3a6f1c4a1dbc271654d9a32c7a90d94cb60 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Wed, 10 Oct 2018 10:38:45 +0000 Subject: [PATCH 5/5] releaser: Prepare repository for 0.50-DEV [ci skip] --- config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.toml b/config.toml index f54bc7f92..054ccab56 100644 --- a/config.toml +++ b/config.toml @@ -69,7 +69,7 @@ twitter = "GoHugoIO" [params] description = "The world’s fastest framework for building websites" ## Used for views in rendered HTML (i.e., rather than using the .Hugo variable) - release = "0.49.1" + release = "0.50-DEV" ## Setting this to true will add a "noindex" to *EVERY* page on the site removefromexternalsearch = false ## Gh repo for site footer (include trailing slash)