diff --git a/content/en/content-management/multilingual.md b/content/en/content-management/multilingual.md index 9987bca8c..036d74064 100644 --- a/content/en/content-management/multilingual.md +++ b/content/en/content-management/multilingual.md @@ -52,6 +52,10 @@ help = "Aide" title = "مدونتي" weight = 2 languagedirection = "rtl" + +[languages.pt-pt] +title = "O meu blog" +weight = 3 {{< /code-toggle >}} Anything not defined in a `languages` block will fall back to the global value for that key (e.g., `copyright` for the English `en` language). This also works for `params`, as demonstrated with `help` above: You will get the value `Aide` in French and `Help` in all the languages without this parameter set. @@ -67,6 +71,8 @@ If the default language needs to be rendered below its own language code (`/en`) Only the obvious non-global options can be overridden per language. Examples of global options are `baseURL`, `buildDrafts`, etc. +**Please note:** use lowercase language codes, even when using regional languages (ie. use pt-pt instead of pt-PT). Currently Hugo language internals lowercase language codes, which can cause conflicts with settings like `DefaultContentLanguage` which are not lowercased. Please track the evolution of this issue in [Hugo repository issue tracker](https://github.com/gohugoio/hugo/issues/7344) + ### Disable a Language You can disable one or more languages. This can be useful when working on a new translation. diff --git a/content/en/content-management/shortcodes.md b/content/en/content-management/shortcodes.md index b565ffafa..a298bc425 100644 --- a/content/en/content-management/shortcodes.md +++ b/content/en/content-management/shortcodes.md @@ -255,6 +255,11 @@ Using the preceding `instagram` with `hidecaption` example above, the following {{< instagram BWNjjyYFxVx hidecaption >}} + +{{% note %}} +The `instagram`-shortcode refers an endpoint of Instagram's API, that's deprecated since October 24th, 2020. Thus, no images can be fetched from this API endpoint, resulting in an error when the `instagram`-shortcode is used. For more information please have a look at GitHub issue [#7879](https://github.com/gohugoio/hugo/issues/7879). +{{% /note %}} + ### `param` Gets a value from the current `Page's` params set in front matter, with a fall back to the site param value. It will log an `ERROR` if the param with the given key could not be found in either. diff --git a/content/en/functions/format.md b/content/en/functions/format.md index cdcec2fb3..b09a77e29 100644 --- a/content/en/functions/format.md +++ b/content/en/functions/format.md @@ -94,19 +94,20 @@ More examples can be found in Go's [documentation for the time package][timecons ### Cardinal Numbers and Ordinal Abbreviations -Spelled-out cardinal numbers (e.g. "one", "two", and "three") and ordinal abbreviations (i.e., with shorted suffixes like "1st", "2nd", and "3rd") are not currently supported: +Spelled-out cardinal numbers (e.g. "one", "two", and "three") are not currently supported. + +Ordinal abbreviations (i.e., with shorted suffixes like "1st", "2nd", and "3rd") are not currently directly supported. By using `{{.Date.Format "Jan 2nd 2006"}}`, Hugo assumes you want to append `nd` as a string to the day of the month. However, you can chain functions together to create something like this: ``` -{{.Date.Format "Jan 2nd 2006"}} +{{ .Date.Format "2" }}{{ if in (slice 1 21 31) .Date.Day}}st{{ else if in (slice 2 22) .Date.Day}}nd{{ else if in (slice 3 23) .Date.Day}}rd{{ else }}th{{ end }} of {{ .Date.Format "January 2006" }} ``` -Hugo assumes you want to append `nd` as a string to the day of the month and outputs the following: +This will output: ``` -Mar 3nd 2017 +5th of March 2017 ``` - ### Use `.Local` and `.UTC` diff --git a/content/en/functions/time.md b/content/en/functions/time.md index 3be2d4368..c4f74215b 100644 --- a/content/en/functions/time.md +++ b/content/en/functions/time.md @@ -10,16 +10,16 @@ categories: [functions] menu: docs: parent: "functions" -keywords: [dates,time] -signature: ["time INPUT"] +keywords: [dates,time,location] +signature: ["time INPUT [LOCATION]"] workson: [] -hugoversion: +hugoversion: "v0.77.0" relatedfuncs: [] deprecated: false aliases: [] --- -`time` converts a timestamp string into a [`time.Time`](https://godoc.org/time#Time) structure so you can access its fields: +`time` converts a timestamp string with an optional default location into a [`time.Time`](https://godoc.org/time#Time) structure so you can access its fields: ``` {{ time "2016-05-28" }} → "2016-05-28T00:00:00Z" @@ -27,6 +27,18 @@ aliases: [] {{ mul 1000 (time "2016-05-28T10:30:00.00+10:00").Unix }} → 1464395400000, or Unix time in milliseconds ``` +## Using Locations + +The optional `LOCATION` parameter is a string that sets a default location that is associated with the specified time value. If the time value has an explicit timezone or offset specified, it will take precedence over the `LOCATION` parameter. + +The list of valid locations may be system dependent, but should include `UTC`, `Local`, or any location in the [IANA Time Zone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). + +``` +{{ time "2020-10-20" }} → 2020-10-20 00:00:00 +0000 UTC +{{ time "2020-10-20" "America/Los_Angeles" }} → 2020-10-20 00:00:00 -0700 PDT +{{ time "2020-01-20" "America/Los_Angeles" }} → 2020-01-20 00:00:00 -0800 PST +``` + ## Example: Using `time` to get Month Index The following example takes a UNIX timestamp---set as `utimestamp: "1489276800"` in a content's front matter---converts the timestamp (string) to an integer using the [`int` function][int], and then uses [`printf`][] to convert the `Month` property of `time` into an index. diff --git a/content/en/hugo-modules/configuration.md b/content/en/hugo-modules/configuration.md index 175809a37..5405e4e51 100644 --- a/content/en/hugo-modules/configuration.md +++ b/content/en/hugo-modules/configuration.md @@ -22,6 +22,7 @@ noVendor = "" proxy = "direct" noProxy = "none" private = "*.*" +replacements = "" {{< /code-toggle >}} @@ -37,6 +38,9 @@ noProxy private : Comma separated glob list matching paths that should be treated as private. +replacements {{< new-in "0.77.0" >}} +: A comma separated (or a slice) list of module path to directory replacement mapping, e.g. `"github.com/bep/myprettytheme -> ../..,github.com/bep/shortcodes -> /some/path`. This is mostly useful for temporary locally development of a module, and then it makes sense to set it as an OS environment variable, e.g: `env HUGO_MODULE_REPLACEMENTS="github.com/bep/myprettytheme -> ../.."`. Any relative path is relate to [themesDir](https://gohugo.io/getting-started/configuration/#all-configuration-settings), and absolute paths are allowed. + Note that the above terms maps directly to their counterparts in Go Modules. Some of these setting may be natural to set as OS environment variables. To set the proxy server to use, as an example: ``` diff --git a/content/en/news/0.77.0-relnotes/featured.png b/content/en/news/0.77.0-relnotes/featured.png new file mode 100644 index 000000000..4245479a5 Binary files /dev/null and b/content/en/news/0.77.0-relnotes/featured.png differ diff --git a/content/en/news/0.77.0-relnotes/index.md b/content/en/news/0.77.0-relnotes/index.md new file mode 100644 index 000000000..c9db7ef99 --- /dev/null +++ b/content/en/news/0.77.0-relnotes/index.md @@ -0,0 +1,90 @@ + +--- +date: 2020-10-30 +title: "Hugo 0.77.0: Hugo Modules Improvements and More " +description: "New Replacements config option for simpler development workflows, ignore errors from getJSON, localized dates, and more." +categories: ["Releases"] +--- + +Hugo `0.77.0` is a small, but useful release. Some notable updates are: + +* **time.AsTime** accepts an optional location as second parameter, allowing timezone aware printing of dates. +* You can now build with `go install -tags nodeploy` if you don't need the **`hugo deploy`** feature. +* Remote **`getJSON`** errors can now be ignored by adding `ignoreErrors = ["error-remote-getjson"]` to your site config. + +There are also several useful **[Hugo Modules](https://gohugo.io/hugo-modules/)** enhancements: + +* We have added `Replacements` to the [Module Configuration](https://gohugo.io/hugo-modules/configuration/#module-config-top-level). This should enable a much simpler developer workflow, simpler to set up preview sites for your remote theme etc, as you now can do `env HUGO_MODULE_REPLACEMENTS="github.com/bep/myprettytheme -> ../.." hugo` and similar. +* The module `Path` for local modules can now be absolute for imports defined in the project. + +This release represents **38 contributions by 11 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 [@moorereason](https://github.com/moorereason), and [@anthonyfok](https://github.com/anthonyfok) 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 [@davidsneighbour](https://github.com/davidsneighbour), [@coliff](https://github.com/coliff) and [@kaushalmodi](https://github.com/kaushalmodi) for all the 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 **3 contributions by 3 contributors**. + +Hugo now has: + +* 47530+ [stars](https://github.com/gohugoio/hugo/stargazers) +* 438+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors) +* 361+ [themes](http://themes.gohugo.io/) + +## Enhancements + +### Templates + +* Refactor time.AsTime location implementation [807db97a](https://github.com/gohugoio/hugo/commit/807db97af83ff61b022cbc8af80b9dc9cdb8dd43) [@moorereason](https://github.com/moorereason) +* Update Hugo time to support optional [LOCATION] parameter [26eeb291](https://github.com/gohugoio/hugo/commit/26eeb2914720929d2d778f14d6a4bf737014e9e3) [@virgofx](https://github.com/virgofx) +* Improve layout path construction [acfa1538](https://github.com/gohugoio/hugo/commit/acfa153863d6ff2acf17ffb4395e05d102229905) [@moorereason](https://github.com/moorereason) +* Test all lookup permutations in TestLayout [78b26d53](https://github.com/gohugoio/hugo/commit/78b26d538c716d463b30c23de7df5eaa4d5504fd) [@moorereason](https://github.com/moorereason) +* Reformat TestLayout table [28179bd5](https://github.com/gohugoio/hugo/commit/28179bd55619847f46ca0ffd316ef52fc9c96f1e) [@moorereason](https://github.com/moorereason) + +### Other + +* Allow absolute paths for project imports [beabc8d9](https://github.com/gohugoio/hugo/commit/beabc8d998249ecc5dd522d696dc6233a29131c2) [@bep](https://github.com/bep) [#7910](https://github.com/gohugoio/hugo/issues/7910) +* Regen docs helper [332b65e4](https://github.com/gohugoio/hugo/commit/332b65e4ccb6ac0d606de2a1b23f5189c72542be) [@bep](https://github.com/bep) +* Add module.replacements [173187e2](https://github.com/gohugoio/hugo/commit/173187e2633f3fc037c83e1e3de2902ae3c93b92) [@bep](https://github.com/bep) [#7904](https://github.com/gohugoio/hugo/issues/7904)[#7908](https://github.com/gohugoio/hugo/issues/7908) +* Do not call CDN service invalidation when executing a dry run deployment [56a34350](https://github.com/gohugoio/hugo/commit/56a343507ca28254edb891bc1c21b6c8ca017982) [@zemanel](https://github.com/zemanel) [#7884](https://github.com/gohugoio/hugo/issues/7884) +* Pass editor arguments from newContentEditor correctly [d48a98c4](https://github.com/gohugoio/hugo/commit/d48a98c477a818d28008d9771050d2681e63e880) [@bhavin192](https://github.com/bhavin192) +* Bump github.com/spf13/cobra from 0.0.7 to 1.1.1 [3261678f](https://github.com/gohugoio/hugo/commit/3261678f63fd66810db77ccaf9a0c0e426be5380) [@anthonyfok](https://github.com/anthonyfok) +* Allow optional "nodeploy" tag to exclude deploy command from bin [f465c5c3](https://github.com/gohugoio/hugo/commit/f465c5c3079261eb7fa513e2d2793851b9c52b83) [@emhagman](https://github.com/emhagman) [#7826](https://github.com/gohugoio/hugo/issues/7826) +* Allow cascade _target to work with non toml fm [3400aff2](https://github.com/gohugoio/hugo/commit/3400aff2588cbf9dd4629c05537d16b019d0fdf5) [@gwatts](https://github.com/gwatts) [#7874](https://github.com/gohugoio/hugo/issues/7874) +* Allow getJSON errors to be ignored [fdfa4a5f](https://github.com/gohugoio/hugo/commit/fdfa4a5fe62232f65f1dd8d6fe0c500374228788) [@bep](https://github.com/bep) [#7866](https://github.com/gohugoio/hugo/issues/7866) +* bump github.com/evanw/esbuild from 0.7.15 to 0.7.18 [8cbe2bbf](https://github.com/gohugoio/hugo/commit/8cbe2bbfad6aa4de267921e24e166d4addf47040) [@dependabot[bot]](https://github.com/apps/dependabot) +* Revert "Add benchmark for building docs site" [b886fa46](https://github.com/gohugoio/hugo/commit/b886fa46bb92916152476cfac45c7a5ee5e5820a) [@bep](https://github.com/bep) +* Avoid making unnecessary allocation [14bce18a](https://github.com/gohugoio/hugo/commit/14bce18a6c5aca8cb3e70a74d5045ca8b2358fee) [@moorereason](https://github.com/moorereason) +* Add benchmark for building docs site [837e084b](https://github.com/gohugoio/hugo/commit/837e084bbe53e9e2e6cd471d2a3daf273a874d92) [@moorereason](https://github.com/moorereason) +* Always show page number when 5 pages or less [08e4f9ff](https://github.com/gohugoio/hugo/commit/08e4f9ff9cc448d5fea9b8a62a23aed8aad0d047) [@moorereason](https://github.com/moorereason) [#7523](https://github.com/gohugoio/hugo/issues/7523) +* bump github.com/frankban/quicktest from 1.11.0 to 1.11.1 [f033d9f0](https://github.com/gohugoio/hugo/commit/f033d9f01d13d8cd08205ccfaa09919ed15dca77) [@dependabot[bot]](https://github.com/apps/dependabot) +* bump github.com/evanw/esbuild from 0.7.14 to 0.7.15 [59fe2794](https://github.com/gohugoio/hugo/commit/59fe279424c66ac6a89cafee01a5b2e34dbcc1fb) [@dependabot[bot]](https://github.com/apps/dependabot) +* Merge branch 'release-0.76.5' [62119022](https://github.com/gohugoio/hugo/commit/62119022d1be41e423ef3bcf467a671ce6c4f7dd) [@bep](https://github.com/bep) +* Render aliases even if render=link [79a022a1](https://github.com/gohugoio/hugo/commit/79a022a15c5f39b8ae87a94665f14bf1797b605c) [@bep](https://github.com/bep) [#7832](https://github.com/gohugoio/hugo/issues/7832) +* Render aliases even if render=link [ead5799f](https://github.com/gohugoio/hugo/commit/ead5799f7ea837fb2ca1879a6d37ba364e53827f) [@bep](https://github.com/bep) [#7832](https://github.com/gohugoio/hugo/issues/7832) +* bump github.com/spf13/afero from 1.4.0 to 1.4.1 [d57be113](https://github.com/gohugoio/hugo/commit/d57be113243be4b76310d4476fbb7525d1452658) [@dependabot[bot]](https://github.com/apps/dependabot) +* bump github.com/evanw/esbuild from 0.7.9 to 0.7.14 [d0705966](https://github.com/gohugoio/hugo/commit/d070596694a3edbf42fc315bb326505aa39fce90) [@dependabot[bot]](https://github.com/apps/dependabot) +* Update to Go 1.15 and Alpine 3.12 [f5ea359d](https://github.com/gohugoio/hugo/commit/f5ea359dd34bf59a2944f1d9667838202af13c93) [@ducksecops](https://github.com/ducksecops) +* Install postcss v8 explicitly as it is now a peer dependency [e9a7ebaf](https://github.com/gohugoio/hugo/commit/e9a7ebaf67a63ffe5e64c3b3aaefe66feb7f1868) [@anthonyfok](https://github.com/anthonyfok) +* Merge branch 'release-0.76.3' [49972d07](https://github.com/gohugoio/hugo/commit/49972d07925604fea45afe1ace7b5dcc6efc30bf) [@bep](https://github.com/bep) +* Add merge helper [c98132e3](https://github.com/gohugoio/hugo/commit/c98132e30e01a9638e61bd888c769d30e4e43ad5) [@bep](https://github.com/bep) +* Add workaround for known language, but missing plural rule error [33e9d79b](https://github.com/gohugoio/hugo/commit/33e9d79b78b32d0cc19693ab3c29ba9941d80f8f) [@bep](https://github.com/bep) [#7798](https://github.com/gohugoio/hugo/issues/7798) +* Update to github.com/tdewolff/minify v2.9.4" [6dd60fca](https://github.com/gohugoio/hugo/commit/6dd60fca73ff96b48064bb8c6586631a2370ffc6) [@bep](https://github.com/bep) [#7792](https://github.com/gohugoio/hugo/issues/7792) + +## Fixes + +### Templates + +* Fix reflection bug in merge [6d95dc9d](https://github.com/gohugoio/hugo/commit/6d95dc9d74681cba53b46e79c6e1d58d27fcdfb0) [@moorereason](https://github.com/moorereason) [#7899](https://github.com/gohugoio/hugo/issues/7899) + +### Other + +* Fix setting HUGO_MODULE_PROXY etc. via env vars [8a1c637c](https://github.com/gohugoio/hugo/commit/8a1c637c4494751046142e0ef345fce38fc1431b) [@bep](https://github.com/bep) [#7903](https://github.com/gohugoio/hugo/issues/7903) +* Fix for language code case issue with pt-br etc. [50682043](https://github.com/gohugoio/hugo/commit/506820435cacb39ce7bb1835f46a15e913b95828) [@bep](https://github.com/bep) [#7804](https://github.com/gohugoio/hugo/issues/7804) +* Fix for bare TOML keys [fc6abc39](https://github.com/gohugoio/hugo/commit/fc6abc39c75c152780151c35bc95b12bee01b09c) [@bep](https://github.com/bep) +* Fix i18n .Count regression [f9e798e8](https://github.com/gohugoio/hugo/commit/f9e798e8c4234bd60277e3cb10663ba254d4ecb7) [@bep](https://github.com/bep) [#7787](https://github.com/gohugoio/hugo/issues/7787) +* Fix typo in 0.76.0 release note [ee56efff](https://github.com/gohugoio/hugo/commit/ee56efffcb3f81120b0d3e0297b4fb5966124354) [@digitalcraftsman](https://github.com/digitalcraftsman) + + + + + diff --git a/data/docs.json b/data/docs.json index 394ccd32f..7ef0b939b 100644 --- a/data/docs.json +++ b/data/docs.json @@ -1557,18 +1557,13 @@ "keepWhitespace": false }, "css": { - "keepCSS2": true, - "precision": 0 - }, - "js": { - "precision": 0, - "keepVarNames": false - }, - "json": { - "precision": 0 + "decimals": -1, + "keepCSS2": true }, + "js": {}, + "json": {}, "svg": { - "precision": 0 + "decimals": -1 }, "xml": { "keepWhitespace": false @@ -4727,7 +4722,8 @@ "AsTime": { "Description": "AsTime converts the textual representation of the datetime string into\na time.Time interface.", "Args": [ - "v" + "v", + "args" ], "Aliases": null, "Examples": [ diff --git a/netlify.toml b/netlify.toml index 52b48d35a..d0dc9ded3 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,7 +3,7 @@ publish = "public" command = "hugo --gc --minify" [context.production.environment] -HUGO_VERSION = "0.76.5" +HUGO_VERSION = "0.77.0" HUGO_ENV = "production" HUGO_ENABLEGITINFO = "true" @@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true" command = "hugo --gc --minify --enableGitInfo" [context.split1.environment] -HUGO_VERSION = "0.76.5" +HUGO_VERSION = "0.77.0" HUGO_ENV = "production" [context.deploy-preview] command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL" [context.deploy-preview.environment] -HUGO_VERSION = "0.76.5" +HUGO_VERSION = "0.77.0" [context.branch-deploy] command = "hugo --gc --minify -b $DEPLOY_PRIME_URL" [context.branch-deploy.environment] -HUGO_VERSION = "0.76.5" +HUGO_VERSION = "0.77.0" [context.next.environment] HUGO_ENABLEGITINFO = "true" diff --git a/resources/_gen/images/news/0.77.0-relnotes/featured_hu95e3f73231f4ff78ed176e490b00b665_130926_480x0_resize_catmullrom_2.png b/resources/_gen/images/news/0.77.0-relnotes/featured_hu95e3f73231f4ff78ed176e490b00b665_130926_480x0_resize_catmullrom_2.png new file mode 100644 index 000000000..ad6a7a670 Binary files /dev/null and b/resources/_gen/images/news/0.77.0-relnotes/featured_hu95e3f73231f4ff78ed176e490b00b665_130926_480x0_resize_catmullrom_2.png differ diff --git a/resources/_gen/images/news/0.77.0-relnotes/featured_hu95e3f73231f4ff78ed176e490b00b665_130926_640x0_resize_catmullrom_2.png b/resources/_gen/images/news/0.77.0-relnotes/featured_hu95e3f73231f4ff78ed176e490b00b665_130926_640x0_resize_catmullrom_2.png new file mode 100644 index 000000000..7d037e510 Binary files /dev/null and b/resources/_gen/images/news/0.77.0-relnotes/featured_hu95e3f73231f4ff78ed176e490b00b665_130926_640x0_resize_catmullrom_2.png differ