diff --git a/content/en/content-management/multilingual.md b/content/en/content-management/multilingual.md index c2e3cfa66..7e38b96f9 100644 --- a/content/en/content-management/multilingual.md +++ b/content/en/content-management/multilingual.md @@ -15,7 +15,7 @@ aliases: [/content/multilingual/,/tutorials/create-a-multilingual-site/] You should define the available languages in a `languages` section in your site configuration. -> Also See [Hugo Multilingual Part 1: Content translation] +Also See [Hugo Multilingual Part 1: Content translation]. ## Configure Languages @@ -97,7 +97,9 @@ From **Hugo 0.31** we support multiple languages in a multihost configuration. S This means that you can now configure a `baseURL` per `language`: -> If a `baseURL` is set on the `language` level, then all languages must have one and they must all be different. +{{% note %}} +If a `baseURL` is set on the `language` level, then all languages must have one and they must all be different. +{{% /note %}} Example: diff --git a/content/en/contribute/development.md b/content/en/contribute/development.md index cb56783e9..7bf7848ae 100644 --- a/content/en/contribute/development.md +++ b/content/en/contribute/development.md @@ -122,7 +122,9 @@ You set up the working copy of the repository locally on your computer. Your loc We assume that you've set up your `GOPATH` (see the section above if you're unsure about this). You should now copy the Hugo repository down to your computer. You'll hear this called "clone the repo". GitHub's [help pages](https://help.github.com/articles/cloning-a-repository/) give us a short explanation: -> When you create a repository on GitHub, it exists as a remote repository. You can create a local clone of your repository on your computer and sync between the two locations. +{{% note %}} +When you create a repository on GitHub, it exists as a remote repository. You can create a local clone of your repository on your computer and sync between the two locations. +{{% /note %}} We're going to clone the [master Hugo repository](https://github.com/gohugoio/hugo). That seems counter-intuitive, since you won't have commit rights on it. But it's required for the Go workflow. You'll work on a copy of the master and push your changes to your own repository on GitHub. @@ -134,8 +136,7 @@ cd $HOME/src git clone https://github.com/gohugoio/hugo.git ``` -> Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build. -> The easiest is to clone Hugo in a directory outside of GOPATH +Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build. The easiest is to clone Hugo in a directory outside of GOPATH And then, install dependencies of Hugo by running the following in the cloned directory: @@ -154,7 +155,9 @@ go install github.com/magefile/mage@latest If you're not familiar with this term, GitHub's [help pages](https://help.github.com/articles/fork-a-repo/) provide again a simple explanation: -> A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project. +{{% note %}} +A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project. +{{% /note %}} #### Fork by hand diff --git a/content/en/functions/len.md b/content/en/functions/len.md index 9a57fb9b8..cdf3cf405 100644 --- a/content/en/functions/len.md +++ b/content/en/functions/len.md @@ -1,54 +1,44 @@ --- title: len -description: Returns the length of a variable according to its type. +description: Returns the length of a string, slice, map, or collection. categories: [functions] menu: docs: parent: functions -keywords: [] +keywords: [length] signature: ["len INPUT"] relatedfuncs: [] --- -`len` is a built-in function in Go that returns the length of a variable according to its type. From the Go documentation: +With a string: -> Array: the number of elements in v. -> -> Pointer to array: the number of elements in *v (even if v is nil). -> -> Slice, or map: the number of elements in v; if v is nil, len(v) is zero. -> -> String: the number of bytes in v. -> -> Channel: the number of elements queued (unread) in the channel buffer; if v is nil, len(v) is zero. +```go-html-template +{{ "ab" | len }} → 2 +{{ "" | len }} → 0 +``` -`len` is also considered a [fundamental function for Hugo templating]. +With a slice: -## `len` Example 1: Longer Headings +```go-html-template +{{ slice "a" "b" | len }} → 2 +{{ slice | len }} → 0 +``` -You may want to append a class to a heading according to the length of the string therein. The following templating checks to see if the title's length is greater than 80 characters and, if so, adds a `long-title` class to the `