Squashed 'docs/' changes from ef02e34e..35abbc86

35abbc86 Add example with taxonomy for title template func
85e28c10 Remove comment from variable in front matter example
eee8543b Remove comment from variable in front matter example
13a8e0b7 Add missing closing and opening comment tags
83531772 Replace http://example.{com,org}/ with https://example.{com,org}/
6727d820 Update gh repo for issues in config
3a58818e Add note to install Testify
19f13e61 Fix YAML examples in taxonomies.md
dc4b90db Replace old RSS template with new embedded version (#116)
00f39bd7 camelCase output format options
902a14a1 Add missing word to pretty URLs explanation

git-subtree-dir: docs
git-subtree-split: 35abbc869199b852922c024a29e2370272a7c1c8
This commit is contained in:
Bjørn Erik Pedersen 2017-08-06 17:24:51 +02:00
parent 50ec65fbe1
commit e81208265b
21 changed files with 258 additions and 184 deletions

View file

@ -57,6 +57,8 @@ twitter = "GoHugoIO"
removefromexternalsearch = false removefromexternalsearch = false
## Gh repo for site footer (include trailing slash) ## Gh repo for site footer (include trailing slash)
ghrepo = "https://github.com/gohugoio/hugoDocs/" ghrepo = "https://github.com/gohugoio/hugoDocs/"
## GH Repo for filing a new issue
github_repo = "https://github.com/gohugoio/hugo/issues/new"
### Edit content repo (set to automatically enter "edit" mode; this is good for "improve this page" links) ### Edit content repo (set to automatically enter "edit" mode; this is good for "improve this page" links)
ghdocsrepo = "https://github.com/gohugoio/hugoDocs/tree/master/docs" ghdocsrepo = "https://github.com/gohugoio/hugoDocs/tree/master/docs"
## Gitter URL ## Gitter URL

View file

@ -96,8 +96,8 @@ More information about document unique identifiers and headings can be found [be
### Examples ### Examples
* `{{</* ref "blog/post.md" */>}}` => `http://example.com/blog/post/` * `{{</* ref "blog/post.md" */>}}` => `https://example.com/blog/post/`
* `{{</* ref "post.md#tldr" */>}}` => `http://example.com/blog/post/#tldr:caffebad` * `{{</* ref "post.md#tldr" */>}}` => `https://example.com/blog/post/#tldr:caffebad`
* `{{</* relref "post.md" */>}}` => `/blog/post/` * `{{</* relref "post.md" */>}}` => `/blog/post/`
* `{{</* relref "blog/post.md#tldr" */>}}` => `/blog/post/#tldr:caffebad` * `{{</* relref "blog/post.md#tldr" */>}}` => `/blog/post/#tldr:caffebad`
* `{{</* ref "#tldr" */>}}` => `#tldr:badcaffe` * `{{</* ref "#tldr" */>}}` => `#tldr:badcaffe`

View file

@ -54,7 +54,7 @@ slug = "spf13-vim-3-0-release-and-new-website"
--- ---
title: "spf13-vim 3.0 release and new website" title: "spf13-vim 3.0 release and new website"
description: "spf13-vim is a cross platform distribution of vim plugins and resources for Vim." description: "spf13-vim is a cross platform distribution of vim plugins and resources for Vim."
#tags: [ ".vimrc", "plugins", "spf13-vim", "vim" ] tags: [ ".vimrc", "plugins", "spf13-vim", "vim" ]
lastmod: 2015-12-23 lastmod: 2015-12-23
date: "2012-04-06" date: "2012-04-06"
categories: categories:

View file

@ -153,7 +153,7 @@ menu:
{{< /code >}} {{< /code >}}
{{% note %}} {{% note %}}
The URLs must be relative to the context root. If the `baseURL` is `http://example.com/mysite/`, then the URLs in the menu must not include the context root `mysite`. Using an absolute URL will overide the baseURL. If the value used for `URL` in the above example is `http://subdomain.example.com/`, the output will be `http://subdomain.example.com`. The URLs must be relative to the context root. If the `baseURL` is `https://example.com/mysite/`, then the URLs in the menu must not include the context root `mysite`. Using an absolute URL will overide the baseURL. If the value used for `URL` in the above example is `https://subdomain.example.com/`, the output will be `https://subdomain.example.com`.
{{% /note %}} {{% /note %}}
## Nesting ## Nesting

View file

@ -34,20 +34,20 @@ While Hugo supports content nested at any level, the top levels (i.e. `content/<
. .
└── content └── content
└── about └── about
| └── _index.md // <- http://example.com/about/ | └── _index.md // <- https://example.com/about/
├── post ├── post
| ├── firstpost.md // <- http://example.com/post/firstpost/ | ├── firstpost.md // <- https://example.com/post/firstpost/
| ├── happy | ├── happy
| | └── ness.md // <- http://example.com/post/happy/ness/ | | └── ness.md // <- https://example.com/post/happy/ness/
| └── secondpost.md // <- http://example.com/post/secondpost/ | └── secondpost.md // <- https://example.com/post/secondpost/
└── quote └── quote
├── first.md // <- http://example.com/quote/first/ ├── first.md // <- https://example.com/quote/first/
└── second.md // <- http://example.com/quote/second/ └── second.md // <- https://example.com/quote/second/
``` ```
## Path Breakdown in Hugo ## Path Breakdown in Hugo
The following demonstrates the relationships between your content organization and the output URL structure for your Hugo website when it renders. These examples assume you are [using pretty URLs][pretty], which is the default behavior for Hugo. The examples also assume a key-value of `baseurl = "http://example.com"` in your [site's configuration file][config]. The following demonstrates the relationships between your content organization and the output URL structure for your Hugo website when it renders. These examples assume you are [using pretty URLs][pretty], which is the default behavior for Hugo. The examples also assume a key-value of `baseurl = "https://example.com"` in your [site's configuration file][config].
### Index Pages: `_index.md` ### Index Pages: `_index.md`
@ -76,7 +76,7 @@ At build, this will output to the following destination with the associated valu
⊢--------^---------⊣⊢-^-⊣ ⊢--------^---------⊣⊢-^-⊣
permalink permalink
⊢----------^-------------⊣ ⊢----------^-------------⊣
http://example.com/posts/index.html https://example.com/posts/index.html
``` ```
### Single Pages in Sections ### Single Pages in Sections
@ -102,7 +102,7 @@ At the time Hugo builds your site, the content will be output to the following d
⊢--------^--------⊣⊢-^--⊣⊢-------^---------⊣ ⊢--------^--------⊣⊢-^--⊣⊢-------^---------⊣
permalink permalink
⊢--------------------^---------------------⊣ ⊢--------------------^---------------------⊣
http://example.com/posts/my-first-hugo-post/index.html https://example.com/posts/my-first-hugo-post/index.html
``` ```
### Section with Nested Directories ### Section with Nested Directories
@ -120,7 +120,7 @@ To continue the example, the following demonstrates destination paths for a file
⊢--------^--------⊣ ⊢------^-----⊣⊢----^------⊣ ⊢--------^--------⊣ ⊢------^-----⊣⊢----^------⊣
permalink permalink
⊢----------------------^-----------------------⊣ ⊢----------------------^-----------------------⊣
http://example.com/events/chicago/lollapalooza/ https://example.com/events/chicago/lollapalooza/
``` ```
{{% note %}} {{% note %}}
@ -201,9 +201,9 @@ layout: mylayout
--- ---
{{< /code >}} {{< /code >}}
<!-- See https://discourse.gohugo.io/t/path-not-works/6387 --> <!-- See https://discourse.gohugo.io/t/path-not-works/6387 -->
<!-- ### `path` <!-- ### `path`-->
`path` can be provided in the front matter. This will replace the actual path to the file on disk. Destination will create the destination with the same path, including the section. --> <!--`path` can be provided in the front matter. This will replace the actual path to the file on disk. Destination will create the destination with the same path, including the section. -->
### `url` ### `url`

View file

@ -163,7 +163,7 @@ project_url = "https://github.com/gohugoio/hugo"
``` ```
--- ---
title: "Hugo: A fast and flexible static site generator" title: "Hugo: A fast and flexible static site generator"
#tags: ["Development", "Go", "fast", "Blogging"] tags: ["Development", "Go", "fast", "Blogging"]
categories: ["Development"] categories: ["Development"]
series: ["Go Web Dev"] series: ["Go Web Dev"]
slug: "hugo" slug: "hugo"
@ -216,7 +216,7 @@ categories_weight = 44
``` ```
--- ---
title: foo title: foo
#tags: [ "a", "b", "c" ] tags: [ "a", "b", "c" ]
tags_weight: 22 tags_weight: 22
categories: ["d"] categories: ["d"]
categories_weight: 44 categories_weight: 44

View file

@ -43,7 +43,7 @@ permalinks:
post = "/:year/:month/:title/" post = "/:year/:month/:title/"
{{< /code >}} {{< /code >}}
Only the content under `post/` will have the new URL structure. For example, the file `content/post/sample-entry.md` with `date: 2017-02-27T19:20:00-05:00` in its front matter will render to `public/2017/02/sample-entry/index.html` at build time and therefore be reachable at `http://example.com/2013/11/sample-entry/`. Only the content under `post/` will have the new URL structure. For example, the file `content/post/sample-entry.md` with `date: 2017-02-27T19:20:00-05:00` in its front matter will render to `public/2017/02/sample-entry/index.html` at build time and therefore be reachable at `https://example.com/2013/11/sample-entry/`.
### Permalink Configuration Values ### Permalink Configuration Values
@ -147,11 +147,11 @@ Assuming a `baseURL` of `example.com`, the contents of the auto-generated alias
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>http://example.com/posts/my-intended-url</title> <title>https://example.com/posts/my-intended-url</title>
<link rel="canonical" href="http://example.com/posts/my-intended-url"/> <link rel="canonical" href="https://example.com/posts/my-intended-url"/>
<meta name=\"robots\" content=\"noindex\"> <meta name=\"robots\" content=\"noindex\">
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta http-equiv="refresh" content="0; url=http://example.com/posts/my-intended-url"/> <meta http-equiv="refresh" content="0; url=https://example.com/posts/my-intended-url"/>
</head> </head>
</html> </html>
``` ```
@ -190,7 +190,7 @@ content/posts/post-1.md
## Ugly URLs ## Ugly URLs
If you would like to have are often referred to as "ugly URLs" (e.g., example.com/urls.html), set `uglyurls = true` or `uglyurls: true` in your site's `config.toml` or `config.yaml`, respectively. You can also use the `--uglyURLs=true` [flag from the command line][usage] with `hugo` or `hugo server`.. If you would like to have what are often referred to as "ugly URLs" (e.g., example.com/urls.html), set `uglyurls = true` or `uglyurls: true` in your site's `config.toml` or `config.yaml`, respectively. You can also use the `--uglyURLs=true` [flag from the command line][usage] with `hugo` or `hugo server`..
If you want a specific piece of content to have an exact URL, you can specify this in the [front matter][] under the `url` key. The following are examples of the same content directory and what the eventual URL structure will be when Hugo runs with its default behavior. If you want a specific piece of content to have an exact URL, you can specify this in the [front matter][] under the `url` key. The following are examples of the same content directory and what the eventual URL structure will be when Hugo runs with its default behavior.
@ -200,15 +200,15 @@ See [Content Organization][contentorg] for more details on paths.
. .
└── content └── content
└── about └── about
| └── _index.md // <- http://example.com/about/ | └── _index.md // <- https://example.com/about/
├── post ├── post
| ├── firstpost.md // <- http://example.com/post/firstpost/ | ├── firstpost.md // <- https://example.com/post/firstpost/
| ├── happy | ├── happy
| | └── ness.md // <- http://example.com/post/happy/ness/ | | └── ness.md // <- https://example.com/post/happy/ness/
| └── secondpost.md // <- http://example.com/post/secondpost/ | └── secondpost.md // <- https://example.com/post/secondpost/
└── quote └── quote
├── first.md // <- http://example.com/quote/first/ ├── first.md // <- https://example.com/quote/first/
└── second.md // <- http://example.com/quote/second/ └── second.md // <- https://example.com/quote/second/
``` ```
Here's the same organization run with `hugo --uglyURLs`: Here's the same organization run with `hugo --uglyURLs`:
@ -217,15 +217,15 @@ Here's the same organization run with `hugo --uglyURLs`:
. .
└── content └── content
└── about └── about
| └── _index.md // <- http://example.com/about/index.html | └── _index.md // <- https://example.com/about/index.html
├── post ├── post
| ├── firstpost.md // <- http://example.com/post/firstpost.html | ├── firstpost.md // <- https://example.com/post/firstpost.html
| ├── happy | ├── happy
| | └── ness.md // <- http://example.com/post/happy/ness.html | | └── ness.md // <- https://example.com/post/happy/ness.html
| └── secondpost.md // <- http://example.com/post/secondpost.html | └── secondpost.md // <- https://example.com/post/secondpost.html
└── quote └── quote
├── first.md // <- http://example.com/quote/first.html ├── first.md // <- https://example.com/quote/first.html
└── second.md // <- http://example.com/quote/second.html └── second.md // <- https://example.com/quote/second.html
``` ```
@ -233,7 +233,7 @@ Here's the same organization run with `hugo --uglyURLs`:
By default, all relative URLs encountered in the input are left unmodified, e.g. `/css/foo.css` would stay as `/css/foo.css`. The `canonifyURLs` field in your site `config` has a default value of `false`. By default, all relative URLs encountered in the input are left unmodified, e.g. `/css/foo.css` would stay as `/css/foo.css`. The `canonifyURLs` field in your site `config` has a default value of `false`.
By setting `canonifyURLs` to `true`, all relative URLs would instead be *canonicalized* using `baseURL`. For example, assuming you have `baseURL = https://example.com/`, the relative URL `/css/foo.css` would be turned into the absolute URL `http://example.com/css/foo.css`. By setting `canonifyURLs` to `true`, all relative URLs would instead be *canonicalized* using `baseURL`. For example, assuming you have `baseURL = https://example.com/`, the relative URL `/css/foo.css` would be turned into the absolute URL `https://example.com/css/foo.css`.
Benefits of canonicalization include fixing all URLs to be absolute, which may aid with some parsing tasks. Note, however, that all modern browsers handle this on the client without issue. Benefits of canonicalization include fixing all URLs to be absolute, which may aid with some parsing tasks. Note, however, that all modern browsers handle this on the client without issue.

View file

@ -139,6 +139,12 @@ So, let's clone that master repository:
go get -v -u github.com/gohugoio/hugo go get -v -u github.com/gohugoio/hugo
``` ```
Hugo relies on [Testify](https://github.com/stretchr/testify) for testing Go code. If you don't already have it, get the Testify testing tools:
```
go get github.com/stretchr/testify
```
### Fork the repository ### Fork the repository
If you're not fimiliar with this term, GitHub's [help pages](https://help.github.com/articles/fork-a-repo/) provide again a simple explanation: If you're not fimiliar with this term, GitHub's [help pages](https://help.github.com/articles/fork-a-repo/) provide again a simple explanation:

View file

@ -64,7 +64,7 @@ name = ""
license = "MIT" license = "MIT"
licenselink = "https://github.com/<YOURNAME>/<YOURTHEME>/blob/master/LICENSE.md" licenselink = "https://github.com/<YOURNAME>/<YOURTHEME>/blob/master/LICENSE.md"
description = "" description = ""
homepage = "http://example.com/" homepage = "https://example.com/"
tags = [] tags = []
features = [] features = []
min_version = 0.19 min_version = 0.19

View file

@ -20,9 +20,9 @@ aliases: []
Both `absLangURL` and [`relLangURL`](/functions/rellangurl/) are similar to their [`absURL`](/functions/absurl/) and [`relURL`](/functions/relurl) relatives but will add the correct language prefix when the site is configured with more than one language. Both `absLangURL` and [`relLangURL`](/functions/rellangurl/) are similar to their [`absURL`](/functions/absurl/) and [`relURL`](/functions/relurl) relatives but will add the correct language prefix when the site is configured with more than one language.
So for a site `baseURL` set to `http://example.com/hugo/` and the current language is `en`: So for a site `baseURL` set to `https://example.com/hugo/` and the current language is `en`:
``` ```
{{ "blog/" | absLangURL }} → "http://example.com/hugo/en/blog/" {{ "blog/" | absLangURL }} → "https://example.com/hugo/en/blog/"
{{ "blog/" | relLangURL }} → "/hugo/en/blog/" {{ "blog/" | relLangURL }} → "/hugo/en/blog/"
``` ```

View file

@ -18,10 +18,10 @@ deprecated: false
aliases: [] aliases: []
--- ---
Both `absURL` and `relURL` consider the configured value of `baseURL` in your site's [`config` file][configuration]. Given a `baseURL` set to `http://example.com/hugo/`: Both `absURL` and `relURL` consider the configured value of `baseURL` in your site's [`config` file][configuration]. Given a `baseURL` set to `https://example.com/hugo/`:
``` ```
{{ "mystyle.css" | absURL }} → "http://example.com/hugo/mystyle.css" {{ "mystyle.css" | absURL }} → "https://example.com/hugo/mystyle.css"
{{ "mystyle.css" | relURL }} → "/hugo/mystyle.css" {{ "mystyle.css" | relURL }} → "/hugo/mystyle.css"
{{ "http://gohugo.io/" | relURL }} → "http://gohugo.io/" {{ "http://gohugo.io/" | relURL }} → "http://gohugo.io/"
{{ "http://gohugo.io/" | absURL }} → "http://gohugo.io/" {{ "http://gohugo.io/" | absURL }} → "http://gohugo.io/"

View file

@ -38,7 +38,7 @@ You can also use the `add` function with strings. You may like this functionalit
For example, social media sharing with [Twitter Cards][cards] requires the following `meta` link in your site's `<head>` to display Twitter's ["Summary Card with Large Image"][twtsummary]: For example, social media sharing with [Twitter Cards][cards] requires the following `meta` link in your site's `<head>` to display Twitter's ["Summary Card with Large Image"][twtsummary]:
``` ```
<meta name="twitter:image" content="http://example.com/images/my-twitter-image.jpg"> <meta name="twitter:image" content="https://example.com/images/my-twitter-image.jpg">
``` ```
Let's assume you have an `image` field in the front matter of each of your content files: Let's assume you have an `image` field in the front matter of each of your content files:

View file

@ -20,10 +20,10 @@ aliases: []
`absLangURL` and `relLangURL` functions are similar to their [`absURL`](/functions/absurl/) and [`relURL`](/functions/relurl/) relatives but will add the correct language prefix when the site is configured with more than one language. (See [Configuring Multilingual][multiliconfig].) `absLangURL` and `relLangURL` functions are similar to their [`absURL`](/functions/absurl/) and [`relURL`](/functions/relurl/) relatives but will add the correct language prefix when the site is configured with more than one language. (See [Configuring Multilingual][multiliconfig].)
So for a site `baseURL` set to `http://example.com/hugo/` and the current language is `en`: So for a site `baseURL` set to `https://example.com/hugo/` and the current language is `en`:
``` ```
{{ "blog/" | absLangURL }} → "http://example.com/hugo/en/blog/" {{ "blog/" | absLangURL }} → "https://example.com/hugo/en/blog/"
{{ "blog/" | relLangURL }} → "/hugo/en/blog/" {{ "blog/" | relLangURL }} → "/hugo/en/blog/"
``` ```

View file

@ -18,10 +18,10 @@ deprecated: false
aliases: [] aliases: []
--- ---
Both `absURL` and `relURL` consider the configured value of `baseURL` in your site's [`config` file][configuration]. Given a `baseURL` set to `http://example.com/hugo/`: Both `absURL` and `relURL` consider the configured value of `baseURL` in your site's [`config` file][configuration]. Given a `baseURL` set to `https://example.com/hugo/`:
``` ```
{{ "mystyle.css" | absURL }} → "http://example.com/hugo/mystyle.css" {{ "mystyle.css" | absURL }} → "https://example.com/hugo/mystyle.css"
{{ "mystyle.css" | relURL }} → "/hugo/mystyle.css" {{ "mystyle.css" | relURL }} → "/hugo/mystyle.css"
{{ "http://gohugo.io/" | relURL }} → "http://gohugo.io/" {{ "http://gohugo.io/" | relURL }} → "http://gohugo.io/"
{{ "http://gohugo.io/" | absURL }} → "http://gohugo.io/" {{ "http://gohugo.io/" | absURL }} → "http://gohugo.io/"

View file

@ -23,3 +23,11 @@ aliases: []
``` ```
{{title "BatMan"}}` → "Batman" {{title "BatMan"}}` → "Batman"
``` ```
Can be combined in pipes. In the following snippet, the link text is cleaned up using `humanize` to remove dashes and `title` to convert the value of `$name` to Intial Caps.
```
{{ range $name, $items := .Site.Taxonomies.categories }}
<li><a href="{{ printf "%s/%s" "categories" ($name | urlize | lower) | absURL }}">{{ $name | humanize | title }} ({{ len $items }})</a></li>
{{ end }}
```

View file

@ -118,7 +118,7 @@ Your new site already looks great, but you will want to tweak it a little before
Open up `config.toml` in a text editor: Open up `config.toml` in a text editor:
``` ```
baseURL = "http://example.org/" baseURL = "https://example.org/"
languageCode = "en-us" languageCode = "en-us"
title = "My New Hugo Site" title = "My New Hugo Site"
theme = "ananke" theme = "ananke"

View file

@ -26,7 +26,7 @@ A [media type][] (also known as *MIME type* and *content type*) is a two-part id
This is the full set of built-in media types in Hugo: This is the full set of built-in media types in Hugo:
{{< datatable "media" "types" "Type" "Suffix" >}} {{< datatable "media" "types" "type" "suffix" >}}
**Note:** **Note:**
@ -55,7 +55,7 @@ Given a media type and some additional configuration, you get an `Output Format`
This is the full set of Hugo's built-in output formats: This is the full set of Hugo's built-in output formats:
{{< datatable "output" "formats" "Name" "MediaType" "Path" "BaseName" "Rel" "Protocol" "IsPlainText" "IsHTML" "NoUgly">}} {{< datatable "output" "formats" "name" "mediaType" "path" "baseName" "rel" "protocol" "isPlainText" "isHTML" "noUgly">}}
* A page can be output in as many output formats as you want, and you can have an infinite amount of output formats defined **as long as they resolve to a unique path on the file system**. In the above table, the best example of this is `AMP` vs. `HTML`. `AMP` has the value `amp` for `Path` so it doesn't overwrite the `HTML` version; e.g. we can now have both `/index.html` and `/amp/index.html`. * A page can be output in as many output formats as you want, and you can have an infinite amount of output formats defined **as long as they resolve to a unique path on the file system**. In the above table, the best example of this is `AMP` vs. `HTML`. `AMP` has the value `amp` for `Path` so it doesn't overwrite the `HTML` version; e.g. we can now have both `/index.html` and `/amp/index.html`.
* The `MediaType` must match the `Type` of an already defined media type. * The `MediaType` must match the `Type` of an already defined media type.
@ -71,40 +71,40 @@ isPlainText = true
protocol = "bep://" protocol = "bep://"
``` ```
The above example is fictional, but if used for the homepage on a site with `baseURL` `http://example.org`, it will produce a plain text homepage with the URL `bep://example.org/myindex.enr`. The above example is fictional, but if used for the homepage on a site with `baseURL` `https://example.org`, it will produce a plain text homepage with the URL `bep://example.org/myindex.enr`.
### Configure Output Formats ### Configure Output Formats
The following is the full list of configuration options for output formats and their default values: The following is the full list of configuration options for output formats and their default values:
`Name` `name`
: the output format identifier. This is used to define what output format(s) you want for your pages. : the output format identifier. This is used to define what output format(s) you want for your pages.
`MediaType` `mediaType`
: this must match the `Type` of a defined media type. : this must match the `Type` of a defined media type.
`Path` `path`
: sub path to save the output files. : sub path to save the output files.
`BaseName` `baseName`
: the base filename for the list filenames (homepage, etc.). **Default:** `index`. : the base filename for the list filenames (homepage, etc.). **Default:** `index`.
`Rel` `rel`
: can be used to create `rel` values in `link` tags. **Default:** `alternate`. : can be used to create `rel` values in `link` tags. **Default:** `alternate`.
`Protocol` `protocol`
: will replace the "http://" or "https://" in your `baseURL` for this output format. : will replace the "http://" or "https://" in your `baseURL` for this output format.
`IsPlainText` `isPlainText`
: use Go's plain text templates parser for the templates. **Default:** `false`. : use Go's plain text templates parser for the templates. **Default:** `false`.
`IsHTML` `isHTML`
: used in situations only relevant for `HTML`-type formats; e.g., page aliases. : used in situations only relevant for `HTML`-type formats; e.g., page aliases.
`NoUgly` `noUgly`
: used to turn off ugly URLs If `uglyURLs` is set to `true` in your site. **Default:** `false`. : used to turn off ugly URLs If `uglyURLs` is set to `true` in your site. **Default:** `false`.
`NotAlternative` `notAlternative`
: enable if it doesn't make sense to include this format in an `AlternativeOutputFormats` format listing on `Page` (e.g., with `CSS`). Note that we use the term *alternative* and not *alternate* here, as it does not necessarily replace the other format. **Default:** `false`. : enable if it doesn't make sense to include this format in an `AlternativeOutputFormats` format listing on `Page` (e.g., with `CSS`). Note that we use the term *alternative* and not *alternate* here, as it does not necessarily replace the other format. **Default:** `false`.
## Output Formats for Pages ## Output Formats for Pages

View file

@ -84,24 +84,26 @@ This is the default RSS template that ships with Hugo. It adheres to the [RSS 2.
``` ```
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}</title> <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<description>Recent content {{ with .Title }}in {{.}} {{ end }}on {{ .Site.Title }}</description> <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }} <language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
<atom:link href="{{.URL}}" rel="self" type="application/rss+xml" /> {{ with .OutputFormats.Get "RSS" }}
{{ range first 15 .Data.Pages }} {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{ range .Data.Pages }}
<item> <item>
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid> <guid>{{ .Permalink }}</guid>
<description>{{ .Content | html }}</description> <description>{{ .Summary | html }}</description>
</item> </item>
{{ end }} {{ end }}
</channel> </channel>

View file

@ -179,7 +179,7 @@ Any other value defined in the front matter in a content file, including taxonom
title: My First Post title: My First Post
date: date: 2017-02-20T15:26:23-06:00 date: date: 2017-02-20T15:26:23-06:00
categories: [one] categories: [one]
#tags: [two,three,four] tags: [two,three,four]
``` ```
With the above front matter, the `tags` and `categories` taxonomies are accessible via the following: With the above front matter, the `tags` and `categories` taxonomies are accessible via the following:

View file

@ -109,7 +109,7 @@ The following is a list of site-level (aka "global") variables. Many of these va
The following `config.toml` defines a site-wide param for `description`: The following `config.toml` defines a site-wide param for `description`:
``` ```
baseURL = "http://yoursite.example.com/" baseURL = "https://yoursite.example.com/"
[params] [params]
description = "Tesla's Awesome Hugo Site" description = "Tesla's Awesome Hugo Site"

View file

@ -2,76 +2,76 @@
"media": { "media": {
"types": [ "types": [
{ {
"Type": "application/javascript", "type": "application/javascript",
"String": "application/javascript+js", "string": "application/javascript+js",
"MainType": "application", "mainType": "application",
"SubType": "javascript", "subType": "javascript",
"Suffix": "js", "suffix": "js",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "application/json", "type": "application/json",
"String": "application/json+json", "string": "application/json+json",
"MainType": "application", "mainType": "application",
"SubType": "json", "subType": "json",
"Suffix": "json", "suffix": "json",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "application/rss", "type": "application/rss",
"String": "application/rss+xml", "string": "application/rss+xml",
"MainType": "application", "mainType": "application",
"SubType": "rss", "subType": "rss",
"Suffix": "xml", "suffix": "xml",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "application/xml", "type": "application/xml",
"String": "application/xml+xml", "string": "application/xml+xml",
"MainType": "application", "mainType": "application",
"SubType": "xml", "subType": "xml",
"Suffix": "xml", "suffix": "xml",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "text/calendar", "type": "text/calendar",
"String": "text/calendar+ics", "string": "text/calendar+ics",
"MainType": "text", "mainType": "text",
"SubType": "calendar", "subType": "calendar",
"Suffix": "ics", "suffix": "ics",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "text/css", "type": "text/css",
"String": "text/css+css", "string": "text/css+css",
"MainType": "text", "mainType": "text",
"SubType": "css", "subType": "css",
"Suffix": "css", "suffix": "css",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "text/csv", "type": "text/csv",
"String": "text/csv+csv", "string": "text/csv+csv",
"MainType": "text", "mainType": "text",
"SubType": "csv", "subType": "csv",
"Suffix": "csv", "suffix": "csv",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "text/html", "type": "text/html",
"String": "text/html+html", "string": "text/html+html",
"MainType": "text", "mainType": "text",
"SubType": "html", "subType": "html",
"Suffix": "html", "suffix": "html",
"Delimiter": "." "delimiter": "."
}, },
{ {
"Type": "text/plain", "type": "text/plain",
"String": "text/plain+txt", "string": "text/plain+txt",
"MainType": "text", "mainType": "text",
"SubType": "plain", "subType": "plain",
"Suffix": "txt", "suffix": "txt",
"Delimiter": "." "delimiter": "."
} }
] ]
}, },
@ -79,87 +79,143 @@
"formats": [ "formats": [
{ {
"MediaType": "text/html+html", "MediaType": "text/html+html",
"Name": "AMP", "name": "AMP",
"Path": "amp", "mediaType": {
"BaseName": "index", "type": "text/html",
"Rel": "amphtml", "string": "text/html+html",
"Protocol": "", "mainType": "text",
"IsPlainText": false, "subType": "html",
"IsHTML": true, "suffix": "html",
"NoUgly": false, "delimiter": "."
"NotAlternative": false },
"path": "amp",
"baseName": "index",
"rel": "amphtml",
"protocol": "",
"isPlainText": false,
"isHTML": true,
"noUgly": false,
"notAlternative": false
}, },
{ {
"MediaType": "text/css+css", "MediaType": "text/css+css",
"Name": "CSS", "name": "CSS",
"Path": "", "mediaType": {
"BaseName": "styles", "type": "text/css",
"Rel": "stylesheet", "string": "text/css+css",
"Protocol": "", "mainType": "text",
"IsPlainText": true, "subType": "css",
"IsHTML": false, "suffix": "css",
"NoUgly": false, "delimiter": "."
"NotAlternative": true },
"path": "",
"baseName": "styles",
"rel": "stylesheet",
"protocol": "",
"isPlainText": true,
"isHTML": false,
"noUgly": false,
"notAlternative": true
}, },
{ {
"MediaType": "text/csv+csv", "MediaType": "text/csv+csv",
"Name": "CSV", "name": "CSV",
"Path": "", "mediaType": {
"BaseName": "index", "type": "text/csv",
"Rel": "alternate", "string": "text/csv+csv",
"Protocol": "", "mainType": "text",
"IsPlainText": true, "subType": "csv",
"IsHTML": false, "suffix": "csv",
"NoUgly": false, "delimiter": "."
"NotAlternative": false },
"path": "",
"baseName": "index",
"rel": "alternate",
"protocol": "",
"isPlainText": true,
"isHTML": false,
"noUgly": false,
"notAlternative": false
}, },
{ {
"MediaType": "text/calendar+ics", "MediaType": "text/calendar+ics",
"Name": "Calendar", "name": "Calendar",
"Path": "", "mediaType": {
"BaseName": "index", "type": "text/calendar",
"Rel": "alternate", "string": "text/calendar+ics",
"Protocol": "webcal://", "mainType": "text",
"IsPlainText": true, "subType": "calendar",
"IsHTML": false, "suffix": "ics",
"NoUgly": false, "delimiter": "."
"NotAlternative": false },
"path": "",
"baseName": "index",
"rel": "alternate",
"protocol": "webcal://",
"isPlainText": true,
"isHTML": false,
"noUgly": false,
"notAlternative": false
}, },
{ {
"MediaType": "text/html+html", "MediaType": "text/html+html",
"Name": "HTML", "name": "HTML",
"Path": "", "mediaType": {
"BaseName": "index", "type": "text/html",
"Rel": "canonical", "string": "text/html+html",
"Protocol": "", "mainType": "text",
"IsPlainText": false, "subType": "html",
"IsHTML": true, "suffix": "html",
"NoUgly": false, "delimiter": "."
"NotAlternative": false },
"path": "",
"baseName": "index",
"rel": "canonical",
"protocol": "",
"isPlainText": false,
"isHTML": true,
"noUgly": false,
"notAlternative": false
}, },
{ {
"MediaType": "application/json+json", "MediaType": "application/json+json",
"Name": "JSON", "name": "JSON",
"Path": "", "mediaType": {
"BaseName": "index", "type": "application/json",
"Rel": "alternate", "string": "application/json+json",
"Protocol": "", "mainType": "application",
"IsPlainText": true, "subType": "json",
"IsHTML": false, "suffix": "json",
"NoUgly": false, "delimiter": "."
"NotAlternative": false },
"path": "",
"baseName": "index",
"rel": "alternate",
"protocol": "",
"isPlainText": true,
"isHTML": false,
"noUgly": false,
"notAlternative": false
}, },
{ {
"MediaType": "application/rss+xml", "MediaType": "application/rss+xml",
"Name": "RSS", "name": "RSS",
"Path": "", "mediaType": {
"BaseName": "index", "type": "application/rss",
"Rel": "alternate", "string": "application/rss+xml",
"Protocol": "", "mainType": "application",
"IsPlainText": false, "subType": "rss",
"IsHTML": false, "suffix": "xml",
"NoUgly": true, "delimiter": "."
"NotAlternative": false },
"path": "",
"baseName": "index",
"rel": "alternate",
"protocol": "",
"isPlainText": false,
"isHTML": false,
"noUgly": true,
"notAlternative": false
} }
], ],
"layouts": [ "layouts": [