shithub: hugo

Download patch

ref: 5e39eb20a66812e08233431a6c3ffeef691a6f22
parent: 634938908ec8f393b9a05d26b4cfe19ca7abb0d0
parent: e5568488051a571df48401e03f1304b95dbc9028
author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
date: Tue Oct 6 12:24:00 EDT 2020

Merge commit 'e5568488051a571df48401e03f1304b95dbc9028'

diff: cannot open b/docs/resources/_gen/images/news/0.75.0-relnotes//null: file does not exist: 'b/docs/resources/_gen/images/news/0.75.0-relnotes//null'
--- a/docs/content/en/content-management/page-bundles.md
+++ b/docs/content/en/content-management/page-bundles.md
@@ -135,10 +135,6 @@
 headless = true
 ```
 
-{{% note %}}
-Only leaf bundles can be made headless.
-{{% /note %}}
-
 There are many use cases of such headless page bundles:
 
 -   Shared media galleries
--- a/docs/content/en/content-management/toc.md
+++ b/docs/content/en/content-management/toc.md
@@ -116,6 +116,7 @@
 
 A collection of textile samples lay spread out on the table - Samsa was a travelling salesman - and above it there hung a picture that he had recently cut out of an illustrated magazine and housed in a nice, gilded frame. It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. Gregor then turned to look out the window at the dull weather. Drops
 ```
+Hugo will take this AsciiDoc and create a table of contents store it in the page variable `.TableOfContents`, in the same as described for Markdown.
 
 [conditionals]: /templates/introduction/#conditionals
 [front matter]: /content-management/front-matter/
--- a/docs/content/en/getting-started/configuration-markup.md
+++ b/docs/content/en/getting-started/configuration-markup.md
@@ -30,6 +30,8 @@
 
 {{< code-toggle config="markup.goldmark" />}}
 
