From 857b0b26a5fb931bfcedaef83d838f4d98242982 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Thu, 28 Jun 2018 12:38:48 +0000 Subject: [PATCH 01/16] releaser: Prepare repository for 0.43-DEV [ci skip] --- config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.toml b/config.toml index 61864c64f..1c9307a35 100644 --- a/config.toml +++ b/config.toml @@ -70,7 +70,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.42.2" + release = "0.43-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) From 37cc522613dd1ae55092f2265a8c29f3f4b7080e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 6 Jul 2018 14:12:10 +0200 Subject: [PATCH 02/16] Add a newScratch template func Fixes #4685 --- content/en/functions/scratch.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/en/functions/scratch.md b/content/en/functions/scratch.md index 9df78fe43..93a1e426a 100644 --- a/content/en/functions/scratch.md +++ b/content/en/functions/scratch.md @@ -22,6 +22,9 @@ aliases: [/extras/scratch/,/doc/scratch/] In most cases you can do okay without `Scratch`, but due to scoping issues, there are many use cases that aren't solvable in Go Templates without `Scratch`'s help. +`.Scratch` is available as methods on `Page` and `Shortcode`. Since Hugo 0.43 you can also create a locally scoped `Scratch` using the template func `newScratch`. + + {{% note %}} See [this Go issue](https://github.com/golang/go/issues/10608) for the main motivation behind Scratch. {{% /note %}} From d9d6e4bf7161898a8a453bc6c96d26b2c9c81112 Mon Sep 17 00:00:00 2001 From: Yang Li Date: Sat, 7 Jul 2018 17:40:47 +0800 Subject: [PATCH 03/16] Fix typos --- content/en/getting-started/code-toggle.md | 2 +- content/en/news/0.35-relnotes/index.md | 2 +- content/en/news/0.36.1-relnotes/index.md | 2 +- data/articles.toml | 2 +- themes/gohugoioTheme/src/js/tabs.js | 2 +- themes/gohugoioTheme/static/dist/app.bundle.js | 16 ++++++++-------- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/content/en/getting-started/code-toggle.md b/content/en/getting-started/code-toggle.md index 3e6b7da0d..b304d2c5b 100644 --- a/content/en/getting-started/code-toggle.md +++ b/content/en/getting-started/code-toggle.md @@ -12,7 +12,7 @@ toc: true ## The Config Toggler! -This is an exemple for the Config Toggle shortcode. +This is an example for the Config Toggle shortcode. Its purpose is to let users choose a Config language by clicking on its corresponding tab. Upon doing so, every Code toggler on the page will be switched to the target language. Also, target language will be saved in user's `localStorage` so when they go to a different pages, Code Toggler display their last "toggled" config language. ## That Config Toggler diff --git a/content/en/news/0.35-relnotes/index.md b/content/en/news/0.35-relnotes/index.md index 80b4afd7b..104cbd222 100644 --- a/content/en/news/0.35-relnotes/index.md +++ b/content/en/news/0.35-relnotes/index.md @@ -82,7 +82,7 @@ Hugo now has: * Add a `GetPage` to the site benchmarks [a1956391](https://github.com/gohugoio/hugo/commit/a19563910eec5fed08f3b02563b9a7b38026183d) [@bep](https://github.com/bep) * Add headless bundle support [0432c64d](https://github.com/gohugoio/hugo/commit/0432c64dd22e4610302162678bb93661ba68d758) [@bep](https://github.com/bep) [#4311](https://github.com/gohugoio/hugo/issues/4311) * Merge matching resources params maps [5a0819b9](https://github.com/gohugoio/hugo/commit/5a0819b9b5eb9e79826cfa0a65f235d9821b1ac4) [@bep](https://github.com/bep) [#4315](https://github.com/gohugoio/hugo/issues/4315) -* Add some general code contribution criterias [78c86330](https://github.com/gohugoio/hugo/commit/78c863305f337ed4faf3cf0a23675f28b0ae5641) [@bep](https://github.com/bep) +* Add some general code contribution criteria [78c86330](https://github.com/gohugoio/hugo/commit/78c863305f337ed4faf3cf0a23675f28b0ae5641) [@bep](https://github.com/bep) * Tighten page kind logic, introduce tests [8125b4b0](https://github.com/gohugoio/hugo/commit/8125b4b03d10eb73f8aea3f9ea41172aba8df082) [@vassudanagunta](https://github.com/vassudanagunta) ## Fixes diff --git a/content/en/news/0.36.1-relnotes/index.md b/content/en/news/0.36.1-relnotes/index.md index 59bf56297..00a5b346c 100644 --- a/content/en/news/0.36.1-relnotes/index.md +++ b/content/en/news/0.36.1-relnotes/index.md @@ -25,7 +25,7 @@ You would experience errors of type: png: invalid format: not enough pixel data ``` -This commit fixes that by adding a mutex per image. This should also improve the performance, sligthly, as it avoids duplicate work. +This commit fixes that by adding a mutex per image. This should also improve the performance, slightly, as it avoids duplicate work. The current workaround before this fix is to always operate on the original: diff --git a/data/articles.toml b/data/articles.toml index 379ae5562..c2dda2914 100644 --- a/data/articles.toml +++ b/data/articles.toml @@ -107,7 +107,7 @@ date = "2016-10-22" [[article]] - title = "通过 Gitlab-cl 将 Hugo blog 自动部署至 GitHub (Chinese, Continious integration)" + title = "通过 Gitlab-cl 将 Hugo blog 自动部署至 GitHub (Chinese, Continuous integration)" url = "https://zetaoyang.github.io/post/2016/10/17/gitlab-cl.html" author = "Zetao Yang" date = "2016-10-17" diff --git a/themes/gohugoioTheme/src/js/tabs.js b/themes/gohugoioTheme/src/js/tabs.js index dd90fdfa4..a689d474e 100644 --- a/themes/gohugoioTheme/src/js/tabs.js +++ b/themes/gohugoioTheme/src/js/tabs.js @@ -37,7 +37,7 @@ function toggleTabs(event) { for (i = 0; i < allTabs.length; i++) { allTabs[i].addEventListener("click", toggleTabs) } -// Upon page load, if user has a prefered language in its localStorage, tabs are set to it. +// Upon page load, if user has a preferred language in its localStorage, tabs are set to it. if(window.localStorage.getItem('configLangPref')) { toggleTabs(window.localStorage.getItem('configLangPref')) } diff --git a/themes/gohugoioTheme/static/dist/app.bundle.js b/themes/gohugoioTheme/static/dist/app.bundle.js index 7ea75e36f..d623c80ef 100644 --- a/themes/gohugoioTheme/static/dist/app.bundle.js +++ b/themes/gohugoioTheme/static/dist/app.bundle.js @@ -399,7 +399,7 @@ function toggleTabs(event) { for (i = 0; i < allTabs.length; i++) { allTabs[i].addEventListener("click", toggleTabs); } -// Upon page load, if user has a prefered language in its localStorage, tabs are set to it. +// Upon page load, if user has a preferred language in its localStorage, tabs are set to it. if (window.localStorage.getItem('configLangPref')) { toggleTabs(window.localStorage.getItem('configLangPref')); } @@ -2083,7 +2083,7 @@ function defaultClearTimeout () { } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations + //normal environments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined @@ -2108,7 +2108,7 @@ function runTimeout(fun) { } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations + //normal environments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined @@ -2190,7 +2190,7 @@ process.nextTick = function (fun) { } }; -// v8 likes predictible objects +// v8 likes predictable objects function Item(fun, array) { this.fun = fun; this.array = array; @@ -4181,7 +4181,7 @@ AlgoliaSearchCore.prototype._jsonRequest = function(initialOpts) { return client._promise.reject(err); } - // When a timeout occured, retry by raising timeout + // When a timeout occurred, retry by raising timeout if (err instanceof errors.RequestTimeout) { return retryRequestWithHigherTimeout(); } @@ -4892,7 +4892,7 @@ IndexCore.prototype._search = function(params, url, callback, additionalUA) { * @param attrs (optional) if set, contains the array of attribute names to retrieve * @param callback (optional) the result callback called with two arguments * error: null or Error('message') -* content: the object to retrieve or the error message if a failure occured +* content: the object to retrieve or the error message if a failure occurred */ IndexCore.prototype.getObject = function(objectID, attrs, callback) { var indexObj = this; @@ -6701,7 +6701,7 @@ function Typeahead(o) { if (_.isMsie() && ($menu[0] === active || $menu[0].contains(active))) { $e.preventDefault(); // stop immediate in order to prevent Input#_onBlur from - // getting exectued + // getting executed $e.stopImmediatePropagation(); _.defer(function() { $input.focus(); }); } @@ -10431,7 +10431,7 @@ while (++i < len) { break; } } -// v8 likes predictible objects +// v8 likes predictable objects function Item(fun, array) { this.fun = fun; this.array = array; From 2bf648944c10891077153b5f6b38321e1d9cca2d Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Mon, 9 Jul 2018 10:00:04 +0000 Subject: [PATCH 04/16] releaser: Bump versions for release of 0.43 [ci skip] --- config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.toml b/config.toml index 1c9307a35..ddb124474 100644 --- a/config.toml +++ b/config.toml @@ -70,7 +70,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.43-DEV" + release = "0.43" ## 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 e539613f7a24dc096de340f9a43fbc4173340e8d Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Mon, 9 Jul 2018 10:00:04 +0000 Subject: [PATCH 05/16] releaser: Add release notes to /docs for release of 0.43 [ci skip] --- content/en/news/0.43-relnotes/index.md | 84 ++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 content/en/news/0.43-relnotes/index.md diff --git a/content/en/news/0.43-relnotes/index.md b/content/en/news/0.43-relnotes/index.md new file mode 100644 index 000000000..5aaba8ff6 --- /dev/null +++ b/content/en/news/0.43-relnotes/index.md @@ -0,0 +1,84 @@ + +--- +date: 2018-07-09 +title: "0.43" +description: "0.43" +categories: ["Releases"] +--- + + Hugo `0.43` adds a powerful and very simple to use **Assets Pipeline** with **SASS and SCSS** with source map support, **PostCSS** and **minification** and **fingerprinting** and **Subresource Integrity** and ... much more. Oh, did we mention that you can now do **ad-hoc image processing** and execute text resources as Go templates? + +I, [@bep](https://github.com/bep), implemented this in [dea71670](https://github.com/gohugoio/hugo/commit/dea71670c059ab4d5a42bd22503f18c087dd22d4) [#4381]. We will work hard to get the documentation up to date, but follow the links above for details, and also see this [demo project](https://github.com/bep/hugo-sass-test). + +An example pipeline: + +```go-html-template +{{ $styles := resources.Get "scss/main.scss" | toCSS | postCSS | minify | fingerprint }} + +``` + +To me, the above is beautiful in its speed and simplicity. It could be printed on a t-shirt. I wrote in the [Hugo Birthday Post](https://gohugo.io/news/lets-celebrate-hugos-5th-birthday/) some days ago about the value of a single binary with native and fast implementations. I should have added _simplicity_ as a keyword. There seem to be a misconception that all of this needs to be hard and painful. + +This release represents **35 contributions by 7 contributors** to the main Hugo code base. +[@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@anthonyfok](https://github.com/anthonyfok), [@openscript](https://github.com/openscript), and [@caarlos0](https://github.com/caarlos0) for their ongoing contributions. +And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) for his relentless work on keeping the themes site in pristine condition and to [@kaushalmodi](https://github.com/kaushalmodi) for his great work on the documentation site. + +Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs), +which has received **11 contributions by 5 contributors**. A special thanks to [@bep](https://github.com/bep), [@danrl](https://github.com/danrl), [@regisphilibert](https://github.com/regisphilibert), and [@digitalcraftsman](https://github.com/digitalcraftsman) for their work on the documentation site. + +Hugo now has: + +* 26968+ [stars](https://github.com/gohugoio/hugo/stargazers) +* 443+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors) +* 238+ [themes](http://themes.gohugo.io/) + +## Notes + +* Replace deprecated {Get,}ByPrefix with {Get,}Match [42ed6025](https://github.com/gohugoio/hugo/commit/42ed602580a672e420e1d860384e812f4871ff67) [@anthonyfok](https://github.com/anthonyfok) +* Hugo is now released with two binary version: One with and one without SCSS/SASS support. At the time of writing, this is only available in the binaries on the GitHub release page. Brew, Snap builds etc. will come. But note that you **only need the extended version if you want to edit SCSS**. For your CI server, or if you don't use SCSS, you will most likely want the non-extended version. + +## Enhancements + +### Templates + +* Return en empty slice in `after` instead of error [f8212d20](https://github.com/gohugoio/hugo/commit/f8212d20009c4b5cc6e1ec733d09531eb6525d9f) [@bep](https://github.com/bep) [#4894](https://github.com/gohugoio/hugo/issues/4894) +* Update internal pagination template to support Bootstrap 4 [ca1e46ef](https://github.com/gohugoio/hugo/commit/ca1e46efb94e3f3d2c8482cb9434d2f38ffd2683) [@bep](https://github.com/bep) [#4881](https://github.com/gohugoio/hugo/issues/4881) +* Support text/template/parse API change in go1.11 [9f27091e](https://github.com/gohugoio/hugo/commit/9f27091e1067875e2577c331acc60adaef5bb234) [@anthonyfok](https://github.com/anthonyfok) [#4784](https://github.com/gohugoio/hugo/issues/4784) + +### Core + +* Allow forward slash in shortcode names [de37455e](https://github.com/gohugoio/hugo/commit/de37455ec73cffd039b44e8f6c62d2884b1d6bbd) [@bep](https://github.com/bep) [#4886](https://github.com/gohugoio/hugo/issues/4886) +* Reset the global pages cache on server rebuilds [128f14ef](https://github.com/gohugoio/hugo/commit/128f14efad90886ffef37c01ac1e20436a732f97) [@bep](https://github.com/bep) [#4845](https://github.com/gohugoio/hugo/issues/4845) + +### Other + +* Bump CircleCI image [e3df6478](https://github.com/gohugoio/hugo/commit/e3df6478f09a7a5fed96aced791fa94fd2c35d1a) [@bep](https://github.com/bep) +* Add Goreleaser extended config [626afc98](https://github.com/gohugoio/hugo/commit/626afc98254421f5a5edc97c541b10bd81d5bbbb) [@bep](https://github.com/bep) [#4908](https://github.com/gohugoio/hugo/issues/4908) +* Build both hugo and hugo.extended for 0.43 [e1027c58](https://github.com/gohugoio/hugo/commit/e1027c5846b48c4ad450f6cc27e2654c9e0dae39) [@anthonyfok](https://github.com/anthonyfok) [#4908](https://github.com/gohugoio/hugo/issues/4908) +* Add temporary build script [bfc3488b](https://github.com/gohugoio/hugo/commit/bfc3488b8e8b3dc1ffc6a339ee2dac8dcbdb55a9) [@bep](https://github.com/bep) +* Add "extended" to "hugo version" [ce84b524](https://github.com/gohugoio/hugo/commit/ce84b524f4e94299b5b66afe7ce1a9bd4a9959fc) [@anthonyfok](https://github.com/anthonyfok) [#4913](https://github.com/gohugoio/hugo/issues/4913) +* Add a newScratch template func [2b8d907a](https://github.com/gohugoio/hugo/commit/2b8d907ab731627f4e2a30442cd729064516c8bb) [@bep](https://github.com/bep) [#4685](https://github.com/gohugoio/hugo/issues/4685) +* Add Hugo Piper with SCSS support and much more [dea71670](https://github.com/gohugoio/hugo/commit/dea71670c059ab4d5a42bd22503f18c087dd22d4) [@bep](https://github.com/bep) [#4381](https://github.com/gohugoio/hugo/issues/4381)[#4903](https://github.com/gohugoio/hugo/issues/4903)[#4858](https://github.com/gohugoio/hugo/issues/4858) +* Consider root and current section's content type if set in front matter [c790029e](https://github.com/gohugoio/hugo/commit/c790029e1dbb0b66af18d05764bd6045deb2e180) [@bep](https://github.com/bep) [#4891](https://github.com/gohugoio/hugo/issues/4891) +* Update docker image [554553c0](https://github.com/gohugoio/hugo/commit/554553c09c7657d28681e1fa0638806a452737a0) [@bep](https://github.com/bep) +* Merge branch 'release-0.42.2' [282f6035](https://github.com/gohugoio/hugo/commit/282f6035e7c36f8550d91033e3a66718468c6c8b) [@bep](https://github.com/bep) +* Release 0.42.2 [1637d12e](https://github.com/gohugoio/hugo/commit/1637d12e3762fc1ebab4cd675f75afaf25f59cdb) [@bep](https://github.com/bep) +* Update GoReleaser config [1f0c4e1f](https://github.com/gohugoio/hugo/commit/1f0c4e1fb347bb233f3312c424fbf5a013c03604) [@caarlos0](https://github.com/caarlos0) +* Create missing head.html partial on new theme generation [fd71fa89](https://github.com/gohugoio/hugo/commit/fd71fa89bd6c197402582c87b2b76d4b96d562bf) [@openscript](https://github.com/openscript) +* Add html doctype to baseof.html template for new themes [b5a3aa70](https://github.com/gohugoio/hugo/commit/b5a3aa7082135d0a573f4fbb00f798e26b67b902) [@openscript](https://github.com/openscript) +* Adds .gitattributes to force Go files to LF [6a2968fd](https://github.com/gohugoio/hugo/commit/6a2968fd5c0116d93de0f379ac615e9076821899) [@neurocline](https://github.com/neurocline) +* Update to Go 1.9.7 and Go 1.10.3 [23d5fc82](https://github.com/gohugoio/hugo/commit/23d5fc82ee01d56440d0991c899acd31e9b63e27) [@anthonyfok](https://github.com/anthonyfok) +* Update Dockerfile to a multi-stage build [8531ec7c](https://github.com/gohugoio/hugo/commit/8531ec7ca36fd35a57fba06bbb06a65c94dfd3ed) [@skoblenick](https://github.com/skoblenick) [#4154](https://github.com/gohugoio/hugo/issues/4154) +* Release 0.42.1 [d67e843c](https://github.com/gohugoio/hugo/commit/d67e843c1212e1f53933556b5f946c8541188d9a) [@bep](https://github.com/bep) +* Do not fail server build when /static is missing [34ee27a7](https://github.com/gohugoio/hugo/commit/34ee27a78b9e2b5f475d44253ae234067b76cc6e) [@bep](https://github.com/bep) [#4846](https://github.com/gohugoio/hugo/issues/4846) + +## Fixes + +* Do not create paginator pages for the other output formats [43338c3a](https://github.com/gohugoio/hugo/commit/43338c3a99769eb7d0df0c12559b8b3d42b67dba) [@bep](https://github.com/bep) [#4890](https://github.com/gohugoio/hugo/issues/4890) +* Fix the shortcodes/partials vs base template detection [a5d0a57e](https://github.com/gohugoio/hugo/commit/a5d0a57e6bdab583134a68c035aac9b3007f006a) [@bep](https://github.com/bep) [#4897](https://github.com/gohugoio/hugo/issues/4897) +* nfpm replacements [e1a052ec](https://github.com/gohugoio/hugo/commit/e1a052ecb823c688406a8af97dfaaf52a75231da) [@caarlos0](https://github.com/caarlos0) +* Fix typos [3cea2932](https://github.com/gohugoio/hugo/commit/3cea2932e17a08ebc19cd05f3079d9379bc8fba5) [@idealhack](https://github.com/idealhack) + + + + From 83966769a494829abad83b64c81ebaa578b1ec0f Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Mon, 9 Jul 2018 10:03:30 +0000 Subject: [PATCH 06/16] releaser: Prepare repository for 0.44-DEV [ci skip] --- config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.toml b/config.toml index ddb124474..da71d10d0 100644 --- a/config.toml +++ b/config.toml @@ -70,7 +70,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.43" + release = "0.44-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) From 2c59a330c05c31097266ad10dff5bd36aceccdc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 9 Jul 2018 12:11:38 +0200 Subject: [PATCH 07/16] Adjust release notes [ci skip] --- content/en/news/0.43-relnotes/index.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/content/en/news/0.43-relnotes/index.md b/content/en/news/0.43-relnotes/index.md index 5aaba8ff6..483131033 100644 --- a/content/en/news/0.43-relnotes/index.md +++ b/content/en/news/0.43-relnotes/index.md @@ -8,8 +8,6 @@ categories: ["Releases"] Hugo `0.43` adds a powerful and very simple to use **Assets Pipeline** with **SASS and SCSS** with source map support, **PostCSS** and **minification** and **fingerprinting** and **Subresource Integrity** and ... much more. Oh, did we mention that you can now do **ad-hoc image processing** and execute text resources as Go templates? -I, [@bep](https://github.com/bep), implemented this in [dea71670](https://github.com/gohugoio/hugo/commit/dea71670c059ab4d5a42bd22503f18c087dd22d4) [#4381]. We will work hard to get the documentation up to date, but follow the links above for details, and also see this [demo project](https://github.com/bep/hugo-sass-test). - An example pipeline: ```go-html-template @@ -19,6 +17,24 @@ An example pipeline: To me, the above is beautiful in its speed and simplicity. It could be printed on a t-shirt. I wrote in the [Hugo Birthday Post](https://gohugo.io/news/lets-celebrate-hugos-5th-birthday/) some days ago about the value of a single binary with native and fast implementations. I should have added _simplicity_ as a keyword. There seem to be a misconception that all of this needs to be hard and painful. +New functions to create `Resource` objects: + +* `resources.Get` +* `resources.FromString`: Create a Resource from a string. + +New `Resource` transformation funcs: + +* `resources.ToCSS`: Compile `SCSS` or `SASS` into `CSS`. +* `resources.PostCSS`: Process your CSS with PostCSS. Config file support (project or theme or passed as an option). +* `resources.Minify`: Currently supports `css`, `js`, `json`, `html`, `svg`, `xml`. +* `resources.Fingerprint`: Creates a fingerprinted version of the given Resource with Subresource Integrity. +* `resources.Concat`: Concatenates a list of Resource objects. Think of this as a poor man's bundler. +* `resources.ExecuteAsTemplate`: Parses and executes the given Resource and data context (e.g. .Site) as a Go template. + + +I, [@bep](https://github.com/bep), implemented this in [dea71670](https://github.com/gohugoio/hugo/commit/dea71670c059ab4d5a42bd22503f18c087dd22d4). We will work hard to get the documentation up to date, but follow the links above for details, and also see this [demo project](https://github.com/bep/hugo-sass-test). + + This release represents **35 contributions by 7 contributors** to the main Hugo code base. [@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@anthonyfok](https://github.com/anthonyfok), [@openscript](https://github.com/openscript), and [@caarlos0](https://github.com/caarlos0) for their ongoing contributions. And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) for his relentless work on keeping the themes site in pristine condition and to [@kaushalmodi](https://github.com/kaushalmodi) for his great work on the documentation site. From d3985afb703d54d66511f28c410be65d4fbf3bc7 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Fri, 13 Jul 2018 06:03:09 +0000 Subject: [PATCH 08/16] releaser: Bump versions for release of 0.44 [ci skip] --- config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.toml b/config.toml index da71d10d0..4897e94bd 100644 --- a/config.toml +++ b/config.toml @@ -70,7 +70,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.44-DEV" + release = "0.44" ## 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 c6f4b97a2c49b56f08d19a0466d874dd63224623 Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Fri, 13 Jul 2018 06:03:09 +0000 Subject: [PATCH 09/16] releaser: Add release notes to /docs for release of 0.44 [ci skip] --- content/en/news/0.44-relnotes/index.md | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 content/en/news/0.44-relnotes/index.md diff --git a/content/en/news/0.44-relnotes/index.md b/content/en/news/0.44-relnotes/index.md new file mode 100644 index 000000000..2725d4746 --- /dev/null +++ b/content/en/news/0.44-relnotes/index.md @@ -0,0 +1,39 @@ + +--- +date: 2018-07-13 +title: "0.44" +description: "0.44" +categories: ["Releases"] +--- + + +Hugo `0.44` is the follow-up release, or **The Sequel**, of the very well received `0.43` only days ago. That release added **Hugo Pipes**, with SCSS/SASS support, assets bundling and minification, ad-hoc image processing and much more. + +This is mostly a bug-fix release, but it also includes several important improvements. + +Many complained that their SVG images vanished when browsed from the `hugo server`. With **Hugo Pipes** MIME types suddenly got really important, but Hugo's use of `Suffix` was ambiguous. This became visible when we redefined the `image/svg+xml` to work with **Hugo Pipes**. We have now added a `Suffixes` field on the MIME type definition in Hugo, which is a list of one or more filename suffixes the MIME type is identified with. If you need to add a custom MIME type definition, this means that you also need to specify the full MIME type as the key, e.g. `image/svg+xml`. + +Hugo now has: + +* 27120+ [stars](https://github.com/gohugoio/hugo/stargazers) +* 443+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors) +* 239+ [themes](http://themes.gohugo.io/) + +## Notes +* `MediaType.Suffix` is deprecated and replaced with a plural version, `MediaType.Suffixes`, with a more specific definition. You will get a detailed WARNING in the console if you need to do anything. + +## Enhancements +* Allow multiple file suffixes per media type [b874a1ba](https://github.com/gohugoio/hugo/commit/b874a1ba7ab8394dc741c8c70303a30a35b63e43) [@bep](https://github.com/bep) [#4920](https://github.com/gohugoio/hugo/issues/4920) +* Clean up the in-memory Resource reader usage [47d38628](https://github.com/gohugoio/hugo/commit/47d38628ec0f4e72ff17661f13456b2a1511fe13) [@bep](https://github.com/bep) [#4936](https://github.com/gohugoio/hugo/issues/4936) +* Move opening of the transformed resources after cache check [0024dcfe](https://github.com/gohugoio/hugo/commit/0024dcfe3e016c67046de06d1dac5e7f5235f9e1) [@bep](https://github.com/bep) +* Improve type support in `resources.Concat` [306573de](https://github.com/gohugoio/hugo/commit/306573def0e20ec16ee5c447981cc09ed8bb7ec7) [@bep](https://github.com/bep) [#4934](https://github.com/gohugoio/hugo/issues/4934) +* Flush `partialCached` cache on rebuilds [6b6dcb44](https://github.com/gohugoio/hugo/commit/6b6dcb44a014699c289bf32fe57d4c4216777be0) [@bep](https://github.com/bep) [#4931](https://github.com/gohugoio/hugo/issues/4931) +* Include the transformation step in the error message [d96f2a46](https://github.com/gohugoio/hugo/commit/d96f2a460f58e91d8f6253a489d4879acfec6916) [@bep](https://github.com/bep) [#4924](https://github.com/gohugoio/hugo/issues/4924) +* Exclude *.svg from CRLF/LF conversion [9c1e8208](https://github.com/gohugoio/hugo/commit/9c1e82085eb07d5b4dcdacbe82d5bafd26e08631) [@anthonyfok](https://github.com/anthonyfok) + +## Fixes + +* Fix `resources.Concat` for transformed resources [beec1fc9](https://github.com/gohugoio/hugo/commit/beec1fc98e5d37bba742d6bc2a0ff7c344b469f8) [@bep](https://github.com/bep) [#4936](https://github.com/gohugoio/hugo/issues/4936) +* Fix static filesystem for themed multihost sites [80c8f3b8](https://github.com/gohugoio/hugo/commit/80c8f3b81a9849080e64bf877288ede28d960d3f) [@bep](https://github.com/bep) [#4929](https://github.com/gohugoio/hugo/issues/4929) +* Set permission of embedded templates to 0644 [2b73e89d](https://github.com/gohugoio/hugo/commit/2b73e89d6d2822e86360a6c92c87f539677c119b) [@anthonyfok](https://github.com/anthonyfok) + From 468aef3fc2b0bf3c5e1a76b4e18b690be0ef613c Mon Sep 17 00:00:00 2001 From: hugoreleaser Date: Fri, 13 Jul 2018 06:05:41 +0000 Subject: [PATCH 10/16] releaser: Prepare repository for 0.45-DEV [ci skip] --- config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.toml b/config.toml index 4897e94bd..63d9cef15 100644 --- a/config.toml +++ b/config.toml @@ -70,7 +70,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.44" + release = "0.45-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) From 1c8896cb1a3a463705d05bcdc78c786a664ed6f1 Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Mon, 16 Jul 2018 21:15:05 +0200 Subject: [PATCH 11/16] Fix addkit link to account for i18n --- content/en/tools/starter-kits.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en/tools/starter-kits.md b/content/en/tools/starter-kits.md index 0ce81cc4e..b2386cc2f 100644 --- a/content/en/tools/starter-kits.md +++ b/content/en/tools/starter-kits.md @@ -30,11 +30,11 @@ The following starter kits are developed by active members of the Hugo community * [Atlas][]. Atlas is a Hugo boilerplate designed to speed up development with support for Netlify, Netlify CMS, Gulp, Linting, SCSS, ES6 & more. It's actively maintained and contributions are always welcome. -[addkit]: https://github.com/gohugoio/hugo/edit/master/docs/content/tools/starter-kits.md +[addkit]: https://github.com/gohugoio/hugo/edit/master/docs/content/en/tools/starter-kits.md [amp]: https://www.ampproject.org/ [Blaupause]: https://github.com/fspoettel/blaupause [GOHUGO AMP]: https://github.com/wildhaber/gohugo-amp [gohugodocs]: https://gohugo-amp.gohugohq.com/ [hugulp]: https://github.com/jbrodriguez/hugulp [Victor Hugo]: https://github.com/netlify/victor-hugo -[Atlas]: https://github.com/indigotree/atlas \ No newline at end of file +[Atlas]: https://github.com/indigotree/atlas From 1fd1219b0288d9e327ea33a990d6e93b185b4db0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 19 Jul 2018 15:03:35 +0200 Subject: [PATCH 12/16] docs: Document refLinksErrorLevel and refLinksNotFoundURL See #4964 --- content/en/content-management/cross-references.md | 13 +++++++++++++ content/en/getting-started/configuration.md | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/content/en/content-management/cross-references.md b/content/en/content-management/cross-references.md index 2980719e9..56599e47c 100644 --- a/content/en/content-management/cross-references.md +++ b/content/en/content-management/cross-references.md @@ -123,6 +123,19 @@ Few examples: ## Version 1.0 {#version-1-dot-0} ``` + +## Ref and RelRef Configuration + +The behaviour 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 logg level. Valid values are `ERROR` (default) or `WARNING`. Any `ERROR` will fail the build (`exit -1`). + +refLinksNotFoundURL +: URL to be used as a placeholder when a page reference cannot be found in `ref` or `relref`. Is used as-is. + + [built-in Hugo shortcodes]: /content-management/shortcodes/#using-the-built-in-shortcodes [lists]: /templates/lists/ [output formats]: /templates/output-formats/ diff --git a/content/en/getting-started/configuration.md b/content/en/getting-started/configuration.md index 7b0ca2a01..18f9e7025 100644 --- a/content/en/getting-started/configuration.md +++ b/content/en/getting-started/configuration.md @@ -183,6 +183,12 @@ related relativeURLs (false) : Enable this to make all relative URLs relative to content root. Note that this does not affect absolute URLs. +refLinksErrorLevel ("ERROR") +: When using `ref` or `relref` to resolve page links and a link cannot resolved, it will be logged with this logg level. Valid values are `ERROR` (default) or `WARNING`. Any `ERROR` will fail the build (`exit -1`). + +refLinksNotFoundURL +: URL to be used as a placeholder when a page reference cannot be found in `ref` or `relref`. Is used as-is. + rssLimit (unlimited) : Maximum number of items in the RSS feed. From 127aeee0973033517268982ae9e6f43467300b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 19 Jul 2018 17:02:03 +0200 Subject: [PATCH 13/16] docs: Update ref, relref, GetPage docs --- .../en/content-management/cross-references.md | 97 ++++--------------- content/en/content-management/page-bundles.md | 2 +- content/en/functions/GetPage.md | 43 ++++---- 3 files changed, 47 insertions(+), 95 deletions(-) diff --git a/content/en/content-management/cross-references.md b/content/en/content-management/cross-references.md index 56599e47c..00f6ad1c1 100644 --- a/content/en/content-management/cross-references.md +++ b/content/en/content-management/cross-references.md @@ -1,6 +1,6 @@ --- title: Links and Cross References -description: Hugo makes it easy to link documents together. +description: Shortcodes for creating links to documents. date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-03-31 @@ -16,119 +16,65 @@ toc: true --- - The `ref` and `relref` shortcodes link documents together, both of which are [built-in Hugo shortcodes][]. These shortcodes are also used to provide links to headings inside of your content, whether across documents or within a document. The only difference between `ref` and `relref` is whether the resulting URL is absolute (`http://1.com/about/`) or relative (`/about/`), respectively. +The `ref` and `relref` shortcode resolves the absolute or relative permalink given a path to a document. ## 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. +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. -### Document Names +**Paths without a leading `/` will first be tried resolved relative to the current page.** -The `documentname` is the name of a document, including the format extension; this may be just the filename, or the relative path from the `content/` directory. With a document `content/blog/post.md`, either format will produce the same result: +You will get an error if you document could not be uniquely resolved. The error behaviour can be configured, see below. -``` -{{}} => `/blog/post/` -{{}} => `/blog/post/` +### Link to another language version + +Link to another language version of a document, you need to use this syntax: + +```go-html-template +{{}} ``` -If you have the same filename used across multiple sections, you should only use the relative path format; otherwise, the behavior will be `undefined`. This is best illustrated with an example `content` directory: +### Get another Output Format -``` -. -└── content - ├── events - │   └── my-birthday.md - ├── galleries - │   └── my-birthday.md - ├── meta - │   └── my-article.md - └── posts - └── my-birthday.md -``` +To link to a given Output Format of a document, you can use this syntax: -To be sure to get the correct reference in this case, use the full path: - -{{< code file="content/meta/my-article.md" copy="false" >}} -{{}} => /events/my-birthday/ -{{< /code >}} - -### With Multiple Output Formats - -If the page exists in multiple [output formats][], `ref` or `relref` can be used with a output format name: - -``` - [Neat]({{}}) +```go-html-template +{{}} ``` ### Anchors 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: -``` +```go-html-template {{}} => #anchors:9decaf7 -{{}} => /blog/post/#who:badcafe ``` 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 -``` +```go-html-template {{}} => #who:9decaf7 -{{}} => /blog/post/#who:badcafe +{{}} => /blog/post/#who:badcafe ``` More information about document unique identifiers and headings can be found [below]({{< ref "#hugo-heading-anchors" >}}). -### Examples - -* `{{}}` => `https://example.com/blog/post/` -* `{{}}` => `https://example.com/blog/post/#tldr:caffebad` -* `{{}}` => `/blog/post/` -* `{{}}` => `/blog/post/#tldr:caffebad` -* `{{}}` => `#tldr:badcaffe` -* `{{}}` => `#tldr:badcaffe` - -## 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.) - -``` -{{}} -/content-management/cross-references/#hugo-heading-anchors:77cd9ea530577debf4ce0f28c8dca242 -``` - -### Manually Specifying Anchors - -For Markdown content files, if the `headerIds` [Blackfriday extension][bfext] is -enabled (which it is by default), user can manually specify the anchor for any -heading. - -Few examples: - -``` -## Alpha 101 {#alpha} - -## Version 1.0 {#version-1-dot-0} -``` - ## Ref and RelRef Configuration The behaviour 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 logg level. Valid values are `ERROR` (default) or `WARNING`. Any `ERROR` will fail the build (`exit -1`). @@ -136,7 +82,6 @@ refLinksNotFoundURL : URL to be used as a placeholder when a page reference cannot be found in `ref` or `relref`. Is used as-is. -[built-in Hugo shortcodes]: /content-management/shortcodes/#using-the-built-in-shortcodes [lists]: /templates/lists/ [output formats]: /templates/output-formats/ [shortcode]: /content-management/shortcodes/ diff --git a/content/en/content-management/page-bundles.md b/content/en/content-management/page-bundles.md index 639d81eff..1c99d6a56 100644 --- a/content/en/content-management/page-bundles.md +++ b/content/en/content-management/page-bundles.md @@ -97,7 +97,7 @@ anywhere: But you can get it by `.Site.GetPage`. Here is an example: ```go-html-template -{{ $headless := .Site.GetPage "page" "some-headless-bundle" }} +{{ $headless := .Site.GetPage "/some-headless-bundle" }} {{ $reusablePages := $headless.Resources.Match "author*" }}

