Squashed 'docs/' changes from ec0abe052..6c2195936
6c2195936 Update featured.png 109a0fcca add len function to navigation side menu 39a356bc5 Revert "Add some rickrolls redirects" b8393b1b5 Add some rickrolls redirects 2ce21c34b Update configuration-markup.md (add rel="noopener") 95bd7974e Disambiguate global and page resources 5e233dc4b Update base.md 959b9dc3a Fix typo on "where" page aff8059a1 Release 0.70.0 44a172ac0 releaser: Add release notes to /docs for release of 0.70.0 1b01c8988 Release 0.70.0 5ece21c6c Merge commit '89044b8f8795f17c36396c67823183a20fc88139' 0894aec5b Rename transpileJS to babel 5da27c7a6 resources: Add JavaScript transpiling solution git-subtree-dir: docs git-subtree-split: 6c21959360394165435fa36eac489bf6a701ae9a
|
@ -35,7 +35,7 @@ Note that we extended this property from a boolean to an enum in Hugo 0.68.0.
|
||||||
Valid values are:
|
Valid values are:
|
||||||
|
|
||||||
never
|
never
|
||||||
: The page will not be included in any page collection.
|
: The page will not be incldued in any page collection.
|
||||||
|
|
||||||
always (default)
|
always (default)
|
||||||
: The page will be included in all page collections, e.g. `site.RegularPages`, `$page.Pages`.
|
: The page will be included in all page collections, e.g. `site.RegularPages`, `$page.Pages`.
|
||||||
|
|
|
@ -18,14 +18,23 @@ menu:
|
||||||
|
|
||||||
The `image` is a [Page Resource]({{< relref "/content-management/page-resources" >}}), and the processing methods listed below do not work on images inside your `/static` folder.
|
The `image` is a [Page Resource]({{< relref "/content-management/page-resources" >}}), and the processing methods listed below do not work on images inside your `/static` folder.
|
||||||
|
|
||||||
To get all images in a [Page Bundle]({{< relref "/content-management/organization#page-bundles" >}}):
|
To print all images paths in a [Page Bundle]({{< relref "/content-management/organization#page-bundles" >}}):
|
||||||
|
|
||||||
```go-html-template
|
```go-html-template
|
||||||
{{ with .Resources.ByType "image" }}
|
{{ with .Resources.ByType "image" }}
|
||||||
|
{{ range . }}
|
||||||
|
{{ .RelPermalink }}
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## The Image Resource
|
||||||
|
|
||||||
|
The `image` resource can also be retrieved from a [global resource]({{< relref "/hugo-pipes/introduction#from-file-to-resource" >}})
|
||||||
|
|
||||||
|
{{- $image := resources.Get "images/logo.jpg" -}}
|
||||||
|
|
||||||
## Image Processing Methods
|
## Image Processing Methods
|
||||||
|
|
||||||
The `image` resource implements the methods `Resize`, `Fit` and `Fill`, each returning the transformed image using the specified dimensions and processing options. The `image` resource also, since Hugo 0.58, implements the method `Exif` and `Filter`.
|
The `image` resource implements the methods `Resize`, `Fit` and `Fill`, each returning the transformed image using the specified dimensions and processing options. The `image` resource also, since Hugo 0.58, implements the method `Exif` and `Filter`.
|
||||||
|
|
|
@ -73,6 +73,14 @@ my-post
|
||||||
: This leaf bundle has the `index.md`, two other content
|
: This leaf bundle has the `index.md`, two other content
|
||||||
Markdown files and two image files.
|
Markdown files and two image files.
|
||||||
|
|
||||||
|
image1
|
||||||
|
: This image is a page resource of `my-post`
|
||||||
|
and only available in `my-post/index.md` resources.
|
||||||
|
|
||||||
|
image2
|
||||||
|
: This image is a page resource of `my-post`
|
||||||
|
and only available in `my-post/index.md` resources.
|
||||||
|
|
||||||
my-other-post
|
my-other-post
|
||||||
: This leaf bundle has only the `index.md`.
|
: This leaf bundle has only the `index.md`.
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,10 @@ menu:
|
||||||
weight: 31
|
weight: 31
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Page resources are available for [page bundles]({{< relref "/content-management/page-bundles" >}}) only,
|
||||||
|
i.e. a directory with either a `index.md`, or `_index.md` file at its root. Resources are only attached to
|
||||||
|
the lowest page they are bundled with, and simple which names does not contain `index.md` are not attached any resource.
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
ResourceType
|
ResourceType
|
||||||
|
|
|
@ -7,6 +7,9 @@ date: 2017-02-01
|
||||||
publishdate: 2017-02-01
|
publishdate: 2017-02-01
|
||||||
lastmod: 2017-04-18
|
lastmod: 2017-04-18
|
||||||
categories: [functions]
|
categories: [functions]
|
||||||
|
menu:
|
||||||
|
docs:
|
||||||
|
parent: "functions"
|
||||||
keywords: []
|
keywords: []
|
||||||
signature: ["len INPUT"]
|
signature: ["len INPUT"]
|
||||||
workson: [lists,taxonomies,terms]
|
workson: [lists,taxonomies,terms]
|
||||||
|
|
|
@ -138,7 +138,7 @@ You can also nest `where` clauses to drill down on lists of content by more than
|
||||||
|
|
||||||
Filtering only works for set fields. To check whether a field is set or exists, you can use the operand `nil`.
|
Filtering only works for set fields. To check whether a field is set or exists, you can use the operand `nil`.
|
||||||
|
|
||||||
This can be useful to filter a small amount of pages from a large pool. Instead of set field on all pages, you can set field on required pages only.
|
This can be useful to filter a small amount of pages from a large pool. Instead of setting a field on all pages, you can set that field on required pages only.
|
||||||
|
|
||||||
Only the following operators are available for `nil`
|
Only the following operators are available for `nil`
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ PlainText
|
||||||
Here is a code example for how the render-link.html template could look:
|
Here is a code example for how the render-link.html template could look:
|
||||||
|
|
||||||
{{< code file="layouts/_default/_markup/render-link.html" >}}
|
{{< code file="layouts/_default/_markup/render-link.html" >}}
|
||||||
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text | safeHTML }}</a>
|
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>
|
||||||
{{< /code >}}
|
{{< /code >}}
|
||||||
|
|
||||||
#### Image Markdown example:
|
#### Image Markdown example:
|
||||||
|
|
55
content/en/hugo-pipes/babel.md
Executable file
|
@ -0,0 +1,55 @@
|
||||||
|
---
|
||||||
|
title: Babel
|
||||||
|
description: Hugo Pipes can process JS files with Babel.
|
||||||
|
date: 2019-03-21
|
||||||
|
publishdate: 2019-03-21
|
||||||
|
lastmod: 2019-03-21
|
||||||
|
categories: [asset management]
|
||||||
|
keywords: []
|
||||||
|
menu:
|
||||||
|
docs:
|
||||||
|
parent: "pipes"
|
||||||
|
weight: 49
|
||||||
|
weight: 49
|
||||||
|
sections_weight: 49
|
||||||
|
draft: false
|
||||||
|
---
|
||||||
|
|
||||||
|
Any JavaScript resource file can be transpiled to another JavaScript version using `resources.Babel` which takes for argument the resource object and an optional dict of options listed below. Babel uses the [babel cli](https://babeljs.io/docs/en/babel-cli).
|
||||||
|
|
||||||
|
|
||||||
|
{{% note %}}
|
||||||
|
Hugo Pipe's Babel requires the `@babel/cli` and `@babel/core` JavaScript packages to be installed in the project or globally (`npm install -g @babel/cli @babel/core`) along with any Babel plugin(s) or preset(s) used (e.g., `npm install @babel/preset-env --save-dev`).
|
||||||
|
|
||||||
|
If you are using the Hugo Snap package, Babel and plugin(s) need to be installed locally within your Hugo site directory, e.g., `npm install @babel/cli @babel/core --save-dev` without the `-g` flag.
|
||||||
|
{{% /note %}}
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
config [string]
|
||||||
|
: Path to the Babel configuration file. Hugo will, by default, look for a `babel.config.js` in your project. More information on these configuration files can be found here: [babel configuration](https://babeljs.io/docs/en/configuration).
|
||||||
|
|
||||||
|
minified [bool]
|
||||||
|
: Save as much bytes as possible when printing
|
||||||
|
|
||||||
|
noComments [bool]
|
||||||
|
: Write comments to generated output (true by default)
|
||||||
|
|
||||||
|
compact [bool]
|
||||||
|
: Do not include superfluous whitespace characters and line terminators. Defaults to `auto` if not set.
|
||||||
|
|
||||||
|
verbose [bool]
|
||||||
|
: Log everything
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```go-html-template
|
||||||
|
{{- $transpiled := resources.Get "scripts/main.js" | babel -}}
|
||||||
|
```
|
||||||
|
|
||||||
|
Or with options:
|
||||||
|
|
||||||
|
```go-html-template
|
||||||
|
{{ $opts := dict "noComments" true }}
|
||||||
|
{{- $transpiled := resources.Get "scripts/main.js" | babel $opts -}}
|
||||||
|
```
|
BIN
content/en/news/0.70.0-relnotes/hugo-70-featured.png
Normal file
After Width: | Height: | Size: 64 KiB |
68
content/en/news/0.70.0-relnotes/index.md
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
|
||||||
|
---
|
||||||
|
date: 2020-05-06
|
||||||
|
title: "JavaScript Transpiler"
|
||||||
|
description: "Hugo 0.70.0 adds a new pipe function that uses Babel to transpile JavaScript."
|
||||||
|
categories: ["Releases"]
|
||||||
|
---
|
||||||
|
|
||||||
|
This is a small release, and the main new feature is that you can now use [Babel](https://gohugo.io/hugo-pipes/babel/) to transpile JavaScript.
|
||||||
|
|
||||||
|
This release represents **22 contributions by 12 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 [@BurtonQin](https://github.com/BurtonQin), [@tekezo](https://github.com/tekezo), and [@sensimevanidus](https://github.com/sensimevanidus) for their ongoing contributions.
|
||||||
|
And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) and [@onedrawingperday](https://github.com/onedrawingperday) for their relentless work on keeping the themes site in pristine condition and to [@davidsneighbour](https://github.com/davidsneighbour) 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 **6 contributions by 4 contributors**. A special thanks to [@bep](https://github.com/bep), [@MJ2097](https://github.com/MJ2097), [@jeremyzilar](https://github.com/jeremyzilar), and [@larryclaman](https://github.com/larryclaman) for their work on the documentation site.
|
||||||
|
|
||||||
|
|
||||||
|
Hugo now has:
|
||||||
|
|
||||||
|
* 43734+ [stars](https://github.com/gohugoio/hugo/stargazers)
|
||||||
|
* 437+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
|
||||||
|
* 316+ [themes](http://themes.gohugo.io/)
|
||||||
|
|
||||||
|
## Enhancements
|
||||||
|
|
||||||
|
### Templates
|
||||||
|
|
||||||
|
* Change defer RLock to RUnlock [5146dc61](https://github.com/gohugoio/hugo/commit/5146dc614fc45df698ebf890af06421dea988c96) [@BurtonQin](https://github.com/BurtonQin)
|
||||||
|
|
||||||
|
### Output
|
||||||
|
|
||||||
|
* Modify gen chromastyles to output all CSS classes [102ec2da](https://github.com/gohugoio/hugo/commit/102ec2da7adcc4afb7050b17989f0486f8379679) [@acahir](https://github.com/acahir) [#7167](https://github.com/gohugoio/hugo/issues/7167)
|
||||||
|
|
||||||
|
### Core
|
||||||
|
|
||||||
|
* Add Unlock before panic [736f84b2](https://github.com/gohugoio/hugo/commit/736f84b2d539857f7fdd0e42353af80b4dccfe8d) [@BurtonQin](https://github.com/BurtonQin)
|
||||||
|
|
||||||
|
### Other
|
||||||
|
|
||||||
|
* Update minify to v2.6.2 [01befcce](https://github.com/gohugoio/hugo/commit/01befcce35ec992d195ce1b9a6a1eeda693cb5a8) [@pperzyna](https://github.com/pperzyna) [#6699](https://github.com/gohugoio/hugo/issues/6699)
|
||||||
|
* Add support for sort by boolean [04b1a6d9](https://github.com/gohugoio/hugo/commit/04b1a6d997e72d9abada28db22650d38ccbcbb39) [@Mipsters](https://github.com/Mipsters)
|
||||||
|
* Update to Libsass 3.6.4 [dd31e800](https://github.com/gohugoio/hugo/commit/dd31e800075eebd78f921df8b4865c238006e7a7) [@bep](https://github.com/bep) [#7231](https://github.com/gohugoio/hugo/issues/7231)
|
||||||
|
* Rename transpileJS to babel [6add6d77](https://github.com/gohugoio/hugo/commit/6add6d77b48cf0aab8b39d7a2bddedb1aa2a52b8) [@bep](https://github.com/bep) [#5764](https://github.com/gohugoio/hugo/issues/5764)
|
||||||
|
* Add JavaScript transpiling solution [2a171ff1](https://github.com/gohugoio/hugo/commit/2a171ff1c5d9b1603fe78c67d2d894bb2efccc8b) [@hmmmmniek](https://github.com/hmmmmniek) [#5764](https://github.com/gohugoio/hugo/issues/5764)
|
||||||
|
* Disable a test locally [67f92041](https://github.com/gohugoio/hugo/commit/67f920419a53c7ff11e01c4286dca23e92110a12) [@bep](https://github.com/bep)
|
||||||
|
* Add diagnostic hints to init timeout message [fe60b7d9](https://github.com/gohugoio/hugo/commit/fe60b7d9e4c12dbc428f992c05969bc14c7fe7a2) [@mtlynch](https://github.com/mtlynch)
|
||||||
|
* Update goldmark-highlighting [5c41f41a](https://github.com/gohugoio/hugo/commit/5c41f41ad4b14e48aea64687a7600f5ad231e879) [@satotake](https://github.com/satotake) [#7027](https://github.com/gohugoio/hugo/issues/7027)[#6596](https://github.com/gohugoio/hugo/issues/6596)
|
||||||
|
* Update go-org to v1.1.0 [2b28e5a9](https://github.com/gohugoio/hugo/commit/2b28e5a9cb79af2a8d70c80036f52bcf5399b9df) [@niklasfasching](https://github.com/niklasfasching)
|
||||||
|
* Update to goldmark v1.1.28 [feaa582c](https://github.com/gohugoio/hugo/commit/feaa582cbe950e82969da5e99e3fb9a3947025df) [@bep](https://github.com/bep) [#7113](https://github.com/gohugoio/hugo/issues/7113)
|
||||||
|
|
||||||
|
## Fixes
|
||||||
|
|
||||||
|
### Other
|
||||||
|
|
||||||
|
* Fix some missing JS class collector cases [c03ea2b6](https://github.com/gohugoio/hugo/commit/c03ea2b66010d2996d652903cb8fa41e983e787f) [@bep](https://github.com/bep) [#7216](https://github.com/gohugoio/hugo/issues/7216)
|
||||||
|
* Fix IsAncestor and IsDescendant when the same page is passed [8d5766d4](https://github.com/gohugoio/hugo/commit/8d5766d417d6564a1aa1cbe8f9a29ab9bba22371) [@tekezo](https://github.com/tekezo)
|
||||||
|
* Fix IsAncestor and IsDescendant under subsection [27a4c441](https://github.com/gohugoio/hugo/commit/27a4c4410cd9592249925fb14b32605fb961c597) [@tekezo](https://github.com/tekezo)
|
||||||
|
* Fix typo in test suite [49e6c8cb](https://github.com/gohugoio/hugo/commit/49e6c8cb4ed83e20f1e0ac164e91c38854177b99) [@panakour](https://github.com/panakour)
|
||||||
|
* Fix class collector when running with --minify [f37e77f2](https://github.com/gohugoio/hugo/commit/f37e77f2d338cf876cfa637a662acd76f0f2009b) [@bep](https://github.com/bep) [#7161](https://github.com/gohugoio/hugo/issues/7161)
|
||||||
|
* Fix toLower [27af5a33](https://github.com/gohugoio/hugo/commit/27af5a339a4d3c5712b5ed946a636a8c21916039) [@bep](https://github.com/bep) [#7198](https://github.com/gohugoio/hugo/issues/7198)
|
||||||
|
* Fix broken test [b3c82575](https://github.com/gohugoio/hugo/commit/b3c825756f3251f8b26e53262f9d6f484aecf750) [@bep](https://github.com/bep)
|
||||||
|
* Fix typo in Hugo's Security Model [cd4d8202](https://github.com/gohugoio/hugo/commit/cd4d8202016bd3eb5ed9144c8945edaba73c8cf4) [@sensimevanidus](https://github.com/sensimevanidus)
|
||||||
|
* Fix query parameter handling in server fast render mode [ee67dbef](https://github.com/gohugoio/hugo/commit/ee67dbeff5bae6941facaaa39cb995a1ee6def03) [@bep](https://github.com/bep) [#7163](https://github.com/gohugoio/hugo/issues/7163)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 430 KiB After Width: | Height: | Size: 64 KiB |
|
@ -25,7 +25,7 @@ The `block` keyword allows you to define the outer shell of your pages' one or m
|
||||||
|
|
||||||
## Base Template Lookup Order
|
## Base Template Lookup Order
|
||||||
|
|
||||||
{{< new-in "0.63.0" >}} Since Hugo v0.63, the base template lookup order closely follows that of the template is applies to (e.g. `_default/list.html`).
|
{{< new-in "0.63.0" >}} Since Hugo v0.63, the base template lookup order closely follows that of the template it applies to (e.g. `_default/list.html`).
|
||||||
|
|
||||||
See [Template Lookup Order](/templates/lookup-order/) for details and examples.
|
See [Template Lookup Order](/templates/lookup-order/) for details and examples.
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ publish = "public"
|
||||||
command = "hugo --gc --minify"
|
command = "hugo --gc --minify"
|
||||||
|
|
||||||
[context.production.environment]
|
[context.production.environment]
|
||||||
HUGO_VERSION = "0.69.2"
|
HUGO_VERSION = "0.70.0"
|
||||||
HUGO_ENV = "production"
|
HUGO_ENV = "production"
|
||||||
HUGO_ENABLEGITINFO = "true"
|
HUGO_ENABLEGITINFO = "true"
|
||||||
|
|
||||||
|
@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true"
|
||||||
command = "hugo --gc --minify --enableGitInfo"
|
command = "hugo --gc --minify --enableGitInfo"
|
||||||
|
|
||||||
[context.split1.environment]
|
[context.split1.environment]
|
||||||
HUGO_VERSION = "0.69.2"
|
HUGO_VERSION = "0.70.0"
|
||||||
HUGO_ENV = "production"
|
HUGO_ENV = "production"
|
||||||
|
|
||||||
[context.deploy-preview]
|
[context.deploy-preview]
|
||||||
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
|
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
|
||||||
|
|
||||||
[context.deploy-preview.environment]
|
[context.deploy-preview.environment]
|
||||||
HUGO_VERSION = "0.69.2"
|
HUGO_VERSION = "0.70.0"
|
||||||
|
|
||||||
[context.branch-deploy]
|
[context.branch-deploy]
|
||||||
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
|
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
|
||||||
|
|
||||||
[context.branch-deploy.environment]
|
[context.branch-deploy.environment]
|
||||||
HUGO_VERSION = "0.69.2"
|
HUGO_VERSION = "0.70.0"
|
||||||
|
|
||||||
[context.next.environment]
|
[context.next.environment]
|
||||||
HUGO_ENABLEGITINFO = "true"
|
HUGO_ENABLEGITINFO = "true"
|
||||||
|
|
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 145 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 236 KiB |
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 68 KiB |