+For details on the extensions, refer to [this section](https://github.com/yuin/goldmark/#built-in-extensions) of the Goldmark documentation
+
 Some settings explained:
 
 unsafe
--- a/docs/content/en/getting-started/configuration.md
+++ b/docs/content/en/getting-started/configuration.md
@@ -67,7 +67,7 @@
 
 Considering the structure above, when running `hugo --environment staging`, Hugo will use every settings from `config/_default` and merge `staging`'s on top of those.
 {{% note %}}
-Default environments are __development__ with `hugo serve` and __production__ with `hugo`.
+Default environments are __development__ with `hugo server` and __production__ with `hugo`.
 {{%/ note %}}
 ## All Configuration Settings
 
--- a/docs/content/en/hugo-modules/configuration.md
+++ b/docs/content/en/hugo-modules/configuration.md
@@ -88,7 +88,7 @@
 : If enabled, any module configuration file, e.g. `config.toml`, will not be loaded. Note that this will also stop the loading of any transitive module dependencies.
 
 disable
-: Set to `true` to disable the module off while keeping any version info in the `go.*` files.
+: Set to `true` to disable the module while keeping any version info in the `go.*` files.
 
 {{< gomodules-info >}}
 
--- a/docs/content/en/hugo-modules/use-modules.md
+++ b/docs/content/en/hugo-modules/use-modules.md
@@ -41,7 +41,7 @@
 ```toml
 [module]
   [[module.imports]]
-    path = "github.com/spf13/hyde/"
+    path = "github.com/spf13/hyde"
 ```
 
 ## Update Modules
--- a/docs/content/en/hugo-pipes/js.md
+++ b/docs/content/en/hugo-pipes/js.md
@@ -38,6 +38,8 @@
 {{ $externals := slice "react" "react-dom" }}
 ```
 
+> Marking a package as external doesn't imply that the library can be loaded from a CDN. It simply tells Hugo not to expand/include the package in the JS file.
+
 defines [map]
 : Allow to define a set of string replacement to be performed when building. Should be a map where each key is to be replaced by its value.
 
@@ -66,3 +68,29 @@
 {{ $built := resources.Get "scripts/main.js" | js.Build $opts }}
 <script type="text/javascript" src="{{ $built.RelPermalink }}" defer></script>
 ```
+
+#### Shimming a JS library
+It's a very common practice to load external libraries using CDN rather than importing all packages in a single JS file, making it bulky. To do the same with Hugo, you'll need to shim the libraries as follows. In this example, `algoliasearch` and `instantsearch.js` will be shimmed.
+
+Firstly, add the following to your project's `package.json`:
+```json
+{
+  "browser": {
+    "algoliasearch/lite": "./public/js/shims/algoliasearch.js",
+    "instantsearch.js/es/lib/main": "./public/js/shims/instantsearch.js"
+  }
+}
+```
+
+What this does is it tells Hugo to look for the listed packages somewhere else. Here we're telling Hugo to look for `algoliasearch/lite` and `instantsearch.js/es/lib/main` in the project's `public/js/shims` folder.
+
+Now we'll need to create the shim JS files which export the global JS variables `module.exports = window.something`. You can create a separate shim JS file in your `assets` directory, and redirect the import paths there if you wish, but a much cleaner way is to create these files on the go, by having the following before your JS is built.
+
+```go-html-template
+{{ $a := "module.exports = window.algoliasearch" | resources.FromString "js/shims/algoliasearch.js" }}
+{{ $i := "module.exports = window.instantsearch" | resources.FromString "js/shims/instantsearch.js" }}
+
+{{/* Call RelPermalink unnecessarily to generate JS files */}}
+{{ $placebo := slice $a.RelPermalink $i.RelPermalink }}
+```
+That's it! You should now have a browser-friendly JS which can use external JS libraries.
binary files /dev/null b/docs/content/en/news/0.75.0-relnotes/featured.png differ
--- a/docs/content/en/news/0.75.0-relnotes/index.md
+++ b/docs/content/en/news/0.75.0-relnotes/index.md
@@ -1,16 +1,15 @@
 
 ---
 date: 2020-09-14
-title: "0.75.0"
-description: "0.75.0"
+title: "NPM Pack"
+description: "Hugo 0.75 comes with a new \"hugo mod npm pack\" command, several improvements re. Hugo Modules and the Node tools, and more."
 categories: ["Releases"]
 ---
 
-	Hugo `0.75.0` brings several improvements to Hugo Modules, a new CLI command to bridge the JavaScript dependencies into Hugo, a refresh of the versions of the most important upstream dependencies, and more.
+Hugo `0.75.0` brings several improvements to Hugo Modules, a new CLI command to bridge the JavaScript dependencies into Hugo, a refresh of the versions of the most important upstream dependencies, and more. There are also some good bug fixes in this release. One notable one is covered by [this commit](https://github.com/gohugoio/hugo/commit/4055c121847847d8bd6b95a928185daee065091b) -- which covers a "stale content scenario in server" when you include content or page data via `GetPage` from a shortcode.
 
 ## NPM Pack
 
-
 The new CLI command is called `hugo mod npm pack`.  We have marked it as experimental. It works great, go ahead and use it, but we need to test this out in real projects to get a feel of it; it is likely that it will change/improve in the upcoming versions of Hugo. The command creates a consolidated `package.json` from the project and all of its [theme components](https://gohugo.io/hugo-modules/theme-components/). On version conflicts, the version closest to the project is selected. We may revise that strategy in the future ([minimal version selection](https://about.sourcegraph.com/blog/the-pain-that-minimal-version-selection-solves/) maybe?), but this should give both control and the least amount of surprise for the site owner.
 
 So, why did we do this? JavaScript is often a background actor in a Hugo project, and it doesn't make sense to publish it to a NPM registry. The JS dependencies are mostly build tools (PostCSS, TailwindCSS, Babel), `devDependencies`. This has been working fine as long as you kept the JS config files (including `package.json`) in the project, adding duplication/work when using ready-to-use theme components. These tools work best when you have everything below a single file tree, which is very much different to how [Hugo Modules](https://gohugo.io/hugo-modules/) work. An example of a module with TailwindCSS:
@@ -44,7 +43,7 @@
 
 * We have added a `noVendor` Glob pattern config to the module config [d4611c43](https://github.com/gohugoio/hugo/commit/d4611c4322dabfd8d2520232be578388029867db) [@bep](https://github.com/bep) [#7647](https://github.com/gohugoio/hugo/issues/7647). This allows you to only vendor a subset of your dependencies.
 * We have added `ignoreImports` option to module imports config [20af9a07](https://github.com/gohugoio/hugo/commit/20af9a078189ce1e92a1d2047c90fba2a4e91827) [@bep](https://github.com/bep) [#7646](https://github.com/gohugoio/hugo/issues/7646), which allows you to import a module and load its config, but not follow its imports.
-* We have deprecated `--ignoreVendor` in favour of a `--ignoreVendor`, a patch matching Glob pattern [9a1e6d15](https://github.com/gohugoio/hugo/commit/9a1e6d15a31ec667b2ff9cf20e43b1daca61e004) [@bep](https://github.com/bep). A typical use for this would be when you have vendored your dependencies, but want to edit one of them.
+* We have deprecated `--ignoreVendor` in favour of a `--ignoreVendorPaths`, a patch matching Glob pattern [9a1e6d15](https://github.com/gohugoio/hugo/commit/9a1e6d15a31ec667b2ff9cf20e43b1daca61e004) [@bep](https://github.com/bep). A typical use for this would be when you have vendored your dependencies, but want to edit one of them.
 
 
 ## Statistics
@@ -61,6 +60,10 @@
 * 46596+ [stars](https://github.com/gohugoio/hugo/stargazers)
 * 438+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
 * 352+ [themes](http://themes.gohugo.io/)
+
+## Notes
+* We now build with Go 1.15, which means that we no longer build release binaries for MacOS 32-bit.
+* You may now get an error message about "error calling partial: partials that returns a value needs a non-zero argument.". This error situation was not caught earlier, and comes from a limitation in Go's templates: If you use the `return` keyword in a partial, the argument you pass to that partial (e.g. the ".") cannot be zero (and 0 and "" is considered a zero argument).
 
 ## Enhancements
 
--- a/docs/content/en/templates/pagination.md
+++ b/docs/content/en/templates/pagination.md
@@ -43,9 +43,15 @@
 There are two ways to configure and use a `.Paginator`:
 
 1. The simplest way is just to call `.Paginator.Pages` from a template. It will contain the pages for *that page*.
-2. Select a subset of the pages with the available template functions and ordering options, and pass the slice to `.Paginate`, e.g. `{{ range (.Paginate ( first 50 .Pages.ByTitle )).Pages }}`.
+2. Select another set of pages with the available template functions and ordering options, and pass the slice to `.Paginate`, e.g.
+  * `{{ range (.Paginate ( first 50 .Pages.ByTitle )).Pages }}` or
+  * `{{ range (.Paginate .RegularPagesRecursive).Pages }}`.
 
 For a given **Page**, it's one of the options above. The `.Paginator` is static and cannot change once created.
+
+If you call `.Paginator` or `.Paginate` multiple times on the same page, you should ensure all the calls are identical. Once *either* `.Paginator` or `.Paginate` is called while generating a page, its result is cached, and any subsequent similar call will reuse the cached result. This means that any such calls which do not match the first one will not behave as written.
+
+(Remember that function arguments are eagerly evaluated, so a call like `$paginator := cond x .Paginator (.Paginate .RegularPagesRecursive)` is an example of what you should *not* do. Use `if`/`else` instead to ensure exactly one evaluation.)
 
 The global page size setting (`Paginate`) can be overridden by providing a positive integer as the last argument. The examples below will give five items per page:
 
--- a/docs/content/en/templates/sitemap-template.md
+++ b/docs/content/en/templates/sitemap-template.md
@@ -43,7 +43,7 @@
 
 ## Hugo’s sitemap.xml
 
-This template respects the version 0.9 of the [Sitemap Protocol](https://www.sitemaps.org/protocol.html).
+This template respects the version 1.0 of the [Sitemap Protocol](https://www.sitemaps.org/protocol.html).
 
 ```xml
 {{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
--- a/docs/content/en/templates/taxonomy-templates.md
+++ b/docs/content/en/templates/taxonomy-templates.md
@@ -158,11 +158,11 @@
 
 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, then the more recent content will be displayed first.
+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.
+The default weight for any piece of content is 0. Zero means "does not have a weight", not "has a weight of numerical value zero".
 
-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.
+Weights of zero are thus 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
 
--- a/docs/content/en/tools/frontends.md
+++ b/docs/content/en/tools/frontends.md
@@ -30,5 +30,4 @@
     * **Features:** inline PageDown editor, visual tree view, image upload and digital asset management with Cloudinary, site preview, continuous integration with GitHub, atomic deploy and hosting, Git and Hugo integration, autosave, custom domain, project syncing, theme cloning and management. Developers have complete control over the source code and can manage it with GitHub’s deceptively simple workflow.
 * [DATOCMS](https://www.datocms.com) DatoCMS is a fully customizable administrative area for your static websites. Use your favorite website generator, let your clients publish new content independently, and the host the site anywhere you like.
 * [Forestry.io](https://forestry.io/). Forestry is a git-backed CMS for Hugo, Gatsby, Jekyll and VuePress websites with support for GitHub, GitLab, Bitbucket and Azure Devops. Forestry provides a nice user interface to edit and model content for non technical editors. It supports S3, Cloudinary and Netlify Large Media integrations for storing media. Every time an update is made via the CMS, Forestry will commit changes back to your repo and vice-versa.
-* [Netlify.com](https://www.netlify.com). Netlify builds, deploys, and hosts your static website or app (Hugo, Jekyll, etc). Netlify offers a drag-and-drop interface and automatic deployments from GitHub or Bitbucket.
-    * **Features:** global CDN, atomic deploys, ultra-fast DNS, instant cache invalidation, high availability, automated hosting, Git integration, form submission hooks, authentication providers, and custom domains. Developers have complete control over the source code and can manage it with GitHub or Bitbucket's deceptively simple workflow.
+
--- a/docs/netlify.toml
+++ b/docs/netlify.toml
@@ -3,7 +3,7 @@
 command = "hugo --gc --minify"
 
 [context.production.environment]
-HUGO_VERSION = "0.74.3"
+HUGO_VERSION = "0.75.1"
 HUGO_ENV = "production"
 HUGO_ENABLEGITINFO = "true"
 
@@ -11,7 +11,7 @@
 command = "hugo --gc --minify --enableGitInfo"
 
 [context.split1.environment]
-HUGO_VERSION = "0.74.3"
+HUGO_VERSION = "0.75.1"
 HUGO_ENV = "production"
 
 [context.deploy-preview]
@@ -18,13 +18,13 @@
 command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
 
 [context.deploy-preview.environment]
-HUGO_VERSION = "0.74.3"
+HUGO_VERSION = "0.75.1"
 
 [context.branch-deploy]
 command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
 
 [context.branch-deploy.environment]
-HUGO_VERSION = "0.74.3"
+HUGO_VERSION = "0.75.1"
 
 [context.next.environment]
 HUGO_ENABLEGITINFO = "true"
binary files /dev/null b/docs/resources/_gen/images/news/0.75.0-relnotes/featured_hubc6f618a9a95ca518cbd88f6725b3660_125400_480x0_resize_catmullrom_2.png differ
binary files /dev/null b/docs/resources/_gen/images/news/0.75.0-relnotes/featured_hubc6f618a9a95ca518cbd88f6725b3660_125400_640x0_resize_catmullrom_2.png differ