Authors

{{ range $reusablePages }} diff --git a/content/en/functions/GetPage.md b/content/en/functions/GetPage.md index 1a8a51c13..2d9de4d7a 100644 --- a/content/en/functions/GetPage.md +++ b/content/en/functions/GetPage.md @@ -1,6 +1,6 @@ --- title: .GetPage -description: "Gets a `Page` of a given `Kind` and `path`." +description: "Gets a `Page` of a given `path`." godocref: date: 2017-02-01 publishdate: 2017-02-01 @@ -10,7 +10,7 @@ menu: docs: parent: "functions" keywords: [sections,lists,indexes] -signature: [".GetPage KIND PATH"] +signature: [".GetPage PATH"] workson: [] hugoversion: relatedfuncs: [] @@ -18,35 +18,42 @@ deprecated: false aliases: [] --- -Every `Page` has a [`Kind` attribute][page_kinds] that shows what kind of page it is. While this attribute can be used to list pages of a certain `kind` using `where`, often it can be useful to fetch a single page by its path. - -`.GetPage` returns a page of a given `Kind` and `path`. +`.GetPage` returns a page of a given `path`. Both `Site` and `Page` implements this method. The `Page` variant will, if given a relative path -- i.e. a path without a leading `/` -- try look for the page relative to the current page. {{% note %}} -If the `path` is `"foo/bar.md"`, it can be written as exactly that, or broken up -into multiple strings as `"foo" "bar.md"`. +**Note:** We overhauled and simplified the `.GetPage` API in Hugo 0.45. Before that you needed to provide a `Kind` attribute in addition to the path, e.g. `{{ .Site.GetPage "section" "blog" }}`. This will still work, but is now superflous. {{% /note %}} -``` -{{ with .Site.GetPage "section" "blog" }}{{ .Title }}{{ end }} + +```go-html-template +{{ with .Site.GetPage "/blog" }}{{ .Title }}{{ end }} ``` This method wil return `nil` when no page could be found, so the above will not print anything if the blog section is not found. -For a regular page (whose `Kind` is `page`): +To fund a regular page in the blog section:: -``` -{{ with .Site.GetPage "page" "blog/my-post.md" }}{{ .Title }}{{ end }} +```go-html-template +{{ with .Site.GetPage "/blog/my-post.md" }}{{ .Title }}{{ end }} ``` -Note that the `path` can also be supplied like this, where the slash-separated -path elements are added as separate strings: +And since `Page` also provides a `.GetPage` method, the above is the same as: -``` -{{ with .Site.GetPage "page" "blog" "my-post.md" }}{{ .Title }}{{ end }} +```go-html-template +{{ with .Site.GetPage "/blog" }} +{{ with .GetPage "my-post.md" }}{{ .Title }}{{ end }} +{{ end }} ``` -## `.GetPage` Example +## .GetPage and Multilingual Sites + +The previous examples have used the full content filename to lookup the post. Depending on how you have organized your content (whether you have the language code in the file name or not, e.g. `my-post.en.md`), you may want to do the lookup without extension. This will get you the current language's version of the page: + +```go-html-template +{{ with .Site.GetPage "/blog/my-post" }}{{ .Title }}{{ end }} +``` + +## .GetPage Example This code snippet---in the form of a [partial template][partials]---allows you to do the following: @@ -57,7 +64,7 @@ This code snippet---in the form of a [partial template][partials]---allows you t {{< code file="grab-top-two-tags.html" >}}