diff --git a/docs/content/en/about/hugo-and-gdpr.md b/docs/content/en/about/hugo-and-gdpr.md index 15352ae7c..e193e1838 100644 --- a/docs/content/en/about/hugo-and-gdpr.md +++ b/docs/content/en/about/hugo-and-gdpr.md @@ -28,6 +28,7 @@ toc: true Note that: * These settings have their defaults setting set to _off_, i.e. how it worked before Hugo `0.41`. You must do your own evaluation of your site and apply the appropriate settings. + * These settings work with the [internal templates](/templates/internal/). Some theme may contain custom templates for embedding services like Google Analytics. In that case these options have no effect. * We will continue this work and improve this further in future Hugo versions. ## All Privacy Settings diff --git a/docs/content/en/content-management/archetypes.md b/docs/content/en/content-management/archetypes.md index 904ca8c31..ff4a2d783 100644 --- a/docs/content/en/content-management/archetypes.md +++ b/docs/content/en/content-management/archetypes.md @@ -35,7 +35,7 @@ The above will create a new content file in `content/posts/my-first-post.md` usi 3. `themes/my-theme/archetypes/posts.md` 4. `themes/my-theme/archetypes/default.md` -The last two list items is only applicable if you use a theme and it uses the `my-theme` theme name as an example. +The last two list items are only applicable if you use a theme and it uses the `my-theme` theme name as an example. ## Create a New Archetype Template diff --git a/docs/content/en/content-management/comments.md b/docs/content/en/content-management/comments.md index 268dc4c0e..17914ba2c 100644 --- a/docs/content/en/content-management/comments.md +++ b/docs/content/en/content-management/comments.md @@ -59,7 +59,7 @@ There are a few alternatives to commenting on static sites for those who do not * [Muut](http://muut.com/) * [isso](http://posativ.org/isso/) (Self-hosted, Python) * [Tutorial on Implementing Isso with Hugo][issotutorial] - +* [Utterances](https://utteranc.es/) (Open source, Github comments widget built on Github issues) diff --git a/docs/content/en/content-management/formats.md b/docs/content/en/content-management/formats.md index ab9fdd781..f7a466c3c 100644 --- a/docs/content/en/content-management/formats.md +++ b/docs/content/en/content-management/formats.md @@ -240,7 +240,7 @@ Markdown syntax is simple enough to learn in a single sitting. The following are [mdcheatsheet]: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet [mdguide]: https://www.markdownguide.org/ [mdtutorial]: http://www.markdowntutorial.com/ -[Miek Gieben's website]: https://miek.nl/2016/March/05/mmark-syntax-document/ +[Miek Gieben's website]: https://miek.nl/2016/march/05/mmark-syntax-document/ [mmark]: https://github.com/miekg/mmark [mmarkgh]: https://github.com/miekg/mmark/wiki/Syntax [org]: http://orgmode.org/ diff --git a/docs/content/en/content-management/menus.md b/docs/content/en/content-management/menus.md index 4278b03be..bc48c82e7 100644 --- a/docs/content/en/content-management/menus.md +++ b/docs/content/en/content-management/menus.md @@ -80,7 +80,7 @@ You can also add entries to menus that aren’t attached to a piece of content. Here’s an example snippet pulled from a configuration file: -{{< code-toggle file="config.toml" >}} +{{< code-toggle file="config" >}} [[menu.main]] name = "about hugo" pre = "" @@ -90,6 +90,7 @@ Here’s an example snippet pulled from a configuration file: [[menu.main]] name = "getting started" pre = "" + post = "New!" weight = -100 url = "/getting-started/" {{< /code-toggle >}} diff --git a/docs/content/en/content-management/related.md b/docs/content/en/content-management/related.md index 9a4c77d40..636e95970 100644 --- a/docs/content/en/content-management/related.md +++ b/docs/content/en/content-management/related.md @@ -14,13 +14,13 @@ aliases: [/content/related/,/related/] toc: true --- -{{% note %}} -We currently do not index **Page content**. We thought we would release something that will make most people happy before we start solving [Sherlock's last case](https://github.com/joearms/sherlock). -{{% /note %}} + +Hugo uses a set of factors to identify a page's related content based on Front Matter parameters. This can be tuned to the desired set of indices and parameters or left to Hugo's default [Related Content configuration](#configure-related-content). ## List Related Content -To list up to 5 related pages is as simple as including something similar to this partial in your single page template: + +To list up to 5 related pages (which share the same _date_ or _keyword_ parameters) is as simple as including something similar to this partial in your single page template: {{< code file="layouts/partials/related.html" >}} {{ $related := .Site.RegularPages.Related . | first 5 }} @@ -34,67 +34,62 @@ To list up to 5 related pages is as simple as including something similar to thi {{ end }} {{< /code >}} +### Methods + +Here is the list of "Related" methods available on a page collection such `.RegularPages`. + +#### .Related PAGE +Returns a collection of pages related the given one. + +``` +{{ $related := .RegularPages.Related . }} +``` + +#### .RelatedIndices PAGE INDICE1 [INDICE2 ...] +Returns a collection of pages related to a given one restricted to a list of indices. + +``` +{{ $related := .RegularPages.RelatedIndices . "tags" "date" }} +``` + +#### .RelatedTo KEYVALS [KEYVALS2 ...] +Returns a collection of pages related together by a set of indices and their match. + +In order to build those set and pass them as argument, one must use the `keyVals` function where the first agrument would be the `indice` and the consective ones its potential `matches`. + +``` +{{ $related := .RegularPages.RelatedTo ( keyVals "tags" "hugo" "rocks") ( keyVals "date" .Date ) }} +``` {{% note %}} 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 be seen in this Go interface: - -```go -// A PageGenealogist finds related pages in a page collection. This interface is implemented -// by Pages and PageGroup, which makes it available as `{{ .RegularPages.Related . }}` etc. -type PageGenealogist interface { - - // Template example: - // {{ $related := .RegularPages.Related . }} - Related(doc related.Document) (Pages, error) - - // Template example: - // {{ $related := .RegularPages.RelatedIndices . "tags" "date" }} - RelatedIndices(doc related.Document, indices ...interface{}) (Pages, error) - - // Template example: - // {{ $related := .RegularPages.RelatedTo ( keyVals "tags" "hugo" "rocks") ( keyVals "date" .Date ) }} - RelatedTo(args ...types.KeyValues) (Pages, error) -} -``` ## Configure Related Content Hugo provides a sensible default configuration of Related Content, but you can fine-tune this in your configuration, on the global or language level if needed. +### Default configuration + +Without any `related` configuration set on the project, Hugo's Related Content methods will use the following. + +```yaml +related: + threshold: 80 + includeNewer: false + toLower: false + indices: + - name: keywords + weight: 100 + - name: date + weight: 10 +``` + +Custom configuration should be set using the same syntax. + {{% note %}} If you add a `related` config section, you need to add a complete configuration. It is not possible to just set, say, `includeNewer` and use the rest from the Hugo defaults. {{% /note %}} -Below is a sample `config.toml` section: - -``` -[related] - -# Only include matches with rank >= threshold. This is a normalized rank between 0 and 100. -threshold = 80 - -# To get stable "See also" sections we, by default, exclude newer related pages. -includeNewer = false - -# Will lower case keywords in both queries and in the indexes. -toLower = false - -[[related.indices]] -name = "keywords" -weight = 150 -[[related.indices]] -name = "author" -toLower = true -weight = 30 -[[related.indices]] -name = "tags" -weight = 100 -[[related.indices]] -name = "date" -weight = 10 -pattern = "2006" -``` ### Top Level Config Options threshold @@ -135,9 +130,6 @@ He should now be able to add an improved version of that "Related Content" secti * If you don't use any of the `Related` methods, you will not use the Relate Content feature, and performance will be the same as before. * Calling `.RegularPages.Related` etc. will create one inverted index, also sometimes named posting list, that will be reused for any lookups in that same page collection. Doing that in addition to, as an example, calling `.Pages.Related` will work as expected, but will create one additional inverted index. This should still be very fast, but worth having in mind, especially for bigger sites. - - - - - - +{{% note %}} +We currently do not index **Page content**. We thought we would release something that will make most people happy before we start solving [Sherlock's last case](https://github.com/joearms/sherlock). +{{% /note %}} diff --git a/docs/content/en/content-management/summaries.md b/docs/content/en/content-management/summaries.md index 0f8939377..63d64aa3c 100644 --- a/docs/content/en/content-management/summaries.md +++ b/docs/content/en/content-management/summaries.md @@ -21,32 +21,40 @@ With the use of the `.Summary` [page variable][pagevariables], Hugo generates su ## Summary Splitting Options -* Hugo-defined Summary Split -* User-defined Summary Split +* Automatic Summary Split +* Manual Summary Split It is natural to accompany the summary with links to the original content, and a common design pattern is to see this link in the form of a "Read More ..." button. See the `.RelPermalink`, `.Permalink`, and `.Truncated` [page variables][pagevariables]. -### Hugo-defined: Automatic Summary Splitting +### Automatic Summary Splitting -By default, Hugo automatically takes the first 70 words of your content as its summary and stores it into the `.Summary` page variable for use in your templates. Taking the Hugo-defined approach to summaries may save time, but it has pros and cons: - -* **Pros:** Automatic, no additional work on your part. -* **Cons:** All HTML tags are stripped from the summary, and the first 70 words, whether they belong to a heading or to different paragraphs, are all put into one paragraph. +By default, Hugo automatically takes the first 70 words of your content as its summary and stores it into the `.Summary` page variable for use in your templates. You may customize the summary length by setting `summaryLength` in your [site configuration](/getting-started/configuration/). {{% note %}} -The Hugo-defined summaries are set to use word count calculated by splitting the text by one or more consecutive white space characters. If you are creating content in a `CJK` language and want to use Hugo's automatic summary splitting, set `hasCJKLanguage` to `true` in you [site configuration](/getting-started/configuration/). +You can customize how HTML tags in the summary are loaded using functions such as `plainify` and `safeHTML`. {{% /note %}} -### User-defined: Manual Summary Splitting +{{% note %}} +The Hugo-defined summaries are set to use word count calculated by splitting the text by one or more consecutive whitespace characters. If you are creating content in a `CJK` language and want to use Hugo's automatic summary splitting, set `hasCJKLanguage` to `true` in your [site configuration](/getting-started/configuration/). +{{% /note %}} -Alternatively, you may add the <!--more--> summary divider where you want to split the article. For [org content][org], use `# more` where you want to split the article. Content that comes before the summary divider will be used as that content's summary and stored in the `.Summary` page variable with all HTML formatting intact. +### Manual Summary Splitting + +Alternatively, you may add the <!--more--> summary divider where you want to split the article. + +For [Org mode content][org], use `# more` where you want to split the article. + +Content that comes before the summary divider will be used as that content's summary and stored in the `.Summary` page variable with all HTML formatting intact. {{% note "Summary Divider"%}} The concept of a *summary divider* is not unique to Hugo. It is also called the "more tag" or "excerpt separator" in other literature. {{% /note %}} -* Pros: Freedom, precision, and improved rendering. All HTML tags and formatting are preserved. -* Cons: Extra work for content authors, since they need to remember to type <!--more--> (or `# more` for [org content][org]) in each content file. This can be automated by adding the summary divider below the front matter of an [archetype](/content-management/archetypes/). +Pros +: Freedom, precision, and improved rendering. All HTML tags and formatting are preserved. + +Cons +: Extra work for content authors, since they need to remember to type <!--more--> (or `# more` for [org content][org]) in each content file. This can be automated by adding the summary divider below the front matter of an [archetype](/content-management/archetypes/). {{% warning "Be Precise with the Summary Divider" %}} Be careful to enter <!--more--> exactly; i.e., all lowercase and with no whitespace. diff --git a/docs/content/en/contribute/development.md b/docs/content/en/contribute/development.md index be2ca4a2b..e9e1cd10f 100644 --- a/docs/content/en/contribute/development.md +++ b/docs/content/en/contribute/development.md @@ -15,7 +15,6 @@ menu: weight: 10 sections_weight: 10 draft: false -aliases: [/contribute/development/] toc: true --- diff --git a/docs/content/en/contribute/documentation.md b/docs/content/en/contribute/documentation.md index e8603d432..7b198a4ca 100644 --- a/docs/content/en/contribute/documentation.md +++ b/docs/content/en/contribute/documentation.md @@ -94,15 +94,15 @@ Code blocks are crucial for providing examples of Hugo's new features to end use ### Standard Syntax -Across all pages on the Hugo docs, the typical triple-back-tick markdown syntax is used. If you do not want to take the extra time to implement the following code block shortcodes, please use standard GitHub-flavored markdown. The Hugo docs use a version of [highlight.js](https://highlightjs.org/) with a specific set of languages. +Across many pages on the Hugo docs, the typical triple-back-tick markdown syntax (```` ``` ````) is used. If you do not want to take the extra time to implement the following code block shortcodes, please use standard GitHub-flavored markdown. The Hugo docs use a version of [highlight.js](https://highlightjs.org/) with a specific set of languages. Your options for languages are `xml`/`html`, `go`/`golang`, `md`/`markdown`/`mkd`, `handlebars`, `apache`, `toml`, `yaml`, `json`, `css`, `asciidoc`, `ruby`, `powershell`/`ps`, `scss`, `sh`/`zsh`/`bash`/`git`, `http`/`https`, and `javascript`/`js`. -``` +```` ```

