diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-07-18 11:05:58 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-07-18 11:05:58 +0200 |
commit | 59ebc83d72b09d28d62d8600517c73a4ffe70c66 (patch) | |
tree | 1432d4fac5a6ff28ef815e6d6bb2ecb24b503c35 /docs/content/en | |
parent | ebe4d39f175f73e4f130972cb3d74ef0af5d5761 (diff) | |
parent | b6b37a1f00f808f3c0d2715f65ca2d3091f36495 (diff) |
Merge commit 'b6b37a1f00f808f3c0d2715f65ca2d3091f36495'
Diffstat (limited to 'docs/content/en')
41 files changed, 289 insertions, 266 deletions
diff --git a/docs/content/en/about/new-in-032/index.md b/docs/content/en/about/new-in-032/index.md index b8ca6430e..5ae688fc6 100644 --- a/docs/content/en/about/new-in-032/index.md +++ b/docs/content/en/about/new-in-032/index.md @@ -24,7 +24,7 @@ This documentation belongs in other places in this documentation site, but is pu Also see this demo project from [bep](https://github.com/bep/), the clever Norwegian behind these new features: -* http://hugotest.bep.is/ +* https://temp.bep.is/hugotest/ * https://github.com/bep/hugotest (source) ## Page Resources diff --git a/docs/content/en/about/what-is-hugo.md b/docs/content/en/about/what-is-hugo.md index 2c7339f7c..de7344866 100644 --- a/docs/content/en/about/what-is-hugo.md +++ b/docs/content/en/about/what-is-hugo.md @@ -43,27 +43,23 @@ Hugo is for people building a blog, a company site, a portfolio site, documentat [@spf13]: https://twitter.com/@spf13 [Aerobatic]: https://www.aerobatic.com/ -[Amazon S3]: http://aws.amazon.com/s3/ +[Amazon S3]: https://aws.amazon.com/s3/ [Azure]: https://blogs.msdn.microsoft.com/acoat/2016/01/28/publish-a-static-web-site-using-azure-web-apps/ -[CloudFront]: http://aws.amazon.com/cloudfront/ "Amazon CloudFront" -[contributing to it]: https://github.com/gohugoio/hugo -[DreamHost]: http://www.dreamhost.com/ +[CloudFront]: https://aws.amazon.com/cloudfront/ "Amazon CloudFront" +[DreamHost]: https://www.dreamhost.com/ [Firebase]: https://firebase.google.com/docs/hosting/ "Firebase static hosting" [GitHub Pages]: https://pages.github.com/ [GitLab Pages]: https://about.gitlab.com/features/pages/ [Go language]: https://golang.org/ [GoDaddy]: https://www.godaddy.com/ "Godaddy.com Hosting" -[Google Cloud Storage]: http://cloud.google.com/storage/ +[Google Cloud Storage]: https://cloud.google.com/storage/ [Heroku]: https://www.heroku.com/ -[Jekyll]: http://jekyllrb.com/ [Jekyll]: https://jekyllrb.com/ [Middleman]: https://middlemanapp.com/ -[Middleman]: https://middlemanapp.com/ -[Nanoc]: http://nanoc.ws/ [Nanoc]: https://nanoc.ws/ [Netlify]: https://netlify.com -[rackspace]: https://www.rackspace.com/cloud/files -[static site generator]: /about/benefits/ [Rackspace]: https://www.rackspace.com/cloud/files -[static site generator]: /about/benefits/ [Surge]: https://surge.sh +[contributing to it]: https://github.com/gohugoio/hugo +[rackspace]: https://www.rackspace.com/cloud/files +[static site generator]: /about/benefits/ diff --git a/docs/content/en/content-management/authors.md b/docs/content/en/content-management/authors.md index afc94fa62..530557ac0 100644 --- a/docs/content/en/content-management/authors.md +++ b/docs/content/en/content-management/authors.md @@ -170,7 +170,7 @@ Last but not least, we have to create the second list that contains all publicat The layout for this page can be defined in the template `layouts/taxonomy/author.html`. {{< code file="layouts/taxonomy/author.html" download="author.html" >}} -{{ range .Data.Pages }} +{{ range .Pages }} <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2> <span>written by {{ .Author.DisplayName }}</span> {{ .Summary }} diff --git a/docs/content/en/content-management/menus.md b/docs/content/en/content-management/menus.md index c2eadf50f..4278b03be 100644 --- a/docs/content/en/content-management/menus.md +++ b/docs/content/en/content-management/menus.md @@ -36,47 +36,7 @@ A **menu** is a named array of menu entries accessible by name via the [`.Site.M If you make use of the [multilingual feature](/content-management/multilingual/), you can define language-independent menus. {{% /note %}} -A menu entry has the following properties (i.e., variables) available to it: - -`.URL` -: string - -`.Name` -: string - -`.Menu` -: string - -`.Identifier` -: string - -`.Pre` -: template.HTML - -`.Post` -: template.HTML - -`.Weight` -: int - -`.Parent` -: string - -`.Children` -: Menu - -Note that menus also have the following functions available as well: - -`.HasChildren` -: boolean - -Additionally, there are some relevant functions available to menus on a page: - -`.IsMenuCurrent` -: (menu string, menuEntry *MenuEntry ) boolean - -`.HasMenuCurrent` -: (menu string, menuEntry *MenuEntry) boolean +See the [Menu Entry Properties][me-props] for all the variables and functions related to a menu entry. ## Add content to menus @@ -139,7 +99,7 @@ The URLs must be relative to the context root. If the `baseURL` is `https://exam {{% /note %}} ## Nesting - + All nesting of content is done via the `parent` field. The parent of an entry should be the identifier of another entry. The identifier should be unique (within a menu). @@ -159,3 +119,4 @@ See [Menu Templates](/templates/menu-templates/) for information on how to rende [config]: /getting-started/configuration/ [multilingual]: /content-management/multilingual/ [sitevars]: /variables/ +[me-props]: /variables/menus/ diff --git a/docs/content/en/content-management/related.md b/docs/content/en/content-management/related.md index 5755676c3..9a4c77d40 100644 --- a/docs/content/en/content-management/related.md +++ b/docs/content/en/content-management/related.md @@ -39,7 +39,7 @@ To list up to 5 related pages is as simple as including something similar to thi Read [this blog article](https://regisphilibert.com/blog/2018/04/hugo-optmized-relashionships-with-related-content/) for a great explanation of more advanced usage of this feature. {{% /note %}} -The full set of methods available on the page lists can bee seen in this Go interface: +The full set of methods available on the page lists can be seen in this Go interface: ```go // A PageGenealogist finds related pages in a page collection. This interface is implemented diff --git a/docs/content/en/content-management/shortcodes.md b/docs/content/en/content-management/shortcodes.md index 0116078f4..35305764c 100644 --- a/docs/content/en/content-management/shortcodes.md +++ b/docs/content/en/content-management/shortcodes.md @@ -178,7 +178,7 @@ This shortcode will convert the source code provided into syntax-highlighted HTM <section id="main"> <div> <h1 id="title">{{ .Title }}</h1> - {{ range .Data.Pages }} + {{ range .Pages }} {{ .Render "summary"}} {{ end }} </div> @@ -194,7 +194,7 @@ The `highlight` shortcode example above would produce the following HTML when th <span style="color: #f92672"><section</span> <span style="color: #a6e22e">id=</span><span style="color: #e6db74">"main"</span><span style="color: #f92672">></span> <span style="color: #f92672"><div></span> <span style="color: #f92672"><h1</span> <span style="color: #a6e22e">id=</span><span style="color: #e6db74">"title"</span><span style="color: #f92672">></span>{{ .Title }}<span style="color: #f92672"></h1></span> - {{ range .Data.Pages }} + {{ range .Pages }} {{ .Render "summary"}} {{ end }} <span style="color: #f92672"></div></span> diff --git a/docs/content/en/content-management/static-files.md b/docs/content/en/content-management/static-files.md index fe5ea77e0..8967f5983 100644 --- a/docs/content/en/content-management/static-files.md +++ b/docs/content/en/content-management/static-files.md @@ -1,6 +1,6 @@ --- title: Static Files -description: "The `static` folder is where you place all your **static files**." +description: "Files that get served **statically** (as-is, no modification) on the site root." date: 2017-11-18 categories: [content management] keywords: [source, directories] @@ -13,36 +13,58 @@ aliases: [/static-files] toc: true --- -The `static` folder is where you place all your **static files**, e.g. stylesheets, JavaScript, images etc. +By default, the `static/` directory in the site project is used for +all **static files** (e.g. stylesheets, JavaScript, images). -You can set the name of the static folder to use in your configuration file. From **Hugo 0.31** you can configure as many static directories as you need. All the files in all the static directories will form a union filesystem. +Hugo can be configured to look into a different directory, or even +**multiple directories** for such static files by configuring the +`staticDir` parameter in the [site config][]. All the files in all the +static directories will form a union filesystem. -Example: +This union filesystem will be served from your site root. So a file +`<SITE PROJECT>/static/me.png` will be accessible as +`<MY_BASEURL>/me.png`. + +Here's an example of setting `staticDir` and `staticDir2` for a +multi-language site: {{< code-toggle copy="false" file="config" >}} staticDir = ["static1", "static2"] -[languages] -[languages.no] -staticDir = ["staticDir_override", "static_no"] -baseURL = "https://example.no" -languageName = "Norsk" -weight = 1 -title = "På norsk" +[languages] [languages.en] staticDir2 = "static_en" baseURL = "https://example.com" languageName = "English" weight = 2 title = "In English" +[languages.no] +staticDir = ["staticDir_override", "static_no"] +baseURL = "https://example.no" +languageName = "Norsk" +weight = 1 +title = "På norsk" {{</ code-toggle >}} In the above, with no theme used: -* The English site will get its static files as a union of "static1", "static2" and "static_en". On file duplicates, the right-most version will win. -* The Norwegian site will get its static files as a union of "staticDir_override" and "static_no". +- The English site will get its static files as a union of "static1", + "static2" and "static_en". On file duplicates, the right-most + version will win. +- The Norwegian site will get its static files as a union of + "staticDir_override" and "static_no". + +Note 1 +: The **2** (can be a number between 0 and 10) in `staticDir2` is + added to tell Hugo that you want to **add** this directory to the + global set of static directories defined using `staticDir`. Using + `staticDir` on the language level would replace the global value (as + can be seen in the Norwegian site case). -**Note:** The `2` `static2` (can be a number between 0 and 10) is added to tell Hugo that you want to **add** this directory to the global set of static directories. Using `staticDir` on the language level would replace the global value. +Note 2 +: The example above is a [multihost setup][]. In a regular setup, all + the static directories will be available to all sites. -**Note:** The example above is a [multihost setup](/content-management/multilingual/#configure-multilingual-multihost). In a regular setup, all the static directories will be available to all sites. +[site config]: /getting-started/configuration/#all-configuration-settings +[multihost setup]: /content-management/multilingual/#configure-multilingual-multihost diff --git a/docs/content/en/content-management/summaries.md b/docs/content/en/content-management/summaries.md index 1c341400e..0f8939377 100644 --- a/docs/content/en/content-management/summaries.md +++ b/docs/content/en/content-management/summaries.md @@ -1,7 +1,7 @@ --- title: Content Summaries linktitle: Summaries -description: Hugo generates summaries of your content. +description: Hugo generates summaries of your content. date: 2017-01-10 publishdate: 2017-01-10 lastmod: 2017-01-10 @@ -57,7 +57,7 @@ Be careful to enter <code><!--more--></code> exactly You can show content summaries with the following code. You could use the following snippet, for example, in a [section template][]. {{< code file="page-list-with-summaries.html" >}} -{{ range first 10 .Data.Pages }} +{{ range first 10 .Pages }} <article> <!-- this <div> includes the title summary --> <div> @@ -78,4 +78,4 @@ Note how the `.Truncated` boolean valuable may be used to hide the "Read More... [org]: /content-management/formats/ [pagevariables]: /variables/page/ -[section template]: /templates/section-templates/
\ No newline at end of file +[section template]: /templates/section-templates/ diff --git a/docs/content/en/content-management/syntax-highlighting.md b/docs/content/en/content-management/syntax-highlighting.md index 4576624d0..841ecbd3d 100644 --- a/docs/content/en/content-management/syntax-highlighting.md +++ b/docs/content/en/content-management/syntax-highlighting.md @@ -134,7 +134,7 @@ Highlighting is carried out via the [built-in shortcode](/content-management/sho <section id="main"> <div> <h1 id="title">{{ .Title }}</h1> - {{ range .Data.Pages }} + {{ range .Pages }} {{ .Render "summary"}} {{ end }} </div> @@ -157,7 +157,7 @@ It is also possible to add syntax highlighting with GitHub flavored code fences. <section id="main"> <div> <h1 id="title">{{ .Title }}</h1> - {{ range .Data.Pages }} + {{ range .Pages }} {{ .Render "summary"}} {{ end }} </div> diff --git a/docs/content/en/functions/after.md b/docs/content/en/functions/after.md index f01ba1436..d627f792a 100644 --- a/docs/content/en/functions/after.md +++ b/docs/content/en/functions/after.md @@ -39,7 +39,7 @@ You can use `after` in combination with the [`first` function][] and Hugo's [pow {{ define "main" }} <section class="row featured-article"> <h2>Featured Article</h2> - {{ range first 1 .Data.Pages.ByPublishDate.Reverse }} + {{ range first 1 .Pages.ByPublishDate.Reverse }} <header> <h3><a href="{{.Permalink}}">{{.Title}}</a></h3> </header> @@ -48,7 +48,7 @@ You can use `after` in combination with the [`first` function][] and Hugo's [pow </section> <div class="row recent-articles"> <h2>Recent Articles</h2> - {{ range first 3 (after 1 .Data.Pages.ByPublishDate.Reverse) }} + {{ range first 3 (after 1 .Pages.ByPublishDate.Reverse) }} <section class="recent-article"> <header> <h3><a href="{{.Permalink}}">{{.Title}}</a></h3> diff --git a/docs/content/en/functions/first.md b/docs/content/en/functions/first.md index 29ba3ac1c..464dfa671 100644 --- a/docs/content/en/functions/first.md +++ b/docs/content/en/functions/first.md @@ -21,8 +21,7 @@ aliases: [] ``` -{{ range first 10 .Data.Pages }} +{{ range first 10 .Pages }} {{ .Render "summary" }} {{ end }} ``` - diff --git a/docs/content/en/functions/hasmenucurrent.md b/docs/content/en/functions/hasmenucurrent.md index eac41103e..c7b8eb7a9 100644 --- a/docs/content/en/functions/hasmenucurrent.md +++ b/docs/content/en/functions/hasmenucurrent.md @@ -10,14 +10,18 @@ menu: docs: parent: "functions" keywords: [menus] -signature: ["HasMenuCurrent"] +signature: ["PAGE.HasMenuCurrent MENU MENUENTRY"] workson: [menus] hugoversion: -relatedfuncs: [] +relatedfuncs: ["IsMenuCurrent"] deprecated: false toc: false -draft: true +draft: false aliases: [] --- -Used in [menu templates](/templates/menu-templates/). +`.HasMenuCurrent` is a method in `Page` object returning a _boolean_ value. It +returns `true` if the PAGE is the same object as the `.Page` in one of the +**children menu entries** under MENUENTRY in a given MENU. + +You can find its example use in [menu templates](/templates/menu-templates/). diff --git a/docs/content/en/functions/ismenucurrent.md b/docs/content/en/functions/ismenucurrent.md index 647dcdcf0..66c7197a2 100644 --- a/docs/content/en/functions/ismenucurrent.md +++ b/docs/content/en/functions/ismenucurrent.md @@ -10,14 +10,18 @@ menu: docs: parent: "functions" keywords: [menus] -signature: ["IsMenuCurrent"] +signature: ["PAGE.IsMenuCurrent MENU MENUENTRY"] workson: [menus] hugoversion: -relatedfuncs: [] +relatedfuncs: ["HasMenuCurrent"] deprecated: false -draft: true +draft: false aliases: [] needsexample: true --- -Used in [menu templates](/templates/menu-templates/). +`.IsMenuCurrent` is a method in `Page` object returning a _boolean_ value. It +returns `true` if the PAGE is the same object as the `.Page` in MENUENTRY in a +given MENU. + +You can find its example use in [menu templates](/templates/menu-templates/). diff --git a/docs/content/en/functions/last.md b/docs/content/en/functions/last.md index ea633837b..f992b980a 100644 --- a/docs/content/en/functions/last.md +++ b/docs/content/en/functions/last.md @@ -23,8 +23,7 @@ aliases: [] ``` -{{ range last 10 .Data.Pages }} +{{ range last 10 .Pages }} {{ .Render "summary" }} {{ end }} ``` - diff --git a/docs/content/en/functions/render.md b/docs/content/en/functions/render.md index a4abfa81d..c76af39fe 100644 --- a/docs/content/en/functions/render.md +++ b/docs/content/en/functions/render.md @@ -26,7 +26,7 @@ This function is only available when applied to a single piece of content within This example could render a piece of content using the content view located at `/layouts/_default/summary.html`: ``` -{{ range .Data.Pages }} +{{ range .Pages }} {{ .Render "summary"}} {{ end }} ``` diff --git a/docs/content/en/functions/scratch.md b/docs/content/en/functions/scratch.md index 93a1e426a..c0ecaca80 100644 --- a/docs/content/en/functions/scratch.md +++ b/docs/content/en/functions/scratch.md @@ -33,11 +33,19 @@ See [this Go issue](https://github.com/golang/go/issues/10608) for the main moti For a detailed analysis of `.Scratch` and in context use cases, see this [post](https://regisphilibert.com/blog/2017/04/hugo-scratch-explained-variable/). {{% /note %}} -## Methods +## Get a Scratch -`Scratch` is added to both `Page` and `Shortcode` -- with following methods: +From Hugo `0.43` you can also create a locally scoped `Scratch` by calling `newScratch`: + +```go-html-template +$scratch := newScratch +$scratch.Set "greeting" "Hello" +``` + +A `Scratch` is also added to both `Page` and `Shortcode`. `Sratch` have the following methods: #### .Set + Set the given value to a given key |