mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Squashed 'docs/' changes from 73f355ce..ef02e34e
ef02e34e Correct the mmark example frontmatter parameter 6e91e900 SectionPagesMenu > sectionPagesMenu 1a0db1a6 Adjust sectionPagesMenu f9f87d9d Fix extension's missing period. 7062ae07 Remove Press and Articles page 771f2b38 Remove outdated and redudant content file for release notes 64cf47c3 Remove outdated note in docs contribution guide bdb11b89 Fix typo 8324af70 Fixes broken link on Roadmap d93f0992 functions: Add all missing binary comparison operators fb7ae80a Fix typo in usage.md fbdae08b Fix typo in content-management/taxonomies.md 66fab8d2 Make <title> less stuttery b3cd4c22 Remove old temp release notes 5589ba96 Fix typos in templates/lists.md af3a0807 http > HTTP b2af90ae Remove formatting in description of blog article 6e2e60a9 Add blog article about Netlify files 0bb6f2f2 Use title in archetype file 7b2490ff Get the Archetypes up to new spec f401d69b Load CSS and JS via HTTP/2 server push 4aef4944 Adjust titles 362acdb2 Fix typo in quickstart c2440560 Remove inline icons from installation guide d2edcbc3 Revert "Fix links to Disqus template documentation" 622f49cf Add a full commands section at the quick start end 752f065b Fix server command in README 93e08e19 Fix links to Disqus template documentation 5e0cfaa9 Adjust Linux install d51397c2 Fix broken link in Quick Start 1fb39846 Add /quickstart alias to quickstart 7440616b Add new and simpler quickstart b3ec6986 Let page title correspond to function name replaceRE b44499c9 Add YouTube tutorial about taxonomies 88b9eb0e Add RSS templates example 6c0bde3f Update slice.md 6c212ea6 Reorder to match the following content order d2122992 Complete "content" spelling under theme components e4824eb3 Fix the output shortcode and its usage 0adfc945 Add archetypes YouTube video 638e9d9b Fix double "your" typo in taxonomies.md git-subtree-dir: docs git-subtree-split: ef02e34eaf296c3f94b4446b3c3347771e786057
This commit is contained in:
parent
2c0d1ccdcd
commit
50ec65fbe1
50 changed files with 390 additions and 1754 deletions
|
@ -27,8 +27,10 @@ git submodule update --init
|
|||
Also note that the documentation version for a given version of Hugo can also be found in the `/docs` sub-folder of the [Hugo source repository](https://github.com/gohugoio/hugo).
|
||||
|
||||
Then to view the docs in your browser, run Hugo and open up the link:
|
||||
|
||||
```bash
|
||||
hugo serve
|
||||
▶ hugo server
|
||||
|
||||
Started building sites ...
|
||||
.
|
||||
.
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
---
|
||||
linktitle: ""
|
||||
title: "{{ replace .TranslationBaseName "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
description: ""
|
||||
godocref: ""
|
||||
publishdate: ""
|
||||
lastmod: ""
|
||||
categories: []
|
||||
tags: []
|
||||
weight: 00
|
||||
#tags: []
|
||||
slug: ""
|
||||
aliases: []
|
||||
toc: false
|
||||
draft: true
|
||||
---
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
linktitle: ""
|
||||
description: ""
|
||||
godocref: ""
|
||||
publishdate: ""
|
||||
lastmod: ""
|
||||
categories: [functions]
|
||||
tags: []
|
||||
ns: ""
|
||||
signature: []
|
||||
workson: []
|
||||
hugoversion: ""
|
||||
aliases: []
|
||||
relatedfuncs: []
|
||||
toc: false
|
||||
deprecated: false
|
||||
---
|
|
@ -1,13 +0,0 @@
|
|||
---
|
||||
description: ""
|
||||
lastmod: ""
|
||||
license: ""
|
||||
licenseLink: ""
|
||||
sitelink: ""
|
||||
sourcelink: ""
|
||||
categories: [showcase]
|
||||
tags: []
|
||||
image: ""
|
||||
toc: false
|
||||
notesforauthors: "Go to gohugo.io/contribute/documentation for more info"
|
||||
---
|
|
@ -1,16 +0,0 @@
|
|||
---
|
||||
linktitle: ""
|
||||
description: ""
|
||||
godocref: ""
|
||||
publishdate: ""
|
||||
lastmod: ""
|
||||
categories: [tutorials]
|
||||
tags: []
|
||||
author: ""
|
||||
authorurl: ""
|
||||
originalurl: ""
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors: "Go to gohugo.io/contribute/documentation for more info."
|
||||
---
|
||||
|
10
config.toml
10
config.toml
|
@ -6,7 +6,7 @@ enableEmoji = true
|
|||
footnotereturnlinkcontents = "↩"
|
||||
languageCode = "en-us"
|
||||
metaDataFormat = "yaml"
|
||||
title = "Hugo: A Fast and Flexible Website Generator"
|
||||
title = "Hugo"
|
||||
theme = "gohugoioTheme"
|
||||
|
||||
googleAnalytics = "UA-7131036-4"
|
||||
|
@ -25,7 +25,7 @@ pygmentsCodeFences = true
|
|||
pygmentsStyle = "friendly"
|
||||
|
||||
[outputs]
|
||||
home = [ "HTML", "RSS", "REDIR" ]
|
||||
home = [ "HTML", "RSS", "REDIR", "HEADERS" ]
|
||||
section = [ "HTML", "RSS"]
|
||||
|
||||
[mediaTypes]
|
||||
|
@ -39,7 +39,11 @@ mediatype = "text/netlify"
|
|||
baseName = "_redirects"
|
||||
isPlainText = true
|
||||
notAlternative = true
|
||||
|
||||
[outputFormats.HEADERS]
|
||||
mediatype = "text/netlify"
|
||||
baseName = "_headers"
|
||||
isPlainText = true
|
||||
notAlternative = true
|
||||
|
||||
[social]
|
||||
twitter = "GoHugoIO"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: "Hugo: A Fast and Flexible Website Generator"
|
||||
title: "A Fast and Flexible Website Generator"
|
||||
date: 2017-03-02T12:00:00-05:00
|
||||
features:
|
||||
- heading: Blistering Speed
|
||||
|
|
|
@ -44,7 +44,7 @@ Feel free to [contribute to Hugo's development][devcontribute], [improve Hugo's
|
|||
[migrate]: /tools/migrations/
|
||||
[milestones]: https://github.com/gohugoio/hugo/milestone/14
|
||||
[newissue]: https://github.com/gohugoio/hugo/issues/
|
||||
[related forum thread]: https://disourse.gohugo.io/t/web-based-editor/155
|
||||
[related forum thread]: https://discourse.gohugo.io/t/web-based-editor/155
|
||||
[themes]: /themes/
|
||||
[themescontrib]: /contribute/themes/
|
||||
[tutorials]: /tutorials
|
||||
|
|
|
@ -29,6 +29,8 @@ See above
|
|||
|
||||
**Archetypes** are content files in the [archetypes directory][] of your project that contain preconfigured [front matter][] for your website's [content types][]. Archetypes facilitate consistent metadata across your website content and allow content authors to quickly generate instances of a content type via the `hugo new` command.
|
||||
|
||||
{{< youtube S3Tj3UcTFz8 >}}
|
||||
|
||||
The `hugo new` generator for archetypes assumes your working directory is the content folder at the root of your project. Hugo is able to infer the appropriate archetype by assuming the content type from the content section passed to the CLI command:
|
||||
|
||||
```
|
||||
|
@ -47,15 +49,13 @@ To override the content type Hugo infers from `[content-section]`, add the `--ki
|
|||
|
||||
Running this command in a new site that does not have default or custom archetypes will create the following file:
|
||||
|
||||
{{% output file="content/posts/my-first-post.md" %}}
|
||||
```
|
||||
{{< output file="content/posts/my-first-post.md" >}}
|
||||
+++
|
||||
date = "2017-02-01T19:20:04-07:00"
|
||||
title = "my first post"
|
||||
draft = true
|
||||
+++
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
{{% note %}}
|
||||
In this example, if you do not already have a `content/posts` directory, Hugo will create both `content/posts/` and `content/posts/my-first-post.md` for you.
|
||||
|
@ -119,16 +119,14 @@ $ hugo new posts/my-new-post.md
|
|||
|
||||
Hugo then creates a new markdown file with the following front matter:
|
||||
|
||||
{{% output file="content/posts/my-new-post.md" %}}
|
||||
```
|
||||
{{< output file="content/posts/my-new-post.md" >}}
|
||||
+++
|
||||
categories = ["web development"]
|
||||
date = "2017-02-01T19:20:04-07:00"
|
||||
tags = ["golang", "hugo"]
|
||||
title = "my new post"
|
||||
+++
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
We see that the `title` and `date` key-values have been added in addition to the `tags` and `categories` key-values from `archetypes/default.md`.
|
||||
|
||||
|
@ -160,8 +158,7 @@ $ hugo new posts/post-from-custom.md
|
|||
|
||||
This time, Hugo recognizes our custom `archetypes/posts.md` archetype and uses it instead of `archetypes/default.md`. The generated file will now include the full list of front matter parameters, as well as the base archetype's `title` and `date`:
|
||||
|
||||
{{% output file="content/posts/post-from-custom-archetype.md" %}}
|
||||
```
|
||||
{{< output file="content/posts/post-from-custom-archetype.md" >}}
|
||||
+++
|
||||
categories = ""
|
||||
date = 2017-02-13T17:24:43-08:00
|
||||
|
@ -169,8 +166,7 @@ description = ""
|
|||
tags = ""
|
||||
title = "post from custom archetype"
|
||||
+++
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
### Hugo Docs Custom Archetype
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ In the event that you want to only use Mmark in specific files, you can also def
|
|||
---
|
||||
title: My Post
|
||||
date: 2017-04-01
|
||||
markdown: mmark
|
||||
markup: mmark
|
||||
---
|
||||
```
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ Translated articles are identified by the name of the content file.
|
|||
1. `/content/about.en.md`
|
||||
2. `/content/about.fr.md`
|
||||
|
||||
In this eample, the `about.md` will be assigned the configured `defaultContentLanguage`.
|
||||
In this example, the `about.md` will be assigned the configured `defaultContentLanguage`.
|
||||
|
||||
1. `/content/about.md`
|
||||
2. `/content/about.fr.md`
|
||||
|
|
|
@ -95,16 +95,14 @@ The `figure` shortcode can use the following named parameters:
|
|||
|
||||
#### Example `figure` Output
|
||||
|
||||
{{% output file="figure-output-example.html" %}}
|
||||
```
|
||||
{{< output file="figure-output-example.html" >}}
|
||||
<figure>
|
||||
<img src="/media/spf13.jpg" />
|
||||
<figcaption>
|
||||
<h4>Steve Francia</h4>
|
||||
</figcaption>
|
||||
</figure>
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
### `gist`
|
||||
|
||||
|
@ -130,11 +128,9 @@ If the gist contains several files and you want to quote just one of them, you c
|
|||
|
||||
#### Example `gist` Output
|
||||
|
||||
{{% output file="gist-output.html" %}}
|
||||
```
|
||||
{{< output file="gist-output.html" >}}
|
||||
{{< gist spf13 7896402 >}}
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
#### Example `gist` Display
|
||||
|
||||
|
@ -165,8 +161,7 @@ This shortcode will convert the source code provided into syntax-highlighted HTM
|
|||
|
||||
The `highlight` shortcode example above would produce the following HTML when the site is rendered:
|
||||
|
||||
{{% output file="tutorials/learn-html/index.html" %}}
|
||||
```
|
||||
{{< output file="tutorials/learn-html/index.html" >}}
|
||||
<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>
|
||||
|
@ -175,8 +170,7 @@ The `highlight` shortcode example above would produce the following HTML when th
|
|||
{{ end }}
|
||||
<span style="color: #f92672"></div></span>
|
||||
<span style="color: #f92672"></section></span>
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
{{% note "More on Syntax Highlighting" %}}
|
||||
To see even more options for adding syntax-highlighted code blocks to your website, see [Syntax Highlighting in Developer Tools](/tools/syntax-highlighting/).
|
||||
|
@ -206,11 +200,9 @@ You also have the option to hide the caption:
|
|||
|
||||
By adding the preceding `hidecaption` example, the following HTML will be added to your rendered website's markup:
|
||||
|
||||
{{% output file="instagram-hide-caption-output.html" %}}
|
||||
```
|
||||
{{< output file="instagram-hide-caption-output.html" >}}
|
||||
{{< instagram BWNjjyYFxVx hidecaption >}}
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
#### Example `instagram` Display
|
||||
|
||||
|
@ -265,11 +257,9 @@ Extract the value from the field `data-id` and pass it to the shortcode:
|
|||
|
||||
#### `speakerdeck` Example Output
|
||||
|
||||
{{% output file="speakerdeck-example-input.md" %}}
|
||||
```
|
||||
{{< output file="speakerdeck-example-input.md" >}}
|
||||
{{< speakerdeck 4e8126e72d853c0060001f97 >}}
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
#### `speakerdeck` Example Display
|
||||
|
||||
|
@ -297,11 +287,9 @@ Pass the tweet's ID from the URL as a parameter to the `tweet` shortcode:
|
|||
|
||||
Using the preceding `tweet` example, the following HTML will be added to your rendered website's markup:
|
||||
|
||||
{{% output file="example-tweet-output.html" %}}
|
||||
```
|
||||
{{< output file="example-tweet-output.html" >}}
|
||||
{{< tweet 877500564405444608 >}}
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
#### Example `tweet` Display
|
||||
|
||||
|
@ -329,11 +317,9 @@ Extract the ID from the video's URL and pass it to the `vimeo` shortcode:
|
|||
|
||||
Using the preceding `vimeo` example, the following HTML will be added to your rendered website's markup:
|
||||
|
||||
{{% output file="example-vimeo-output.html" %}}
|
||||
```
|
||||
{{< output file="example-vimeo-output.html" >}}
|
||||
{{< vimeo 146022717 >}}
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
{{% tip %}}
|
||||
If you want to further customize the visual styling of the YouTube or Vimeo output, add a `class` named parameter when calling the shortcode. The new `class` will be added to the `<div>` that wraps the `<iframe>` *and* will remove the inline styles. Note that you will need to call the `id` as a named parameter as well.
|
||||
|
|
|
@ -32,6 +32,8 @@ Term
|
|||
Value
|
||||
: a piece of content assigned to a term
|
||||
|
||||
{{< youtube "-np9GX6cL38" >}}
|
||||
|
||||
## Example Taxonomy: Movie Website
|
||||
|
||||
Let's assume you are making a website about movies. You may want to include the following taxonomies:
|
||||
|
@ -92,7 +94,7 @@ disableKinds = ["taxonomy","taxonomyTerm"]
|
|||
|
||||
### Default Destinations
|
||||
|
||||
When taxonomies are used---and [taxonomy templates][] are provided---Hugo will automatically create both a page listing all the taxonomy's terms and individual pages with lists of content associated with each term. For example, a `categories` taxonomy declared in your your configuration and used in your content front matter will create the following pages:
|
||||
When taxonomies are used---and [taxonomy templates][] are provided---Hugo will automatically create both a page listing all the taxonomy's terms and individual pages with lists of content associated with each term. For example, a `categories` taxonomy declared in your configuration and used in your content front matter will create the following pages:
|
||||
|
||||
* A single page at `example.com/categories/` that lists all the [terms within the taxonomy][]
|
||||
* [Individual taxonomy list pages][taxonomy templates] (e.g., `/categories/development/`) for each of the terms that shows a listing of all pages marked as part of that taxonomy within any content file's [front matter][]
|
||||
|
@ -163,7 +165,7 @@ project_url = "https://github.com/gohugoio/hugo"
|
|||
title: "Hugo: A fast and flexible static site generator"
|
||||
#tags: ["Development", "Go", "fast", "Blogging"]
|
||||
categories: ["Development"]
|
||||
categories: ["Go Web Dev"]
|
||||
series: ["Go Web Dev"]
|
||||
slug: "hugo"
|
||||
project_url: "https://github.com/gohugoio/hugo"
|
||||
---
|
||||
|
|
|
@ -38,10 +38,6 @@ Adding new content to the Hugo docs follows the same pattern, regardless of the
|
|||
hugo new <DOCS-SECTION>/<new-content-lowercase>.md
|
||||
```
|
||||
|
||||
{{% note "`title:`, `date:`, and Field Order" %}}
|
||||
`title` and `date` fields are added automatically when using archetypes via `hugo new`. Do not be worried if the order of the new file's front matter fields on your local machine is different than that of the examples provided in the Hugo docs. This is a known issue [(#452)](https://github.com/gohugoio/hugo/issues/452).
|
||||
{{% /note %}}
|
||||
|
||||
### Add a New Function
|
||||
|
||||
Once you have cloned the Hugo repository, you can create a new function via the following command. Keep the file name lowercase.
|
||||
|
@ -92,20 +88,6 @@ Here is a review of the front matter fields automatically generated for you usin
|
|||
|
||||
In the body of your function, expand the short description used in the front matter. Include as many examples as possible, and leverage the Hugo docs [`code` shortcode](#adding-code-blocks). If you are unable to add examples but would like to solicit help from the Hugo community, add `needsexample: true` to your front matter.
|
||||
|
||||
### Add a New Tutorial
|
||||
|
||||
Once you have cloned the Hugo repository, you can create a new tutorial via the following command. Name the markdown file accordingly:
|
||||
|
||||
```
|
||||
hugo new tutorials/my-new-tutorial.md
|
||||
```
|
||||
|
||||
The archetype for the `tutorials` content type is as follows:
|
||||
|
||||
{{< code file="archetypes/tutorials.md" >}}
|
||||
{{< readfile file="/themes/gohugoioTheme/archetypes/tutorials.md">}}
|
||||
{{< /code >}}
|
||||
|
||||
## Add Code Blocks
|
||||
|
||||
Code blocks are crucial for providing examples of Hugo's new features to end users of the Hugo docs. Whenever possible, create examples that you think Hugo users will be able to implement in their own projects.
|
||||
|
@ -223,12 +205,10 @@ The `output` shortcode is almost identical to the `code` shortcode but only take
|
|||
|
||||
The preceding `output` example will render as follows to the Hugo docs:
|
||||
|
||||
{{% output file="post/my-first-post/index.html" %}}
|
||||
```
|
||||
{{< output file="post/my-first-post/index.html" >}}
|
||||
<h1>This is my First Hugo Blog Post</h1>
|
||||
<p>I am excited to be using Hugo.</p>
|
||||
```
|
||||
{{% /output %}} -->
|
||||
{{< /output >}} -->
|
||||
|
||||
## Blockquotes
|
||||
|
||||
|
@ -278,13 +258,11 @@ Here is a piece of information I would like to draw your **attention** to.
|
|||
|
||||
#### Example `note` Output
|
||||
|
||||
{{% output file="note-with-heading.html" %}}
|
||||
```
|
||||
{{< output file="note-with-heading.html" >}}
|
||||
{{% note %}}
|
||||
Here is a piece of information I would like to draw your **attention** to.
|
||||
{{% /note %}}
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
#### Example `note` Display
|
||||
|
||||
|
@ -306,13 +284,11 @@ Here's a bit of advice to improve your productivity with Hugo.
|
|||
|
||||
#### Example `tip` Output
|
||||
|
||||
{{% output file="tip-output.html" %}}
|
||||
```
|
||||
{{< output file="tip-output.html" >}}
|
||||
{{% tip %}}
|
||||
Here's a bit of advice to improve your productivity with Hugo.
|
||||
{{% /tip %}}
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
#### Example `tip` Display
|
||||
|
||||
|
@ -334,13 +310,11 @@ This is a warning, which should be reserved for *important* information like bre
|
|||
|
||||
#### Example `warning` Output
|
||||
|
||||
{{% output file="warning-admonition-output.html" %}}
|
||||
```
|
||||
{{< output file="warning-admonition-output.html" >}}
|
||||
{{% warning %}}
|
||||
This is a warning, which should be reserved for *important* information like breaking changes.
|
||||
{{% /warning %}}
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
#### Example `warning` Display
|
||||
|
||||
|
|
|
@ -26,12 +26,10 @@ An example:
|
|||
<p>SGVsbG8gd29ybGQ = {{ "SGVsbG8gd29ybGQ=" | base64Decode }}</p>
|
||||
{{< /code >}}
|
||||
|
||||
{{% output file="base-64-output.html" %}}
|
||||
```
|
||||
{{< output file="base-64-output.html" >}}
|
||||
<p>Hello world = SGVsbG8gd29ybGQ=</p>
|
||||
<p>SGVsbG8gd29ybGQ = Hello world</p>
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
You can also pass other data types as arguments to the template function which tries to convert them. The following will convert *42* from an integer to a string because both `base64Encode` and `base64Decode` always return a string.
|
||||
|
||||
|
|
|
@ -72,11 +72,9 @@ And then using dot notation
|
|||
|
||||
Which would return
|
||||
|
||||
{{% output file="dot-notation-default-return-value.html" %}}
|
||||
```
|
||||
{{< output file="dot-notation-default-return-value.html" >}}
|
||||
<title>Sane Defaults</title>
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
The following have equivalent return values but are far less terse. This demonstrates the utility of `default`:
|
||||
|
||||
|
|
|
@ -44,11 +44,9 @@ title: I love Delimit
|
|||
<p>Tags: {{ delimit .Params.tags ", " }}</p>
|
||||
{{< /code >}}
|
||||
|
||||
{{% output file="delimit-page-tags-output.html" %}}
|
||||
```
|
||||
{{< output file="delimit-page-tags-output.html" >}}
|
||||
<p>Tags: tag1, tag2, tag3</p>
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
Here is the same example but with the optional "last" delimiter:
|
||||
|
||||
|
@ -56,11 +54,9 @@ Here is the same example but with the optional "last" delimiter:
|
|||
Tags: {{ delimit .Params.tags ", " ", and " }}
|
||||
{{< /code >}}
|
||||
|
||||
{{% output file="delimit-page-tags-final-and-output.html" %}}
|
||||
```
|
||||
{{< output file="delimit-page-tags-final-and-output.html" >}}
|
||||
<p>Tags: tag1, tag2, and tag3</p>
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
|
||||
[lists]: /templates/lists/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: eq
|
||||
linktitle: eq
|
||||
description: Returns true if the parameters are equal.
|
||||
description: Returns the boolean truth of arg1 == arg2.
|
||||
godocref:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
|
|
25
content/functions/ge.md
Normal file
25
content/functions/ge.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
title: ge
|
||||
linktitle: ge
|
||||
description: Returns the boolean truth of arg1 >= arg2.
|
||||
godocref:
|
||||
date: 2017-07-26
|
||||
publishdate: 2017-07-26
|
||||
lastmod: 2017-07-26
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [operators,logic]
|
||||
signature: ["ge ARG1 ARG2"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
|
||||
```
|
||||
{{ if ge 10 5 }}true{{ end }}
|
||||
```
|
25
content/functions/gt.md
Normal file
25
content/functions/gt.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
title: gt
|
||||
linktitle: gt
|
||||
description: Returns the boolean truth of arg1 > arg2.
|
||||
godocref:
|
||||
date: 2017-07-26
|
||||
publishdate: 2017-07-26
|
||||
lastmod: 2017-07-26
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [operators,logic]
|
||||
signature: ["gt ARG1 ARG2"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
|
||||
```
|
||||
{{ if gt 10 5 }}true{{ end }}
|
||||
```
|
25
content/functions/le.md
Normal file
25
content/functions/le.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
title: le
|
||||
linktitle: le
|
||||
description: Returns the boolean truth of arg1 <= arg2.
|
||||
godocref:
|
||||
date: 2017-07-26
|
||||
publishdate: 2017-07-26
|
||||
lastmod: 2017-07-26
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [operators,logic]
|
||||
signature: ["le ARG1 ARG2"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
|
||||
```
|
||||
{{ if le 5 10 }}true{{ end }}
|
||||
```
|
25
content/functions/lt.md
Normal file
25
content/functions/lt.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
title: lt
|
||||
linktitle: lt
|
||||
description: Returns the boolean truth of arg1 < arg2.
|
||||
godocref:
|
||||
date: 2017-07-26
|
||||
publishdate: 2017-07-26
|
||||
lastmod: 2017-07-26
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [operators,logic]
|
||||
signature: ["lt ARG1 ARG2"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
|
||||
```
|
||||
{{ if lt 5 10 }}true{{ end }}
|
||||
```
|
25
content/functions/ne.md
Normal file
25
content/functions/ne.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
title: ne
|
||||
linktitle: ne
|
||||
description: Returns the boolean truth of arg1 != arg2.
|
||||
godocref:
|
||||
date: 2017-07-26
|
||||
publishdate: 2017-07-26
|
||||
lastmod: 2017-07-26
|
||||
categories: [functions]
|
||||
menu:
|
||||
docs:
|
||||
parent: "functions"
|
||||
#tags: [operators,logic]
|
||||
signature: ["ne ARG1 ARG2"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
|
||||
```
|
||||
{{ if ne .Section "blog" }}current{{ end }}
|
||||
```
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: replacere
|
||||
title: replaceRE
|
||||
# linktitle: replaceRE
|
||||
description: Replaces all occurrences of a regular expression with the replacement pattern.
|
||||
godocref:
|
||||
|
|
|
@ -43,14 +43,12 @@ The following is an example of a sidebar partial that may be used in conjunction
|
|||
|
||||
This partial would produce the following HTML output:
|
||||
|
||||
{{% output file="bad-url-sidebar-menu-output.html" %}}
|
||||
```
|
||||
{{< output file="bad-url-sidebar-menu-output.html" >}}
|
||||
<!-- This unordered list may be part of a sidebar menu -->
|
||||
<ul>
|
||||
<li><a href="#ZgotmplZ">IRC: #golang at freenode</a></li>
|
||||
</ul>
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
The odd output can be remedied by adding ` | safeURL` to our `.Title` page variable:
|
||||
|
||||
|
@ -63,13 +61,11 @@ The odd output can be remedied by adding ` | safeURL` to our `.Title` page varia
|
|||
|
||||
With the `.URL` page variable piped through `safeURL`, we get the desired output:
|
||||
|
||||
{{% output file="correct-url-sidebar-menu-output.html" %}}
|
||||
```
|
||||
{{< output file="correct-url-sidebar-menu-output.html" >}}
|
||||
<ul class="sidebar-menu">
|
||||
<li><a href="irc://irc.freenode.net/#golang">IRC: #golang at freenode</a></li>
|
||||
</ul>
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
[configuration]: /getting-started/configuration/
|
||||
[menus]: /content-management/menus/
|
||||
|
|
|
@ -29,13 +29,11 @@ aliases: []
|
|||
|
||||
This example would return the following:
|
||||
|
||||
{{% output file="shuffle-output.html" %}}
|
||||
```
|
||||
{{< output file="shuffle-output.html" >}}
|
||||
<!-- Shuffled sequence = -->
|
||||
<div>2 5 3 1 4</div>
|
||||
<!-- Shuffled slice = -->
|
||||
<div>buzz foo bar</div>
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
This example also makes use of the [slice](/functions/slice/) and [seq](/functions/seq/) functions.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: slice
|
||||
# linktitle: slice
|
||||
description: Creates a alice (array) of all passed arguments.
|
||||
description: Creates a slice (array) of all passed arguments.
|
||||
godocref:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
|
|
|
@ -51,8 +51,7 @@ The following might be used as a partial within a [single page template][singlet
|
|||
|
||||
The preceding partial would then output to the rendered page as follows, assuming the page is being built with Hugo's default pretty URLs.
|
||||
|
||||
{{% output file="/blog/greatest-city/index.html" %}}
|
||||
```
|
||||
{{< output file="/blog/greatest-city/index.html" >}}
|
||||
<header>
|
||||
<h1>The World's Greatest City</h1>
|
||||
<div><a href="/locations/chicago-il/">Chicago IL</a></div>
|
||||
|
@ -68,8 +67,7 @@ The preceding partial would then output to the rendered page as follows, assumin
|
|||
</li>
|
||||
</ul>
|
||||
</header>
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
|
||||
[singletemplate]: /templates/single-page-templates/
|
||||
|
|
|
@ -28,10 +28,10 @@ Hugo is written in [Go](https://golang.org/) with support for multiple platforms
|
|||
|
||||
Hugo currently provides pre-built binaries for the following:
|
||||
|
||||
* <i class="icon-apple"></i> macOS (Darwin) for x64, i386, and ARM architectures
|
||||
* <i class="icon-windows"></i> Windows
|
||||
* <i class="icon-linux"></i> Linux
|
||||
* <i class="icon-freebsd"></i> FreeBSD
|
||||
* macOS (Darwin) for x64, i386, and ARM architectures
|
||||
* Windows
|
||||
* Linux
|
||||
* FreeBSD
|
||||
|
||||
Hugo may also be compiled from source wherever the Go compiler tool chain can run; e.g., on other operating systems such as DragonFly BSD, OpenBSD, Plan 9, Solaris, and others. See <https://golang.org/doc/install/source> for the full set of supported combinations of target operating systems and compilation architectures.
|
||||
|
||||
|
@ -87,7 +87,7 @@ go install github.com/gohugoio/hugo
|
|||
If you are a Windows user, substitute the `$HOME` environment variable above with `%USERPROFILE%`.
|
||||
{{% /note %}}
|
||||
|
||||
## <i class="icon-apple"></i>macOS
|
||||
## macOS
|
||||
|
||||
### Assumptions
|
||||
|
||||
|
@ -295,7 +295,7 @@ go build -o hugo main.go
|
|||
|
||||
Then place the `hugo` executable somewhere in your `$PATH`. You're now ready to start using Hugo.
|
||||
|
||||
## <i class="icon-windows"></i>Windows
|
||||
## Windows
|
||||
|
||||
The following aims to be a complete guide to installing Hugo on your Windows PC.
|
||||
|
||||
|
@ -410,14 +410,26 @@ C:\Hugo\Sites\example.com>dir
|
|||
|
||||
{{< youtube c8fJIRNChmU >}}
|
||||
|
||||
## <i class="icon-linux"></i>Linux
|
||||
## Linux
|
||||
|
||||
### Snap Package
|
||||
|
||||
In any of the [Linux distributions that support snaps][snaps]:
|
||||
|
||||
```
|
||||
snap install hugo
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
Hugo-as-a-snap can write only inside the user’s `$HOME` directory---and gvfs-mounted directories owned by the user---because of Snaps’ confinement and security model. More information is also available [in this related GitHub issue](https://github.com/gohugoio/hugo/issues/3143).
|
||||
{{% /note %}}
|
||||
|
||||
### Debian and Ubuntu
|
||||
|
||||
In any of the [Linux distributions that support snaps](https://snapcraft.io/docs/core/install):
|
||||
Debian and Ubuntu provide a `hugo` version via `apt-get`:
|
||||
|
||||
```
|
||||
sudo apt install hugo
|
||||
sudo apt-get install hugo
|
||||
```
|
||||
|
||||
#### Pros
|
||||
|
@ -427,7 +439,7 @@ sudo apt install hugo
|
|||
|
||||
#### Cons
|
||||
|
||||
* Might not be the latest version, especially if you are using an older, stable version (e.g., Ubuntu 16.04 LTS). Until backports and PPA are available, you may consider installing the Hugo snap package to get the latest version of Hugo, as described below.
|
||||
* Might not be the latest version, especially if you are using an older, stable version (e.g., Ubuntu 16.04 LTS). Until backports and PPA are available, you may consider installing the Hugo snap package to get the latest version of Hugo.
|
||||
|
||||
### Arch
|
||||
|
||||
|
@ -447,17 +459,6 @@ yaourt -S hugo
|
|||
|
||||
See the [related discussion in the Hugo forums][redhatforum].
|
||||
|
||||
### Snap Package
|
||||
|
||||
In any of the [Linux distributions that support snaps][snaps]:
|
||||
|
||||
```
|
||||
snap install hugo
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
Hugo-as-a-snap can write only inside the user’s `$HOME` directory---and gvfs-mounted directories owned by the user---because of Snaps’ confinement and security model. More information is also available [in this related GitHub issue](https://github.com/gohugoio/hugo/issues/3143).
|
||||
{{% /note %}}
|
||||
|
||||
## Upgrade Hugo
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
---
|
||||
title: Quick Start
|
||||
linktitle: Quick Start
|
||||
description: Build an online bookshelf that taps into Hugo's CLI, directory structure, configuration, and theming.
|
||||
description: Create a Hugo site using the beautiful Ananke theme.
|
||||
date: 2013-07-01
|
||||
publishdate: 2013-07-01
|
||||
lastmod: 2017-06-22
|
||||
categories: [getting started]
|
||||
#tags: [quick start,usage]
|
||||
authors: [Shekhar Gulati, Ryan Watters]
|
||||
|
@ -15,534 +14,127 @@ menu:
|
|||
weight: 10
|
||||
sections_weight: 10
|
||||
draft: false
|
||||
aliases: [/overview/quickstart/]
|
||||
aliases: [/quickstart/,/overview/quickstart/]
|
||||
toc: true
|
||||
wip: true
|
||||
---
|
||||
|
||||
{{% note %}}
|
||||
This Quick Start was originally written by [Shekhar Gulati](https://twitter.com/shekhargulati) in his [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series but has been heavily modified to represent additional features and other changes to Hugo.
|
||||
This quick start uses `macOS` in the examples. For instructions about how to install Hugo on other operating systems, see [install](/getting-started/installing).
|
||||
|
||||
You also need [Git installed](https://git-scm.com/downloads) to run this tutorial.
|
||||
{{% /note %}}
|
||||
|
||||
In this Quick Start, we will build an online bookshelf that lists books and their reviews.
|
||||
|
||||
## Step 1. Install Hugo
|
||||
|
||||
[Install Hugo][install]. If installing from [Hugo releases][releases], you'll need to save the main executable as `hugo` (or `hugo.exe` on Windows) somewhere in your `PATH`. You will need the `hugo` command in the following steps.
|
||||
## Step 1: Install Hugo
|
||||
|
||||
{{% note "Windows Users and Git Bash" %}}
|
||||
If you're on Windows, this Quick Start will assume you're using [Git Bash](https://git-for-windows.github.io/) (aka Git for Windows).
|
||||
{{% note %}}
|
||||
`Homebrew`, a package manager for `macOS`, can be installed from [brew.sh](https://brew.sh/). See [install](/getting-started/installing) if you are running Windows etc.
|
||||
{{% /note %}}
|
||||
|
||||
Once `hugo` is installed, make sure to run the `help` command to verify `hugo` installation. The following is an abridged version of what will write to the console when entering the command:
|
||||
|
||||
```
|
||||
hugo help
|
||||
|
||||
hugo is the main command, used to build your Hugo site.
|
||||
|
||||
Hugo is a Fast and Flexible Static Site Generator
|
||||
built with love by spf13 and friends in Go.
|
||||
|
||||
Complete documentation is available at http://gohugo.io/.
|
||||
```bash
|
||||
brew install hugo
|
||||
```
|
||||
|
||||
You can check the version of Hugo you're currently using with the `hugo version` command:
|
||||
To verify your new install:
|
||||
|
||||
```
|
||||
```bash
|
||||
hugo version
|
||||
```
|
||||
|
||||
```
|
||||
Hugo Static Site Generator v0.18.1 BuildDate: 2016-12-30T05:02:43-05:00
|
||||
|
||||
{{< asciicast HDlKrUrbfT7yiWsbd6QoxzRTN >}}
|
||||
|
||||
|
||||
## Step 2: Create a New Site
|
||||
|
||||
```bash
|
||||
hugo new site quickstart
|
||||
```
|
||||
|
||||
## Step 2. Scaffold Your Hugo Bookshelf Website
|
||||
The above will create a new Hugo site in a folder named `quickstart`.
|
||||
|
||||
Hugo's CLI has commands that allow you to quickly scaffold a new website. Navigate to your preferred location on your file system and create a new Hugo site `bookshelf` by executing the `hugo new` command:
|
||||
{{< asciicast 1PH9A2fs14Dnyarx5v8OMYQer >}}
|
||||
|
||||
```
|
||||
hugo new site bookshelf
|
||||
|
||||
## Step 3: Add a Theme
|
||||
|
||||
See [themes.gohugo.io](https://themes.gohugo.io/) for a list of themes to consider. This quickstart uses the beautiful [Ananke theme](https://themes.gohugo.io/gohugo-theme-ananke/).
|
||||
|
||||
```bash
|
||||
cd quickstart;\
|
||||
git init;\
|
||||
git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke;\
|
||||
|
||||
# Edit your config.toml configuration file
|
||||
# and add the Ananke theme.
|
||||
echo 'theme = "ananke"' >> config.toml
|
||||
```
|
||||
|
||||
Change into the newly created `bookshelf` directory. Listing the new directory's content will show the following:
|
||||
|
||||
{{< asciicast WJM2LEZQs8VRhNeuZ5NiGPp9I >}}
|
||||
|
||||
## Step 4: Add Some Content
|
||||
|
||||
```
|
||||
.
|
||||
├── archetypes
|
||||
├── config.toml
|
||||
├── content
|
||||
├── data
|
||||
├── layouts
|
||||
├── static
|
||||
└── themes
|
||||
|
||||
6 directories, 1 file
|
||||
hugo new posts/my-first-post.md
|
||||
```
|
||||
|
||||
You'll see the `bookshelf` directory has 6 subdirectories and 1 file. Let's look at each of them quickly. (See [Directory Structure][hugodirectories].)
|
||||
|
||||
* `archetypes`: [Archetypes][archetypes] allow you to preconfigure [front matter][fm] for content files for easier scaffolding of content from the command line using `hugo new`.
|
||||
* `config.toml`: Hugo uses `.toml` as its default configuration format but also accepts `.yml` and `.json`. The configuration settings mentioned in the `config.toml` are applied to the full website an include important global variables such as the `baseURL` and `title` of your website. (See [Configuration][configuration].)
|
||||
* `content`: This single directory houses all of the content for your website. Each subdirectory in content is considered a [section][]. If your website has sections for posts, events, and tutorials, you would create `content/posts`, `content/events`, and `content/tutorials`.
|
||||
* `data`: This directory is used to store files of serialized data (YAML, TOML, or JSON) that can be used in [data templates][datatemplates] and your [website's menu][sitemenu].
|
||||
* `layouts`: This is the hub for all your [templating][templating], including [list and section templates](/templates/lists/) and [shortcodes](/templates/shortcode-templates/).
|
||||
* `static`: This houses all your static content; i.e., images, JavaScript, and CSS. Everything in `/static` is copied over *as is* to your finished website.
|
||||
* `themes`: This is where you will download themes for Hugo. You can see a showcase of all themes at <http://themes.gohugo.io>.
|
||||
|
||||
## Step 3. Add Content
|
||||
|
||||
Let's now add a post to our "bookshelf." We will use the `hugo new` command to add a post. This first post will be on the book [*Good To Great*][bookurl]. Make sure you are inside the `bookshelf` directory.
|
||||
|
||||
{{< code file="create-new-book-review-post.sh" >}}
|
||||
hugo new post/good-to-great.md
|
||||
{{< /code >}}
|
||||
|
||||
You should then see the following output:
|
||||
Edit the newly created content file if you want. Now, start the Hugo server with [drafts](/getting-started/usage/#draft-future-and-expired-content) enabled:
|
||||
|
||||
```
|
||||
/Users/yourusername/bookshelf/content/post/good-to-great.md created
|
||||
```
|
||||
▶ hugo server -D
|
||||
|
||||
The above command will create a new directory `post` inside the `content` directory and create `content/post/good-to-great.md`. The directory for your Hugo project will now look like the following:
|
||||
|
||||
```
|
||||
.
|
||||
├── archetypes
|
||||
├── config.toml
|
||||
├── content
|
||||
│ └── post
|
||||
│ └── good-to-great.md
|
||||
├── data
|
||||
├── layouts
|
||||
├── static
|
||||
└── themes
|
||||
```
|
||||
|
||||
Open `good-to-great.md` in your preferred text editor:
|
||||
|
||||
```
|
||||
+++
|
||||
date = "2017-02-19T21:09:05-06:00"
|
||||
title = "good to great"
|
||||
draft = true
|
||||
|
||||
+++
|
||||
```
|
||||
|
||||
The text bracketed by `+++` is the TOML [front matter][fm] for the content. Front matter enables you to define embedded metadata that travels with the content file. Since we have not configured any [archetypes][archetypes] for our project, Hugo has used its built-in base archetype, which includes the following three values in the front matter:
|
||||
|
||||
* `date` specifies the date and time at which post was created from the command line
|
||||
* `title` specifies the title for the post, which Hugo will infer from the file name
|
||||
* `draft`, when set to `true`, tells Hugo the content is not yet ready to be published
|
||||
|
||||
Let's update `good-to-great.md` with a short review of *Good to Great*:
|
||||
|
||||
{{< code file="good-to-great-start.md" >}}
|
||||
+++
|
||||
date = "2016-02-14T16:11:58+05:30"
|
||||
draft = true
|
||||
title = "Good to Great Book Review"
|
||||
+++
|
||||
|
||||
I read **Good to Great in January 2016**. An awesome read sharing detailed analysis on how good companies became great. Although this book is about how companies became great but we could apply a lot of the learnings on ourselves. Concepts like level 5 leader, hedgehog concept, the stockdale paradox are equally applicable to individuals.
|
||||
{{< /code >}}
|
||||
|
||||
## Step 4. Serve Content
|
||||
|
||||
Hugo has a built-in server that can serve your website locally for easy previewing and development. To serve content, execute the following command inside the `bookshelf` directory:
|
||||
|
||||
```
|
||||
hugo server
|
||||
```
|
||||
|
||||
You should see something similar to the following output:
|
||||
|
||||
```
|
||||
Built site for language en:
|
||||
0 of 1 draft rendered
|
||||
0 future content
|
||||
0 expired content
|
||||
0 regular pages created
|
||||
1 other pages created
|
||||
0 non-page files copied
|
||||
0 paginator pages created
|
||||
0 tags created
|
||||
0 categories created
|
||||
total in 1 ms
|
||||
Watching for changes in /Users/yourusername/bookshelf/{data,content,layouts,static}
|
||||
Serving pages from memory
|
||||
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
|
||||
Press Ctrl+C to stop
|
||||
```
|
||||
|
||||
This will start the server on port `1313`. You can view your blog at <http://localhost:1313/>. However, when you go to the link, you will see nothing. This is for a couple reasons:
|
||||
|
||||
1. As you can see in the `hugo server` command output, Hugo did *not* render the draft. Hugo will only render drafts if you pass the `buildDrafts` flag to the `hugo server` command.
|
||||
2. We have not specified how Markdown content should be rendered. We need to create our own layouts via templates or specify a theme, the latter of which we will do in the next step.
|
||||
|
||||
Kill the server using <kbd>Ctrl</kbd> + <kbd>C</kbd> and then rerun the server with the `--buildDrafts` flag appended to the command:
|
||||
|
||||
```
|
||||
hugo server --buildDrafts
|
||||
```
|
||||
|
||||
You should now see something similar to the following:
|
||||
|
||||
```
|
||||
Built site for language en:
|
||||
1 of 1 draft rendered
|
||||
0 future content
|
||||
0 expired content
|
||||
1 regular pages created
|
||||
2 other pages created
|
||||
0 non-page files copied
|
||||
0 paginator pages created
|
||||
0 tags created
|
||||
0 categories created
|
||||
total in 2 ms
|
||||
Watching for changes in /Users/yourusername/bookshelf/{data,content,layouts,static}
|
||||
Serving pages from memory
|
||||
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
|
||||
Press Ctrl+C to stop
|
||||
```
|
||||
|
||||
Okay, so we now have our single page "built," but we're not seeing anything in the browser at <http://localhost:1313>. This was only to demonstrate the utility of the `--buildDrafts` flag.
|
||||
|
||||
While we are getting closer, we still need to specific a theme for Hugo to use when building our site.
|
||||
|
||||
## Step 5. Add A Theme
|
||||
|
||||
[Themes][themessection] provide Hugo with layout and templates to render your website. You can see the full selection of open-source themes at <http://themes.gohugo.io>.
|
||||
|
||||
{{% note "No Default Hugo Theme" %}}
|
||||
Hugo currently doesn’t ship with a default theme, thus allowing end users to pick whichever theme best suits their projects.
|
||||
{{% /note %}}
|
||||
|
||||
Themes should be added in the `themes` directory, one of the directories scaffolded with the `hugo new site` command we used to start our Hugo project. To install our themes, first change into the `themes` directory:
|
||||
|
||||
```
|
||||
cd themes
|
||||
```
|
||||
|
||||
You can clone one or more themes from within the `themes` directory. We will use the [Robust theme][robusttheme] but at the most recent commit as of this Quick Start's last update.
|
||||
|
||||
Once inside the `themes` directory, you can use the following one-liner to clone Robust, check out the specific commit, and then return to your project's root directory:
|
||||
|
||||
{{< code file="clone-robust-theme" >}}
|
||||
git clone https://github.com/dim0627/hugo_theme_robust.git && cd hugo_theme_robust && git checkout 3baae29 && cd ../..
|
||||
{{< /code >}}
|
||||
|
||||
Now let's start Hugo's server again but with the addition of the `-theme` flag for Robust:
|
||||
|
||||
{{< code file="hugo-server-with-theme.sh" >}}
|
||||
hugo server --theme=hugo_theme_robust --buildDrafts
|
||||
{{< /code >}}
|
||||
|
||||
You should see an output to the console similar to the following:
|
||||
|
||||
```
|
||||
Built site for language en:
|
||||
1 of 1 draft rendered
|
||||
0 future content
|
||||
0 expired content
|
||||
1 regular pages created
|
||||
2 other pages created
|
||||
0 non-page files copied
|
||||
2 paginator pages created
|
||||
0 tags created
|
||||
0 categories created
|
||||
total in 8 ms
|
||||
Watching for changes in /Users/yourusername/bookshelf/{data,content,layouts,static,themes}
|
||||
Serving pages from memory
|
||||
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
|
||||
Press Ctrl+C to stop
|
||||
```
|
||||
|
||||
If Hugo doesn't find the specified theme in the `themes` directory,
|
||||
it will throw an exception:
|
||||
|
||||
```
|
||||
FATAL: 2016/02/14 Unable to find theme Directory: /Users/yourusername/bookshelf/themes/robust
|
||||
```
|
||||
|
||||
To view your website, you can go to <http://localhost:1313/>. You should see something similar to the following image:
|
||||
|
||||
![](/images/quickstart/bookshelf-robust-theme.png)
|
||||
|
||||
Similar to the way we looked at the scaffolding for our new Hugo website, let's take a look at what comprises a typical Hugo theme. The following is only a selection of what you would see if you were to list out the contents of the Robust theme directory. These are also some of the default files created by Hugo as of v0.23. (See [Creating a Theme][createtheme])
|
||||
|
||||
```
|
||||
.
|
||||
├── LICENSE.md
|
||||
├── archetypes
|
||||
│ └── default.md
|
||||
├── layouts
|
||||
│ ├── 404.html
|
||||
│ ├── _default
|
||||
│ │ ├── list.html
|
||||
│ │ └── single.html
|
||||
│ ├── index.html
|
||||
│ └── partials
|
||||
│ ├── footer.html
|
||||
│ └── header.html
|
||||
├── static
|
||||
│ ├── css
|
||||
│ └── js
|
||||
└── theme.toml
|
||||
```
|
||||
|
||||
* `theme.toml` is the theme configuration file that provides information about the theme; e.g., theme name, theme description, theme author, theme license, and minimum Hugo version, which will default to your locally installed version of Hugo.
|
||||
* `layouts` contains different views (i.e., [templates][templating]) for different content types. In this quick start, we see that each content type has a `single.html` and `list.html`. `single.html` is used for rendering a single piece of content. `list.html` is used to view a list of content items. For example, you will use `list.html` to view `*.md` in the posts [section][listsectiontemplates]. Think of `list.html` as `example.com/posts` and `single.html` as `example.com/posts/my-single-post/`.
|
||||
* `static` has the same purpose as that of the `static` in our original scaffolding. This directory stores all the static assets used by the theme and is copied over *as is* at build time.
|
||||
|
||||
## Step 6. Use Multiple Themes
|
||||
|
||||
You can very easily switch between different themes in Hugo. Let's suppose we want to try out the [`bleak` theme][bleaktheme]. Kill the Hugo server if you are still running it from the command line.
|
||||
|
||||
From your project root, you can use this one-liner to change into `themes`, clone Bleak, and go back to your project's root directory:
|
||||
|
||||
{{< code file="clone-bleak-theme.sh" >}}
|
||||
cd themes && git clone https://github.com/Zenithar/hugo-theme-bleak.git && cd ..
|
||||
{{< /code >}}
|
||||
|
||||
Now restart the server with our new theme flag:
|
||||
|
||||
{{< code file="run-server-with-bleak.sh" >}}
|
||||
hugo server --theme=hugo-theme-bleak --buildDrafts
|
||||
{{< /code >}}
|
||||
|
||||
Our website is now using the `bleak` theme at <http://localhost:1313>, which should look similar to the following screenshot:
|
||||
|
||||
![Screenshot of the Quick Start website's homepage running with the Bleak Hugo theme.](/images/quickstart/bookshelf-bleak-theme.png)
|
||||
|
||||
## Step 7. Update Your Configuration
|
||||
|
||||
Kill the Hugo server if you are still running it with the Bleak theme, and then restart the server with the `robust` theme. We will use Robust for the duration of this Quick Start:
|
||||
|
||||
{{< code file="restart-with-robust-sh" >}}
|
||||
hugo server --theme=hugo_theme_robust --buildDrafts
|
||||
{{< /code >}}
|
||||
|
||||
### Update Our `config.toml`
|
||||
|
||||
Our website is currently using the dummy values specified in `bookshelf/config.toml`, which were auto-generated with `hugo new site bookshelf`. Let's update the configuration:
|
||||
|
||||
{{< code file="updated-config.toml" >}}
|
||||
baseURL = "http://example.org/"
|
||||
languageCode = "en-us"
|
||||
title = "Shekhar Gulati Book Reviews"
|
||||
|
||||
[Params]
|
||||
Author = "Shekhar Gulati"
|
||||
{{< /code >}}
|
||||
|
||||
### Watch Your Site Reload Instantly
|
||||
|
||||
Hugo has built-in support for LiveReload. This means that Hugo will rebuild and reload your site every time you save a change to content, templates, static assets, and even your configuration. You should see something similar to the following screenshot at <http://localhost:1313> once you save the above changes to your `config.toml`:
|
||||
|
||||
![](/images/quickstart/bookshelf-updated-config.png)
|
||||
|
||||
The change is also reflected in the console. As soon as you changed the configuration file, Hugo applied those changes to the affected pages and rebuilt the site:
|
||||
|
||||
```
|
||||
Config file changed: /Users/yourusername/bookshelf/config.toml
|
||||
Started building sites ...
|
||||
Built site for language en:
|
||||
1 of 1 draft rendered
|
||||
0 future content
|
||||
0 expired content
|
||||
1 regular pages created
|
||||
2 other pages created
|
||||
8 other pages created
|
||||
0 non-page files copied
|
||||
2 paginator pages created
|
||||
0 tags created
|
||||
1 paginator pages created
|
||||
0 categories created
|
||||
total in 20 ms
|
||||
0 tags created
|
||||
total in 18 ms
|
||||
Watching for changes in /Users/bep/sites/quickstart/{data,content,layouts,static,themes}
|
||||
Serving pages from memory
|
||||
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
|
||||
Press Ctrl+C to stop
|
||||
```
|
||||
|
||||
## Step 8. Customize the Robust Theme
|
||||
|
||||
The `robust` theme is a good start towards our online bookshelf, but we want to customize it a bit to meet our desired look and feel. Hugo makes it very easy to [customize existing themes or create your own][themes] themes as well. For the purpose of the Quick Start, we will focus on customization.
|
||||
**Navigate to your new site at [http://localhost:1313/](http://localhost:1313/).**
|
||||
|
||||
The first change that we have to make is to use a different default image instead of the one used in the theme. The theme's default image used in both the `list.html` and `single.html` views resides inside `themes/hugo_theme_robust/static/images/default.jpg`. We can easily override it by creating a simple directory structure inside our repository's `static` directory.
|
||||
|
||||
Create an images directory inside of `bookshelf/static` and copy an image with name `default.jpg` inside of it. We will use the default image shown below.
|
||||
|
||||
![](/images/quickstart/default.jpg)
|
||||
## Step 5: Customize the Theme
|
||||
|
||||
Hugo will sync the changes and reload the website to use the new image:
|
||||
Your new site already looks great, but you will want to tweak it a little before you release it to the public.
|
||||
|
||||
![](/images/quickstart/bookshelf-new-default-image.png)
|
||||
### Site Configuration
|
||||
|
||||
Now we need to change the layout of the index page so that only images are shown instead of the text. The file at `themes/hugo_theme_robust/layouts/index.html` refers to a partial `li.html` template that renders the following list view:
|
||||
Open up `config.toml` in a text editor:
|
||||
|
||||
```
|
||||
<article class="li">
|
||||
<a href="{{ .Permalink }}" class="clearfix">
|
||||
<div class="image" style="background-image: url({{ $.Site.BaseURL }}images/{{ with .Params.image }}{{ . }}{{ else }}default.jpg{{ end }});"></div>
|
||||
<div class="detail">
|
||||
<time>{{ with .Site.Params.DateForm }}{{ $.Date.Format . }}{{ else }}{{ $.Date.Format "Mon, Jan 2, 2006" }}{{ end }}</time>
|
||||
<h2 class="title">{{ .Title }}</h2>
|
||||
<div class="summary">{{ .Summary }}</div>
|
||||
</div>
|
||||
</a>
|
||||
</article>
|
||||
baseURL = "http://example.org/"
|
||||
languageCode = "en-us"
|
||||
title = "My New Hugo Site"
|
||||
theme = "ananke"
|
||||
```
|
||||
|
||||
Create a new file for `li.html` inside the `bookshelf/layouts/_default` directory. If you are in your project root, you can use the following one-liner to both create the file and return to the project root:
|
||||
Replace the `title` above with something more personal. Also, if you already have a domain ready, set the `baseURL`. Note that this value is not needed when running the local development server.
|
||||
|
||||
{{< code file="create-new-li-html.sh" >}}
|
||||
cd layouts && mkdir _default && cd _default && touch li.html && cd ../..
|
||||
{{< /code >}}
|
||||
|
||||
Copy the content shown below into the new `li.html`. When contrasting this with the `li.html` that ships with the Robust theme, you'll notice we have removed details of the book so that only the image is shown:
|
||||
|
||||
{{< code file="layouts/_default/li.html" >}}
|
||||
<article class="li">
|
||||
<a href="{{ .Permalink }}" class="clearfix">
|
||||
<div class="image" style="background-image: url({{ $.Site.BaseURL }}images/{{ with .Params.image }}{{ . }}{{ else }}default.jpg{{ end }});"></div>
|
||||
</a>
|
||||
</article>
|
||||
{{< /code >}}
|
||||
|
||||
Now, the website should render similar to the following screenshot:
|
||||
|
||||
![](/images/quickstart/bookshelf-only-picture.png)
|
||||
|
||||
Next, we want to remove information related to the theme from the footer. Let's create a new directory at `bookshelf/layouts/partials`. This will hold our new file called `default_foot.html`.
|
||||
|
||||
This is a new [partial template][partials]. If you are still in the project's root directory, you can use the following one-liner to create the partial before returning to the project root:
|
||||
|
||||
{{< code file="create-new-default-foot.sh" >}}
|
||||
cd layouts && mkdir partials && cd partials && touch default_foot.html && cd ../..
|
||||
{{< /code >}}
|
||||
|
||||
Now add the following to our new `default_foot.html` partial template:
|
||||
|
||||
{{< code file="layouts/partials/default_foot.html" >}}
|
||||
<footer class="site">
|
||||
<p>{{ with .Site.Copyright | safeHTML }}{{ . }}{{ else }}© {{ $.Site.LastChange.Year }} {{ if isset $.Site.Params "Author" }}{{ $.Site.Params.Author }}{{ else }}{{ .Site.Title }}{{ end }}{{ end }}</p>
|
||||
<p>Powered by <a href="http://gohugo.io" target="_blank">Hugo</a>,</p>
|
||||
</footer>
|
||||
{{< /code >}}
|
||||
|
||||
So far we are using the default image, but we would like to use the book image so that we can relate to the book. Every book review will define a configuration setting in its front matter. Update the content and front matter of `good-to-great.md` as shown below.
|
||||
|
||||
{{< code file="content/post/good-to-great.md" >}}
|
||||
+++
|
||||
date = "2017-02-19T21:09:05-06:00"
|
||||
draft = true
|
||||
title = "Good to Great Book Review"
|
||||
image = "good-to-great.jpg"
|
||||
+++
|
||||
|
||||
I read **Good to Great in January 2016**. An awesome read sharing detailed analysis on how good companies became great. Although this book is about how companies became great but we could apply a lot of the learnings on ourselves. Concepts like level 5 leader, hedgehog concept, the stockdale paradox are equally applicable to individuals.
|
||||
{{< /code >}}
|
||||
|
||||
Grab a (legal) image from somewhere, name it `good-to-great.jpg`, and place it in the `bookshelf/static/images` directory.
|
||||
|
||||
After adding a few more books to our shelf, the shelf appears as shown below.
|
||||
|
||||
![](/images/quickstart/bookshelf.png)
|
||||
|
||||
|
||||
## Step 9. Make Your Posts Public
|
||||
|
||||
So far, all the posts that we have written are in draft status (i.e., `draft = true`). To make a draft public, you can run a Hugo CLI command or manually change the draft status in the post's front matter to `false`. Hugo provides a handy command line argument called `undraft` to do this for us:
|
||||
|
||||
```
|
||||
hugo undraft content/post/good-to-great.md
|
||||
```
|
||||
|
||||
If we check the front matter of `good-to-great.md` after running this command, we'll notice that Hugo has written the change of draft status to the file:
|
||||
|
||||
```
|
||||
+++
|
||||
date = "2017-02-19T22:42:53-06:00"
|
||||
draft = false
|
||||
title = "Good to Great Book Review"
|
||||
image = "good-to-great.jpg"
|
||||
+++
|
||||
```
|
||||
|
||||
Now, we can start the server *without* the `buildDrafts` option.
|
||||
|
||||
```
|
||||
hugo server --theme=hugo_theme_robust
|
||||
```
|
||||
|
||||
<!-- ## Step 10. Integrate Disqus Comments
|
||||
|
||||
{{% note "Adding Disqus to Your Website" %}}
|
||||
To implement Disqus comments as part of the Quick Start, you'll need to set up a Disqus account. Follow the [Disqus documentation for adding their service to websites](https://help.disqus.com/customer/portal/articles/1257441-adding-disqus-to-your-site).
|
||||
{{% note %}}
|
||||
**Tip:** Make the changes to the site configuration or any other file in your site while the Hugo server is running, and you will see the changes in the browser right away.
|
||||
{{% /note %}}
|
||||
|
||||
To enable Disqus on our new site, we only need to update the `disqusShortname` in the config.toml as shown below.
|
||||
|
||||
```
|
||||
[Params]
|
||||
Author = "Shekhar Gulati"
|
||||
disqusShortname = <your disqus shortname>
|
||||
```
|
||||
For theme specific configuration options, see the [theme site](https://github.com/budparr/gohugo-theme-ananke).
|
||||
|
||||
Now, commenting will be enabled in your blog.
|
||||
**For further theme customization, see [Customize a Theme](/themes/customizing/).**
|
||||
|
||||
![](/images/quickstart/bookshelf-disqus.png)
|
||||
-->
|
||||
## Step 10. Build Your Website
|
||||
## Recapitulation
|
||||
|
||||
To generate a website that can be deployed to GitHub pages, we first need to change the `baseURL` in our configuration as follows:
|
||||
|
||||
```
|
||||
baseURL = "https://<yourgithubusername>.github.io/bookshelf/"
|
||||
```
|
||||
|
||||
Then type the following command while in the root directory of your Hugo project:
|
||||
|
||||
```
|
||||
hugo --theme=hugo_theme_robust
|
||||
0 draft content
|
||||
0 future content
|
||||
5 pages created
|
||||
2 paginator pages created
|
||||
0 tags created
|
||||
0 categories created
|
||||
in 17 ms
|
||||
```
|
||||
|
||||
After you run the `hugo` command, a `bookshelf/public` directory will be created containing the generated website source.
|
||||
|
||||
## Step 11. What Next?
|
||||
|
||||
**Congratulations!** Your new `bookshelf`/public directory is a fully generated, deployable Hugo website. Since all your files are *static*, you have innumerable options for hosting, and your new directory structure and simple content format are going to make scaling your website a breeze.
|
||||
|
||||
Here's what you should look into next:
|
||||
|
||||
1. [See hosting and deployment options][hostinganddeploy] for sharing your newly created Hugo website with the world.
|
||||
2. [Learn more about Hugo's powerful templating][templating] to tailor your new Hugo website to your specific needs and keep it scaling accordingly.
|
||||
3. [Visit the Hugo Discussion Forum][forum] to ask questions, answer questions, and become an active member of the Hugo community.
|
||||
|
||||
[archetypes]: /content-management/archetypes/
|
||||
[bookurl]: https://www.amazon.com/Good-Great-Some-Companies-Others/dp/0066620996/
|
||||
[bleaktheme]: http://themes.gohugo.io/bleak/
|
||||
[configuration]: /getting-started/configuration/
|
||||
[createtheme]: /themes/creating/
|
||||
[datatemplates]: /templates/data-templates/
|
||||
[forum]: https://discourse.gohugo.io
|
||||
[fm]: /content-management/front-matter/
|
||||
[hostinganddeploy]: /hosting-and-deployment/
|
||||
[hugodirectories]: /getting-started/directory-structure/
|
||||
[install]: /getting-started/installing/
|
||||
[lists]: /templating/lists/
|
||||
[partials]: /templates/partials/
|
||||
[quickinstall]: /getting-started/installing/#quick-install
|
||||
[releases]: https://github.com/gohugoio/hugo/releases
|
||||
[robusttheme]: https://github.com/dim0627/hugo_theme_robust
|
||||
[section]: /content-management/sections/
|
||||
[sectiontemplates]: /templates/section-templates/
|
||||
[shortcodetemplates]: /templates/shortcode-templates/
|
||||
[sitemenu]: /content-management/menus/
|
||||
[templating]: /templates/introduction/
|
||||
[themessection]: /themes/
|
||||
[themes]: /themes/
|
||||
{{< asciicast pWp4uvyAkdWgQllD9RCfeBL5k >}}
|
||||
|
|
|
@ -18,7 +18,7 @@ aliases: [/overview/usage/,/extras/livereload/,/doc/usage/,/usage/]
|
|||
toc: true
|
||||
---
|
||||
|
||||
The following is a description of the most command commands you will use while developing your Hugo project. See the [Command Line Reference][commands] for a comprehensive view of Hugo's CLI.
|
||||
The following is a description of the most common commands you will use while developing your Hugo project. See the [Command Line Reference][commands] for a comprehensive view of Hugo's CLI.
|
||||
|
||||
## Test Installation
|
||||
|
||||
|
|
79
content/news/http2-server-push-in-hugo.md
Normal file
79
content/news/http2-server-push-in-hugo.md
Normal file
|
@ -0,0 +1,79 @@
|
|||
---
|
||||
title: "HTTP/2 Server Push in Hugo"
|
||||
date: 2017-07-24T18:36:00+02:00
|
||||
description: >
|
||||
As every page in Hugo can be output to multiple formats, it is easy to create Netlify's _redirects and _headers files on the fly.
|
||||
categories: [blog]
|
||||
#tags: []
|
||||
slug: "http2-server-push-in-hugo"
|
||||
aliases: []
|
||||
author: bep
|
||||
images:
|
||||
- images/gohugoio-card-1.png
|
||||
---
|
||||
|
||||
**Netlify** recently announced support for [HTTP/2 server push](https://www.netlify.com/blog/2017/07/18/http/2-server-push-on-netlify/), and we have now added it to the **gohugo.io** sites for the main `CSS` and `JS` bundles, along with server-side 301 redirect support.
|
||||
|
||||
If you navigate to https://gohugo.io and look in the Chrome developer network console, you should now see `Push` as the new source ("Initiator") for the `CSS` and `JSS`:
|
||||
|
||||
{{< figure src="/images/blog/hugo-http2-push.png" caption="Network log for https://gohugo.io" >}}
|
||||
|
||||
**Setting up this in Hugo was easy:**
|
||||
|
||||
## 1. Configure Netlify Output Formats
|
||||
|
||||
Add a new custom media type and two new output formats to `config.toml`. For more on output formats in Hugo, see [Custom Output Formats](/templates/output-formats/).
|
||||
```bash
|
||||
[outputs]
|
||||
home = [ "HTML", "RSS", "REDIR", "HEADERS" ]
|
||||
|
||||
[mediaTypes]
|
||||
[mediaTypes."text/netlify"]
|
||||
suffix = ""
|
||||
delimiter = ""
|
||||
|
||||
[outputFormats]
|
||||
[outputFormats.REDIR]
|
||||
mediatype = "text/netlify"
|
||||
baseName = "_redirects"
|
||||
isPlainText = true
|
||||
notAlternative = true
|
||||
[outputFormats.HEADERS]
|
||||
mediatype = "text/netlify"
|
||||
baseName = "_headers"
|
||||
isPlainText = true
|
||||
notAlternative = true
|
||||
```
|
||||
## 2. Add Template For the _headers File
|
||||
|
||||
Add `layouts/index.headers`:
|
||||
|
||||
```bash
|
||||
/*
|
||||
X-Frame-Options: DENY
|
||||
X-XSS-Protection: 1; mode=block
|
||||
X-Content-Type-Options: nosniff
|
||||
Referrer-Policy: origin-when-cross-origin
|
||||
*/
|
||||
Link: <{{ "dist/app.bundle.js" | relURL }}>; rel=preload; as=script
|
||||
Link: <{{ "dist/main.css" | relURL }}>; rel=preload; as=style
|
||||
```
|
||||
The template above creates both a security header definition and a HTTP/2 server push configuration.
|
||||
|
||||
Also note that this is a template for the home page, so the full `Page` with its `Site` and many variables are available. You can also use `partial` to include other templates.
|
||||
|
||||
|
||||
|
||||
|
||||
## 3. Add Template For the _redirects File
|
||||
Add `layouts/index.redirects`:
|
||||
```bash
|
||||
# Netlify redirects. See https://www.netlify.com/docs/redirects/
|
||||
{{ range $p := .Site.Pages -}}
|
||||
{{ range .Aliases }}
|
||||
{{ . | printf "%-35s" }} {{ $p.RelPermalink -}}
|
||||
{{ end -}}
|
||||
{{- end -}}
|
||||
```
|
||||
The template above creates 301 redirects for your [aliases](/content-management/urls/#aliases), so you will probably want to turn off aliases in your `config.toml`: `disableAliases = true`.
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
title: Press and Articles
|
||||
linktitle: Press and Articles
|
||||
description: A list of articles, blog posts, or tutorials where Hugo is featured.
|
||||
date: 2016-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
#tags: [articles, tutorials, press]
|
||||
categories: [news and articles]
|
||||
menu:
|
||||
main:
|
||||
parent: "News"
|
||||
weight: 30
|
||||
weight: 30
|
||||
sections_weight: 30
|
||||
draft: false
|
||||
aliases: [/community/press/]
|
||||
toc: false
|
||||
notesforauthors: "If adding an item to the articles list, be sure to follow the format of '| [Linked Title]() | Author Name | YYYY-MM-DD |'."
|
||||
---
|
||||
|
||||
{{% note "Help Keep This List Up to Date" %}}
|
||||
Know of a post, article, or tutorial on Hugo? [Please add it to this list](https://github.com/gohugoio/hugo/edit/master/docs/content/news/press-and-articles.md).
|
||||
{{% /note %}}
|
||||
|
||||
Hugo has been featured in the following Blog Posts, Press, and Media.
|
||||
|
||||
{{< articlelist >}}
|
|
@ -1,981 +0,0 @@
|
|||
---
|
||||
title: Release Notes
|
||||
linktitle: Release Notes
|
||||
description: See the full list of Hugo release notes since v0.05 in June 2015.
|
||||
date: 2016-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [releases]
|
||||
draft: false
|
||||
aliases: [/meta/release-notes/]
|
||||
toc: true
|
||||
---
|
||||
|
||||
## **0.20.2** April 16th 2017
|
||||
|
||||
Hugo `0.20.2` adds support for plain text partials included into `HTML` templates. This was a side-effect of the big new [Custom Output Format](/templates/output-formats/) feature in `0.20`, and while the change was intentional and there was an ongoing discussion about fixing it in {{< gh 3273 >}}, it did break some themes. There were valid workarounds for these themes, but we might as well get it right.
|
||||
|
||||
The most obvious use case for this is inline `CSS` styles, which you now can do without having to name your partials with a `html` suffix.
|
||||
|
||||
A simple example:
|
||||
|
||||
In `layouts/partials/mystyles.css`:
|
||||
|
||||
```
|
||||
body {
|
||||
background-color: {{ .Param "colors.main" }}
|
||||
}
|
||||
```
|
||||
|
||||
Then in `config.toml` (note that by using the `.Param` lookup func, we can override the color in a page's front matter if we want):
|
||||
|
||||
```
|
||||
[params]
|
||||
[params.colors]
|
||||
main = "green"
|
||||
text = "blue"
|
||||
```
|
||||
|
||||
And then in `layouts/partials/head.html` (or the partial used to include the head section into your layout):
|
||||
|
||||
```
|
||||
<head>
|
||||
<style type="text/css">
|
||||
{{ partial "mystyles.css" . | safeCSS }}
|
||||
</style>
|
||||
</head>
|
||||
```
|
||||
|
||||
Of course, `0.20` also made it super-easy to create external `CSS` stylesheets based on your site and page configuration. A simple example:
|
||||
|
||||
Add "CSS" to your home page's `outputs` list, create the template `/layouts/index.css` using Go template syntax for the dynamic parts, and then include it into your `HTML` template with:
|
||||
|
||||
```
|
||||
{{ with .OutputFormats.Get "css" }}
|
||||
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
|
||||
{{ end }}`
|
||||
```
|
||||
|
||||
## **0.20.1** April 13th 2017
|
||||
|
||||
Hugo `0.20.1` is a bug fix release, fixing some important regressions introduced in `0.20` a couple of days ago:
|
||||
|
||||
* Fix logic for base template in a work directory vs in a theme {{< gh 3323 >}}
|
||||
* camelCased templates (partials, shortcodes, etc.) not found {{< gh 3333 >}}
|
||||
* LiveReload fails with `_index.md` with paginator {{< gh 3315 >}}
|
||||
* `rssURI` WARNING always shown {{< gh 3319 >}}
|
||||
|
||||
See the [full list of closed issues on GitHub](https://github.com/gohugoio/hugo/milestone/16?closed=1).
|
||||
|
||||
## **0.20** April 10th 2017
|
||||
|
||||
Hugo `0.20` introduces the powerful and long sought after feature [Custom Output Formats](/templates/output-formats/)); Hugo isn't just that "static HTML with an added RSS feed" anymore. *Say hello* to calendars, e-book formats, Google AMP, and JSON search indexes, to name a few ({{< gh 2828 >}}).
|
||||
|
||||
This release represents **over 180 contributions by over 30 contributors** to the main Hugo code base. Since last release Hugo has **gained 1100 stars, 20 new contributors and 5 additional themes.**
|
||||
|
||||
Hugo now has:
|
||||
|
||||
* 16300+ stars
|
||||
* 495+ contributors
|
||||
* 156+ themes
|
||||
|
||||
{{< gh "@bep" >}} still leads the Hugo development with his witty Norwegian humor, and once again contributed a significant amount of additions. Also a big shoutout to {{< gh "@digitalcraftsman" >}} for his relentless work on keeping the documentation and the themes site in pristine condition, and {{< gh "@moorereason" >}} and {{< gh "@bogem" >}} for their ongoing contributions.
|
||||
|
||||
### Other Highlights
|
||||
|
||||
{{< gh "@bogem" >}} has also contributed TOML as an alternative and much simpler format for language/i18n files ({{< gh 3200 >}}). A feature you will appreciate when you start to work on larger translations.
|
||||
|
||||
Also, there have been some important updates in the Emacs Org-mode handling: {{< gh "@chaseadamsio" >}} has fixed the newline-handling ({{< gh 3126 >}}) and {{< gh "@clockoon" >}} has added basic footnote support.
|
||||
|
||||
Worth mentioning is also the ongoing work that {{< gh "@rdwatters" >}} and {{< gh "@budparr" >}} is doing to re-do the [gohugo.io](https://gohugo.io/) site, including a total restructuring and partial rewrite of the documentation. It is getting close to finished, and it looks fantastic!
|
||||
|
||||
### Notes
|
||||
|
||||
* `RSS` description in the built-in template is changed from full `.Content` to `.Summary`. This is a somewhat breaking change, but is what most people expect from their RSS feeds. If you want full content, please provide your own RSS template.
|
||||
* The deprecated `.RSSlink` is now removed. Use `.RSSLink`.
|
||||
* `RSSUri` is deprecated and will be removed in a future Hugo version, replace it with an output format definition.
|
||||
* The deprecated `.Site.GetParam` is now removed, use `.Site.Param`.
|
||||
* Hugo does no longer append missing trailing slash to `baseURL` set as a command line parameter, making it consistent with how it behaves from site config. {{< gh 3262 >}}
|
||||
|
||||
### Enhancements
|
||||
|
||||
* Hugo `0.20` is built with Go 1.8.1.
|
||||
* Add `.Site.Params.mainSections` that defaults to the section with the most pages. Plan is to get themes to use this instead of the hardcoded `blog` in `where` clauses. {{< gh 3206 >}}
|
||||
* File extension is now configurable. {{< gh 320 >}}
|
||||
* Impove `markdownify` template function performance. {{< gh 3292 >}}
|
||||
* Add taxonomy terms' pages to `.Data.Pages` {{< gh 2826 >}}
|
||||
* Change `RSS` description from full `.Content` to `.Summary`.
|
||||
* Ignore "." dirs in `hugo --cleanDestinationDir` {{< gh 3202 >}}
|
||||
* Allow `jekyll import` to accept both `2006-01-02` and `2006-1-2` date format {{< gh 2738 >}}
|
||||
* Raise the default `rssLimit` {{< gh 3145 >}}
|
||||
* Unify section list vs single template lookup order {{< gh 3116 >}}
|
||||
* Allow `apply` to be used with the built-in Go template funcs `print`, `printf` and `println`. {{< gh 3139 >}}
|
||||
|
||||
### Fixes
|
||||
|
||||
* Fix deadlock in `getJSON` {{< gh 3211 >}}
|
||||
* Make sure empty terms pages are created. {{< gh 2977 >}}
|
||||
* Fix base template lookup order for sections {{< gh 2995 >}}
|
||||
* `URL` fixes:
|
||||
* Fix pagination URLs with `baseURL` with sub-root and `canonifyUrls=false` {{< gh 1252 >}}
|
||||
* Fix pagination URL for resources with "." in name {{< gh 2110 >}} {{< gh 2374 >}} {{< gh 1885 >}}
|
||||
* Handle taxonomy names with period {{< gh 3169 >}}
|
||||
* Handle `uglyURLs` ambiguity in `Permalink` {{< gh 3102 >}}
|
||||
* Fix `Permalink` for language-roots wrong when `uglyURLs` is `true` {{< gh 3179 >}}
|
||||
* Fix misc case issues for `URLs` {{< gh 1641 >}}
|
||||
* Fix for taxonomies URLs when `uglyUrls=true` {{< gh 1989 >}}
|
||||
* Fix empty `RSSLink` for list pages with content page. {{< gh 3131 >}}
|
||||
* Correctly identify regular pages on the form "my_index_page.md" {{< gh 3234 >}}
|
||||
* `Exit -1` on `ERROR` in global logger {{< gh 3239 >}}
|
||||
* Document hugo `help command` {{< gh 2349 >}}
|
||||
* Fix internal `Hugo` version handling for bug fix releases. {{< gh 3025 >}}
|
||||
* Only return `RSSLink` for pages that actually have a RSS feed. {{< gh 1302 >}}
|
||||
|
||||
|
||||
## **0.19** February 27th 2017
|
||||
|
||||
We're happy to announce the first release of Hugo in 2017.
|
||||
|
||||
This release represents **over 180 contributions by over 50 contributors** to the main Hugo code base. Since last release Hugo has **gained 1450 stars, 35 new contributors, and 15 additional themes.**
|
||||
|
||||
Hugo now has:
|
||||
|
||||
* 15200+ stars
|
||||
* 470+ contributors
|
||||
* 151+ themes
|
||||
|
||||
Furthermore, Hugo has its own Twitter account ([@gohugoio](https://twitter.com/gohugoio)) where we share bite-sized news and themes from the Hugo community.
|
||||
|
||||
{{< gh "@bep" >}} leads the Hugo development and once again contributed a significant amount of additions. Also a big shoutout to {{< gh "@chaseadamsio" >}} for the Emacs Org-mode support, {{< gh "@digitalcraftsman" >}} for his relentless work on keeping the documentation and the themes site in pristine condition, {{< gh "@fj" >}}for his work on revising the `params` handling in Hugo, and {{< gh "@moorereason" >}} and {{< gh "@bogem" >}} for their ongoing contributions.
|
||||
|
||||
### Highlights
|
||||
|
||||
Hugo `0.19` brings native Emacs Org-mode content support ({{<gh 1483>}}), big thanks to {{< gh "@chaseadamsio" >}}.
|
||||
|
||||
Also, a considerably amount of work have been put into cleaning up the Hugo source code, in an issue titled [Refactor the globals out of site build](https://github.com/gohugoio/hugo/issues/2701). This is not immediately visible to the Hugo end user, but will speed up future development.
|
||||
|
||||
Hugo `0.18` was bringing full-parallel page rendering, so workarounds depending on rendering order did not work anymore, and pages with duplicate target paths (common examples would be `/index.md` or `/about/index.md`) would now conflict with the homepage or the section listing.
|
||||
|
||||
With Hugo `0.19`, you can control this behaviour by turning off page types you do not want ({{<gh 2534 >}}). In its most extreme case, if you put the below setting in your [`config.toml`](/getting-started/configuration/), you will get **nothing!**:
|
||||
|
||||
```
|
||||
disableKinds = ["page", "home", "section", "taxonomy", "taxonomyTerm", "RSS", "sitemap", "robotsTXT", "404"]
|
||||
```
|
||||
|
||||
### Other New Features
|
||||
|
||||
* Add ability to sort pages by front matter parameters, enabling easy custom "top 10" page lists. {{<gh 3022 >}}
|
||||
* Add `truncate` template function {{<gh 2882 >}}
|
||||
* Add `now` function, which replaces the now deprecated `.Now` {{<gh 2859 >}}
|
||||
* Make RSS item limit configurable {{<gh 3035 >}}
|
||||
|
||||
### Enhancements
|
||||
|
||||
* Enhance `.Param` to permit arbitrarily nested parameter references {{<gh 2598 >}}
|
||||
* Use `Page.Params` more consistently when adding metadata {{<gh 3033 >}}
|
||||
* The `sectionPagesMenu` feature ("Section menu for the lazy blogger") is now integrated with the section content pages. {{<gh 2974 >}}
|
||||
* Hugo `0.19` is compiled with Go 1.8!
|
||||
* Make template funcs like `findRE` and friends more liberal in what argument types they accept {{<gh 3018 >}} {{<gh 2822 >}}
|
||||
* Improve generation of OpenGraph date tags {{<gh 2979 >}}
|
||||
|
||||
### Notes
|
||||
|
||||
* `sourceRelativeLinks` is now deprecated and will be removed in Hugo `0.21` if no one is stepping up to the plate and fixes and maintains this feature. {{<gh 3028 >}}
|
||||
|
||||
### Fixes
|
||||
|
||||
* Fix `.Site.LastChange` on sites where the default sort order is not chronological. {{<gh 2909 >}}
|
||||
* Fix regression of `.Truncated` evaluation in manual summaries. {{<gh 2989 >}}
|
||||
* Fix `preserveTaxonomyNames` regression {{<gh 3070 >}}
|
||||
* Fix issue with taxonomies when only some have content page {{<gh 2992 >}}
|
||||
* Fix instagram shortcode panic on invalid ID {{<gh 3048 >}}
|
||||
* Fix subtle data race in `getJSON` {{<gh 3045 >}}
|
||||
* Fix deadlock in cached partials {{<gh 2935 >}}
|
||||
* Avoid double-encoding of paginator URLs {{<gh 2177 >}}
|
||||
* Allow tilde in URLs {{<gh 2177 >}}
|
||||
* Fix `.Site.Pages` handling on live reloads {{<gh 2869 >}}
|
||||
* `UniqueID` now correctly uses the fill file path from the content root to calculate the hash, and is finally ... unique!
|
||||
* Discard current language based on `.Lang()`, go get translations correct for paginated pages. {{<gh 2972 >}}
|
||||
* Fix infinite loop in template AST handling for recursive templates {{<gh 2927 >}}
|
||||
* Fix issue with watching when config loading fails {{<gh 2603 >}}
|
||||
* Correctly flush the imageConfig on live-reload {{<gh 3016 >}}
|
||||
* Fix parsing of TOML arrays in front matter {{<gh 2752 >}}
|
||||
|
||||
### Docs
|
||||
|
||||
* Add tutorial "How to use Google Firebase to host a Hugo site" {{<gh 3007 >}}
|
||||
* Improve documentation for menu rendering {{<gh 3056 >}}
|
||||
* Revise GitHub Pages deployment tutorial {{<gh 2930 >}}
|
||||
|
||||
## **0.18.1** December 30th 2016
|
||||
|
||||
Hugo 0.18.1 is a bug fix release fixing some issues introduced in Hugo 0.18:
|
||||
|
||||
* Fix 32-bit binaries {{<gh 2847 >}}
|
||||
* Fix issues with `preserveTaxonomyNames` {{<gh 2809 >}}
|
||||
* Fix `.URL` for taxonomy pages when `uglyURLs=true` {{<gh 2819 >}}
|
||||
* Fix `IsTranslated` and `Translations` for node pages {{<gh 2812 >}}
|
||||
* Make template error messages more verbose {{<gh 2820 >}}
|
||||
|
||||
## **0.18.0** December 19th 2016
|
||||
|
||||
Today, we're excited to release the much-anticipated Hugo 0.18!
|
||||
|
||||
We're heading towards the end of the year 2016, and we can look back on three releases and a steady growing community around the project.
|
||||
This release includes **over 220 contributions by nearly 50 contributors** to the main codebase.
|
||||
Since the last release, Hugo has **gained 1750 stars and 27 additional themes**.
|
||||
|
||||
Hugo now has:
|
||||
|
||||
- 13750+ stars
|
||||
- 408+ contributors
|
||||
- 137+ themes
|
||||
|
||||
{{< gh "@bep" >}} once again took the lead of Hugo and contributed a significant amount of additions.
|
||||
Also a big shoutout to {{< gh "@digitalcraftsman" >}} for his relentless work on keeping the documentation and the themes site in pristine condition,
|
||||
and also a big thanks to {{< gh "@moorereason" >}} and {{< gh "@bogem" >}} for their contributions.
|
||||
|
||||
We wish you all a Merry Christmas and a Happy New Year.<br>
|
||||
*The Hugo team*
|
||||
|
||||
### Highlights
|
||||
|
||||
The primary new feature in Hugo 0.18 is that every piece of content is now a `Page` ({{<gh 2297>}}). This means that every page, including the homepage, can have a content file with front matter.
|
||||
|
||||
Not only is this a much simpler model to understand, it is also faster and paved the way for several important new features:
|
||||
|
||||
* Enable proper titles for Nodes {{<gh 1051>}}
|
||||
* Sitemap.xml should include nodes, as well as pages {{<gh 1303>}}
|
||||
* Document homepage content workaround {{<gh 2240>}}
|
||||
* Allow homepage to be easily authored in markdown {{<gh 720>}}
|
||||
* Minimalist website with homepage as content {{<gh 330>}}
|
||||
|
||||
Hugo again continues its trend of each release being faster than the last. It's quite a challenge to consistently add significant new functionality and simultaneously dramatically improve performance. Running [this benchmark]( https://github.com/bep/hugo-benchmark) with [these sites](https://github.com/bep/hugo-benchmark/tree/master/sites) (renders to memory) shows about 60% reduction in time spent and 30% reduction in memory usage compared to Hugo 0.17.
|
||||
|
||||
### Other New Features
|
||||
|
||||
* Every `Page` now has a `Kind` property. Since everything is a `Page` now, the `Kind` is used to differentiate different kinds of pages.
|
||||
Possible values are `page`, `home`, `section`, `taxonomy`, and `taxonomyTerm`.
|
||||
(Internally, we also define `RSS`, `sitemap`, `robotsTXT`, and `404`, but those have no practical use for end users at the moment since they are not included in any collections.)
|
||||
* Add a `GitInfo` object to `Page` if `enableGitInfo` is set. It then also sets `Lastmod` for the given `Page` to the author date provided by Git. {{<gh 2291>}}
|
||||
* Implement support for alias templates {{<gh 2533 >}}
|
||||
* New template functions:
|
||||
* Add `imageConfig` function {{<gh 2677>}}
|
||||
* Add `sha256` function {{<gh 2762>}}
|
||||
* Add `partialCached` template function {{<gh 1368>}}
|
||||
* Add shortcode to display Instagram images {{<gh 2690>}}
|
||||
* Add `noChmod` option to disable perm sync {{<gh 2749>}}
|
||||
* Add `quiet` build mode {{<gh 1218>}}
|
||||
|
||||
|
||||
### Notices
|
||||
|
||||
* `.Site.Pages` will now contain *several kinds of pages*, including regular pages, sections, taxonomies, and the homepage.
|
||||
If you want a specific kind of page, you can filter it with `where` and `Kind`.
|
||||
`.Site.RegularPages` is a shortcut to the page collection you have been used to getting.
|
||||
* `RSSlink` is now deprecated. Use `RSSLink` instead.
|
||||
Note that in Hugo 0.17 both of them existed, so there is a fifty-fifty chance you will not have to do anything
|
||||
(if you use a theme, the chance is close to 0), and `RSSlink` will still work for two Hugo versions.
|
||||
|
||||
### Fixes
|
||||
|
||||
* Revise the `base` template lookup logic so it now better matches the behavior of regular templates, making it easier to override the master templates from the theme {{<gh 2783>}}
|
||||
* Add workaround for `block` template crash.
|
||||
Block templates are very useful, but there is a bug in Go 1.6 and 1.7 which makes the template rendering crash if you use the block template in more complex scenarios.
|
||||
This is fixed in the upcoming Go 1.8, but Hugo adds a temporary workaround in Hugo 0.18. {{<gh 2549>}}
|
||||
* All the `Params` configurations are now case insensitive {{<gh 1129>}} {{<gh 2590>}} {{<gh 2615>}}
|
||||
* Make RawContent raw again {{<gh 2601>}}
|
||||
* Fix archetype title and date handling {{<gh 2750>}}
|
||||
* Fix TOML archetype parsing in `hugo new` {{<gh 2745>}}
|
||||
* Fix page sorting when weight is zero {{<gh 2673>}}
|
||||
* Fix page names that contain dot {{<gh 2555>}}
|
||||
* Fix RSS Title regression {{<gh 2645>}}
|
||||
* Handle ToC before handling shortcodes {{<gh 2433>}}
|
||||
* Only watch relevant themes dir {{<gh 2602>}}
|
||||
* Hugo new content creates TOML slices with closing bracket on new line {{<gh 2800>}}
|
||||
|
||||
### Improvements
|
||||
|
||||
* Add page information to error logging in rendering {{<gh 2570>}}
|
||||
* Deprecate `RSSlink` in favor of `RSSLink`
|
||||
* Make benchmark command more useful {{<gh 2432>}}
|
||||
* Consolidate the `Param` methods {{<gh 2590>}}
|
||||
* Allow to set cache dir in config file
|
||||
* Performance improvements:
|
||||
* Avoid repeated Viper loads of `sectionPagesMenu` {{<gh 2728>}}
|
||||
* Avoid reading from Viper for path and URL funcs {{<gh 2495>}}
|
||||
* Add `partialCached` template function. This can be a significant performance boost if you have complex partials that does not need to be rerendered for every page. {{<gh 1368>}}
|
||||
|
||||
### Documentation Updates
|
||||
|
||||
* Update roadmap {{<gh 2666>}}
|
||||
* Update multilingual example {{<gh 2417>}}
|
||||
* Add a "Deployment with rsync" tutorial page {{<gh 2658>}}
|
||||
* Refactor `/docs` to use the `block` keyword {{<gh 2226>}}
|
||||
|
||||
|
||||
## **0.17.0** October 7th 2016
|
||||
|
||||
Hugo is going global with our 0.17 release. We put a lot of thought into how we could extend Hugo
|
||||
to support multilingual websites with the most simple and elegant experience. Hugo's multilingual
|
||||
capabilities rival the best web and documentation software, but Hugo's experience is unmatched.
|
||||
If you have a single language website, the simple Hugo experience you already love is unchanged.
|
||||
Adding additional languages to your website is simple and straightforward. Hugo has been completely
|
||||
internally rewritten to be multilingual aware with translation and internationalization features
|
||||
embedded throughout Hugo.
|
||||
|
||||
Hugo continues its trend of each release being faster than the last. It's quite a challenge to consistently add
|
||||
significant new functionality and simultaneously dramatically improve performance. {{<gh "@bep">}} has made it
|
||||
his personal mission to apply the Go mantra of "Enable more. Do less" to Hugo. Hugo's consistent improvement
|
||||
is a testament to his brilliance and his dedication to his craft. Hugo additionally benefits from the
|
||||
performance improvements from the Go team in the Go 1.7 release.
|
||||
|
||||
This release represents **over 300 contributions by over 70 contributors** to
|
||||
the main Hugo code base. Since last release Hugo has **gained 2000 stars, 50 new
|
||||
contributors and 20 additional themes.**
|
||||
|
||||
Hugo now has:
|
||||
|
||||
* 12,000 stars on GitHub
|
||||
* 370+ contributors
|
||||
* 110+ themes
|
||||
|
||||
{{<gh "@bep" >}} continues to lead the project with the lionshare of contributions
|
||||
and reviews. A special thanks to {{<gh "@bep" >}} and {{<gh "@abourget" >}} for their
|
||||
considerable work on multilingual support.
|
||||
|
||||
A big welcome to newcomers {{<gh "@MarkDBlackwell" >}}, {{<gh "@bogem" >}} and
|
||||
{{<gh "@g3wanghc" >}} for their critical contributions.
|
||||
|
||||
### Highlights
|
||||
|
||||
**Multilingual Support:**
|
||||
Hugo now supports multiple languages side-by-side. A single site can now have multiple languages rendered with
|
||||
full support for translation and i18n.
|
||||
|
||||
**Performance:**
|
||||
Hugo is faster than ever! Hugo 0.17 is not only our fastest release, it's also the most efficient.
|
||||
Hugo 0.17 is **nearly twice as fast as Hugo 0.16** and uses about 10% less memory.
|
||||
This means that the same site will build in nearly half the time it took with Hugo 0.16.
|
||||
For the first time Hugo sites are averaging well under 1ms per rendered content.
|
||||
|
||||
**Docs overhaul:**
|
||||
This release really focused on improving the documentation. [Gohugo.io](http://gohugo.io) is
|
||||
more accurate and complete than ever.
|
||||
|
||||
**Support for macOS Sierra**
|
||||
|
||||
### New Features
|
||||
* Multilingual support {{<gh 2303>}}
|
||||
* Allow content expiration {{<gh 2137 >}}
|
||||
* New templates functions:
|
||||
* `querify` function to generate query strings inside templates {{<gh 2257>}}
|
||||
* `htmlEscape` and `htmlUnescape` template functions {{<gh 2287>}}
|
||||
* `time` converts a timestamp string into a time.Time structure {{<gh 2329>}}
|
||||
|
||||
### Enhancements
|
||||
|
||||
* Render the shortcodes as late as possible {{<gh 0xed0985404db4630d1b9d3ad0b7e41fb186ae0112>}}
|
||||
* Remove unneeded casts in page.getParam {{<gh 2186 >}}
|
||||
* Automatic page date fallback {{<gh 2239>}}
|
||||
* Enable safeHTMLAttr {{<gh 2234>}}
|
||||
* Add TODO list support for markdown {{<gh 2296>}}
|
||||
* Make absURL and relURL accept any type {{<gh 2352>}}
|
||||
* Suppress 'missing static' error {{<gh 2344>}}
|
||||
* Make summary, wordcount etc. more efficient {{<gh 2378>}}
|
||||
* Better error reporting in `hugo convert` {{<gh 2440>}}
|
||||
* Reproducible builds thanks to govendor {{<gh 2461>}}
|
||||
|
||||
### Fixes
|
||||
|
||||
* Fix shortcode in markdown headers {{<gh 2210 >}}
|
||||
* Explicitly bind livereload to hugo server port {{<gh 2205>}}
|
||||
* Fix Emojify for certain text patterns {{<gh 2198>}}
|
||||
* Normalize file name to NFC {{<gh 2259>}}
|
||||
* Ignore emacs temp files {{<gh 2266>}}
|
||||
* Handle symlink change event {{<gh 2273>}}
|
||||
* Fix panic when using URLize {{<gh 2274>}}
|
||||
* `hugo import jekyll`: Fixed target path location check {{<gh 2293>}}
|
||||
* Return all errors from casting in templates {{<gh 2356>}}
|
||||
* Fix paginator counter on x86-32 {{<gh 2420>}}
|
||||
* Fix half-broken self-closing shortcodes {{<gh 2499>}}
|
||||
|
||||
****
|
||||
|
||||
## **0.16.0** June 6th 2016
|
||||
|
||||
Hugo 0.16 is our best and biggest release ever. The Hugo community has
|
||||
outdone itself with continued performance improvements,
|
||||
[beautiful themes](http://themes.gohugo.io) for all types of sites from project
|
||||
sites to documentation to blogs to portfolios, and increased stability.
|
||||
|
||||
This release represents **over 550 contributions by over 110 contributors** to
|
||||
the main Hugo code base. Since last release Hugo has **gained 3500 stars, 90
|
||||
contributors and 23 additional themes.**
|
||||
|
||||
This release celebrates 3 years since {{< gh "@spf13" >}} wrote the first lines
|
||||
of Hugo. During those 3 years Hugo has accomplished some major milestones
|
||||
including...
|
||||
|
||||
* 10,000+ stars on GitHub
|
||||
* 320+ contributors
|
||||
* 90+ themes
|
||||
* 1000s of happy websites
|
||||
* Many subprojects like {{< gh "@spf13/cobra">}}, {{< gh "@spf13/viper">}} and
|
||||
{{< gh "@spf13/afero">}} which have experienced broad usage across the Go
|
||||
ecosystem.
|
||||
|
||||
{{< gh "@bep" >}} led the development of Hugo for the 3rd consecutive release
|
||||
with nearly half of the contributions to 0.16 in addition to his considerable
|
||||
contributions as lead maintainer. {{< gh "@anthonyfok" >}}, {{< gh
|
||||
"@DigitalCraftsman" >}}, {{< gh "@MooreReason" >}} all made significant
|
||||
contributions. A special thanks to {{< gh "@abourget" >}} for his considerable
|
||||
work on multilingual support. Due to its broad impact we wanted to spend more
|
||||
time testing it and it will be included in Hugo's next release.
|
||||
|
||||
### Highlights
|
||||
|
||||
**Partial Builds:** Prior to this release Hugo would always reread and rebuild
|
||||
the entire site. This release introduces support for reactive site building
|
||||
while watching (`hugo server`). Hugo will watch the filesystem for changes and
|
||||
only re-read the changed files. Depending on the files change Hugo will
|
||||
intelligently re-render only the needed portion of the site. Performance gains
|
||||
depend on the operation performed and size of the site. In our testing build
|
||||
times decreased anywhere from 10% to 99%.
|
||||
|
||||
**Template Improvements:** Template improvements continue to be a mainstay of each Hugo release. Hugo 0.16 adds support for the new `block` keyword introduced in Go 1.6 -- think base templates with default sections -- as well as many new template functions.
|
||||
|
||||
**Polish:** As Hugo matures releases will inevitably contain fewer huge new features. This release represents hundreds of small improvements across ever facet of Hugo which will make for a much better experience for all of our users. Worth mentioning here is the curious bug where live reloading didn't work in some editors on OS X, including the popular TextMate 2. This is now fixed. Oh, and now any error will exit with an error code, a big thing for automated deployments.
|
||||
|
||||
### New Features
|
||||
* Support reading configuration variables from the OS environment {{<gh 2090 >}}
|
||||
* Add emoji support {{<gh 1892>}}
|
||||
* Add `themesDir` option to configuration {{<gh 1556>}}
|
||||
* Add support for Go 1.6 `block` keyword in templates {{<gh 1832>}}
|
||||
* Partial static sync {{<gh 1644>}}
|
||||
* Source file based relative linking (à la GitHub) {{<gh 0x0f6b334b6715253b030c4e783b88e911b6e53e56>}}
|
||||
* Add `ByLastmod` sort function to pages. {{<gh 0xeb627ca16de6fb5e8646279edd295a8bf0f72bf1 >}}
|
||||
* New templates functions:
|
||||
* `readFile` {{<gh 1551 >}}
|
||||
* `countwords` and `countrunes` {{<gh 1440>}}
|
||||
* `default` {{<gh 1943>}}
|
||||
* `hasPrefix` {{<gh 1243>}}
|
||||
* `humanize` {{<gh 1818>}}
|
||||
* `jsonify` {{<gh 0x435e996c4fd48e9009ffa9f83a19fb55f0777dbd>}}
|
||||
* `md5` and `sha1` {{<gh 1932>}}
|
||||
* `replaceRE` {{<gh 1845>}}
|
||||
* `findRE` {{<gh 2048>}}
|
||||
* `shuffle` {{<gh 1942>}}
|
||||
* `slice` {{<gh 1902>}}
|
||||
* `plainify` {{<gh 1915>}}
|
||||
|
||||
### Enhancements
|
||||
|
||||
* Hugo now exits with error code on any error. This is a big thing for
|
||||
automated deployments. {{<gh 740 >}}
|
||||
* Print error when `/index.html` is zero-length {{<gh 947>}}
|
||||
* Enable dirname and filename bash autocompletion for more flags {{<gh
|
||||
0x666ddd237791b56fd048992dca9a27d1af50a10e>}}
|
||||
* Improve error handling in commands {{<gh 1502>}}
|
||||
* Add sanity checks for `hugo import jekyll` {{<gh 1625 >}}
|
||||
* Add description to `Page.Params` {{<gh 1484>}}
|
||||
* Add async version of Google Analytics internal template {{<gh 1711>}}
|
||||
* Add autostart option to YouTube shortcode {{<gh 1784>}}
|
||||
* Set Date and Lastmod for main homepage {{<gh 1903>}}
|
||||
* Allow URL with extension in front matter {{<gh 1923>}}
|
||||
* Add list support in Scratch {{<gh
|
||||
0xeaba04e82bdfc5d4c29e970f11b4aab9cc0efeaa>}}
|
||||
* Add file option to gist shortcode {{<gh 1955>}}
|
||||
* Add config layout and content directory CLI options {{<gh 1698>}}
|
||||
* Add boolean value comparison to `where` template function {{<gh
|
||||
0xf3c74c9db484c8961e70cb3458f9e41e7832fa12>}}
|
||||
* Do not write to to cache when `ignoreCache` is set {{<gh 2067>}}
|
||||
* Add option to disable rendering of 404 page {{<gh 2037>}}
|
||||
* Mercurial is no longer needed to build Hugo {{<gh 2062 >}}
|
||||
* Do not create `robots.txt` by default {{<gh 2049>}}
|
||||
* Disable syntax guessing for PygmentsCodeFences by default. To enable syntax
|
||||
guessing again, add the following to your config file:
|
||||
`PygmentsCodeFencesGuessSyntax = true` {{<gh 2034>}}
|
||||
* Make `ByCount` sort consistently {{<gh 1930>}}
|
||||
* Add `Scratch` to shortcode {{<gh 2000>}}
|
||||
* Add support for symbolic links for content, layout, static, theme {{<gh 1855
|
||||
>}}
|
||||
* Add '+' as one of the valid characters in URLs specified in the front matter
|
||||
{{<gh 1290 >}}
|
||||
* Make alias redirect output URLs relative when `RelativeURLs = true` {{<gh
|
||||
2093 >}}
|
||||
* Hugo injects meta generator tag on homepage if missing {{<gh
|
||||
2182 >}}
|
||||
|
||||
### Fixes
|
||||
* Fix file change watcher for TextMate 2 and friends on OS X {{<gh 1053 >}}
|
||||
* Make dynamic reloading of config file reliable on all platform {{<gh 1684 >}}
|
||||
* Hugo now works on Linux/arm64 {{<gh 1772 >}}
|
||||
* `plainIDAnchors` now defaults to `true` {{<gh 2057>}}
|
||||
* Win32 and ARM builds fixed {{<gh 1716>}}
|
||||
* Copy static dir files without theme's static dir {{<gh 1656>}}
|
||||
* Make `noTimes` command flag work {{<gh 1657>}}
|
||||
* Change most global CLI flags into local ones {{<gh 1624>}}
|
||||
* Remove transformation of menu URLs {{<gh 1239>}}
|
||||
* Do not fail on unknown Jekyll file {{<gh 1705>}}
|
||||
* Use absolute path when editing with editor {{<gh 1589>}}
|
||||
* Fix hugo server "Watching for changes" path display {{<gh 1721>}}
|
||||
* Do not strip special characters out of URLs {{<gh 1292>}}
|
||||
* Fix `RSSLink` when uglyURLs are enabled {{<gh 175>}}
|
||||
* Get BaseURL from viper in server mode {{<gh 1821>}}
|
||||
* Fix shortcode handling in RST {{<gh 1904>}}
|
||||
* Use default sitemap configuration for homepage {{<gh 1304>}}
|
||||
* Exit if specific port is unavailable in server mode {{<gh 1901>}}
|
||||
* Fix regression in "section menus for lazy blogger" {{<gh 2065>}}
|
||||
|
||||
****
|
||||
|
||||
## **0.15.0** November 25, 2015
|
||||
|
||||
The v0.15.0 Hugo release brings a lot of polish to Hugo. Exactly 6 months after
|
||||
the 0.14 release, Hugo has seen massive growth and changes. Most notably, this
|
||||
is Hugo's first release under the Apache 2.0 license. With this license change
|
||||
we hope to expand the great community around Hugo and make it easier for our
|
||||
many users to contribute. This release represents over **377 contributions by
|
||||
87 contributors** to the main Hugo repo and hundreds of improvements to the
|
||||
libraries Hugo uses. Hugo also launched a [new theme
|
||||
showcase](http://themes.gohugo.io) and participated in
|
||||
[Hacktoberfest](https://hacktoberfest.digitalocean.com).
|
||||
|
||||
Hugo now has:
|
||||
|
||||
* 6700 (+2700) stars on GitHub
|
||||
* 235 (+75) contributors
|
||||
* 65 (+30) themes
|
||||
|
||||
|
||||
**Template Improvements:** This release takes Hugo to a new level of speed and
|
||||
usability. Considerable work has been done adding features and performance to
|
||||
the template system which now has full support of Ace, Amber and Go Templates.
|
||||
|
||||
**Hugo Import:** Have a Jekyll site, but dreaming of porting it to Hugo? This
|
||||
release introduces a new `hugo import jekyll`command that makes this easier
|
||||
than ever.
|
||||
|
||||
**Performance Improvements:** Just when you thought Hugo couldn't get any faster,
|
||||
Hugo continues to improve in speed while adding features. Notably Hugo 0.15
|
||||
introduces the ability to render and serve directly from memory resulting in
|
||||
30%+ lower render times.
|
||||
|
||||
Huge thanks to all who participated in this release. A special thanks to
|
||||
{{< gh "@bep" >}} who led the development of Hugo this release again,
|
||||
{{< gh "@anthonyfok" >}},
|
||||
{{< gh "@eparis" >}},
|
||||
{{< gh "@tatsushid" >}} and
|
||||
{{< gh "@DigitalCraftsman" >}}.
|
||||
|
||||
|
||||
### New features
|
||||
* new `hugo import jekyll` command. {{< gh 1469 >}}
|
||||
* The new `Param` convenience method on `Page` and `Node` can be used to get the most specific parameter value for a given key. {{< gh 1462 >}}
|
||||
* Several new information elements have been added to `Page` and `Node`:
|
||||
* `RuneCount`: The number of [runes](http://blog.golang.org/strings) in the content, excluding any whitespace. This may be a good alternative to `.WordCount` for Japanese and other CJK languages where a word-split by spaces makes no sense. {{< gh 1266 >}}
|
||||
* `RawContent`: Raw Markdown as a string. One use case may be of embedding remarkjs.com slides.
|
||||
* `IsHome`: tells the truth about whether you're on the homepage or not.
|
||||
|
||||
### Improvements
|
||||
* `hugo server` now builds ~30%+ faster by rendering to memory instead of disk. To get the old behavior, start the server with `--renderToDisk=true`.
|
||||
* Hugo now supports dynamic reloading of the config file when watching.
|
||||
* We now use a custom-built `LazyFileReader` for reading file contents, which means we don't read media files in `/content` into memory anymore -- and file reading is now performed in parallel on multicore PCs. {{< gh 1181 >}}
|
||||
* Hugo is now built with `Go 1.5` which, among many other improvements, have fixed the last known data race in Hugo. {{< gh 917 >}}
|
||||
* Paginator now also supports page groups. {{< gh 1274 >}}
|
||||
* Markdown improvements:
|
||||
* Hugo now supports GitHub-flavoured markdown code fences for highlighting for `md`-files (Blackfriday rendered markdown) and `mmark` files (MMark rendered markdown). {{< gh 362 1258 >}}
|
||||
* Several new Blackfriday options are added:
|
||||
* Option to disable Blackfriday's `Smartypants`.
|
||||
* Option for Blackfriday to open links in a new window/tab. {{< gh 1220 >}}
|
||||
* Option to disable Blackfriday's LaTeX style dashes {{< gh 1231 >}}
|
||||
* Definition lists extension support.
|
||||
* `Scratch` now has built-in `map` support.
|
||||
* We now fall back to `link title` for the default page sort. {{< gh 1299 >}}
|
||||
* Some notable new configuration options:
|
||||
* `IgnoreFiles` can be set with a list of Regular Expressions that matches files to be ignored during build. {{< gh 1189 >}}
|
||||
* `PreserveTaxonomyNames`, when set to `true`, will preserve what you type as the taxonomy name both in the folders created and the taxonomy `key`, but it will be normalized for the URL. {{< gh 1180 >}}
|
||||
* `hugo gen` can now generate man files, bash auto complete and markdown documentation
|
||||
* Hugo will now make suggestions when a command is mistyped
|
||||
* Shortcodes now have a boolean `.IsNamedParams` property. {{< gh 1597 >}}
|
||||
|
||||
### New Template Features
|
||||
* All template engines:
|
||||
* The new `dict` function that could be used to pass maps into a template. {{< gh 1463 >}}
|
||||
* The new `pluralize` and `singularize` template funcs.
|
||||
* The new `base64Decode` and `base64Encode` template funcs.
|
||||
* The `sort` template func now accepts field/key chaining arguments and pointer values. {{< gh 1330 >}}
|
||||
* Several fixes for `slicestr` and `substr`, most importantly, they now have full `utf-8`-support. {{< gh 1190 1333 1347 >}}
|
||||
* The new `last` template function allows the user to select the last `N` items of a slice. {{< gh 1148 >}}
|
||||
* The new `after` func allows the user to select the items after the `Nth` item. {{< gh 1200 >}}
|
||||
* Add `time.Time` type support to the `where`, `ge`, `gt`, `le`, and `lt` template functions.
|
||||
* It is now possible to use constructs like `where Values ".Param.key" nil` to filter pages that doesn't have a particular parameter. {{< gh 1232 >}}
|
||||
* `getJSON`/`getCSV`: Add retry on invalid content. {{< gh 1166 >}}
|
||||
* The new `readDir` func lists local files. {{< gh 1204 >}}
|
||||
* The new `safeJS` function allows the embedding of content into JavaScript contexts in Go templates.
|
||||
* Get the main site RSS link from any page by accessing the `.Site.RSSLink` property. {{< gh 1566 >}}
|
||||
* Ace templates:
|
||||
* Base templates now also works in themes. {{< gh 1215 >}}.
|
||||
* And now also on Windows. {{< gh 1178 >}}
|
||||
* Full support for Amber templates including all template functions.
|
||||
* A built-in template for Google Analytics. {{< gh 1505 >}}
|
||||
* Hugo is now shipped with new built-in shortcodes: {{< gh 1576 >}}
|
||||
* `youtube` for YouTube videos
|
||||
* `vimeo` for Vimeo videos
|
||||
* `gist` for GitHub gists
|
||||
* `tweet` for Twitter Tweets
|
||||
* `speakerdeck` for Speakerdeck slides
|
||||
|
||||
|
||||
### Bugfixes
|
||||
* Fix data races in page sorting and page reversal. These operations are now also cached. {{< gh 1293 >}}
|
||||
* `page.HasMenuCurrent()` and `node.HasMenuCurrent()` now work correctly in multi-level nested menus.
|
||||
* Support `Fish and Chips` style section titles. Previously, this would end up as `Fish And Chips`. Now, the first character is made toupper, but the rest are preserved as-is. {{< gh 1176 >}}
|
||||
* Hugo now removes superfluous p-tags around shortcodes. {{< gh 1148 >}}
|
||||
|
||||
### Notices
|
||||
* `hugo server` will watch by default now.
|
||||
* Some fields and methods were deprecated in `0.14`. These are now removed, so the error message isn't as friendly if you still use the old values. So please change:
|
||||
* `getJson` to `getJSON`, `getCsv` to `getCSV`, `safeHtml` to
|
||||
`safeHTML`, `safeCss` to `safeCSS`, `safeUrl` to `safeURL`, `Url` to `URL`,
|
||||
`UrlPath` to `URLPath`, `BaseUrl` to `BaseURL`, `Recent` to `Pages`.
|
||||
|
||||
### Known Issues
|
||||
|
||||
Using the Hugo v0.15 32-bit Windows or ARM binary, running `hugo server` would crash or hang due to a [memory alignment issue](https://golang.org/pkg/sync/atomic/#pkg-note-BUG) in [Afero](https://github.com/spf13/afero). The bug was discovered shortly after the v0.15.0 release and has since been [fixed](https://github.com/spf13/afero/pull/23) by {{< gh "@tpng" >}}. If you encounter this bug, you may either compile Hugo v0.16-DEV from source, or use the following solution/workaround:
|
||||
|
||||
* **64-bit Windows users: Please use [hugo_0.15_windows_amd64.zip](https://github.com/gohugoio/hugo/releases/download/v0.15/hugo_0.15_windows_amd64.zip)** (amd64 == x86-64). It is only the 32-bit hugo_0.15_windows_386.zip that crashes/hangs (see {{< gh 1621 >}} and {{< gh 1628 >}}).
|
||||
* **32-bit Windows and ARM users: Please run `hugo server --renderToDisk` as a workaround** until Hugo v0.16 is released (see [“hugo server” returns runtime error on armhf](https://discourse.gohugo.io/t/hugo-server-returns-runtime-error-on-armhf/2293) and {{< gh 1716 >}}).
|
||||
|
||||
----
|
||||
|
||||
## **0.14.0** May 25, 2015
|
||||
|
||||
The v0.14.0 Hugo release brings of the most demanded features to Hugo. The
|
||||
foundation of Hugo is stabilizing nicely and a lot of polish has been added.
|
||||
We’ve expanded support for additional content types with support for AsciiDoc,
|
||||
Restructured Text, HTML and Markdown. Some of these types depend on external
|
||||
libraries as there does not currently exist native support in Go. We’ve tried
|
||||
to make the experience as seamless as possible. Look for more improvements here
|
||||
in upcoming releases.
|
||||
|
||||
A lot of work has been done to improve the user experience, with extra polish
|
||||
to the Windows experience. Hugo errors are more helpful overall and Hugo now
|
||||
can detect if it’s being run in Windows Explorer and provide additional
|
||||
instructions to run it via the command prompt.
|
||||
|
||||
The Hugo community continues to grow. Hugo has over 4000 stars on github, 165
|
||||
contributors, 35 themes and 1000s of happy users. It is now the 5th most
|
||||
popular static site generator (by Stars) and has the 3rd largest contributor
|
||||
community.
|
||||
|
||||
This release represents over **240 contributions by 36 contributors** to the main
|
||||
Hugo codebase.
|
||||
|
||||
Big shout out to {{< gh "@bep" >}} who led the development of Hugo
|
||||
this release, {{< gh "@anthonyfok" >}},
|
||||
{{< gh "@eparis" >}},
|
||||
{{< gh "@SchumacherFM" >}},
|
||||
{{< gh "@RickCogley" >}} &
|
||||
{{< gh "@mdhender" >}} for their significant contributions
|
||||
and {{< gh "@tatsushid" >}} for his continuous improvements
|
||||
to the templates. Also a big thanks to all the theme creators. 11 new themes
|
||||
have been added since last release and the [hugoThemes repo now has previews of
|
||||
all of
|
||||
them](https://github.com/gohugoio/hugoThemes/blob/master/README.md#theme-list).
|
||||
|
||||
Hugo also depends on a lot of other great projects. A big thanks to all of our dependencies including:
|
||||
[cobra](https://github.com/spf13/cobra),
|
||||
[viper](https://github.com/spf13/viper),
|
||||
[blackfriday](https://github.com/russross/blackfriday),
|
||||
[pflag](https://github.com/spf13/pflag),
|
||||
[HugoThemes](https://github.com/gohugoio/hugothemes),
|
||||
[BurntSushi](https://github.com/BurntSushi/toml),
|
||||
[goYaml](https://github.com/go-yaml/yaml/tree/v2), and the Go standard library.
|
||||
|
||||
### New features
|
||||
|
||||
* Support for all file types in content directory.
|
||||
* If dedicated file type handler isn’t found it will be copied to the destination.
|
||||
* Add `AsciiDoc` support using external helpers.
|
||||
* Add experimental support for [`Mmark`](https://github.com/miekg/mmark) markdown processor
|
||||
* Bash autocomplete support via `genautocomplete` command
|
||||
* Add section menu support for a [Section Menu for "the Lazy Blogger"](/templates/menu-templates/)
|
||||
* Add support for `Ace` base templates
|
||||
* Adding `RelativeURLs = true` to site config will now make all the relative URLs relative to the content root.
|
||||
* New template functions:
|
||||
* `getenv`
|
||||
* The string functions `substr` and `slicestr`
|
||||
* `seq`, a sequence generator very similar to its Gnu counterpart
|
||||
* `absURL` and `relURL`, both of which takes the `BaseURL` setting into account
|
||||
|
||||
### Improvements
|
||||
|
||||
* Highlighting with `Pygments` is now cached to disk -- expect a major speed boost if you use it!
|
||||
* More Pygments highlighting options, including `line numbers`
|
||||
* Show help information to Windows users who try to double click on `hugo.exe`.
|
||||
* Add `bind` flag to `hugo server` to set the interface to which the server will bind
|
||||
* Add support for `canonifyURLs` in `srcset`
|
||||
* Add shortcode support for HTML (content) files
|
||||
* Allow the same `shortcode` to be used with or without inline content
|
||||
* Configurable RSS output filename
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* Fix panic with paginator and zero pages in result set.
|
||||
* Fix crossrefs on Windows.
|
||||
* Fix `eq` and `ne` template functions when used with a raw number combined with the result of `add`, `sub` etc.
|
||||
* Fix paginator with uglyURLs
|
||||
* Fix {{< gh 998 >}}, supporting UTF8 characters in Permalinks.
|
||||
|
||||
### Notices
|
||||
|
||||
* To get variable and function names in line with the rest of the Go community,
|
||||
a set of variable and function names has been deprecated: These will still
|
||||
work in 0.14, but will be removed in 0.15. What to do should be obvious by
|
||||
the build log; `getJson` to `getJSON`, `getCsv` to `getCSV`, `safeHtml` to
|
||||
`safeHTML`, `safeCss` to `safeCSS`, `safeUrl` to `safeURL`, `Url` to `URL`,
|
||||
`UrlPath` to `URLPath`, `BaseUrl` to `BaseURL`, `Recent` to `Pages`,
|
||||
`Indexes` to `Taxonomies`.
|
||||
|
||||
|
||||
----
|
||||
|
||||
## **0.13.0** Feb 21, 2015
|
||||
|
||||
The v0.13.0 release is the largest Hugo release to date. The release introduced
|
||||
some long sought after features (pagination, sequencing, data loading, tons of
|
||||
template improvements) as well as major internal improvements. In addition to
|
||||
the code changes, the Hugo community has grown significantly and now has over
|
||||
3000 stars on github, 134 contributors, 24 themes and 1000s of happy users.
|
||||
|
||||
This release represents **448 contributions by 65 contributors**
|
||||
|
||||
A special shout out to {{< gh "@bep" >}} and
|
||||
{{< gh "@anthonyfok" >}} for their new role as Hugo
|
||||
maintainers and their tremendous contributions this release.
|
||||
|
||||
### New major features
|
||||
* Support for [data files](/templates/data-templates/) in [YAML](http://yaml.org/),
|
||||
[JSON](http://www.json.org/), or [TOML](https://github.com/toml-lang/toml)
|
||||
located in the `data` directory ({{< gh 885 >}})
|
||||
* Support for [dynamic content](/templates/data-templates/) by loading JSON & CSV
|
||||
from remote sources via GetJson and GetCsv in short codes or other layout
|
||||
files ({{< gh 748 >}})
|
||||
* [Pagination support](/templates/pagination/) for homepage, sections and
|
||||
taxonomies ({{< gh 750 >}})
|
||||
* Universal sequencing support
|
||||
* A new, generic Next/Prev functionality is added to all lists of pages
|
||||
(sections, taxonomies, etc.)
|
||||
* Add in-section [Next/Prev](/variables/) content pointers
|
||||
* `Scratch` -- [a "scratchpad"](/functions/scratch/) for your node- and page-scoped
|
||||
variables
|
||||
* [Cross Reference](/content-management/cross-references/) support to easily link documents
|
||||
together with the ref and relref shortcodes.
|
||||
* [Ace](https://github.com/yosssi/ace) template engine support ({{< gh 541 >}})
|
||||
* A new [shortcode](/content-management/shortcodes/) token of `{{</* */>}}` (raw HTML)
|
||||
alongside the existing `{{%/* */%}}` (Markdown)
|
||||
* A top level `Hugo` variable (on Page & Node) is added with various build
|
||||
information
|
||||
* Several new ways to order and group content:
|
||||
* `ByPublishDate`
|
||||
* `GroupByPublishDate(format, order)`
|
||||
* `GroupByParam(key, order)`
|
||||
* `GroupByParamDate(key, format, order)`
|
||||
* Hugo has undergone a major refactoring, with a new handler system and a
|
||||
generic file system. This sounds and is technical, but will pave the way for
|
||||
new features and make Hugo even speedier
|
||||
|
||||
### Notable enhancements to existing features
|
||||
|
||||
* The [shortcode](/content-management/shortcodes/) handling is rewritten for speed and
|
||||
better error messages.
|
||||
* Several improvements to the [template functions](/functions/):
|
||||
* [`where`](/functions/where/) is now even more powerful and accepts SQL-like syntax with the
|
||||
operators `==`, `eq`; `!=`, `<>`, `ne`; `>=`, `ge`; `>`, `gt`; `<=`,
|
||||
`le`; `<`, `lt`; `in`, `not in`
|
||||
* `where` template function now also accepts dot chaining key argument
|
||||
(e.g. `"Params.foo.bar"`)
|
||||
* New template functions:
|
||||
* `apply`
|
||||
* `chomp`
|
||||
* `delimit`
|
||||
* `sort`
|
||||
* `markdownify`
|
||||
* `in` and `intersect`
|
||||
* `trim`
|
||||
* `replace`
|
||||
* `dateFormat`
|
||||
* Several [configurable improvements related to Markdown
|
||||
rendering](/getting-started/configuration/):
|
||||
* Configuration of footnote rendering
|
||||
* Optional support for smart angled quotes, e.g. `"Hugo"` → «Hugo»
|
||||
* Enable descriptive header IDs
|
||||
* URLs in XML output is now correctly canonified ({{< gh 725 728 >}}, and part
|
||||
of {{< gh 789 >}})
|
||||
|
||||
### Other improvements
|
||||
|
||||
* Internal change to use byte buffer pool significantly lowering memory usage
|
||||
and providing measurable performance improvements overall
|
||||
* Changes to docs:
|
||||
* A new [Troubleshooting](/troubleshooting/) section is added
|
||||
* It's now searchable through Google Custom Search ({{< gh 753 >}})
|
||||
* Some new great tutorials:
|
||||
* [Automated deployments with
|
||||
Wercker](/tutorials/automated-deployments/)
|
||||
* [Creating a new theme](/tutorials/creating-a-new-theme/)
|
||||
* [`hugo new`](/content-management/archetypes/) now copies the content in addition to the front matter
|
||||
* Improved unit test coverage
|
||||
* Fixed a lot of Windows-related path issues
|
||||
* Improved error messages for template and rendering errors
|
||||
* Enabled soft LiveReload of CSS and images ({{< gh 490 >}})
|
||||
* Various fixes in RSS feed generation ({{< gh 789 >}})
|
||||
* `HasMenuCurrent` and `IsMenuCurrent` is now supported on Nodes
|
||||
* A bunch of [bug fixes](https://github.com/gohugoio/hugo/commits/master)
|
||||
|
||||
----
|
||||
|
||||
## **0.12.0** Sept 1, 2014
|
||||
|
||||
A lot has happened since Hugo v0.11.0 was released. Most of the work has been
|
||||
focused on polishing the theme engine and adding critical functionality to the
|
||||
templates.
|
||||
|
||||
This release represents over 90 code commits from 28 different contributors.
|
||||
|
||||
* 10 [new themes](https://github.com/gohugoio/hugoThemes) created by the community
|
||||
* Fully themable [Partials](/templates/partials/)
|
||||
* [404 template](/templates/404/) support in themes
|
||||
* [Shortcode](/content-management/shortcodes/) support in themes
|
||||
* [Views](/templates/views/) support in themes
|
||||
* Inner [shortcode](/content-management/shortcodes/) content now treated as Markdown
|
||||
* Support for header ids in Markdown (# Header {#myid})
|
||||
* [Where](/templates/lists/) template function to filter lists of content, taxonomies, etc.
|
||||
* [GroupBy](/templates/lists/) & [GroupByDate](/templates/list/) methods to group pages
|
||||
* Taxonomy [pages list](/templates/taxonomy-templates/) now sortable, filterable, limitable & groupable
|
||||
* General cleanup to taxonomies & documentation to make it more clear and consistent
|
||||
* [Showcase](/showcase/) returned and has been expanded
|
||||
* Pretty links now always have trailing slashes
|
||||
* [BaseUrl](/getting-started/configuration/) can now include a subdirectory
|
||||
* Better feedback about draft & future post rendering
|
||||
* A variety of improvements to [the website](http://gohugo.io/)
|
||||
|
||||
----
|
||||
|
||||
## **0.11.0** May 28, 2014
|
||||
|
||||
This release represents over 110 code commits from 29 different contributors.
|
||||
|
||||
* Considerably faster... about 3 - 4x faster on average
|
||||
* [LiveReload](/getting-started/usage/). Hugo will automatically reload the browser when the build is complete
|
||||
* Theme engine w/[Theme Repository](https://github.com/gohugoio/hugoThemes)
|
||||
* [Menu system](/content-management/menus/) with support for active page
|
||||
* [Builders](/getting-started/usage/) to quickly create a new site, content or theme
|
||||
* [XML sitemap](/templates/sitemap-template/) generation
|
||||
* [Integrated Disqus](/content-management/comments/) support
|
||||
* Streamlined [template organization](/templates/)
|
||||
* [Brand new docs site](http://gohugo.io/)
|
||||
* Support for publishDate which allows for posts to be dated in the future
|
||||
* More [sort](/templates/lists/) options
|
||||
* Logging support
|
||||
* Much better error handling
|
||||
* More informative verbose output
|
||||
* Renamed Indexes > [Taxonomies](/content-management/taxonomies/)
|
||||
* Renamed Chrome > [Partials](/templates/partials/)
|
||||
|
||||
----
|
||||
|
||||
## **0.10.0** March 1, 2014
|
||||
|
||||
This release represents over 110 code commits from 29 different contributors.
|
||||
|
||||
* [Syntax highlighting](/tools/syntax-highlighting/) powered by pygments (**slow**)
|
||||
* Ability to [sort content](/templates/lists/) many more ways
|
||||
* Automatic [table of contents](/content-management/toc/) generation
|
||||
* Support for Unicode URLs, aliases and indexes
|
||||
* Configurable per-section [permalink](/content-management/urls/) pattern support
|
||||
* Support for [paired shortcodes](/content-management/shortcodes/)
|
||||
* Shipping with some [shortcodes](/content-management/shortcodes/) (highlight & figure)
|
||||
* Adding [canonify](/content-management/urls/) option to keep urls relative
|
||||
* A bunch of [additional template functions](/functions/)
|
||||
* Watching very large sites now works on Mac
|
||||
* RSS generation improved. Limited to 50 items by default, can limit further in [template](/templates/rss/)
|
||||
* Boolean params now supported in [fm](/content-management/front-matter/)
|
||||
* Launched website [showcase](/showcase/). Show off your own hugo site!
|
||||
* A bunch of [bug fixes](https://github.com/gohugoio/hugo/commits/master)
|
||||
|
||||
----
|
||||
|
||||
## **0.9.0** November 15, 2013
|
||||
|
||||
This release represents over 220 code commits from 22 different contributors.
|
||||
|
||||
* New [command based interface](/getting-started/usage/) similar to git (`hugo server -s ./`)
|
||||
* Amber template support
|
||||
* [Aliases](/content-management/urls/) (redirects)
|
||||
* Support for top level pages (in addition to homepage)
|
||||
* Complete overhaul of the documentation site
|
||||
* Full Windows support
|
||||
* Better index support including [ordering by content weight](/templates/lists/)
|
||||
* Add params to site config, available in .Site.Params from templates
|
||||
* Friendlier JSON support
|
||||
* Support for html & xml content (with front matter support)
|
||||
* Support for [summary](/content-management/summaries/) content divider (<code><!--more--></code>)
|
||||
* HTML in [summary](/content-management/summaries/) (when using divider)
|
||||
* Added ["Minutes to Read"](/variables/) functionality
|
||||
* Support for a custom 404 page
|
||||
* Cleanup of how content organization is handled
|
||||
* Loads of unit and performance tests
|
||||
* Integration with travis ci
|
||||
* Static directory now watched and copied on any addition or modification
|
||||
* Support for relative permalinks
|
||||
* Fixed watching being triggered multiple times for the same event
|
||||
* Watch now ignores temp files (as created by Vim)
|
||||
* Configurable number of posts on [homepage](/templates/homepage/)
|
||||
* [Front matter](/content-management/front-matter/) supports multiple types (int, string, date, float)
|
||||
* Indexes can now use a default template
|
||||
* Addition of truncated bool to content to determine if should show 'more' link
|
||||
* Support for [linkTitles](/variables/)
|
||||
* Better handling of most errors with directions on how to resolve
|
||||
* Support for more date / time formats
|
||||
* Support for go 1.2
|
||||
* Support for `first` in templates
|
||||
|
||||
----
|
||||
|
||||
## **0.8.0** August 2, 2013
|
||||
|
||||
This release represents over 65 code commits from 6 different contributors.
|
||||
|
||||
* Added support for pretty urls (filename/index.html vs filename.html)
|
||||
* Hugo supports a destination directory
|
||||
* Will efficiently sync content in static to destination directory
|
||||
* Cleaned up options.. now with support for short and long options
|
||||
* Added support for TOML
|
||||
* Added support for YAML
|
||||
* Added support for Previous & Next
|
||||
* Added support for indexes for the indexes
|
||||
* Better Windows compatibility
|
||||
* Support for series
|
||||
* Adding verbose output
|
||||
* Loads of bugfixes
|
||||
|
||||
----
|
||||
|
||||
## **0.7.0** July 4, 2013
|
||||
|
||||
* Hugo now includes a simple server
|
||||
* First public release
|
||||
|
||||
----
|
||||
|
||||
## **0.6.0** July 2, 2013
|
||||
|
||||
* Hugo includes an example documentation site which it builds
|
||||
|
||||
----
|
||||
|
||||
## **0.5.0** June 25, 2013
|
||||
* Hugo is quite usable and able to build spf13.com
|
|
@ -26,7 +26,7 @@ Hugo supports loading data from YAML, JSON, and TOML files located in the `data`
|
|||
|
||||
The `data` folder is where you can store additional data for Hugo to use when generating your site. Data files aren't used to generate standalone pages; rather, they're meant to be supplemental to content files. This feature can extend the content in case your front matter fields grow out of control. Or perhaps you want to show a larger dataset in a template (see example below). In both cases, it's a good idea to outsource the data in their own files.
|
||||
|
||||
These files must be YAML, JSON, or TOML files (using the `.yml`, `.yaml`, `.json`, or `toml` extension). The data will be accessible as a `map` in the `.Site.Data` variable.
|
||||
These files must be YAML, JSON, or TOML files (using the `.yml`, `.yaml`, `.json`, or `.toml` extension). The data will be accessible as a `map` in the `.Site.Data` variable.
|
||||
|
||||
## Data Files in Themes
|
||||
|
||||
|
@ -250,4 +250,4 @@ If you change any local file and the LiveReload is triggered, Hugo will read the
|
|||
[toml]: https://github.com/toml-lang/toml
|
||||
[variadic]: http://en.wikipedia.org/wiki/Variadic_function
|
||||
[vars]: /variables/
|
||||
[yaml]: http://yaml.org/spec/
|
||||
[yaml]: http://yaml.org/spec/
|
||||
|
|
|
@ -100,14 +100,14 @@ You can now access this `_index.md`'s' content in your list template:
|
|||
<header>
|
||||
<h1>{{.Title}}</h1>
|
||||
</header>
|
||||
<!-- "{{.Content}}" pulls from the markdown content of the corresponding _inde.xmd -->
|
||||
<!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
|
||||
{{.Content}}
|
||||
</article>
|
||||
<ul>
|
||||
<!-- Ranges through content/post/*.md -->
|
||||
{{ range .Data.Pages }}
|
||||
<li>
|
||||
<a href="{{.Permalink}}">{{.Date.Format "2006-01-02"}} | {{.Title}}</a
|
||||
<a href="{{.Permalink}}">{{.Date.Format "2006-01-02"}} | {{.Title}}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
|
|
@ -69,10 +69,10 @@ Use the [`absLangUrl`](/functions/abslangurl) or [`relLangUrl`](/functions/rella
|
|||
|
||||
## Section Menu for Lazy Bloggers
|
||||
|
||||
To enable this menu, add the following to your site `config`:
|
||||
To enable this menu, configure `sectionPagesMenu` in your site `config`:
|
||||
|
||||
```
|
||||
SectionPagesMenu = "main"
|
||||
sectionPagesMenu = "main"
|
||||
```
|
||||
|
||||
The menu name can be anything, but take a note of what it is.
|
||||
|
|
|
@ -25,8 +25,8 @@ Hugo includes support for user-defined groupings of content called **taxonomies*
|
|||
|
||||
Hugo provides multiple ways to use taxonomies throughout your project templates:
|
||||
|
||||
* Order the way the terms for a taxonomy are displayed in a [taxonomy terms template](#taxonomy-terms-template)
|
||||
* Order the way content associated with a taxonomy term is displayed in a [taxonomy list template](#taxonomy-list-template)
|
||||
* Order the way the terms for a taxonomy are displayed in a [taxonomy terms template](#taxonomy-terms-template)
|
||||
* List a single content's taxonomy terms within a [single page template][]
|
||||
|
||||
## Taxonomy List Templates
|
||||
|
|
|
@ -31,7 +31,7 @@ hugo new theme [name]
|
|||
|
||||
## Theme Components
|
||||
|
||||
A theme consists of templates and static assets such as javascript and css files. Themes can also provide [archetypes][], which are archetypal content types used by the `hugo new` command to scaffold new conte files with preconfigured front matter.
|
||||
A theme consists of templates and static assets such as javascript and css files. Themes can also provide [archetypes][], which are archetypal content types used by the `hugo new` command to scaffold new content files with preconfigured front matter.
|
||||
|
||||
|
||||
{{% note "Use the Hugo Generator Tag" %}}
|
||||
|
|
|
@ -63,8 +63,7 @@ Highlighting is carried out via the [built-in shortcode](/content-management/sho
|
|||
|
||||
### Example `highlight` Shortcode Output
|
||||
|
||||
{{% output file="example-highlight-shortcode-output.html" %}}
|
||||
```
|
||||
{{< output file="example-highlight-shortcode-output.html" >}}
|
||||
<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>
|
||||
|
@ -73,8 +72,7 @@ Highlighting is carried out via the [built-in shortcode](/content-management/sho
|
|||
{{ end }}
|
||||
<span style="color: #f92672"></div></span>
|
||||
<span style="color: #f92672"></section></span>
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
### Options
|
||||
|
||||
|
|
|
@ -213,12 +213,10 @@ Two common situations where this type of front matter field could be introduced
|
|||
|
||||
This template would render as follows, assuming you've set [`uglyURLs`](/content-management/urls/) to `false` in your [site `config`](/getting-started/configuration/):
|
||||
|
||||
{{% output file="yourbaseurl/review/book01/index.html" %}}
|
||||
```
|
||||
{{< output file="yourbaseurl/review/book01/index.html" >}}
|
||||
<h3><a href="http://www.my-book-link.here">Buy this book</a></h3>
|
||||
<p>It was recommended by my Mother.</p>
|
||||
```
|
||||
{{% /output %}}
|
||||
{{< /output >}}
|
||||
|
||||
{{% note %}}
|
||||
See [Archetypes](/content-management/archetypes/) for consistency of `Params` across pieces of content.
|
||||
|
|
|
@ -193,6 +193,16 @@
|
|||
"layouts/_default/list.html"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Example": "RSS home, no theme.",
|
||||
"OutputFormat": "RSS",
|
||||
"Suffix": "xml",
|
||||
"Template Lookup Order": [
|
||||
"layouts/rss.xml",
|
||||
"layouts/_default/rss.xml",
|
||||
"layouts/_internal/_default/rss.xml"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Example": "JSON home, no theme.",
|
||||
"OutputFormat": "JSON",
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<table class="utils-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-title">Title</td>
|
||||
<th class="col-author">Author</td>
|
||||
<th class="col-date">Date</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range $ind, $art := $.Site.Data.articles.article }}
|
||||
<tr>
|
||||
<td><a href="{{$art.url}}" target="_blank">{{$art.title | markdownify }}</a></td>
|
||||
<td>{{ $art.author | markdownify }}</td>
|
||||
<td>{{ $art.date }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
2
layouts/shortcodes/asciicast.html
Normal file
2
layouts/shortcodes/asciicast.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
{{ $id := .Get 0 }}
|
||||
<script type="text/javascript" src="https://asciinema.org/a/{{ $id }}.js" id="asciicast-{{ $id }}" data-rows="10" async></script>
|
|
@ -2,10 +2,7 @@
|
|||
{{$icon := index (split $file ".") 1 }}
|
||||
<div class="code" id="{{$file | urlize}}">
|
||||
<div class="filename" title="{{$file}}">{{$file}}</div>
|
||||
<!-- <div class="code-icon">
|
||||
<i class="icon-{{$icon}}"></i>
|
||||
</div> -->
|
||||
<div class="code-copy-content output-content">
|
||||
{{- .Inner -}}
|
||||
<pre><code>{{- .Inner | string -}}</code></pre>
|
||||
</div>
|
||||
</div>
|
|
@ -1,5 +0,0 @@
|
|||
/*
|
||||
X-Frame-Options: DENY
|
||||
X-XSS-Protection: 1; mode=block
|
||||
X-Content-Type-Options: nosniff
|
||||
Referrer-Policy: origin-when-cross-origin
|
BIN
static/images/blog/hugo-http2-push.png
Normal file
BIN
static/images/blog/hugo-http2-push.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
BIN
static/images/gohugoio-card-1.png
Normal file
BIN
static/images/gohugoio-card-1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
|
@ -1,34 +0,0 @@
|
|||
|
||||
|
||||
Hugo `0.22.1` fixes a couple of issues reported after the [0.22 release](https://github.com/gohugoio/hugo/releases/tag/v0.22) Monday. Most importantly a fix for detecting regular subfolders below the root-sections.
|
||||
|
||||
Also, we forgot to adapt the `permalink settings` with support for nested sections, which made that feature less useful than it could be.
|
||||
|
||||
With this release you can configure **permalinks with sections** like this:
|
||||
|
||||
**First level only:**
|
||||
|
||||
```toml
|
||||
[permalinks]
|
||||
blog = ":section/:title"
|
||||
```
|
||||
|
||||
**Nested (all levels):**
|
||||
|
||||
```toml
|
||||
[permalinks]
|
||||
blog = ":sections/:title"
|
||||
```
|
||||
## Fixes
|
||||
|
||||
* Fix section logic for root folders with subfolders [a30023f5](https://github.com/gohugoio/hugo/commit/a30023f5cbafd06034807255181a5b7b17f3c25f) [@bep](https://github.com/bep) [#3586](https://github.com/gohugoio/hugo/issues/3586)
|
||||
* Support sub-sections in permalink settings [1f26420d](https://github.com/gohugoio/hugo/commit/1f26420d392a5ab4c7b7fe1911c0268b45d01ab8) [@bep](https://github.com/bep) [#3580](https://github.com/gohugoio/hugo/issues/3580)
|
||||
* Adjust rlimit to 64000 [ff54b6bd](https://github.com/gohugoio/hugo/commit/ff54b6bddcefab45339d8dc2b13776b92bdc04b9) [@bep](https://github.com/bep) [#3582](https://github.com/gohugoio/hugo/issues/3582)
|
||||
* Make error on setting rlimit a warning only [629e1439](https://github.com/gohugoio/hugo/commit/629e1439e819a7118ae483381d4634f16d3474dd) [@bep](https://github.com/bep) [#3582](https://github.com/gohugoio/hugo/issues/3582)
|
||||
* Revert: Remove the rlimit tweaking on macOS" [26aa06a3](https://github.com/gohugoio/hugo/commit/26aa06a3db57ab7134a900d641fa2976f7971520) [@bep](https://github.com/bep) [#3582](https://github.com/gohugoio/hugo/issues/3582)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit d0445e2ad6bcffcbfa305650dd66e308543bcfdc
|
||||
Subproject commit ce4449747bb1867d7d8b0c579be2ddf4a040274c
|
Loading…
Reference in a new issue