Hello world!

``` -``` +```` ### Code Block Shortcode @@ -118,14 +118,13 @@ With the `code` shortcodes, *you must include triple back ticks and a language d ``` {{%/* code file="smart/file/name/with/path.html" download="download.html" copy="true" */%}} -``` A whole bunch of coding going on up in here! -``` {{%/* /code */%}} ``` The following are the arguments passed into `code`: + ***`file`*** : the only *required* argument. `file` is needed for styling but also plays an important role in helping users create a mental model around Hugo's directory structure. Visually, this will be displayed as text in the top left of the code block. @@ -194,10 +193,8 @@ The `output` shortcode is almost identical to the `code` shortcode but only take ``` {{%/* output file="post/my-first-post/index.html" */%}} -```

This is my First Hugo Blog Post

I am excited to be using Hugo.

-``` {{%/* /output */%}} ``` diff --git a/docs/content/en/functions/GetPage.md b/docs/content/en/functions/GetPage.md index 2d9de4d7a..366d1f093 100644 --- a/docs/content/en/functions/GetPage.md +++ b/docs/content/en/functions/GetPage.md @@ -31,7 +31,7 @@ aliases: [] This method wil return `nil` when no page could be found, so the above will not print anything if the blog section is not found. -To fund a regular page in the blog section:: +To find a regular page in the blog section:: ```go-html-template {{ with .Site.GetPage "/blog/my-post.md" }}{{ .Title }}{{ end }} diff --git a/docs/content/en/functions/default.md b/docs/content/en/functions/default.md index 1b5a9fb6f..18f7b7d33 100644 --- a/docs/content/en/functions/default.md +++ b/docs/content/en/functions/default.md @@ -22,7 +22,7 @@ aliases: [] needsexamples: false --- -`default` checks whether a given value is set and returns a default value if it is not. *Set* in this context means different things depending on date type: +`default` checks whether a given value is set and returns a default value if it is not. *Set* in this context means different things depending on the data type: * non-zero for numeric types and times * non-zero length for strings, arrays, slices, and maps diff --git a/docs/content/en/functions/intersect.md b/docs/content/en/functions/intersect.md index a607ff217..6d2efacbc 100644 --- a/docs/content/en/functions/intersect.md +++ b/docs/content/en/functions/intersect.md @@ -19,27 +19,7 @@ deprecated: false aliases: [] --- -The elements supported are strings, integers, and floats (only float64). - -A useful example of `intersect` functionality is a "related posts" block. `isset` allows us to create a list of links to other posts that have tags that intersect with the tags in the current post. - -The following is an example of a "related posts" [partial template][partials] that could be added to a [single page template][single]: - -{{< code file="layouts/partials/related-posts.html" download="related-posts.html" >}} - -{{< /code >}} - -This is also very useful to use as `AND` filters when combined with where: +An useful example is to use it as `AND` filters when combined with where: ``` {{ $pages := where .Site.RegularPages "Type" "not in" (slice "page" "about") }} diff --git a/docs/content/en/functions/os.Stat.md b/docs/content/en/functions/os.Stat.md new file mode 100644 index 000000000..1e878d896 --- /dev/null +++ b/docs/content/en/functions/os.Stat.md @@ -0,0 +1,33 @@ +--- +title: os.Stat +description: Gets a file information of a given path. +godocref: +date: 2018-08-07 +publishdate: 2018-08-07 +lastmod: 2018-08-07 +categories: [functions] +menu: + docs: + parent: "functions" +keywords: [files] +signature: ["os.Stat PATH"] +workson: [] +hugoversion: +relatedfuncs: [readDir] +deprecated: false +aliases: [] +--- + +If your current project working directory has a single file named `README.txt` (30 bytes): +``` +{{ $stat := os.Stat "README.txt" }} +{{ $stat.Name }} → "README.txt" +{{ $stat.Size }} → 30 +``` + +Function [`os.Stat`][Stat] returns [`os.FileInfo`][osfileinfo]. +For further information of `os.FileInfo`, see [golang page][osfileinfo]. + + +[Stat]: /functions/os.Stat/ +[osfileinfo]: https://golang.org/pkg/os/#FileInfo diff --git a/docs/content/en/getting-started/installing.md b/docs/content/en/getting-started/installing.md index deb2605b1..ccf96317b 100644 --- a/docs/content/en/getting-started/installing.md +++ b/docs/content/en/getting-started/installing.md @@ -343,7 +343,7 @@ You'll need a place to store the Hugo executable, your [content][], and the gene 3. Find the Windows files near the bottom (they're in alphabetical order, so Windows is last) – download either the 32-bit or 64-bit file depending on whether you have 32-bit or 64-bit Windows. (If you don't know, [see here](https://esupport.trendmicro.com/en-us/home/pages/technical-support/1038680.aspx).) 4. Move the ZIP file into your `C:\Hugo\bin` folder. 5. Double-click on the ZIP file and extract its contents. Be sure to extract the contents into the same `C:\Hugo\bin` folder – Windows will do this by default unless you tell it to extract somewhere else. -6. You should now have three new files: hugo executable (e.g. `hugo_0.18_windows_amd64.exe`), `license.md`, and `readme.md`. (You can delete the ZIP download now.) Rename that hugo executable (`hugo_hugo-version_platform_arch.exe`) to `hugo.exe` for ease of use. +6. You should now have three new files: The hugo executable (`hugo.exe`), `LICENSE`, and `README.md`. Now you need to add Hugo to your Windows PATH settings: @@ -472,6 +472,14 @@ For the latest version, the Hugo package maintained by [@daftaupe](https://githu See the [related discussion in the Hugo forums][redhatforum]. +### Solus + +Solus includes Hugo in its package repository, it may be installed with: + +``` +sudo eopkg install hugo +``` + ## OpenBSD OpenBSD provides a package for Hugo via `pkg_add`: diff --git a/docs/content/en/hosting-and-deployment/hosting-on-netlify.md b/docs/content/en/hosting-and-deployment/hosting-on-netlify.md index f2820a8de..01ca42f4f 100644 --- a/docs/content/en/hosting-and-deployment/hosting-on-netlify.md +++ b/docs/content/en/hosting-and-deployment/hosting-on-netlify.md @@ -24,7 +24,7 @@ toc: true ## Assumptions * You have an account with GitHub, GitLab, or Bitbucket. -* You have completed the [Quick Start][] or have Hugo website you are ready to deploy and share with the world. +* You have completed the [Quick Start][] or have a Hugo website you are ready to deploy and share with the world. * You do not already have a Netlify account. ## Create a Netlify account @@ -59,7 +59,7 @@ Select the repo you want to use for continuous deployment. If you have a large n Once selected, you'll be brought to a screen for basic setup. Here you can select the branch you wanted published, your [build command][], and your publish (i.e. deploy) directory. The publish directory should mirror that of what you've set in your [site configuration][config], the default of which is `public`. The following steps assume you are publishing from the `master` branch. -## Configure Hugo Version in Netlify +## Configure Hugo Version in Netlify You can [set Hugo version](https://www.netlify.com/blog/2017/04/11/netlify-plus-hugo-0.20-and-beyond/) for your environments in `netlify.toml` file or set `HUGO_VERSION` as a build environment variable in the Netlify console. @@ -80,7 +80,7 @@ For testing: The Netlify configuration file can be a little hard to understand and get right for the different environment, and you may get some inspiration and tips from this site's `netlify.toml`: {{< code file="netlify.toml" nocode="true" >}} -{{< readfile file="netlify.toml" highlight="toml" >}} +{{< readfile file="netlify.toml" highlight="toml" >}} {{< /code >}} ## Build and Deploy Site diff --git a/docs/content/en/hugo-pipes/postcss.md b/docs/content/en/hugo-pipes/postcss.md index a0ecc6d35..a0a673798 100755 --- a/docs/content/en/hugo-pipes/postcss.md +++ b/docs/content/en/hugo-pipes/postcss.md @@ -27,7 +27,9 @@ The resource will be processed using the project's or theme's own `postcss.confi ``` {{% note %}} -Hugo Pipe's PostCSS requires `postcss-cli` javascript package to be installed on the environement along with any PostCSS plugin used. +Hugo Pipe's PostCSS requires the `postcss-cli` JavaScript package to be installed in the environment (`npm install -g postcss-cli`) along with any PostCSS plugin(s) used (e.g., `npm install -g autoprefixer`). + +If you are using the Hugo Snap package, PostCSS and plugin(s) need to be installed locally within your Hugo site directory, e.g., `npm install postcss-cli` without the `-g` flag. {{% /note %}} ### Options diff --git a/docs/content/en/hugo-pipes/scss-sass.md b/docs/content/en/hugo-pipes/scss-sass.md index baed2b4d0..489d16e77 100755 --- a/docs/content/en/hugo-pipes/scss-sass.md +++ b/docs/content/en/hugo-pipes/scss-sass.md @@ -43,3 +43,7 @@ includePaths [string slice] {{ $options := (dict "targetPath" "style.css" "outputStyle" "compressed" "enableSourceMap" true "includePaths" (slice "node_modules/myscss")) }} {{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }} ``` + +{{% note %}} +Setting `outputStyle` to `compressed` will handle SASS/SCSS files minification better than the more generic [`resources.Minify`]({{< ref "minification">}}). +{{% /note %}} diff --git a/docs/content/en/news/0.47-relnotes/featured-hugo-47-poster.png b/docs/content/en/news/0.47-relnotes/featured-hugo-47-poster.png new file mode 100644 index 000000000..601922961 Binary files /dev/null and b/docs/content/en/news/0.47-relnotes/featured-hugo-47-poster.png differ diff --git a/docs/content/en/news/0.47-relnotes/index.md b/docs/content/en/news/0.47-relnotes/index.md index 8e12a472a..79d15ec62 100644 --- a/docs/content/en/news/0.47-relnotes/index.md +++ b/docs/content/en/news/0.47-relnotes/index.md @@ -1,12 +1,12 @@ --- date: 2018-08-17 -title: "0.47" -description: "0.47" +title: "Output Minification, Live-Reload Fixes and More" +description: "Hugo 0.47: Adds minification of rendered output, but is mostly a massive bug fix release." categories: ["Releases"] --- - Hugo `0.47` is named **Hugo Reloaded**. It adds minification support for the final rendered output (run `hugo --minify`), but it is mostly a bug fix release. And most notably, it fixes a set of issues with live-reloading/partial rebuilds when running `hugo server`. Working with bundles should now be a more pleasant experience, to pick one example. +Hugo `0.47` is named **Hugo Reloaded**. It adds minification support for the final rendered output (run `hugo --minify`), but it is mostly a bug fix release. And most notably, it fixes a set of issues with live-reloading/partial rebuilds when running `hugo server`. Working with bundles should now be a more pleasant experience, to pick one example. This release represents **35 contributions by 6 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 [@satotake](https://github.com/satotake), [@anthonyfok](https://github.com/anthonyfok), and [@coliff](https://github.com/coliff) for their ongoing contributions. diff --git a/docs/content/en/news/0.47.1-relnotes/index.md b/docs/content/en/news/0.47.1-relnotes/index.md index fc82642b2..d35b0fad2 100644 --- a/docs/content/en/news/0.47.1-relnotes/index.md +++ b/docs/content/en/news/0.47.1-relnotes/index.md @@ -1,8 +1,8 @@ --- date: 2018-08-20 -title: "0.47.1" -description: "0.47.1" +title: "Two Bug Fixes" +description: "Hugo 0.47.1: Two Bug Fixes" categories: ["Releases"] images: - images/blog/hugo-bug-poster.png diff --git a/docs/content/en/news/0.48-relnotes/featured-hugo-48-poster.png b/docs/content/en/news/0.48-relnotes/featured-hugo-48-poster.png new file mode 100644 index 000000000..7adb0d22e Binary files /dev/null and b/docs/content/en/news/0.48-relnotes/featured-hugo-48-poster.png differ diff --git a/docs/content/en/news/0.48-relnotes/index.md b/docs/content/en/news/0.48-relnotes/index.md index e5dbb67d0..92c765f23 100644 --- a/docs/content/en/news/0.48-relnotes/index.md +++ b/docs/content/en/news/0.48-relnotes/index.md @@ -1,17 +1,17 @@ --- date: 2018-08-29 -title: "0.48" -description: "0.48" +title: "This One Goes to 11!" +description: "With Go 1.11, Hugo finally gets support for variable overwrites in templates!" categories: ["Releases"] --- - Hugo `0.48` is built with the brand new Go 1.11. On the technical side this means that Hugo now uses [Go Modules](https://github.com/golang/go/wiki/Modules) for the build. The big new functional thing in Go 1.11 for Hugo is added support for [variable overwrites](https://github.com/golang/go/issues/10608). This means that you can now do: +Hugo `0.48` is built with the brand new Go 1.11. On the technical side this means that Hugo now uses [Go Modules](https://github.com/golang/go/wiki/Modules) for the build. The big new functional thing in Go 1.11 for Hugo is added support for [variable overwrites](https://github.com/golang/go/issues/10608). This means that you can now do this and get the expected result: -``` +```go-html-template {{ $var := "Hugo Page" }} {{ if .IsHome }} -{{ $var = "Hugo Home" }} + {{ $var = "Hugo Home" }} {{ end }} Var is {{ $var }} ``` diff --git a/docs/content/en/showcase/over/bio.md b/docs/content/en/showcase/over/bio.md new file mode 100644 index 000000000..415668f9e --- /dev/null +++ b/docs/content/en/showcase/over/bio.md @@ -0,0 +1,5 @@ +The site is built by: + +* [Lauren Waller](https://twitter.com/waller_texas) +* [Wayne Ashley Berry](https://twitter.com/waynethebrain) + diff --git a/docs/content/en/showcase/over/featured-over.png b/docs/content/en/showcase/over/featured-over.png new file mode 100644 index 000000000..726d98731 Binary files /dev/null and b/docs/content/en/showcase/over/featured-over.png differ diff --git a/docs/content/en/showcase/over/index.md b/docs/content/en/showcase/over/index.md new file mode 100644 index 000000000..9640198db --- /dev/null +++ b/docs/content/en/showcase/over/index.md @@ -0,0 +1,17 @@ +--- +title: Over +date: 2018-09-12 +description: "Showcase: \"People from all disciplines contribute to our website; Hugo’s single static binary makes that possible.\"" +siteURL: https://madewithover.com/ + +--- + +At Over we're into creativity, and technology should not get in the way. We want it to be easy for everyone to create, and Hugo does the same for us. That's one of the reasons many of us are fond of using it. + +People from all disciplines contribute to our website, be it legal documentation, layout and design, recruiting, marketing and of course… engineering. Hugo allows us to do this with as little friction as possible. A lot of this comes down to Hugo being distributed as a single static binary. Copy, paste, run... and you're up and running! + +We use [Wercker](https://www.wercker.com/) for continuous integration and deployments, [GitHub](https://github.com/) for contributing to and writing markdown and [Firebase](https://firebase.google.com/docs/hosting/) for hosting. + +This infrastructure takes all the pressure off our engineers, anyone can contribute to our website. Anyone else can review the changes, and of course anyone with permission can deploy those approved changes as well! + +We're busy working on a few new features for our website, and Hugo continues to deliver above and beyond. We're so happy with the choice we made to use Hugo and to us it has become the de-facto static site generator. \ No newline at end of file diff --git a/docs/content/en/templates/404.md b/docs/content/en/templates/404.md index eba2d95df..c6bea1912 100644 --- a/docs/content/en/templates/404.md +++ b/docs/content/en/templates/404.md @@ -50,6 +50,7 @@ Your 404.html file can be set to load automatically when a visitor enters a mist * Apache. You can specify `ErrorDocument 404 /404.html` in an `.htaccess` file in the root of your site. * Nginx. You might specify `error_page 404 /404.html;` in your `nginx.conf` file. * Amazon AWS S3. When setting a bucket up for static web serving, you can specify the error file from within the S3 GUI. +* Amazon CloudFont. You can specify the page in the Error Pages section in the CloudFont Console. [Details here](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-error-pages.html) * Caddy Server. Using `errors { 404 /404.html }`. [Details here](https://caddyserver.com/docs/errors) {{% note %}} diff --git a/docs/content/en/templates/files.md b/docs/content/en/templates/files.md index 6e6f3ec4e..4969a4f33 100644 --- a/docs/content/en/templates/files.md +++ b/docs/content/en/templates/files.md @@ -104,12 +104,12 @@ And here is the result as [called directly in the Hugo docs][] and rendered for {{< readfile file="/content/en/readfiles/testing.txt" markdown="true">}} -[called directly in the Hugo docs]: https://github.com/gohugoio/hugo/blob/master/docs/content/templates/files.md +[called directly in the Hugo docs]: https://github.com/gohugoio/hugoDocs/blob/master/content/en/templates/files.md [dirindex]: https://github.com/gohugoio/hugo/blob/master/docs/layouts/shortcodes/directoryindex.html [osfileinfo]: https://golang.org/pkg/os/#FileInfo [readDir]: /functions/readdir/ [readFile]: /functions/readfile/ [sc]: /content-management/shortcodes/ [sct]: /templates/shortcode-templates/ -[readfilesource]: https://github.com/gohugoio/hugo/blob/master/ -[testfile]: https://github.com/gohugoio/hugo/blob/master/docs/testfile +[readfilesource]: https://github.com/gohugoio/hugoDocs/blob/master/layouts/shortcodes/readfile.html +[testfile]: https://github.com/gohugoio/hugoDocs/blob/master/content/en/readfiles/testing.txt diff --git a/docs/content/en/templates/introduction.md b/docs/content/en/templates/introduction.md index 0b9ad051b..1e1778eb0 100644 --- a/docs/content/en/templates/introduction.md +++ b/docs/content/en/templates/introduction.md @@ -20,26 +20,39 @@ toc: true --- {{% note %}} -The following is only a primer on Go templates. For an in-depth look into Go templates, check the official [Go docs](http://golang.org/pkg/html/template/). +The following is only a primer on Go Templates. For an in-depth look into Go Templates, check the official [Go docs](http://golang.org/pkg/html/template/). {{% /note %}} -Go templates provide an extremely simple template language that adheres to the belief that only the most basic of logic belongs in the template or view layer. +Go Templates provide an extremely simple template language that adheres to the belief that only the most basic of logic belongs in the template or view layer. {{< youtube gnJbPO-GFIw >}} ## Basic Syntax -Go templates are HTML files with the addition of [variables][variables] and [functions][functions]. Go template variables and functions are accessible within `{{ }}`. +Go Templates are HTML files with the addition of [variables][variables] and [functions][functions]. Go Template variables and functions are accessible within `{{ }}`. ### Access a Predefined Variable -``` -{{ foo }} +A _predefined variable_ could be a variable already existing in the +current scope (like the `.Title` example in the [Variables]({{< relref +"#variables" >}}) section below) or a custom variable (like the +`$address` example in that same section). + + +```go-html-template +{{ .Title }} +{{ $address }} ``` -Parameters for functions are separated using spaces. The following example calls the `add` function with inputs of `1` and `2`: +Parameters for functions are separated using spaces. The general syntax is: ``` +{{ FUNCTION ARG1 ARG2 .. }} +``` + +The following example calls the `add` function with inputs of `1` and `2`: + +```go-html-template {{ add 1 2 }} ``` @@ -47,64 +60,88 @@ Parameters for functions are separated using spaces. The following example calls Accessing the Page Parameter `bar` defined in a piece of content's [front matter][]. -``` +```go-html-template {{ .Params.bar }} ``` #### Parentheses Can be Used to Group Items Together -``` +```go-html-template {{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }} ``` -## Variables +## Variables {#variables} -Each Go template gets a data object. In Hugo, each template is passed a `Page`. See [variables][] for more information. +Each Go Template gets a data object. In Hugo, each template is passed +a `Page`. In the below example, `.Title` is one of the elements +accessible in that [`Page` variable][pagevars]. -This is how you access a `Page` variable from a template: +With the `Page` being the default scope of a template, the `Title` +element in current scope (`.` -- "the **dot**") is accessible simply +by the dot-prefix (`.Title`): -``` +```go-html-template {{ .Title }} ``` Values can also be stored in custom variables and referenced later: -``` -{{ $address := "123 Main St."}} +{{% note %}} +The custom variables need to be prefixed with `$`. +{{% /note %}} + +```go-html-template +{{ $address := "123 Main St." }} {{ $address }} ``` {{% warning %}} -Variables defined inside `if` conditionals and similar are not visible on the outside. See [https://github.com/golang/go/issues/10608](https://github.com/golang/go/issues/10608). +For Hugo v0.47 and older versions, variables defined inside `if` +conditionals and similar are not visible on the outside. +See [https://github.com/golang/go/issues/10608](https://github.com/golang/go/issues/10608). Hugo has created a workaround for this issue in [Scratch](/functions/scratch). - {{% /warning %}} +For **Hugo v0.48** and newer, variables can be re-defined using the +new `=` operator (new in Go 1.11). + +Below example will work only in these newer Hugo versions. The example +prints "Var is Hugo Home" on the home page, and "Var is Hugo Page" on +all other pages: + +```go-html-template +{{ $var := "Hugo Page" }} +{{ if .IsHome }} + {{ $var = "Hugo Home" }} +{{ end }} +Var is {{ $var }} +``` + ## Functions -Go templates only ship with a few basic functions but also provide a mechanism for applications to extend the original set. +Go Templates only ship with a few basic functions but also provide a mechanism for applications to extend the original set. [Hugo template functions][functions] provide additional functionality specific to building websites. Functions are called by using their name followed by the required parameters separated by spaces. Template functions cannot be added without recompiling Hugo. ### Example 1: Adding Numbers -``` +```go-html-template {{ add 1 2 }} -=> 3 + ``` ### Example 2: Comparing Numbers -``` +```go-html-template {{ lt 1 2 }} -=> true (i.e., since 1 is less than 2) + ``` -Note that both examples make use of Go template's [math functions][]. +Note that both examples make use of Go Template's [math functions][]. {{% note "Additional Boolean Operators" %}} -There are more boolean operators than those listed in the Hugo docs in the [Go template documentation](http://golang.org/pkg/text/template/#hdr-Functions). +There are more boolean operators than those listed in the Hugo docs in the [Go Template documentation](http://golang.org/pkg/text/template/#hdr-Functions). {{% /note %}} ## Includes @@ -124,116 +161,174 @@ within Hugo. The [`partial`][partials] function is used to include *partial* templates using the syntax `{{ partial "/." . }}`. -Example: +Example of including a `layouts/partials/header.html` partial: -``` +```go-html-template {{ partial "header.html" . }} ``` ### Template -The `template` function was used to include *partial* templates in much older -Hugo versions. Now it is still useful for calling [*internal* -templates][internal_templates]: +The `template` function was used to include *partial* templates +in much older Hugo versions. Now it useful only for calling +[*internal* templates][internal_templates]. The syntax is `{{ template +"_internal/