--- /dev/null
- : a map of Front Matter keys whose values are passed down to the page's descendents unless overwritten by self or a closer ancestor's cascade. See [Front Matter Cascade](#front-matter-cascade) for details.
+---
+title: Front Matter
+linktitle:
+description: Hugo allows you to add front matter in yaml, toml, or json to your content files.
+date: 2017-01-09
+publishdate: 2017-01-09
+lastmod: 2017-02-24
+categories: [content management]
+keywords: ["front matter", "yaml", "toml", "json", "metadata", "archetypes"]
+menu:
+ docs:
+ parent: "content-management"
+ weight: 30
+weight: 30 #rem
+draft: false
+aliases: [/content/front-matter/]
+toc: true
+---
+
+**Front matter** allows you to keep metadata attached to an instance of a [content type][]---i.e., embedded inside a content file---and is one of the many features that gives Hugo its strength.
+
+{{< youtube Yh2xKRJGff4 >}}
+
+## Front Matter Formats
+
+Hugo supports four formats for front matter, each with their own identifying tokens.
+
+TOML
+: identified by opening and closing `+++`.
+
+YAML
+: identified by opening and closing `---`.
+
+JSON
+: a single JSON object surrounded by '`{`' and '`}`', followed by a new line.
+
+ORG
+: a group of Org mode keywords in the format '`#+KEY: VALUE`'. Any line that does not start with `#+` ends the front matter section.
+ Keyword values can be either strings (`#+KEY: VALUE`) or a whitespace separated list of strings (`#+KEY[]: VALUE_1 VALUE_2`).
+
+### Example
+
+{{< code-toggle >}}
+title = "spf13-vim 3.0 release and new website"
+description = "spf13-vim is a cross platform distribution of vim plugins and resources for Vim."
+tags = [ ".vimrc", "plugins", "spf13-vim", "vim" ]
+date = "2012-04-06"
+categories = [
+ "Development",
+ "VIM"
+]
+slug = "spf13-vim-3-0-release-and-new-website"
+{{< /code-toggle >}}
+
+## Front Matter Variables
+
+### Predefined
+
+There are a few predefined variables that Hugo is aware of. See [Page Variables][pagevars] for how to call many of these predefined variables in your templates.
+
+aliases
+: an array of one or more aliases (e.g., old published paths of renamed content) that will be created in the output directory structure . See [Aliases][aliases] for details.
+
+audio
+: an array of paths to audio files related to the page; used by the `opengraph` [internal template](/templates/internal) to populate `og:audio`.
+
+cascade
- : the full path to the content from the web root. It makes no assumptions about the path of the content file. It also ignores any language prefixes of
- the multilingual feature.
++: a map of Front Matter keys whose values are passed down to the page's descendants unless overwritten by self or a closer ancestor's cascade. See [Front Matter Cascade](#front-matter-cascade) for details.
+
+date
+: the datetime assigned to this page. This is usually fetched from the `date` field in front matter, but this behaviour is configurable.
+
+description
+: the description for the content.
+
+draft
+: if `true`, the content will not be rendered unless the `--buildDrafts` flag is passed to the `hugo` command.
+
+expiryDate
+: the datetime at which the content should no longer be published by Hugo; expired content will not be rendered unless the `--buildExpired` flag is passed to the `hugo` command.
+
+headless
+: if `true`, sets a leaf bundle to be [headless][headless-bundle].
+
+images
+: an array of paths to images related to the page; used by [internal templates](/templates/internal) such as `_internal/twitter_cards.html`.
+
+isCJKLanguage
+: if `true`, Hugo will explicitly treat the content as a CJK language; both `.Summary` and `.WordCount` work properly in CJK languages.
+
+keywords
+: the meta keywords for the content.
+
+layout
+: the layout Hugo should select from the [lookup order][lookup] when rendering the content. If a `type` is not specified in the front matter, Hugo will look for the layout of the same name in the layout directory that corresponds with a content's section. See ["Defining a Content Type"][definetype]
+
+lastmod
+: the datetime at which the content was last modified.
+
+linkTitle
+: used for creating links to content; if set, Hugo defaults to using the `linktitle` before the `title`. Hugo can also [order lists of content by `linktitle`][bylinktitle].
+
+markup
+: **experimental**; specify `"rst"` for reStructuredText (requires`rst2html`) or `"md"` (default) for Markdown.
+
+outputs
+: allows you to specify output formats specific to the content. See [output formats][outputs].
+
+publishDate
+: if in the future, content will not be rendered unless the `--buildFuture` flag is passed to `hugo`.
+
+resources
+: used for configuring page bundle resources. See [Page Resources][page-resources].
+
+series
+: an array of series this page belongs to, as a subset of the `series` [taxonomy](/content-management/taxonomies/); used by the `opengraph` [internal template](/templates/internal) to populate `og:see_also`.
+
+slug
+: appears as the tail of the output URL. A value specified in front matter will override the segment of the URL based on the filename.
+
+summary
+: text used when providing a summary of the article in the `.Summary` page variable; details available in the [content-summaries](/content-management/summaries/) section.
+
+title
+: the title for the content.
+
+type
+: the type of the content; this value will be automatically derived from the directory (i.e., the [section][]) if not specified in front matter.
+
+url
- Any node or section can pass down to descendents a set of Front Matter values as long as defined underneath the reserved `cascade` Front Matter key.
++: the full path to the content from the web root. It makes no assumptions about the path of the content file. See [URL Management](/content-management/urls/#set-url-in-front-matter).
+
+videos
+: an array of paths to videos related to the page; used by the `opengraph` [internal template](/templates/internal) to populate `og:video`.
+
+weight
+: used for [ordering your content in lists][ordering]. Lower weight gets higher precedence. So content with lower weight will come first. If set, weights should be non-zero, as 0 is interpreted as an *unset* weight.
+
+\<taxonomies\>
+: field name of the *plural* form of the index. See `tags` and `categories` in the above front matter examples. _Note that the plural form of user-defined taxonomies cannot be the same as any of the predefined front matter variables._
+
+{{% note "Hugo's Default URL Destinations" %}}
+If neither `slug` nor `url` is present and [permalinks are not configured otherwise in your site `config` file](/content-management/urls/#permalinks), Hugo will use the filename of your content to create the output URL. See [Content Organization](/content-management/organization) for an explanation of paths in Hugo and [URL Management](/content-management/urls/) for ways to customize Hugo's default behaviors.
+{{% /note %}}
+
+### User-Defined
+
+You can add fields to your front matter arbitrarily to meet your needs. These user-defined key-values are placed into a single `.Params` variable for use in your templates.
+
+The following fields can be accessed via `.Params.include_toc` and `.Params.show_comments`, respectively. The [Variables][] section provides more information on using Hugo's page- and site-level variables in your templates.
+
+{{< code-toggle copy="false" >}}
+include_toc: true
+show_comments: false
+{{</ code-toggle >}}
+
+## Front Matter Cascade
+
- With the above example the Blog section page and its descendents will return `images/typewriter.jpg` when `.Params.banner` is invoked unless:
++Any node or section can pass down to descendants a set of Front Matter values as long as defined underneath the reserved `cascade` Front Matter key.
+
+### Target Specific Pages
+
+{{< new-in "0.76.0" >}}
+
+Since Hugo 0.76 the `cascade` block can be a slice with a optional `_target` keyword, allowing for multiple `cascade` values targeting different page sets.
+
+{{< code-toggle copy="false" >}}
+title ="Blog"
+[[cascade]]
+background = "yosemite.jpg"
+[cascade._target]
+path="/blog/**"
+lang="en"
+kind="page"
+[[cascade]]
+background = "goldenbridge.jpg"
+[cascade._target]
+kind="section"
+{{</ code-toggle >}}
+
+Keywords available for `_target`:
+
+path
+: A [Glob](https://github.com/gobwas/glob) pattern matching the content path below /content. Expects Unix-styled slashes. Note that this is the virtual path, so it starts at the mount root. The matching support double-asterisks so you can match for patterns like `/blog/*/**` to match anything from the third level and down.
+
+kind
+: The Page's Kind, e.g. "section".
+
+lang
+: A Glob pattern matching the Page's language, e.g. "{en,sv}".
+
+Any of the above can be omitted.
+
+### Example
+
+In `content/blog/_index.md`
+
+{{< code-toggle copy="false" >}}
+title: Blog
+cascade:
+ banner: images/typewriter.jpg
+{{</ code-toggle >}}
+
- - Said descendent has its own `banner` value set
++With the above example the Blog section page and its descendants will return `images/typewriter.jpg` when `.Params.banner` is invoked unless:
+
++- Said descendant has its own `banner` value set
+- Or a closer ancestor node has its own `cascade.banner` value set.
+
+
+
+## Order Content Through Front Matter
+
+You can assign content-specific `weight` in the front matter of your content. These values are especially useful for [ordering][ordering] in list views. You can use `weight` for ordering of content and the convention of [`<TAXONOMY>_weight`][taxweight] for ordering content within a taxonomy. See [Ordering and Grouping Hugo Lists][lists] to see how `weight` can be used to organize your content in list views.
+
+## Override Global Markdown Configuration
+
+It's possible to set some options for Markdown rendering in a content's front matter as an override to the [BlackFriday rendering options set in your project configuration][config].
+
+## Front Matter Format Specs
+
+* [TOML Spec][toml]
+* [YAML Spec][yaml]
+* [JSON Spec][json]
+
+[variables]: /variables/
+[aliases]: /content-management/urls/#aliases
+[archetype]: /content-management/archetypes/
+[bylinktitle]: /templates/lists/#by-link-title
+[config]: /getting-started/configuration/ "Hugo documentation for site configuration"
+[content type]: /content-management/types/
+[contentorg]: /content-management/organization/
+[definetype]: /content-management/types/#defining-a-content-type "Learn how to specify a type and a layout in a content's front matter"
+[headless-bundle]: /content-management/page-bundles/#headless-bundle
+[json]: https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf "Specification for JSON, JavaScript Object Notation"
+[lists]: /templates/lists/#ordering-content "See how to order content in list pages; for example, templates that look to specific _index.md for content and front matter."
+[lookup]: /templates/lookup-order/ "Hugo traverses your templates in a specific order when rendering content to allow for DRYer templating."
+[ordering]: /templates/lists/ "Hugo provides multiple ways to sort and order your content in list templates"
+[outputs]: /templates/output-formats/ "With the release of v22, you can output your content to any text format using Hugo's familiar templating"
+[page-resources]: /content-management/page-resources/
+[pagevars]: /variables/page/
+[section]: /content-management/sections/
+[taxweight]: /content-management/taxonomies/
+[toml]: https://github.com/toml-lang/toml "Specification for TOML, Tom's Obvious Minimal Language"
+[urls]: /content-management/urls/
+[variables]: /variables/
+[yaml]: https://yaml.org/spec/ "Specification for YAML, YAML Ain't Markup Language"
--- /dev/null
- Valid values are `jpg`, `png`, `tif`, `bmp`, `gif` and `webp`.
+---
+title: "Image Processing"
+description: "Image Page resources can be resized and cropped."
+date: 2018-01-24T13:10:00-05:00
+linktitle: "Image Processing"
+categories: ["content management"]
+keywords: [resources, images]
+weight: 4004
+draft: false
+toc: true
+menu:
+ docs:
+ parent: "content-management"
+ weight: 32
+---
+
+## The Image Page Resource
+
+The `image` is a [Page Resource]({{< relref "/content-management/page-resources" >}}), and the processing methods listed below do not work on images inside your `/static` folder.
+
+To print all images paths in a [Page Bundle]({{< relref "/content-management/organization#page-bundles" >}}):
+
+```go-html-template
+{{ with .Resources.ByType "image" }}
+{{ range . }}
+{{ .RelPermalink }}
+{{ end }}
+{{ end }}
+
+```
+
+## The Image Resource
+
+The `image` resource can also be retrieved from a [global resource]({{< relref "/hugo-pipes/introduction#from-file-to-resource" >}})
+
+```go-html-template
+{{- $image := resources.Get "images/logo.jpg" -}}
+```
+
+## Image Processing Methods
+
+The `image` resource implements the `Resize`, `Fit`, `Fill`, and `Filter` methods, each returning a transformed image using the specified dimensions and processing options.
+
+{{% note %}}
+Metadata (EXIF, IPTC, XMP, etc.) is not preserved during image transformation. Use the [`Exif`](#exif) method with the _original_ image to extract EXIF metadata from JPEG or TIFF images.
+{{% /note %}}
+
+### Resize
+
+Resizes the image to the specified width and height.
+
+```go
+// Resize to a width of 600px and preserve ratio
+{{ $image := $resource.Resize "600x" }}
+
+// Resize to a height of 400px and preserve ratio
+{{ $image := $resource.Resize "x400" }}
+
+// Resize to a width 600px and a height of 400px
+{{ $image := $resource.Resize "600x400" }}
+```
+
+### Fit
+
+Scale down the image to fit the given dimensions while maintaining aspect ratio. Both height and width are required.
+
+```go
+{{ $image := $resource.Fit "600x400" }}
+```
+
+### Fill
+
+Resize and crop the image to match the given dimensions. Both height and width are required.
+
+```go
+{{ $image := $resource.Fill "600x400" }}
+```
+
+### Filter
+
+Apply one or more filters to your image. See [Image Filters](/functions/images/#image-filters) for a full list.
+
+```go-html-template
+{{ $img = $img.Filter (images.GaussianBlur 6) (images.Pixelate 8) }}
+```
+
+The above can also be written in a more functional style using pipes:
+
+```go-html-template
+{{ $img = $img | images.Filter (images.GaussianBlur 6) (images.Pixelate 8) }}
+```
+
+The filters will be applied in the given order.
+
+Sometimes it can be useful to create the filter chain once and then reuse it:
+
+```go-html-template
+{{ $filters := slice (images.GaussianBlur 6) (images.Pixelate 8) }}
+{{ $img1 = $img1.Filter $filters }}
+{{ $img2 = $img2.Filter $filters }}
+```
+
+### Exif
+
+Provides an [Exif](https://en.wikipedia.org/wiki/Exif) object with metadata about the image.
+
+Note that this is only supported for JPEG and TIFF images, so it's recommended to wrap the access with a `with`, e.g.:
+
+```go-html-template
+{{ with $img.Exif }}
+Date: {{ .Date }}
+Lat/Long: {{ .Lat}}/{{ .Long }}
+Tags:
+{{ range $k, $v := .Tags }}
+TAG: {{ $k }}: {{ $v }}
+{{ end }}
+{{ end }}
+```
+
+Or individually access EXIF data with dot access, e.g.:
+
+```go-html-template
+{{ with $src.Exif }}
+ <ul>
+ {{ with .Date }}<li>Date: {{ .Format "January 02, 2006" }}</li>{{ end }}
+ {{ with .Tags.ApertureValue }}<li>Aperture: {{ lang.NumFmt 2 . }}</li>{{ end }}
+ {{ with .Tags.BrightnessValue }}<li>Brightness: {{ lang.NumFmt 2 . }}</li>{{ end }}
+ {{ with .Tags.ExposureTime }}<li>Exposure Time: {{ . }}</li>{{ end }}
+ {{ with .Tags.FNumber }}<li>F Number: {{ . }}</li>{{ end }}
+ {{ with .Tags.FocalLength }}<li>Focal Length: {{ . }}</li>{{ end }}
+ {{ with .Tags.ISOSpeedRatings }}<li>ISO Speed Ratings: {{ . }}</li>{{ end }}
+ {{ with .Tags.LensModel }}<li>Lens Model: {{ . }}</li>{{ end }}
+ </ul>
+{{ end }}
+```
+
+Some fields may need to be formatted with [`lang.FormatNumberCustom`]({{< relref "functions/lang" >}}) function to prevent display like `Aperture: 2.278934289` instead of `Aperture: 2.28`.
+
+#### Exif fields
+
+Date
+: "photo taken" date/time
+
+Lat
+: "photo taken where", GPS latitude
+
+Long
+: "photo taken where", GPS longitude
+
+See [Image Processing Config](#image-processing-config) for how to configure what gets included in Exif.
+
+## Image Processing Options
+
+In addition to the dimensions (e.g. `600x400`), Hugo supports a set of additional image options.
+
+### Background Color
+
+The background color to fill into the transparency layer. This is mostly useful when converting to a format that does not support transparency, e.g. `JPEG`.
+
+You can set the background color to use with a 3 or 6 digit hex code starting with `#`.
+
+```go
+{{ $image.Resize "600x jpg #b31280" }}
+```
+
+For color codes, see https://www.google.com/search?q=color+picker
+
+**Note** that you also set a default background color to use, see [Image Processing Config](#image-processing-config).
+
+### JPEG and WebP Quality
+
+Only relevant for JPEG and WebP images, values 1 to 100 inclusive, higher is better. Default is 75.
+
+```go
+{{ $image.Resize "600x q50" }}
+```
+
+{{< new-in "0.83.0" >}} WebP support was added in Hugo 0.83.0.
+
+### Hint
+
+ {{< new-in "0.83.0" >}}
+
+ {{< new-in "0.83.0" >}}
+
+Hint about what type of image this is. Currently only used when encoding to WebP.
+
+Default value is `photo`.
+
+Valid values are `picture`, `photo`, `drawing`, `icon`, or `text`.
+
+```go
+{{ $image.Resize "600x webp drawing" }}
+```
+
+### Rotate
+
+Rotates an image by the given angle counter-clockwise. The rotation will be performed first to get the dimensions correct. The main use of this is to be able to manually correct for [EXIF orientation](https://github.com/golang/go/issues/4341) of JPEG images.
+
+```go
+{{ $image.Resize "600x r90" }}
+```
+
+### Anchor
+
+Only relevant for the `Fill` method. This is useful for thumbnail generation where the main motive is located in, say, the left corner.
+
+Valid values are `Smart`, `Center`, `TopLeft`, `Top`, `TopRight`, `Left`, `Right`, `BottomLeft`, `Bottom`, `BottomRight`.
+
+Default value is `Smart`, which uses [Smartcrop](https://github.com/muesli/smartcrop) to determine the best crop.
+
+```go
+{{ $image.Fill "300x200 BottomLeft" }}
+```
+
+### Resample Filter
+
+Filter used in resizing. Default is `Box`, a simple and fast resampling filter appropriate for downscaling.
+
+Examples are: `Box`, `NearestNeighbor`, `Linear`, `Gaussian`.
+
+See https://github.com/disintegration/imaging for more. If you want to trade quality for faster processing, this may be a option to test.
+
+```go
+{{ $image.Resize "600x400 Gaussian" }}
+```
+
+### Target Format
+
+By default the images is encoded in the source format, but you can set the target format as an option.
+
++Valid values are `bmp`, `gif`, `jpeg`, `jpg`, `png`, `tif`, `tiff`, and `webp`.
+
+```go
+{{ $image.Resize "600x jpg" }}
+```
+
+{{< new-in "0.83.0" >}} WebP support was added in Hugo 0.83.0.
+
+## Image Processing Examples
+
+_The photo of the sunset used in the examples below is Copyright [Bjørn Erik Pedersen](https://commons.wikimedia.org/wiki/User:Bep) (Creative Commons Attribution-Share Alike 4.0 International license)_
+
+{{< imgproc sunset Resize "300x" />}}
+
+{{< imgproc sunset Fill "90x120 left" />}}
+
+{{< imgproc sunset Fill "90x120 right" />}}
+
+{{< imgproc sunset Fit "90x90" />}}
+
+{{< imgproc sunset Resize "300x q10" />}}
+
+This is the shortcode used in the examples above:
+
+{{< code file="layouts/shortcodes/imgproc.html" >}}
+{{< readfile file="layouts/shortcodes/imgproc.html" >}}
+{{< /code >}}
+
+And it is used like this:
+
+```go-html-template
+{{</* imgproc sunset Resize "300x" /*/>}}
+```
+
+{{% note %}}
+**Tip:** Note the self-closing shortcode syntax above. The `imgproc` shortcode can be called both with and without **inner content**.
+{{% /note %}}
+
+## Image Processing Config
+
+You can configure an `imaging` section in `config.toml` with default image processing options:
+
+```toml
+[imaging]
+# Default resample filter used for resizing. Default is Box,
+# a simple and fast averaging filter appropriate for downscaling.
+# See https://github.com/disintegration/imaging
+resampleFilter = "box"
+
+# Default JPEG or WebP quality setting. Default is 75.
+quality = 75
+
+# Default hint about what type of image. Currently only used for WebP encoding.
+# Default is "photo".
+# Valid values are "picture", "photo", "drawing", "icon", or "text".
+hint = "photo"
+
+# Anchor used when cropping pictures.
+# Default is "smart" which does Smart Cropping, using https://github.com/muesli/smartcrop
+# Smart Cropping is content aware and tries to find the best crop for each image.
+# Valid values are Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight
+anchor = "smart"
+
+# Default background color.
+# Hugo will preserve transparency for target formats that supports it,
+# but will fall back to this color for JPEG.
+# Expects a standard HEX color string with 3 or 6 digits.
+# See https://www.google.com/search?q=color+picker
+bgColor = "#ffffff"
+
+[imaging.exif]
+ # Regexp matching the fields you want to Exclude from the (massive) set of Exif info
+# available. As we cache this info to disk, this is for performance and
+# disk space reasons more than anything.
+# If you want it all, put ".*" in this config setting.
+# Note that if neither this or ExcludeFields is set, Hugo will return a small
+# default set.
+includeFields = ""
+
+# Regexp matching the Exif fields you want to exclude. This may be easier to use
+# than IncludeFields above, depending on what you want.
+excludeFields = ""
+
+# Hugo extracts the "photo taken" date/time into .Date by default.
+# Set this to true to turn it off.
+disableDate = false
+
+# Hugo extracts the "photo taken where" (GPS latitude and longitude) into
+# .Long and .Lat. Set this to true to turn it off.
+disableLatLong = false
+```
+
+## Smart Cropping of Images
+
+By default, Hugo will use [Smartcrop](https://github.com/muesli/smartcrop), a library created by [muesli](https://github.com/muesli), when cropping images with `.Fill`. You can set the anchor point manually, but in most cases the smart option will make a good choice. And we will work with the library author to improve this in the future.
+
+An example using the sunset image from above:
+
+{{< imgproc sunset Fill "200x200 smart" />}}
+
+## Image Processing Performance Consideration
+
+Processed images are stored below `<project-dir>/resources` (can be set with `resourceDir` config setting). This folder is deliberately placed in the project, as it is recommended to check these into source control as part of the project. These images are not "Hugo fast" to generate, but once generated they can be reused.
+
+If you change your image settings (e.g. size), remove or rename images etc., you will end up with unused images taking up space and cluttering your project.
+
+To clean up, run:
+
+```bash
+hugo --gc
+```
+
+{{% note %}}
+**GC** is short for **Garbage Collection**.
+{{% /note %}}
--- /dev/null
- weight: 120 #rem
+---
+title: Menus
+linktitle: Menus
+description: Hugo has a simple yet powerful menu system.
+date: 2017-02-01
+publishdate: 2017-02-01
+lastmod: 2017-03-31
+categories: [content management]
+keywords: [menus]
+draft: false
+menu:
+ docs:
+ parent: "content-management"
+ weight: 120
- ```
- ---
++weight: 120
+aliases: [/extras/menus/]
+toc: true
+---
+
+{{% note "Lazy Blogger"%}}
+If all you want is a simple menu for your sections, see the ["Section Menu for Lazy Bloggers" in Menu Templates](/templates/menu-templates/#section-menu-for-lazy-bloggers).
+{{% /note %}}
+
+You can do this:
+
+* Place content in one or many menus
+* Handle nested menus with unlimited depth
+* Create menu entries without being attached to any content
+* Distinguish active element (and active branch)
+
+## What is a Menu in Hugo?
+
+A **menu** is a named array of menu entries accessible by name via the [`.Site.Menus` site variable][sitevars]. For example, you can access your site's `main` menu via `.Site.Menus.main`.
+
+{{% note "Menus on Multilingual Sites" %}}
+If you make use of the [multilingual feature](/content-management/multilingual/), you can define language-independent menus.
+{{% /note %}}
+
+See the [Menu Entry Properties][me-props] for all the variables and functions related to a menu entry.
+
+## Add content to menus
+
+Hugo allows you to add content to a menu via the content's [front matter](/content-management/front-matter/).
+
+### Simple
+
+If all you need to do is add an entry to a menu, the simple form works well.
+
+#### A Single Menu
+
- ---
- ```
++{{< code-toggle >}}
+menu: "main"
- ```
- ---
++{{< /code-toggle >}}
+
+#### Multiple Menus
+
- ---
- ```
++{{< code-toggle >}}
+menu: ["main", "footer"]
-
- ```
- ---
++{{< /code-toggle >}}
+
+#### Advanced
+
- ---
- ```
++{{< code-toggle >}}
+menu:
+ docs:
+ parent: 'extras'
+ weight: 20
- You can also add user-defined content to menu items via the `params` field.
++{{< /code-toggle >}}
+
+## Add Non-content Entries to a Menu
+
+You can also add entries to menus that aren’t attached to a piece of content. This takes place in your Hugo project's [`config` file][config].
+
+Here’s an example snippet pulled from a configuration file:
+
+{{< code-toggle file="config" >}}
+[[menu.main]]
+ name = "about hugo"
+ pre = "<i class='fa fa-heart'></i>"
+ weight = -110
+ identifier = "about"
+ url = "/about/"
+[[menu.main]]
+ name = "getting started"
+ pre = "<i class='fa fa-road'></i>"
+ post = "<span class='alert'>New!</span>"
+ weight = -100
+ url = "/getting-started/"
+{{< /code-toggle >}}
+
+{{% note %}}
+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 override 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 %}}
+
+## Nesting
+
+All nesting of content is done via the `parent` field.
+
+The parent of an entry should be the identifier of another entry. The identifier should be unique (within a menu).
+
+The following order is used to determine an Identifier:
+
+`.Name > .LinkTitle > .Title`
+
+This means that `.Title` will be used unless `.LinkTitle` is present, etc. In practice, `.Name` and `.Identifier` are only used to structure relationships and therefore never displayed.
+
+In this example, the top level of the menu is defined in your [site `config` file][config]. All content entries are attached to one of these entries via the `.Parent` field.
+
+## Params
+
-
++You can also add user-defined content to menu items via the `params` field.
+
+A common use case is to define a custom param to add a css class to a specific menu item.
+
+{{< code-toggle file="config" >}}
+[[menu.main]]
+ name = "about hugo"
+ pre = "<i class='fa fa-heart'></i>"
+ weight = -110
+ identifier = "about"
+ url = "/about/"
+ [menu.main.params]
+ class = "highlight-menu-item"
+{{</ code-toggle >}}
+
+## Render Menus
+
+See [Menu Templates](/templates/menu-templates/) for information on how to render your site menus within your templates.
+
+[config]: /getting-started/configuration/
+[multilingual]: /content-management/multilingual/
+[sitevars]: /variables/
+[me-props]: /variables/menus/
--- /dev/null
- > Also See [Hugo Multilingual Part 1: Content translation](https://regisphilibert.com/blog/2018/08/hugo-multilingual-part-1-managing-content-translation/)
+---
+title: Multilingual Mode
+linktitle: Multilingual and i18n
+description: Hugo supports the creation of websites with multiple languages side by side.
+date: 2017-01-10
+publishdate: 2017-01-10
+lastmod: 2017-01-10
+categories: [content management]
+keywords: [multilingual,i18n, internationalization]
+menu:
+ docs:
+ parent: "content-management"
+ weight: 150
+weight: 150 #rem
+draft: false
+aliases: [/content/multilingual/,/tutorials/create-a-multilingual-site/]
+toc: true
+---
+
+You should define the available languages in a `languages` section in your site configuration.
+
- When working with front matter `Params` in [single page templates][singles], omit the `params` in the key for the translation.
++> Also See [Hugo Multilingual Part 1: Content translation]
+
+## Configure Languages
+
+The following is an example of a site configuration for a multilingual Hugo project:
+
+{{< code-toggle file="config" >}}
+defaultContentLanguage = "en"
+copyright = "Everything is mine"
+
+[params]
+[params.navigation]
+help = "Help"
+
+[languages]
+[languages.en]
+title = "My blog"
+weight = 1
+[languages.en.params]
+linkedin = "https://linkedin.com/whoever"
+
+[languages.fr]
+title = "Mon blogue"
+weight = 2
+[languages.fr.params]
+linkedin = "https://linkedin.com/fr/whoever"
+[languages.fr.params.navigation]
+help = "Aide"
+
+[languages.ar]
+title = "مدونتي"
+weight = 2
+languagedirection = "rtl"
+
+[languages.pt-pt]
+title = "O meu blog"
+weight = 3
+{{< /code-toggle >}}
+
+Anything not defined in a `languages` block will fall back to the global value for that key (e.g., `copyright` for the English `en` language). This also works for `params`, as demonstrated with `help` above: You will get the value `Aide` in French and `Help` in all the languages without this parameter set.
+
+With the configuration above, all content, sitemap, RSS feeds, paginations,
+and taxonomy pages will be rendered below `/` in English (your default content language) and then below `/fr` in French.
+
- We kept this as a standalone setting to make it easier to set via [OS environment](/getting-started/configuration/#configure-with-environment-variables):
++When working with front matter `Params` in [single page templates], omit the `params` in the key for the translation.
+
+`defaultContentLanguage` sets the project's default language. If not set, the default language will be `en`.
+
+If the default language needs to be rendered below its own language code (`/en`) like the others, set `defaultContentLanguageInSubdir: true`.
+
+Only the obvious non-global options can be overridden per language. Examples of global options are `baseURL`, `buildDrafts`, etc.
+
+**Please note:** use lowercase language codes, even when using regional languages (ie. use pt-pt instead of pt-PT). Currently Hugo language internals lowercase language codes, which can cause conflicts with settings like `defaultContentLanguage` which are not lowercased. Please track the evolution of this issue in [Hugo repository issue tracker](https://github.com/gohugoio/hugo/issues/7344)
+
+### Disable a Language
+
+You can disable one or more languages. This can be useful when working on a new translation.
+
+{{< code-toggle file="config" >}}
+disableLanguages = ["fr", "ja"]
+{{< /code-toggle >}}
+
+Note that you cannot disable the default content language.
+
-
++We kept this as a standalone setting to make it easier to set via [OS environment]:
+
+```bash
+HUGO_DISABLELANGUAGES="fr ja" hugo
+```
++
+If you have already a list of disabled languages in `config.toml`, you can enable them in development like this:
+
+```bash
+HUGO_DISABLELANGUAGES=" " hugo server
+```
+
-
+### Configure Multilingual Multihost
+
+From **Hugo 0.31** we support multiple languages in a multihost configuration. See [this issue](https://github.com/gohugoio/hugo/issues/4027) for details.
+
+This means that you can now configure a `baseURL` per `language`:
+
- ```bash
+> If a `baseURL` is set on the `language` level, then all languages must have one and they must all be different.
+
+Example:
+
+{{< code-toggle file="config" >}}
+[languages]
+[languages.fr]
+baseURL = "https://example.fr"
+languageName = "Français"
+weight = 1
+title = "En Français"
+
+[languages.en]
+baseURL = "https://example.com"
+languageName = "English"
+weight = 2
+title = "In English"
+{{</ code-toggle >}}
+
+With the above, the two sites will be generated into `public` with their own root:
+
- ```bash
++```text
+public
+├── en
+└── fr
+```
+
+**All URLs (i.e `.Permalink` etc.) will be generated from that root. So the English home page above will have its `.Permalink` set to `https://example.com/`.**
+
+When you run `hugo server` we will start multiple HTTP servers. You will typically see something like this in the console:
+
-
++```text
+Web Server is available at 127.0.0.1:1313 (bind address 127.0.0.1)
+Web Server is available at 127.0.0.1:1314 (bind address 127.0.0.1)
+Press Ctrl+C to stop
+```
+
+Live reload and `--navigateToChanged` between the servers work as expected.
+
+### Taxonomies and Blackfriday
+
+Taxonomies and [Blackfriday configuration][config] can also be set per language:
+
- Their language is __assigned__ according to the language code added as a __suffix to the filename__.
+{{< code-toggle file="config" >}}
+[Taxonomies]
+tag = "tags"
+
+[blackfriday]
+angledQuotes = true
+hrefTargetBlank = true
+
+[languages]
+[languages.en]
+weight = 1
+title = "English"
+[languages.en.blackfriday]
+angledQuotes = false
+
+[languages.fr]
+weight = 2
+title = "Français"
+[languages.fr.Taxonomies]
+plaque = "plaques"
+{{</ code-toggle >}}
+
+## Translate Your Content
+
+There are two ways to manage your content translations. Both ensure each page is assigned a language and is linked to its counterpart translations.
+
+### Translation by filename
+
+Considering the following example:
+
+1. `/content/about.en.md`
+2. `/content/about.fr.md`
+
+The first file is assigned the English language and is linked to the second.
+The second file is assigned the French language and is linked to the first.
+
-
++Their language is __assigned__ according to the language code added as a __suffix to the filename__.
+
+By having the same **path and base filename**, the content pieces are __linked__ together as translated pages.
+
+{{< note >}}
+If a file has no language code, it will be assigned the default language.
+{{</ note >}}
+
+### Translation by content directory
+
+This system uses different content directories for each of the languages. Each language's content directory is set using the `contentDir` param.
+
+{{< code-toggle file="config" >}}
-
+languages:
+ en:
+ weight: 10
+ languageName: "English"
+ contentDir: "content/english"
+ fr:
+ weight: 20
+ languageName: "Français"
+ contentDir: "content/french"
- ### Bypassing default linking.
+{{< /code-toggle >}}
+
+The value of `contentDir` can be any valid path -- even absolute path references. The only restriction is that the content directories cannot overlap.
+
+Considering the following example in conjunction with the configuration above:
+
+1. `/content/english/about.md`
+2. `/content/french/about.md`
+
+The first file is assigned the English language and is linked to the second.
+The second file is assigned the French language and is linked to the first.
+
+Their language is __assigned__ according to the content directory they are __placed__ in.
+
+By having the same **path and basename** (relative to their language content directory), the content pieces are __linked__ together as translated pages.
+
- ```yaml
- # set in all three pages
++### Bypassing default linking
+
+Any pages sharing the same `translationKey` set in front matter will be linked as translated pages regardless of basename or location.
+
+Considering the following example:
+
+1. `/content/about-us.en.md`
+2. `/content/om.nn.md`
+3. `/content/presentation/a-propos.fr.md`
+
- ```
++{{< code-toggle >}}
+translationKey: "about"
-
++{{< /code-toggle >}}
+
+By setting the `translationKey` front matter param to `about` in all three pages, they will be __linked__ as translated pages.
+
- To localize the URLs, the [`slug`]({{< ref "/content-management/organization/index.md#slug" >}}) or [`url`]({{< ref "/content-management/organization/index.md#url" >}}) front matter param can be set in any of the non-default language file.
+### Localizing permalinks
+
+Because paths and filenames are used to handle linking, all translated pages will share the same URL (apart from the language subdirectory).
+
-
++To localize the URLs, the [`slug`]({{< ref "/content-management/organization/index.md#slug" >}}) or [`url`]({{< ref "/content-management/organization/index.md#url" >}}) front matter param can be set in any of the non-default language file.
+
+For example, a French translation (`content/about.fr.md`) can have its own localized slug.
+
+{{< code-toggle >}}
+Title: A Propos
+slug: "a-propos"
+{{< /code-toggle >}}
+
- {{ range .Translations }}
- <li>
- <a href="{{ .Permalink }}">{{ .Lang }}: {{ .Title }}{{ if .IsPage }} ({{ i18n "wordCount" . }}){{ end }}</a>
- </li>
- {{ end }}
+At render, Hugo will build both `/about/` and `/fr/a-propos/` while maintaining their translation linking.
+
+{{% note %}}
+If using `url`, remember to include the language part as well: `/fr/compagnie/a-propos/`.
+{{%/ note %}}
+
+### Page Bundles
+
+To avoid the burden of having to duplicate files, each Page Bundle inherits the resources of its linked translated pages' bundles except for the content files (markdown files, html files etc...).
+
+Therefore, from within a template, the page will have access to the files from all linked pages' bundles.
+
+If, across the linked bundles, two or more files share the same basename, only one will be included and chosen as follows:
+
+* File from current language bundle, if present.
+* First file found across bundles by order of language `Weight`.
+
+{{% note %}}
+Page Bundle resources follow the same language assignment logic as content files, both by filename (`image.jpg`, `image.fr.jpg`) and by directory (`english/about/header.jpg`, `french/about/header.jpg`).
+{{%/ note %}}
+
+## Reference the Translated Content
+
+To create a list of links to translated content, use a template similar to the following:
+
+{{< code file="layouts/partials/i18nlist.html" >}}
+{{ if .IsTranslated }}
+<h4>{{ i18n "translations" }}</h4>
+<ul>
- The above can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template, whether a [single content page][contenttemplate] or the [homepage][]. It will not print anything if there are no translations for a given page.
++ {{ range .Translations }}
++ <li>
++ <a href="{{ .Permalink }}">{{ .Lang }}: {{ .Title }}{{ if .IsPage }} ({{ i18n "wordCount" . }}){{ end }}</a>
++ </li>
++ {{ end }}
+</ul>
+{{ end }}
+{{< /code >}}
+
-
++The above can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template, whether a [single content page][contenttemplate] or the [homepage]. It will not print anything if there are no translations for a given page.
+
+The above also uses the [`i18n` function][i18func] described in the next section.
+
+### List All Available Languages
+
+`.AllTranslations` on a `Page` can be used to list all translations, including the page itself. On the home page it can be used to build a language navigator:
+
- Hugo uses [go-i18n][] to support string translations. [See the project's source repository][go-i18n-source] to find tools that will help you manage your translation workflows.
+{{< code file="layouts/partials/allLanguages.html" >}}
+<ul>
+{{ range $.Site.Home.AllTranslations }}
+<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
+{{ end }}
+</ul>
+{{< /code >}}
+
+## Translation of Strings
+
- Translations are collected from the `themes/<THEME>/i18n/` folder (built into the theme), as well as translations present in `i18n/` at the root of your project. In the `i18n`, the translations will be merged and take precedence over what is in the theme folder. Language files should be named according to [RFC 5646][] with names such as `en-US.toml`, `fr.toml`, etc.
++Hugo uses [go-i18n] to support string translations. [See the project's source repository][go-i18n-source] to find tools that will help you manage your translation workflows.
+
- {{% note %}}
- From **Hugo 0.31** you no longer need to use a valid language code. It can be anything.
++Translations are collected from the `themes/<THEME>/i18n/` folder (built into the theme), as well as translations present in `i18n/` at the root of your project. In the `i18n`, the translations will be merged and take precedence over what is in the theme folder. Language files should be named according to [RFC 5646] with names such as `en-US.toml`, `fr.toml`, etc.
+
- See https://github.com/gohugoio/hugo/issues/3564
++Artificial languages with private use subtags as defined in [RFC 5646 § 2.2.7](https://datatracker.ietf.org/doc/html/rfc5646#section-2.2.7) are also supported. You may omit the `art-x-` prefix for brevity. For example:
+
- {{% /note %}}
++```text
++art-x-hugolang
++hugolang
++```
+
- ```
++Private use subtags must not exceed 8 alphanumeric characters.
+
+### Query basic translation
+
+From within your templates, use the `i18n` function like this:
+
- ```
++```go-html-template
+{{ i18n "home" }}
+```
+
+The function will search for the `"home"` id:
+
+{{< code-toggle file="i18n/en-US" >}}
+[home]
+other = "Home"
+{{< /code-toggle >}}
+
+The result will be
+
- ```
++```text
+Home
+```
+
+### Query a flexible translation with variables
+
+Often you will want to use the page variables in the translation strings. To do so, pass the `.` context when calling `i18n`:
+
- ```
++```go-html-template
+{{ i18n "wordCount" . }}
+```
+
+The function will pass the `.` context to the `"wordCount"` id:
+
+{{< code-toggle file="i18n/en-US" >}}
+[wordCount]
+other = "This article has {{ .WordCount }} words."
+{{< /code-toggle >}}
+
+Assume `.WordCount` in the context has value is 101. The result will be:
+
- ```
++```text
+This article has 101 words.
+```
+
+### Query a singular/plural translation
+
+In order to meet singular/plural requirement, you must pass a dictionary (map) with a numeric `.Count` property to the `i18n` function. The below example uses `.ReadingTime` variable which has a built-in `.Count` property.
+
- ```
++```go-html-template
+{{ i18n "readingTime" .ReadingTime }}
+```
+
+The function will read `.Count` from `.ReadingTime` and evaluate where the number is singular (`one`) or plural (`other`). After that, it will pass to `readingTime` id:
+
+{{< code-toggle file="i18n/en-US" >}}
+[readingTime]
+one = "One minute to read"
+other = "{{.Count}} minutes to read"
+{{< /code-toggle >}}
+
+Assume `.ReadingTime.Count` in the context has value of 525600. The result will be:
+
- ```
++```text
+525600 minutes to read
+```
+
+If `.ReadingTime.Count` in the context has value is 1. The result is:
+
- ```
++```text
+One minute to read
+```
+
+In case you need to pass custom data: (`(dict "Count" 25)` is minimum requirement)
+
- ## Customize Dates
++```go-html-template
+{{ i18n "readingTime" (dict "Count" 25 "FirstArgument" true "SecondArgument" false "Etc" "so on, so far") }}
+```
+
++## Localization
+
- At the time of this writing, Go does not yet have support for internationalized locales for dates, but if you do some work, you can simulate it. For example, if you want to use French month names, you can add a data file like ``data/mois.yaml`` with this content:
++The following localization examples assume your site's primary language is English, with translations to French and German.
+
- ~~~yaml
- 1: "janvier"
- 2: "février"
- 3: "mars"
- 4: "avril"
- 5: "mai"
- 6: "juin"
- 7: "juillet"
- 8: "août"
- 9: "septembre"
- 10: "octobre"
- 11: "novembre"
- 12: "décembre"
- ~~~
++{{< code-toggle file="config" >}}
++defaultContentLang = 'en'
+
- ...then index the non-English date names in your templates like so:
++[languages]
++[languages.en]
++contentDir = 'content/en'
++languageName = 'English'
++weight = 1
++[languages.fr]
++contentDir = 'content/fr'
++languageName = 'Français'
++weight = 2
++[languages.de]
++contentDir = 'content/de'
++languageName = 'Deutsch'
++weight = 3
+
- ~~~html
- <time class="post-date" datetime="{{ .Date.Format `2006-01-02T15:04:05Z07:00` | safeHTML }}">
- Article publié le {{ .Date.Day }} {{ index $.Site.Data.mois (printf "%d" .Date.Month) }} {{ .Date.Year }} (dernière modification le {{ .Lastmod.Day }} {{ index $.Site.Data.mois (printf "%d" .Lastmod.Month) }} {{ .Lastmod.Year }})
- </time>
- ~~~
++{{< /code-toggle >}}
+
- This technique extracts the day, month and year by specifying ``.Date.Day``, ``.Date.Month``, and ``.Date.Year``, and uses the month number as a key, when indexing the month name data file.
++### Dates
+
-
++With this front matter:
+
++{{< code-toggle >}}
++date = 2021-11-03T12:34:56+01:00
++{{< /code-toggle >}}
++
++And this template code:
++
++```go-html-template
++{{ .Date | time.Format ":date_full" }}
++```
++
++The rendered page displays:
++
++Language|Value
++:--|:--
++English|Wednesday, November 3, 2021
++Français|mercredi 3 novembre 2021
++Deutsch|Mittwoch, 3. November 2021
++
++See [time.Format] for details.
++
++### Currency
++
++With this template code:
++
++```go-html-template
++{{ 512.5032 | lang.FormatCurrency 2 "USD" }}
++```
++
++The rendered page displays:
++
++Language|Value
++:--|:--
++English|$512.50
++Français|512,50 $US
++Deutsch|512,50 $
++
++See [lang.FormatCurrency] and [lang.FormatAccounting] for details.
++
++### Numbers
++
++With this template code:
++
++```go-html-template
++{{ 512.5032 | lang.FormatNumber 2 }}
++```
++
++The rendered page displays:
++
++Language|Value
++:--|:--
++English|512.50
++Français|512,50
++Deutsch|512,50
++
++See [lang.FormatNumber] and [lang.FormatNumberCustom] for details.
++
++### Percentages
++
++With this template code:
++
++```go-html-template
++{{ 512.5032 | lang.FormatPercent 2 }} ---> 512.50%
++```
++
++The rendered page displays:
++
++Language|Value
++:--|:--
++English|512.50%
++Français|512,50 %
++Deutsch|512,50 %
++
++See [lang.FormatPercent] for details.
+
+## Menus
+
+You can define your menus for each language independently. Creating multilingual menus works just like [creating regular menus][menus], except they're defined in language-specific blocks in the configuration file:
+
+{{< code-toggle file="config" >}}
+defaultContentLanguage = "en"
+
+[languages.en]
+weight = 0
+languageName = "English"
+
+[[languages.en.menu.main]]
+url = "/"
+name = "Home"
+weight = 0
+
- ```
+[languages.de]
+weight = 10
+languageName = "Deutsch"
+
+[[languages.de.menu.main]]
+url = "/"
+name = "Startseite"
+weight = 0
+{{< /code-toggle >}}
+
+The rendering of the main navigation works as usual. `.Site.Menus` will just contain the menu in the current language. Note that `absLangURL` below will link to the correct locale of your website. Without it, menu entries in all languages would link to the English version, since it's the default content language that resides in the root directory.
+
-
++```go-html-template
+<ul>
+ {{- $currentPage := . -}}
+ {{ range .Site.Menus.main -}}
+ <li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
+ <a href="{{ .URL | absLangURL }}">{{ .Name }}</a>
+ </li>
+ {{- end }}
+</ul>
- For merging of content from other languages (i.e. missing content translations), see [lang.Merge](/functions/lang.merge/).
+```
+
+## Missing Translations
+
+If a string does not have a translation for the current language, Hugo will use the value from the default language. If no default value is set, an empty string will be shown.
+
+While translating a Hugo website, it can be handy to have a visual indicator of missing translations. The [`enableMissingTranslationPlaceholders` configuration option][config] will flag all untranslated strings with the placeholder `[i18n] identifier`, where `identifier` is the id of the missing translation.
+
+{{% note %}}
+Hugo will generate your website with these missing translation placeholders. It might not be suitable for production environments.
+{{% /note %}}
+
- ```
- hugo --i18n-warnings | grep i18n
++For merging of content from other languages (i.e. missing content translations), see [lang.Merge].
+
+To track down missing translation strings, run Hugo with the `--i18n-warnings` flag:
+
- [singles]: /templates/single-page-templates/
++```bash
++hugo --i18n-warnings | grep i18n
+i18n|MISSING_TRANSLATION|en|wordCount
+```
+
+## Multilingual Themes support
+
+To support Multilingual mode in your themes, some considerations must be taken for the URLs in the templates. If there is more than one language, URLs must meet the following criteria:
+
+* Come from the built-in `.Permalink` or `.RelPermalink`
+* Be constructed with the [`relLangURL` template function][rellangurl] or the [`absLangURL` template function][abslangurl] **OR** be prefixed with `{{ .LanguagePrefix }}`
+
+If there is more than one language defined, the `LanguagePrefix` variable will equal `/en` (or whatever your `CurrentLanguage` is). If not enabled, it will be an empty string (and is therefore harmless for single-language Hugo websites).
+
+[abslangurl]: /functions/abslangurl
+[config]: /getting-started/configuration/
+[contenttemplate]: /templates/single-page-templates/
+[go-i18n-source]: https://github.com/nicksnyder/go-i18n
+[go-i18n]: https://github.com/nicksnyder/go-i18n
+[homepage]: /templates/homepage/
++[Hugo Multilingual Part 1: Content translation]: https://regisphilibert.com/blog/2018/08/hugo-multilingual-part-1-managing-content-translation/
+[i18func]: /functions/i18n/
++[lang.FormatAccounting]: /functions/lang/#langformataccounting
++[lang.FormatCurrency]: /functions/lang/#langformatcurrency
++[lang.FormatNumber]: /functions/lang/#langformatnumber
++[lang.FormatNumberCustom]: functions/lang/#langformatnumbercustom
++[lang.FormatPercent]: /functions/lang/#langformatpercent
++[lang.Merge]: /functions/lang.merge/
+[menus]: /content-management/menus/
++[OS environment]: /getting-started/configuration/#configure-with-environment-variables
+[rellangurl]: /functions/rellangurl
+[RFC 5646]: https://tools.ietf.org/html/rfc5646
++[single page templates]: /templates/single-page-templates/
++[time.Format]: /functions/dateformat
--- /dev/null
- The illustration shows 3 bundles. Note that the home page bundle cannot contain other content pages, but other files (images etc.) are fine.
+---
+title: Content Organization
+linktitle: Organization
+description: Hugo assumes that the same structure that works to organize your source content is used to organize the rendered site.
+date: 2017-02-01
+publishdate: 2017-02-01
+lastmod: 2017-02-01
+categories: [content management,fundamentals]
+keywords: [sections,content,organization,bundle,resources]
+menu:
+ docs:
+ parent: "content-management"
+ weight: 10
+weight: 10 #rem
+draft: false
+aliases: [/content/sections/]
+toc: true
+---
+
+## Page Bundles
+
+Hugo `0.32` announced page-relative images and other resources packaged into `Page Bundles`.
+
+These terms are connected, and you also need to read about [Page Resources]({{< relref "/content-management/page-resources" >}}) and [Image Processing]({{< relref "/content-management/image-processing" >}}) to get the full picture.
+
+{{< imgproc 1-featured Resize "300x" >}}
- The bundle documentation is **work in progress**. We will publish more comprehensive docs about this soon.
++The illustration shows three bundles. Note that the home page bundle cannot contain other content pages, although other files (images etc.) are allowed.
+{{< /imgproc >}}
+
+
+{{% note %}}
- Without any additional configuration, the following will just work:
++The bundle documentation is a **work in progress**. We will publish more comprehensive docs about this soon.
+{{% /note %}}
+
+
+## Organization of Content Source
+
+
+In Hugo, your content should be organized in a manner that reflects the rendered website.
+
+While Hugo supports content nested at any level, the top levels (i.e. `content/<DIRECTORIES>`) are special in Hugo and are considered the content type used to determine layouts etc. To read more about sections, including how to nest them, see [sections][].
+
- You can keep one `_index.md` for your homepage and one in each of your content sections, taxonomies, and taxonomy terms. The following shows typical placement of an `_index.md` that would contain content and front matter for a `posts` section list page on a Hugo website:
++Without any additional configuration, the following will automatically work:
+
+```
+.
+└── content
+ └── about
+ | └── index.md // <- https://example.com/about/
+ ├── posts
+ | ├── firstpost.md // <- https://example.com/posts/firstpost/
+ | ├── happy
+ | | └── ness.md // <- https://example.com/posts/happy/ness/
+ | └── secondpost.md // <- https://example.com/posts/secondpost/
+ └── quote
+ ├── first.md // <- https://example.com/quote/first/
+ └── second.md // <- https://example.com/quote/second/
+```
+
+## 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 = "https://example.com"` in your [site's configuration file][config].
+
+### Index Pages: `_index.md`
+
+`_index.md` has a special role in Hugo. It allows you to add front matter and content to your [list templates][lists]. These templates include those for [section templates][], [taxonomy templates][], [taxonomy terms templates][], and your [homepage template][].
+
+{{% note %}}
+**Tip:** You can get a reference to the content and metadata in `_index.md` using the [`.Site.GetPage` function](/functions/getpage/).
+{{% /note %}}
+
- The [sections][] can be nested as deeply as you need. The important part to understand is, that to make the section tree fully navigational, at least the lower-most section needs a content file. (i.e. `_index.md`).
++You can create one `_index.md` for your homepage and one in each of your content sections, taxonomies, and taxonomy terms. The following shows typical placement of an `_index.md` that would contain content and front matter for a `posts` section list page on a Hugo website:
+
+
+```
+. url
+. ⊢--^-⊣
+. path slug
+. ⊢--^-⊣⊢---^---⊣
+. filepath
+. ⊢------^------⊣
+content/posts/_index.md
+```
+
+At build, this will output to the following destination with the associated values:
+
+```
+
+ url ("/posts/")
+ ⊢-^-⊣
+ baseurl section ("posts")
+⊢--------^---------⊣⊢-^-⊣
+ permalink
+⊢----------^-------------⊣
+https://example.com/posts/index.html
+```
+
- Single content files in each of your sections are going to be rendered as [single page templates][singles]. Here is an example of a single `post` within `posts`:
++The [sections] can be nested as deeply as you want. The important thing to understand is that to make the section tree fully navigational, at least the lower-most section must include a content file. (i.e. `_index.md`).
+
+
+### Single Pages in Sections
+
- When Hugo builds your site, the content will be outputted to the following destination:
++Single content files in each of your sections will be rendered as [single page templates][singles]. Here is an example of a single `post` within `posts`:
+
+
+```
+ path ("posts/my-first-hugo-post.md")
+. ⊢-----------^------------⊣
+. section slug
+. ⊢-^-⊣⊢--------^----------⊣
+content/posts/my-first-hugo-post.md
+```
+
- The following concepts will provide more insight into the relationship between your project's organization and the default behaviors of Hugo when building the output website.
++When Hugo builds your site, the content will be output to the following destination:
+
+```
+
+ url ("/posts/my-first-hugo-post/")
+ ⊢------------^----------⊣
+ baseurl section slug
+⊢--------^--------⊣⊢-^--⊣⊢-------^---------⊣
+ permalink
+⊢--------------------^---------------------⊣
+https://example.com/posts/my-first-hugo-post/index.html
+```
+
+
+## Paths Explained
+
- A default content type is determined by a piece of content's section. `section` is determined by the location within the project's `content` directory. `section` *cannot* be specified or overridden in front matter.
++The following concepts provide more insight into the relationship between your project's organization and the default Hugo behavior when building output for the website.
+
+### `section`
+
- * is based on the content's location within the directory structure OR
- * is defined in front matter and *overrides all the above*
++A default content type is determined by the section in which a content item is stored. `section` is determined by the location within the project's `content` directory. `section` *cannot* be specified or overridden in front matter.
+
+### `slug`
+
+A content's `slug` is either `name.extension` or `name/`. The value for `slug` is determined by
+
+* the name of the content file (e.g., `lollapalooza.md`) OR
+* front matter overrides
+
+### `path`
+
+A content's `path` is determined by the section's path to the file. The file `path`
+
+* is based on the path to the content's location AND
+* does not include the slug
+
+### `url`
+
+The `url` is the relative URL for the piece of content. The `url`
+
- Hugo believes that you organize your content with a purpose. The same structure that works to organize your source content is used to organize the rendered site. As displayed above, the organization of the source content will be mirrored in the destination.
++* is based on the content item's location within the directory structure OR
++* is defined in front matter, in which case it *overrides all the above*
+
+## Override Destination Paths via Front Matter
+
- There are times where you may need more control over your content. In these cases, there are fields that can be specified in the front matter to determine the destination of a specific piece of content.
++Hugo assumes that your content is organized with a purpose. The same structure that you use to organize your source content is used to organize the rendered site. As displayed above, the organization of the source content will be mirrored at the destination.
+
- The following items are defined in this order for a specific reason: items explained further down in the list will override earlier items, and not all of these items can be defined in front matter:
++There are times when you may need more fine-grained control over the content organization. In such cases, the front matter field can be used to determine the destination of a specific piece of content.
+
- This isn't in the front matter, but is the actual name of the file minus the extension. This will be the name of the file in the destination (e.g., `content/posts/my-post.md` becomes `example.com/posts/my-post/`).
++The following items are defined in a specific order for a reason: items explained lower down in the list override higher items. Note that not all items can be defined in front matter.
+
+### `filename`
+
- When defined in the front matter, the `slug` can take the place of the filename for the destination.
++`filename` is not a front matter field. It is the actual file name, minus the extension. This will be the name of the file in the destination (e.g., `content/posts/my-post.md` becomes `example.com/posts/my-post/`).
+
+### `slug`
+
- `section` is determined by a content's location on disk and *cannot* be specified in the front matter. See [sections][] for more information.
++When defined in the front matter, the `slug` can take the place of the filename in the destination.
+
+{{< code file="content/posts/old-post.md" >}}
+---
+title: A new post with the filename old-post.md
+slug: "new-post"
+---
+{{< /code >}}
+
+This will render to the following destination according to Hugo's default behavior:
+
+```
+example.com/posts/new-post/
+```
+
+### `section`
+
- A content's `type` is also determined by its location on disk but, unlike `section`, it *can* be specified in the front matter. See [types][]. This can come in especially handy when you want a piece of content to render using a different layout. In the following example, you can create a layout at `layouts/new/mylayout.html` that Hugo will use to render this piece of content, even in the midst of many other posts.
++`section` is determined by a content item's location on disk and *cannot* be specified in the front matter. See [sections] for more information.
+
+### `type`
+
- A complete URL can be provided. This will override all the above as it pertains to the end destination. This must be the path from the baseURL (starting with a `/`). `url` will be used exactly as it provided in the front matter and will ignore the `--uglyURLs` setting in your site configuration:
++A content item's `type` is also determined by its location on disk but, unlike `section`, it *can* be specified in the front matter. See [types]. This can come in especially handy when you want a piece of content to render using a different layout. In the following example, you can create a layout at `layouts/new/mylayout.html` that Hugo will use to render this piece of content, even in the midst of many other posts.
+
+{{< code file="content/posts/my-post.md" >}}
+---
+title: My Post
+type: new
+layout: mylayout
+---
+{{< /code >}}
+<!-- See https://discourse.gohugo.io/t/path-not-works/6387 -->
+<!-- ### `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. -->
+
+### `url`
+
++A complete URL can be provided. This will override all the above as it pertains to the end destination. This must be the path from the baseURL (starting with a `/`). `url` will be used exactly as it is defined in the front matter, and will ignore the `--uglyURLs` setting in your site configuration:
+
+{{< code file="content/posts/old-url.md" >}}
+---
+title: Old URL
+url: /blog/new-url/
+---
+{{< /code >}}
+
+Assuming your `baseURL` is [configured][config] to `https://example.com`, the addition of `url` to the front matter will make `old-url.md` render to the following destination:
+
+```
+https://example.com/blog/new-url/
+```
+
+You can see more information on how to control output paths in [URL Management][urls].
+
+[config]: /getting-started/configuration/
+[formats]: /content-management/formats/
+[front matter]: /content-management/front-matter/
+[getpage]: /functions/getpage/
+[homepage template]: /templates/homepage/
+[homepage]: /templates/homepage/
+[lists]: /templates/lists/
+[pretty]: /content-management/urls/#pretty-urls
+[section templates]: /templates/section-templates/
+[sections]: /content-management/sections/
+[singles]: /templates/single-page-templates/
+[taxonomy templates]: /templates/taxonomy-templates/
+[taxonomy terms templates]: /templates/taxonomy-templates/
+[types]: /content-management/types/
+[urls]: /content-management/urls/
--- /dev/null
- : The content of the resource itself. For most resources, this returns a string with the contents of the file. This can be used to inline some resources, such as `<script>{{ (.Resources.GetMatch "myscript.js").Content | safeJS }}</script>` or `<img src="{{ (.Resources.GetMatch "mylogo.png").Content | base64Encode }}">`.
+---
+title : "Page Resources"
+description : "Page resources -- images, other pages, documents, etc. -- have page-relative URLs and their own metadata."
+date: 2018-01-24
+categories: ["content management"]
+keywords: [bundle,content,resources]
+weight: 4003
+draft: false
+toc: true
+linktitle: "Page Resources"
+menu:
+ docs:
+ parent: "content-management"
+ weight: 31
+---
+Page resources are only accessible from [page bundles]({{< relref
+"/content-management/page-bundles" >}}), those directories with `index.md` or
+`_index.md` files at their root. Page resources are only available to the
+page with which they are bundled.
+
+In this example, `first-post` is a page bundle with access to 10 page resources including audio, data, documents, images, and video. Although `second-post` is also a page bundle, it has no page resources and is unable to directly access the page resources associated with `first-post`.
+
+```text
+content
+└── post
+ ├── first-post
+ │ ├── images
+ │ │ ├── a.jpg
+ │ │ ├── b.jpg
+ │ │ └── c.jpg
+ │ ├── index.md (root of page bundle)
+ │ ├── latest.html
+ │ ├── manual.json
+ │ ├── notice.md
+ │ ├── office.mp3
+ │ ├── pocket.mp4
+ │ ├── rating.pdf
+ │ └── safety.txt
+ └── second-post
+ └── index.md (root of page bundle)
+```
+
+## Properties
+
+ResourceType
+: The main type of the resource's [Media Type](/templates/output-formats/#media-types). For example, a file of MIME type `image/jpeg` has the ResourceType `image`. A `Page` will have `ResourceType` with value `page`.
+
+{{< new-in "0.80.0" >}} Note that we in Hugo `v0.80.0` fixed a bug where non-image resources (e.g. video) would return the MIME sub type, e.g. `json`.
+
+Name
+: Default value is the filename (relative to the owning page). Can be set in front matter.
+
+Title
+: Default value is the same as `.Name`. Can be set in front matter.
+
+Permalink
+: The absolute URL to the resource. Resources of type `page` will have no value.
+
+RelPermalink
+: The relative URL to the resource. Resources of type `page` will have no value.
+
+Content
++: The content of the resource itself. For most resources, this returns a string
++with the contents of the file. Use this to create inline resources.
++
++```go-html-template
++{{ with .Resources.GetMatch "script.js" }}
++ <script>{{ .Content | safeJS }}</script>
++{{ end }}
++
++{{ with .Resources.GetMatch "style.css" }}
++ <style>{{ .Content | safeCSS }}</style>
++{{ end }}
++
++{{ with .Resources.GetMatch "img.png" }}
++ <img src="data:{{ .MediaType }};base64,{{ .Content | base64Encode }}">
++{{ end }}
++```
+
+MediaType
+: The MIME type of the resource, such as `image/jpeg`.
+
+MediaType.MainType
+: The main type of the resource's MIME type. For example, a file of MIME type `application/pdf` has for MainType `application`.
+
+MediaType.SubType
+: The subtype of the resource's MIME type. For example, a file of MIME type `application/pdf` has for SubType `pdf`. Note that this is not the same as the file extension - PowerPoint files have a subtype of `vnd.mspowerpoint`.
+
+MediaType.Suffixes
+: A slice of possible suffixes for the resource's MIME type.
+
+## Methods
+ByType
+: Returns the page resources of the given type.
+
+```go
+{{ .Resources.ByType "image" }}
+```
+Match
+: Returns all the page resources (as a slice) whose `Name` matches the given Glob pattern ([examples](https://github.com/gobwas/glob/blob/master/readme.md)). The matching is case-insensitive.
+
+```go
+{{ .Resources.Match "images/*" }}
+```
+
+GetMatch
+: Same as `Match` but will return the first match.
+
+### Pattern Matching
+```go
+// Using Match/GetMatch to find this images/sunset.jpg ?
+.Resources.Match "images/sun*" ✅
+.Resources.Match "**/sunset.jpg" ✅
+.Resources.Match "images/*.jpg" ✅
+.Resources.Match "**.jpg" ✅
+.Resources.Match "*" 🚫
+.Resources.Match "sunset.jpg" 🚫
+.Resources.Match "*sunset.jpg" 🚫
+
+```
+
+## Page Resources Metadata
+
+The page resources' metadata is managed from the corresponding page's front matter with an array/table parameter named `resources`. You can batch assign values using [wildcards](https://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm).
+
+{{% note %}}
+Resources of type `page` get `Title` etc. from their own front matter.
+{{% /note %}}
+
+name
+: Sets the value returned in `Name`.
+
+{{% warning %}}
+The methods `Match` and `GetMatch` use `Name` to match the resources.
+{{%/ warning %}}
+
+title
+: Sets the value returned in `Title`
+
+params
+: A map of custom key/values.
+
+
+### Resources metadata example
+
+{{< code-toggle copy="false">}}
+title: Application
+date : 2018-01-25
+resources :
+- src : "images/sunset.jpg"
+ name : "header"
+- src : "documents/photo_specs.pdf"
+ title : "Photo Specifications"
+ params:
+ icon : "photo"
+- src : "documents/guide.pdf"
+ title : "Instruction Guide"
+- src : "documents/checklist.pdf"
+ title : "Document Checklist"
+- src : "documents/payment.docx"
+ title : "Proof of Payment"
+- src : "**.pdf"
+ name : "pdf-file-:counter"
+ params :
+ icon : "pdf"
+- src : "**.docx"
+ params :
+ icon : "word"
+{{</ code-toggle >}}
+
+From the example above:
+
+- `sunset.jpg` will receive a new `Name` and can now be found with `.GetMatch "header"`.
+- `documents/photo_specs.pdf` will get the `photo` icon.
+- `documents/checklist.pdf`, `documents/guide.pdf` and `documents/payment.docx` will get `Title` as set by `title`.
+- Every `PDF` in the bundle except `documents/photo_specs.pdf` will get the `pdf` icon.
+- All `PDF` files will get a new `Name`. The `name` parameter contains a special placeholder [`:counter`](#the-counter-placeholder-in-name-and-title), so the `Name` will be `pdf-file-1`, `pdf-file-2`, `pdf-file-3`.
+- Every docx in the bundle will receive the `word` icon.
+
+{{% warning %}}
+The __order matters__ --- Only the **first set** values of the `title`, `name` and `params`-**keys** will be used. Consecutive parameters will be set only for the ones not already set. In the above example, `.Params.icon` is first set to `"photo"` in `src = "documents/photo_specs.pdf"`. So that would not get overridden to `"pdf"` by the later set `src = "**.pdf"` rule.
+{{%/ warning %}}
+
+### The `:counter` placeholder in `name` and `title`
+
+The `:counter` is a special placeholder recognized in `name` and `title` parameters `resources`.
+
+The counter starts at 1 the first time they are used in either `name` or `title`.
+
+For example, if a bundle has the resources `photo_specs.pdf`, `other_specs.pdf`, `guide.pdf` and `checklist.pdf`, and the front matter has specified the `resources` as:
+
+{{< code-toggle copy="false">}}
+[[resources]]
+ src = "*specs.pdf"
+ title = "Specification #:counter"
+[[resources]]
+ src = "**.pdf"
+ name = "pdf-file-:counter"
+{{</ code-toggle >}}
+
+the `Name` and `Title` will be assigned to the resource files as follows:
+
+| Resource file | `Name` | `Title` |
+|-------------------|-------------------|-----------------------|
+| checklist.pdf | `"pdf-file-1.pdf` | `"checklist.pdf"` |
+| guide.pdf | `"pdf-file-2.pdf` | `"guide.pdf"` |
+| other\_specs.pdf | `"pdf-file-3.pdf` | `"Specification #1"` |
+| photo\_specs.pdf | `"pdf-file-4.pdf` | `"Specification #2"` |
--- /dev/null
- go get github.com/magefile/mage
+---
+title: Contribute to Hugo Development
+linktitle: Development
+description: Hugo relies heavily on contributions from the open source community.
+date: 2017-02-01
+publishdate: 2017-02-01
+lastmod: 2017-02-01
+categories: [contribute]
+keywords: [dev,open source]
+authors: [digitalcraftsman]
+menu:
+ docs:
+ parent: "contribute"
+ weight: 10
+weight: 10
+sections_weight: 10
+draft: false
+toc: true
+---
+
+## Introduction
+
+Hugo is an open-source project and lives by the work of its [contributors][]. There are plenty of [open issues][issues], and we need your help to make Hugo even more awesome. You don't need to be a Go guru to contribute to the project's development.
+
+## Assumptions
+
+This contribution guide takes a step-by-step approach in hopes of helping newcomers. Therefore, we only assume the following:
+
+* You are new to Git or open-source projects in general
+* You are a fan of Hugo and enthusiastic about contributing to the project
+
+{{% note "Additional Questions?" %}}
+If you're struggling at any point in this contribution guide, reach out to the Hugo community in [Hugo's Discussion forum](https://discourse.gohugo.io).
+{{% /note %}}
+
+## Install Go
+
+The installation of Go should take only a few minutes. You have more than one option to get Go up and running on your machine.
+
+If you are having trouble following the installation guides for Go, check out [Go Bootcamp, which contains setups for every platform][gobootcamp] or reach out to the Hugo community in the [Hugo Discussion Forums][forums].
+
+### Install Go From Source
+
+[Download the latest stable version of Go][godl] and follow the official [Go installation guide][goinstall].
+
+Once you're finished installing Go, let's confirm everything is working correctly. Open a terminal---or command line under Windows--and type the following:
+
+```
+go version
+```
+
+You should see something similar to the following written to the console. Note that the version here reflects the most recent version of Go as of the last update for this page:
+
+```
+go version go1.12 darwin/amd64
+```
+
+Next, make sure that you set up your `GOPATH` [as described in the installation guide][setupgopath].
+
+You can print the `GOPATH` with `echo $GOPATH`. You should see a non-empty string containing a valid path to your Go workspace; for example:
+
+```
+/Users/<yourusername>/Code/go
+```
+
+### Install Go with Homebrew
+
+If you are a MacOS user and have [Homebrew](https://brew.sh/) installed on your machine, installing Go is as simple as the following command:
+
+{{< code file="install-go.sh" >}}
+brew install go
+{{< /code >}}
+
+### Install Go via GVM
+
+More experienced users can use the [Go Version Manager][gvm] (GVM). GVM allows you to switch between different Go versions *on the same machine*. If you're a beginner, you probably don't need this feature. However, GVM makes it easy to upgrade to a new released Go version with just a few commands.
+
+GVM comes in especially handy if you follow the development of Hugo over a longer period of time. Future versions of Hugo will usually be compiled with the latest version of Go. Sooner or later, you will have to upgrade if you want to keep up.
+
+## Create a GitHub Account
+
+If you're going to contribute code, you'll need to have an account on GitHub. Go to [www.github.com/join](https://github.com/join) and set up a personal account.
+
+## Install Git on Your System
+
+You will need to have Git installed on your computer to contribute to Hugo development. Teaching Git is outside the scope of the Hugo docs, but if you're looking for an excellent reference to learn the basics of Git, we recommend the [Git book][gitbook] if you are not sure where to begin. We will include short explanations of the Git commands in this document.
+
+Git is a [version control system](https://en.wikipedia.org/wiki/Version_control) to track the changes of source code. Hugo depends on smaller third-party packages that are used to extend the functionality. We use them because we don't want to reinvent the wheel.
+
+Go ships with a sub-command called `get` that will download these packages for us when we setup our working environment. The source code of the packages is tracked with Git. `get` will interact with the Git servers of the package hosters in order to fetch all dependencies.
+
+Move back to the terminal and check if Git is already installed. Type in `git version` and press enter. You can skip the rest of this section if the command returned a version number. Otherwise [download](https://git-scm.com/downloads) the latest version of Git and follow this [installation guide](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
+
+Finally, check again with `git version` if Git was installed successfully.
+
+### Git Graphical Front Ends
+
+There are several [GUI clients](https://git-scm.com/downloads/guis) that help you to operate Git. Not all are available for all operating systems and maybe differ in their usage. Because of this we will document how to use the command line, since the commands are the same everywhere.
+
+### Install Hub on Your System (Optional)
+
+Hub is a great tool for working with GitHub. The main site for it is [hub.github.com](https://hub.github.com/). Feel free to install this little Git wrapper.
+
+On a Mac, you can install [Hub](https://github.com/github/hub) using [Homebrew](https://brew.sh):
+
+```
+brew install hub
+```
+
+Now we'll create an [alias in Bash](https://tldp.org/LDP/abs/html/aliases.html) so that typing `git` actually runs `Hub`:
+
+```
+echo "alias git='hub'" >> ~/.bash_profile
+```
+
+Confirm the installation:
+
+```
+git version 2.21.0
+hub version 2.10.0
+```
+
+## Set up your working copy
+
+You set up the working copy of the repository locally on your computer. Your local copy of the files is what you'll edit, compile, and end up pushing back to GitHub. The main steps are cloning the repository and creating your fork as a remote.
+
+### Clone the repository
+
+We assume that you've set up your `GOPATH` (see the section above if you're unsure about this). You should now copy the Hugo repository down to your computer. You'll hear this called "clone the repo". GitHub's [help pages](https://help.github.com/articles/cloning-a-repository/) give us a short explanation:
+
+> When you create a repository on GitHub, it exists as a remote repository. You can create a local clone of your repository on your computer and sync between the two locations.
+
+We're going to clone the [master Hugo repository](https://github.com/gohugoio/hugo). That seems counter-intuitive, since you won't have commit rights on it. But it's required for the Go workflow. You'll work on a copy of the master and push your changes to your own repository on GitHub.
+
+So, let's make a new directory and clone that master repository:
+
+```
+mkdir $HOME/src
+cd $HOME/src
+git clone https://github.com/gohugoio/hugo.git
+```
+
+> Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build.
+> The easiest is to clone Hugo in a directory outside of GOPATH
+
+And then, install dependencies of Hugo by running the following in the cloned directory:
+
+```
+cd $HOME/src/hugo
+go install
+```
+
+
+Hugo relies on [mage](https://github.com/magefile/mage) for some convenient build and test targets. If you don't already have it, get it:
+
+```
++go install github.com/magefile/mage@latest
+```
+
+### Fork the repository
+
+If you're not familiar with this term, GitHub's [help pages](https://help.github.com/articles/fork-a-repo/) provide again a simple explanation:
+
+> A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.
+
+#### Fork by hand
+
+Open the [Hugo repository](https://github.com/gohugoio/hugo) on GitHub and click on the "Fork" button in the top right.
+
+
+
+Now open your fork repository on GitHub and copy the remote url of your fork. You can choose between HTTPS and SSH as protocol that Git should use for the following operations. HTTPS works always [if you're not sure](https://help.github.com/articles/which-remote-url-should-i-use/).
+
+
+
+Switch back to the terminal and move into the directory of the cloned master repository from the last step.
+
+```
+cd $HOME/src/hugo
+```
+
+Now Git needs to know that our fork exists by adding the copied remote url:
+
+```
+git remote add <YOUR-GITHUB-USERNAME> <COPIED REMOTE-URL>
+```
+
+#### Fork with Hub
+
+Alternatively, you can use the Git wrapper Hub. Hub makes forking a repository easy:
+
+```
+git fork
+```
+
+That command will log in to GitHub using your account, create a fork of the repository that you're currently working in, and add it as a remote to your working copy.
+
+#### Trust, but verify
+
+Let's check if everything went right by listing all known remotes:
+
+```
+git remote -v
+```
+
+The output should look similar:
+
+```
+digitalcraftsman git@github.com:digitalcraftsman/hugo.git (fetch)
+digitalcraftsman git@github.com:digitalcraftsman/hugo.git (push)
+origin https://github.com/gohugoio/hugo (fetch)
+origin https://github.com/gohugoio/hugo (push)
+```
+
+## The Hugo Git Contribution Workflow
+
+### Create a new branch
+
+You should never develop against the "master" branch. The development team will not accept a pull request against that branch. Instead, create a descriptive named branch and work on it.
+
+First, you should always pull the latest changes from the master repository:
+
+```
+git checkout master
+git pull
+```
+
+Now we can create a new branch for your additions:
+
+```
+git checkout -b <BRANCH-NAME>
+```
+
+You can check on which branch you are with `git branch`. You should see a list of all local branches. The current branch is indicated with a little asterisk.
+
+### Contribute to Documentation
+
+Perhaps you want to start contributing to the Hugo docs. If so, you can ignore most of the following steps and focus on the `/docs` directory within your newly cloned repository. You can change directories into the Hugo docs using `cd docs`.
+
+You can start Hugo's built-in server via `hugo server`. Browse the documentation by entering [http://localhost:1313](http://localhost:1313) in the address bar of your browser. The server automatically updates the page whenever you change content.
+
+We have developed a [separate Hugo documentation contribution guide][docscontrib] for more information on how the Hugo docs are built, organized, and improved by the generosity of people like you.
+
+### Build Hugo
+
+While making changes in the codebase it's a good idea to build the binary to test them:
+
+```
+mage hugo
+```
+
+This command generates the binary file at the root of the repository.
+
+If you want to install the binary in `$GOPATH/bin`, run
+
+```
+mage install
+```
+
+### Test
+Sometimes changes on the codebase can cause unintended side effects. Or they don't work as expected. Most functions have their own test cases. You can find them in files ending with `_test.go`.
+
+Make sure the commands
+
+```
+mage -v check
+```
+
+passes.
+
+### Formatting
+The Go code styleguide maybe is opinionated but it ensures that the codebase looks the same, regardless who wrote the code. Go comes with its own formatting tool. Let's apply the styleguide to our additions:
+
+```
+mage fmt
+```
+
+Once you made your additions commit your changes. Make sure that you follow our [code contribution guidelines](https://github.com/gohugoio/hugo/blob/master/CONTRIBUTING.md):
+
+```
+# Add all changed files
+git add --all
+git commit --message "YOUR COMMIT MESSAGE"
+```
+
+The commit message should describe what the commit does (e.g. add feature XYZ), not how it is done.
+
+### Modify commits
+
+You noticed some commit messages don't fulfill the code contribution guidelines or you just forget something to add some files? No problem. Git provides the necessary tools to fix such problems. The next two methods cover all common cases.
+
+If you are unsure what a command does leave the commit as it is. We can fix your commits later in the pull request.
+
+#### Modify the last commit
+
+Let's say you want to modify the last commit message. Run the following command and replace the current message:
+
+```
+git commit --amend -m"YOUR NEW COMMIT MESSAGE"
+```
+
+Take a look at the commit log to see the change:
+
+```
+git log
+# Exit with q
+```
+
+After making the last commit you may have forgot something. There is no need to create a new commit. Just add the latest changes and merge them into the intended commit:
+
+```
+git add --all
+git commit --amend
+```
+
+#### Modify multiple commits
+
+{{% warning "Be Careful Modifying Multiple Commits"%}}
+Modifications such as those described in this section can have serious unintended consequences. Skip this section if you're not sure!
+{{% /warning %}}
+
+This is a bit more advanced. Git allows you to [rebase](https://git-scm.com/docs/git-rebase) commits interactively. In other words: it allows you to rewrite the commit history.
+
+```
+git rebase --interactive @~6
+```
+
+The `6` at the end of the command represents the number of commits that should be modified. An editor should open and present a list of last six commit messages:
+
+```
+pick 80d02a1 tpl: Add hasPrefix to the template funcs' "smoke test"
+pick aaee038 tpl: Sort the smoke tests
+pick f0dbf2c tpl: Add the other test case for hasPrefix
+pick 911c35b Add "How to contribute to Hugo" tutorial
+pick 33c8973 Begin workflow
+pick 3502f2e Refactoring and typo fixes
+```
+
+In the case above we should merge the last two commits in the commit of this tutorial (`Add "How to contribute to Hugo" tutorial`). You can "squash" commits, i.e. merge two or more commits into a single one.
+
+All operations are written before the commit message. Replace "pick" with an operation. In this case `squash` or `s` for short:
+
+```
+pick 80d02a1 tpl: Add hasPrefix to the template funcs' "smoke test"
+pick aaee038 tpl: Sort the smoke tests
+pick f0dbf2c tpl: Add the other test case for hasPrefix
+pick 911c35b Add "How to contribute to Hugo" tutorial
+squash 33c8973 Begin workflow
+squash 3502f2e Refactoring and typo fixes
+```
+
+We also want to rewrite the commits message of the third last commit. We forgot "docs:" as prefix according to the code contribution guidelines. The operation to rewrite a commit is called `reword` (or `r` as shortcut).
+
+You should end up with a similar setup:
+
+```
+pick 80d02a1 tpl: Add hasPrefix to the template funcs' "smoke test"
+pick aaee038 tpl: Sort the smoke tests
+pick f0dbf2c tpl: Add the other test case for hasPrefix
+reword 911c35b Add "How to contribute to Hugo" tutorial
+squash 33c8973 Begin workflow
+squash 3502f2e Refactoring and typo fixes
+```
+
+Close the editor. It should open again with a new tab. A text is instructing you to define a new commit message for the last two commits that should be merged (aka "squashed"). Save the file with <kbd>CTRL</kbd>+<kbd>S</kbd> and close the editor again.
+
+A last time a new tab opens. Enter a new commit message and save again. Your terminal should contain a status message. Hopefully this one:
+
+```
+Successfully rebased and updated refs/heads/<BRANCHNAME>.
+```
+
+Check the commit log if everything looks as expected. Should an error occur you can abort this rebase with `git rebase --abort`.
+
+### Push commits
+
+To push our commits to the fork on GitHub we need to specify a destination. A destination is defined by the remote and a branch name. Earlier, the defined that the remote url of our fork is the same as our GitHub handle, in my case `digitalcraftsman`. The branch should have the same as our local one. This makes it easy to identify corresponding branches.
+
+```
+git push --set-upstream <YOUR-GITHUB-USERNAME> <BRANCHNAME>
+```
+
+Now Git knows the destination. Next time when you to push commits you just need to enter `git push`.
+
+If you modified your commit history in the last step GitHub will reject your try to push. This is a safety-feature because the commit history isn't the same and new commits can't be appended as usual. You can enforce this push explicitly with `git push --force`.
+
+## Open a pull request
+
+We made a lot of progress. Good work. In this step we finally open a pull request to submit our additions. Open the [Hugo master repository](https://github.com/gohugoio/hugo/) on GitHub in your browser.
+
+You should find a green button labeled with "New pull request". But GitHub is clever and probably suggests you a pull request like in the beige box below:
+
+
+
+The new page summaries the most important information of your pull request. Scroll down and you find the additions of all your commits. Make sure everything looks as expected and click on "Create pull request".
+
+### Accept the contributor license agreement
+
+Last but not least you should accept the contributor license agreement (CLA). A new comment should be added automatically to your pull request. Click on the yellow badge, accept the agreement and authenticate yourself with your GitHub account. It just takes a few clicks and only needs to be done once.
+
+
+
+### Automatic builds
+
+We use the [Travis CI loop](https://travis-ci.org/gohugoio/hugo) (Linux and OS X) and [AppVeyor](https://ci.appveyor.com/project/gohugoio/hugo/branch/master) (Windows) to compile Hugo with your additions. This should ensure that everything works as expected before merging your pull request. This in most cases only relevant if you made changes to the codebase of Hugo.
+
+
+
+Above you can see that Travis wasn't able to compile the changes in this pull request. Click on "Details" and try to investigate why the build failed. But it doesn't have to be your fault. Mostly, the `master` branch that we used as foundation for your pull request should build without problems.
+
+If you have questions, leave a comment in the pull request. We are willing to assist you.
+
+## Where to start?
+
+Thank you for reading through this contribution guide. Hopefully, we will see you again soon on GitHub. There are plenty of [open issues][issues] for you to help with.
+
+Feel free to [open an issue][newissue] if you think you found a bug or you have a new idea to improve Hugo. We are happy to hear from you.
+
+## Additional References for Learning Git and Go
+
+* [Codecademy's Free "Learn Git" Course][codecademy] (Free)
+* [Code School and GitHub's "Try Git" Tutorial][trygit] (Free)
+* [The Git Book][gitbook] (Free)
+* [Go Bootcamp][gobootcamp]
+* [GitHub Pull Request Tutorial, Thinkful][thinkful]
+
+
+[codecademy]: https://www.codecademy.com/learn/learn-git
+[contributors]: https://github.com/gohugoio/hugo/graphs/contributors
+[docscontrib]: /contribute/documentation/
+[forums]: https://discourse.gohugo.io
+[gitbook]: https://git-scm.com/
+[gobootcamp]: http://www.golangbootcamp.com/book/get_setup
+[godl]: https://golang.org/dl/
+[goinstall]: https://golang.org/doc/install
+[gvm]: https://github.com/moovweb/gvm
+[issues]: https://github.com/gohugoio/hugo/issues
+[newissue]: https://github.com/gohugoio/hugo/issues/new
+[releases]: /getting-started/
+[setupgopath]: https://golang.org/doc/code.html#Workspaces
+[thinkful]: https://www.thinkful.com/learn/github-pull-request-tutorial/
+[trygit]: https://try.github.io/levels/1/challenges/1
--- /dev/null
- **Note:** We overhauled and simplified the `.GetPage` API in Hugo 0.45. Before that you needed to provide a `Kind` attribute in addition to the path, e.g. `{{ .Site.GetPage "section" "blog" }}`. This will still work, but is now superflous.
+---
+title: .GetPage
+description: "Gets a `Page` of a given `path`."
+date: 2017-02-01
+publishdate: 2017-02-01
+lastmod: 2017-02-01
+categories: [functions]
+menu:
+ docs:
+ parent: "functions"
+keywords: [sections,lists,indexes]
+signature: [".GetPage PATH"]
+workson: []
+hugoversion:
+relatedfuncs: []
+deprecated: false
+aliases: []
+---
+
+`.GetPage` returns a page of a given `path`. Both `Site` and `Page` implements this method. The `Page` variant will, if given a relative path -- i.e. a path without a leading `/` -- try look for the page relative to the current page.
+
+{{% note %}}
- This method wil return `nil` when no page could be found, so the above will not print anything if the blog section is not found.
++**Note:** We overhauled and simplified the `.GetPage` API in Hugo 0.45. Before that you needed to provide a `Kind` attribute in addition to the path, e.g. `{{ .Site.GetPage "section" "blog" }}`. This will still work, but is now superfluous.
+{{% /note %}}
+
+
+```go-html-template
+{{ with .Site.GetPage "/blog" }}{{ .Title }}{{ end }}
+```
+
++This method will return `nil` when no page could be found, so the above will not print anything if the blog section is not found.
+
+To find a regular page in the blog section::
+
+```go-html-template
+{{ with .Site.GetPage "/blog/my-post.md" }}{{ .Title }}{{ end }}
+```
+
+And since `Page` also provides a `.GetPage` method, the above is the same as:
+
+```go-html-template
+{{ with .Site.GetPage "/blog" }}
+{{ with .GetPage "my-post.md" }}{{ .Title }}{{ end }}
+{{ end }}
+```
+
+## .GetPage and Multilingual Sites
+
+The previous examples have used the full content filename to lookup the post. Depending on how you have organized your content (whether you have the language code in the file name or not, e.g. `my-post.en.md`), you may want to do the lookup without extension. This will get you the current language's version of the page:
+
+```go-html-template
+{{ with .Site.GetPage "/blog/my-post" }}{{ .Title }}{{ end }}
+```
+
+## .GetPage Example
+
+This code snippet---in the form of a [partial template][partials]---allows you to do the following:
+
+1. Grab the index object of your `tags` [taxonomy][].
+2. Assign this object to a variable, `$t`
+3. Sort the terms associated with the taxonomy by popularity.
+4. Grab the top two most popular terms in the taxonomy (i.e., the two most popular tags assigned to content.
+
+{{< code file="grab-top-two-tags.html" >}}
+<ul class="most-popular-tags">
+{{ $t := .Site.GetPage "/tags" }}
+{{ range first 2 $t.Data.Terms.ByCount }}
+ <li>{{ . }}</li>
+{{ end }}
+</ul>
+{{< /code >}}
+
+## `.GetPage` on Page Bundles
+
+If the page retrieved by `.GetPage` is a [Leaf Bundle][leaf_bundle], and you
+need to get the nested _**page** resources_ in that, you will need to use the
+methods in `.Resources` as explained in the [Page Resources][page_resources]
+section.
+
+See the [Headless Bundle][headless_bundle] documentation for an example.
+
+
+[partials]: /templates/partials/
+[taxonomy]: /content-management/taxonomies/
+[page_kinds]: /templates/section-templates/#page-kinds
+[leaf_bundle]: /content-management/page-bundles/#leaf-bundles
+[headless_bundle]: /content-management/page-bundles/#headless-bundle
+[page_resources]: /content-management/page-resources/
--- /dev/null
- Note that the `key` can be either a `string` or a `string slice`. The latter is useful to create a deply nested structure, e.g.:
+---
+title: dict
+description: Creates a dictionary from a list of key and value pairs.
+date: 2017-02-01
+publishdate: 2017-02-01
+lastmod: 2017-02-26
+categories: [functions]
+menu:
+ docs:
+ parent: "functions"
+keywords: [dictionary]
+signature: ["dict KEY VALUE [KEY VALUE]..."]
+workson: []
+hugoversion:
+relatedfuncs: []
+deprecated: false
+aliases: []
+---
+
+`dict` is especially useful for passing more than one value to a partial template.
+
++Note that the `key` can be either a `string` or a `string slice`. The latter is useful to create a deeply nested structure, e.g.:
+
+```go-text-template
+{{ $m := dict (slice "a" "b" "c") "value" }}
+```
+
+
+## Example: Using `dict` to pass multiple values to a `partial`
+
+The partial below creates a SVG and expects `fill`, `height` and `width` from the caller:
+
+**Partial definition**
+
+{{< code file="layouts/partials/svgs/external-links.svg" download="external-links.svg" >}}
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
+fill="{{ .fill }}" width="{{ .width }}" height="{{ .height }}" viewBox="0 0 32 32" aria-label="External Link">
+<path d="M25.152 16.576v5.696q0 2.144-1.504 3.648t-3.648 1.504h-14.848q-2.144 0-3.648-1.504t-1.504-3.648v-14.848q0-2.112 1.504-3.616t3.648-1.536h12.576q0.224 0 0.384 0.16t0.16 0.416v1.152q0 0.256-0.16 0.416t-0.384 0.16h-12.576q-1.184 0-2.016 0.832t-0.864 2.016v14.848q0 1.184 0.864 2.016t2.016 0.864h14.848q1.184 0 2.016-0.864t0.832-2.016v-5.696q0-0.256 0.16-0.416t0.416-0.16h1.152q0.256 0 0.416 0.16t0.16 0.416zM32 1.152v9.12q0 0.48-0.352 0.8t-0.8 0.352-0.8-0.352l-3.136-3.136-11.648 11.648q-0.16 0.192-0.416 0.192t-0.384-0.192l-2.048-2.048q-0.192-0.16-0.192-0.384t0.192-0.416l11.648-11.648-3.136-3.136q-0.352-0.352-0.352-0.8t0.352-0.8 0.8-0.352h9.12q0.48 0 0.8 0.352t0.352 0.8z"></path>
+</svg>
+{{< /code >}}
+
+**Partial call**
+
+The `fill`, `height` and `width` values can be stored in one object with `dict` and passed to the partial:
+
+{{< code file="layouts/_default/list.html" >}}
+{{ partial "svgs/external-links.svg" (dict "fill" "#01589B" "width" 10 "height" 20 ) }}
+{{< /code >}}
+
+
+
+[partials]: /templates/partials/
--- /dev/null
- description: Checks whether a file exists under the given path.
+---
+title: "fileExists"
+linktitle: "fileExists"
+date: 2017-08-31T22:38:22+02:00
- lastmod: 2017-08-31T22:38:22+02:00
++description: Checks for file or directory existence.
+publishdate: 2017-08-31T22:38:22+02:00
- signature: ["fileExists PATH"]
++lastmod: 2021-11-26
+categories: [functions]
+menu:
+ docs:
+ parent: "functions"
- relatedfuncs: []
++signature: ["os.FileExists PATH","fileExists PATH"]
+workson: []
+hugoversion:
- `fileExists` allows you to check if a file exists under a given path, e.g. before inserting code into a template:
++relatedfuncs: ['os.ReadDir','os.ReadFile','os.Stat']
+deprecated: false
+aliases: []
+---
++The `os.FileExists` function attempts to resolve the path relative to the root of your project directory. If a matching file or directory is not found, it will attempt to resolve the path relative to the [`contentDir`]({{< relref "getting-started/configuration#contentdir">}}). A leading path separator (`/`) is optional.
+
- {{ if (fileExists "static/img/banner.jpg") -}}
- <img src="{{ "img/banner.jpg" | absURL }}" />
- {{- end }}
- ```
++With this directory structure:
+
++```text
++content/
++├── about.md
++├── contact.md
++└── news/
++ ├── article-1.md
++ └── article-2.md
+```
- In the example above, a banner from the `static` folder should be shown if the given path points to an existing file.
+
++The function returns these values:
++
++```go-html-template
++{{ os.FileExists "content" }} --> true
++{{ os.FileExists "content/news" }} --> true
++{{ os.FileExists "content/news/article-1" }} --> false
++{{ os.FileExists "content/news/article-1.md" }} --> true
++{{ os.FileExists "news" }} --> true
++{{ os.FileExists "news/article-1" }} --> false
++{{ os.FileExists "news/article-1.md" }} --> true
++```
--- /dev/null
- description: Returns the value of an environment variable.
+---
+title: getenv
- lastmod: 2017-02-01
++description: Returns the value of an environment variable, or an empty string if the environment variable is not set.
+date: 2017-02-01
+publishdate: 2017-02-01
- signature: ["getenv VARIABLE"]
++lastmod: 2021-11-26
+categories: [functions]
+menu:
+ docs:
+ parent: "functions"
+keywords: []
- Takes a string containing the name of the variable as input. Returns
- an empty string if the variable is not set, otherwise returns the
- value of the variable.
-
++signature: ["os.Getenv VARIABLE", "getenv VARIABLE"]
+workson: []
+hugoversion:
+relatedfuncs: []
+deprecated: false
+aliases: []
+---
++Examples:
+
- {{ getenv "HOME" }}
++```go-html-template
++{{ os.Getenv "HOME" }} --> /home/victor
++{{ os.Getenv "USER" }} --> victor
+```
- {{% note %}}
- In Unix-like environments, the variable must also be exported in order to be seen by `hugo`.
- {{% /note %}}
++
++You can pass values when building your site:
++
++```bash
++MY_VAR1=foo MY_VAR2=bar hugo
++
++OR
++
++export MY_VAR1=foo
++export MY_VAR2=bar
++hugo
+```
+
++And then retrieve the values within a template:
++
++```go-html-template
++{{ os.Getenv "MY_VAR1" }} --> foo
++{{ os.Getenv "MY_VAR2" }} --> bar
++```
--- /dev/null
- description: Gets a file information of a given path.
+---
+title: os.Stat
- lastmod: 2018-08-07
++description: Returns a FileInfo structure describing a file or directory.
+date: 2018-08-07
+publishdate: 2018-08-07
- relatedfuncs: [readDir]
++lastmod: 2021-11-26
+categories: [functions]
+menu:
+ docs:
+ parent: "functions"
+keywords: [files]
+signature: ["os.Stat PATH"]
+workson: []
+hugoversion:
- If your current project working directory has a single file named `README.txt` (30 bytes):
- ```
- {{ $stat := os.Stat "README.txt" }}
- {{ $stat.Name }} → "README.txt"
- {{ $stat.Size }} → 30
- ```
-
- Function [`os.Stat`][Stat] returns [`os.FileInfo`][osfileinfo].
- For further information of `os.FileInfo`, see [golang page][osfileinfo].
++relatedfuncs: ['os.FileExists','os.ReadDir','os.ReadFile']
+deprecated: false
+aliases: []
+---
++The `os.Stat` function attempts to resolve the path relative to the root of your project directory. If a matching file or directory is not found, it will attempt to resolve the path relative to the [`contentDir`]({{< relref "getting-started/configuration#contentdir">}}). A leading path separator (`/`) is optional.
+
- [Stat]: /functions/os.Stat/
- [osfileinfo]: https://golang.org/pkg/os/#FileInfo
++```go-html-template
++{{ $f := os.Stat "README.md" }}
++{{ $f.IsDir }} --> false (bool)
++{{ $f.ModTime }} --> 2021-11-25 10:06:49.315429236 -0800 PST (time.Time)
++{{ $f.Name }} --> README.md (string)
++{{ $f.Size }} --> 241 (int64)
+
++{{ $d := os.Stat "content" }}
++{{ $d.IsDir }} --> true (bool)
++```
+
++Details of the `FileInfo` structure are available in the [Go documentation](https://pkg.go.dev/io/fs#FileInfo).
--- /dev/null
- description: Gets a directory listing from a directory relative to the current working directory.
- date: 2017-02-01
+---
+title: readDir
- lastmod: 2017-02-01
++description: Returns an array of FileInfo structures sorted by filename, one element for each directory entry.
+publishdate: 2017-02-01
- signature: ["readDir PATH"]
++lastmod: 2021-11-26
+categories: [functions]
+menu:
+ docs:
+ parent: "functions"
+keywords: [files]
- relatedfuncs: [readFile]
++signature: ["os.ReadDir PATH", "readDir PATH"]
+workson: []
+hugoversion:
- If your current project working directory has a single file named `README.txt`:
++relatedfuncs: ['os.FileExists','os.ReadFile','os.Stat']
+deprecated: false
+aliases: []
+---
++The `os.ReadDir` function resolves the path relative to the root of your project directory. A leading path separator (`/`) is optional.
+
- {{ range (readDir ".") }}{{ .Name }}{{ end }} → "README.txt"
++With this directory structure:
+
++```text
++content/
++├── about.md
++├── contact.md
++└── news/
++ ├── article-1.md
++ └── article-2.md
+```
- For more information on using `readDir` and `readFile` in your templates, see [Local File Templates][local].
++
++This template code:
++
++```go-html-template
++{{ range os.ReadDir "content" }}
++ {{ .Name }} --> {{ .IsDir }}
++{{ end }}
++```
++
++Produces:
++
++```html
++about.md --> false
++contact.md --> false
++news --> true
+```
+
- [local]: /templates/files/
++Note that `os.ReadDir` is not recursive.
++
++Details of the `FileInfo` structure are available in the [Go documentation](https://pkg.go.dev/io/fs#FileInfo).
+
++For more information on using `readDir` and `readFile` in your templates, see [Local File Templates]({{< relref "/templates/files" >}}).
--- /dev/null
- description: Reads a file from disk relative to the current project working directory and returns a string.
+---
+title: readFile
- lastmod: 2017-04-30
++description: Returns the contents of a file.
+date: 2017-02-01
+publishdate: 2017-02-01
- signature: ["readFile PATH"]
++lastmod: 2021-11-26
+categories: [functions]
+menu:
+ docs:
+ parent: "functions"
+keywords: [files]
- relatedfuncs: [readDir]
++signature: ["os.ReadFile PATH", "readFile PATH"]
+workson: []
+hugoversion:
- Note that the filename must be relative to the current project working directory, or the project's `/content` folder.
-
- So, if you have a file with the name `README.txt` in the root of your project with the content `Hugo Rocks!`:
++relatedfuncs: ['os.FileExists','os.ReadDir','os.Stat']
+deprecated: false
+aliases: []
+---
++The `os.ReadFile` function attempts to resolve the path relative to the root of your project directory. If a matching file is not found, it will attempt to resolve the path relative to the [`contentDir`]({{< relref "getting-started/configuration#contentdir">}}). A leading path separator (`/`) is optional.
+
- {{readFile "README.txt"}} → "Hugo Rocks!"
++With a file named README.md in the root of your project directory:
+
++```text
++This is **bold** text.
+```
- If you receive a "file doesn't exist" error with a path listed, do take note that the path is the last one checked by the function, and may not accurately reflect your target. You should generally double-check your path for mistakes.
++
++This template code:
++
++```go-html-template
++{{ os.ReadFile "README.md" }}
+```
+
- For more information on using `readDir` and `readFile` in your templates, see [Local File Templates][local].
++Produces:
++
++```html
++This is **bold** text.
++```
+
- [local]: /templates/files/
++Note that `os.ReadFile` returns raw (uninterpreted) content.
+
++For more information on using `readDir` and `readFile` in your templates, see [Local File Templates]({{< relref "/templates/files" >}}).
--- /dev/null
- In addition, borrowing from the extended behavior described at https://php.net substr, if `length` is given and is negative, that number of characters will be omitted from the end of string.
+---
+title: substr
+# linktitle:
+description: Extracts parts of a string from a specified character's position and returns the specified number of characters.
+date: 2017-02-01
+publishdate: 2017-02-01
+lastmod: 2017-02-01
+categories: [functions]
+menu:
+ docs:
+ parent: "functions"
+keywords: [strings]
+aliases: []
+signature: ["substr STRING START [LENGTH]"]
+workson: []
+hugoversion:
+relatedfuncs: []
+deprecated: false
+---
+
+It normally takes two parameters: `start` and `length`. It can also take one parameter: `start`, i.e. `length` is omitted, in which case the substring starting from start until the end of the string will be returned.
+
+To extract characters from the end of the string, use a negative start number.
+
++If `length` is given and is negative, that number of characters will be omitted from the end of string.
+
+```
+{{ substr "abcdef" 0 }} → "abcdef"
+{{ substr "abcdef" 1 }} → "bcdef"
+
+{{ substr "abcdef" 0 1 }} → "a"
+{{ substr "abcdef" 1 1 }} → "b"
+
+{{ substr "abcdef" 0 -1 }} → "abcde"
+{{ substr "abcdef" 1 -1 }} → "bcde"
+
+{{ substr "abcdef" -1 }} → "f"
+{{ substr "abcdef" -2 }} → "ef"
+
+{{ substr "abcdef" -1 1 }} → "f"
+{{ substr "abcdef" -2 1 }} → "e"
+
+{{ substr "abcdef" -3 -1 }} → "de"
+{{ substr "abcdef" -3 -2 }} → "d"
+```
--- /dev/null
- draft: false
- description: .Unix returns the local Time corresponding to the given Unix time, sec seconds and nsec nanoseconds since January 1, 1970 UTC.
+---
+title: .Unix
- publishdate: 2017-02-01
- lastmod: 2017-02-01
++description: Converts a time.Time value to the number of seconds elapsed since the Unix epoch, excluding leap seconds. The Unix epoch is 00:00:00 UTC on 1 January 1970.
+date: 2017-02-01
- signature: [".Unix"]
- workson: [times]
- hugoversion:
+keywords: [dates,time]
+categories: [functions]
+menu:
+ docs:
+ parent: "functions"
- deprecated: false
- aliases: []
++signature: [".Unix",".UnixMilli",".UnixMicro",".UnixNano"]
+relatedfuncs: [Format,dateFormat,now,time]
- ## Example: Time Passed Since Last Modification
+---
+
- This very simple one-liner uses `now.Unix` to calculate the amount of time that has passed between the `.LastMod` for the current page and the last build of the current page.
++The `Milli`, `Micro`, and `Nano` variants return the number of milliseconds, microseconds, and nanoseconds (respectively) elapsed since the Unix epoch.
+
- {{< code file="time-passed.html" >}}
- {{ div (sub now.Unix .Lastmod.Unix) 86400 }}
- {{< /code >}}
++```go-html-template
++.Date.Unix --> 1637259694
++.ExpiryDate.Unix --> 1672559999
++.Lastmod.Unix --> 1637361786
++.PublishDate.Unix --> 1637421261
+
- Since both values are integers, they can be subtracted and then divided by the number of seconds in a day (i.e., `60 * 60 * 24 == 86400`).
-
- {{% note %}}
- Hugo's output is *static*. For the example above to be realistic, the site needs to be built every day.
- {{% /note %}}
-
- [partial template]: /templates/partials/
++("1970-01-01T00:00:00-00:00" | time.AsTime).Unix --> 0
++("1970-01-01T00:00:42-00:00" | time.AsTime).Unix --> 42
++("1970-04-11T01:48:29-08:00" | time.AsTime).Unix --> 8675309
++("2026-05-02T20:09:31-07:00" | time.AsTime).Unix --> 1777777771
+
++now.Unix --> 1637447841
++now.UnixMilli --> 1637447841347
++now.UnixMicro --> 1637447841347378
++now.UnixNano --> 1637447841347378799
++```
--- /dev/null
- **Default value:** 10000
+---
+title: Configure Hugo
+linktitle: Configuration
+description: How to configure your Hugo site.
+date: 2013-07-01
+publishdate: 2017-01-02
+lastmod: 2017-03-05
+categories: [getting started,fundamentals]
+keywords: [configuration,toml,yaml,json]
+menu:
+ docs:
+ parent: "getting-started"
+ weight: 60
+weight: 60
+sections_weight: 60
+draft: false
+aliases: [/overview/source-directory/,/overview/configuration/]
+toc: true
+---
+
+
+## Configuration File
+
+Hugo uses the `config.toml`, `config.yaml`, or `config.json` (if found in the
+site root) as the default site config file.
+
+The user can choose to override that default with one or more site config files
+using the command line `--config` switch.
+
+Examples:
+
+```
+hugo --config debugconfig.toml
+hugo --config a.toml,b.toml,c.toml
+```
+
+{{% note %}}
+Multiple site config files can be specified as a comma-separated string to the `--config` switch.
+{{% /note %}}
+
+{{< todo >}}TODO: distinct config.toml and others (the root object files){{< /todo >}}
+
+## Configuration Directory
+
+In addition to using a single site config file, one can use the `configDir` directory (default to `config/`) to maintain easier organization and environment specific settings.
+
+- Each file represents a configuration root object, such as `params.toml` for `[Params]`, `menu(s).toml` for `[Menu]`, `languages.toml` for `[Languages]` etc...
+- Each file's content must be top-level, for example:
+
+{{< code-toggle file="config" >}}
+[Params]
+ foo = "bar"
+{{< /code-toggle >}}
+
+{{< code-toggle file="params" >}}
+foo = "bar"
+{{< /code-toggle >}}
+
+- Each directory holds a group of files containing settings unique to an environment.
+- Files can be localized to become language specific.
+
+
+```
+├── config
+│ ├── _default
+│ │ ├── config.toml
+│ │ ├── languages.toml
+│ │ ├── menus.en.toml
+│ │ ├── menus.zh.toml
+│ │ └── params.toml
+│ ├── production
+│ │ ├── config.toml
+│ │ └── params.toml
+│ └── staging
+│ ├── config.toml
+│ └── params.toml
+```
+
+Considering the structure above, when running `hugo --environment staging`, Hugo will use every settings from `config/_default` and merge `staging`'s on top of those.
+{{% note %}}
+Default environments are __development__ with `hugo server` and __production__ with `hugo`.
+{{%/ note %}}
+
+## Merge Configuration from Themes
+
+{{< new-in "0.84.0" >}} The configuration merge described below was improved in Hugo 0.84.0 and made fully configurable. The big change/improvement was that we now, by default, do deep merging of `params` maps from themes.
+
+The configuration value for `_merge` can be one of:
+
+none
+: No merge.
+
+shallow
+: Only add values for new keys.
+
+deep
+: Add values for new keys, merge existing.
+
+Note that you don't need to be so verbose as in the default setup below; a `_merge` value higher up will be inherited if not set.
+
+{{< code-toggle config="mergeStrategy" skipHeader=true />}}
+
+## All Configuration Settings
+
+The following is the full list of Hugo-defined variables with their default
+value in parentheses. Users may choose to override those values in their site
+config file(s).
+
+### archetypeDir
+
+**Default value:** "archetypes"
+
+The directory where Hugo finds archetype files (content templates). {{% module-mounts-note %}}
+
+### assetDir
+
+**Default value:** "assets"
+
+The directory where Hugo finds asset files used in [Hugo Pipes](/hugo-pipes/). {{% module-mounts-note %}}
+
+### baseURL
+Hostname (and path) to the root, e.g. https://bep.is/
+
+### blackfriday
+See [Configure Blackfriday](/getting-started/configuration-markup#blackfriday)
+
+### build
+See [Configure Build](#configure-build)
+
+### buildDrafts (false)
+
+**Default value:** false
+
+Include drafts when building.
+
+### buildExpired
+
+**Default value:** false
+
+Include content already expired.
+
+### buildFuture
+
+**Default value:** false
+
+Include content with publishdate in the future.
+
+### caches
+See [Configure File Caches](#configure-file-caches)
+
+### cascade
+
+{{< new-in "0.86.0" >}}
+
+Pass down down default configuration values (front matter) to pages in the content tree. The options in site config is the same as in page front matter, see [Front Matter Cascade](/content-management/front-matter#front-matter-cascade).
+
+### canonifyURLs
+
+**Default value:** false
+
+Enable to turn relative URLs into absolute.
+
+### contentDir
+
+**Default value:** "content"
+
+The directory from where Hugo reads content files. {{% module-mounts-note %}}
+
++### copyright
++
++**Default value:** ""
++
++Copyright notice for your site, typically displayed in the footer.
++
+### dataDir
+
+**Default value:** "data"
+
+The directory from where Hugo reads data files. {{% module-mounts-note %}}
+
+### defaultContentLanguage
+
+**Default value:** "en"
+
+Content without language indicator will default to this language.
+
+### defaultContentLanguageInSubdir
+
+**Default value:** false
+
+Render the default content language in subdir, e.g. `content/en/`. The site root `/` will then redirect to `/en/`.
+
+### disableAliases
+
+**Default value:** false
+
+Will disable generation of alias redirects. Note that even if `disableAliases` is set, the aliases themselves are preserved on the page. The motivation with this is to be able to generate 301 redirects in an `.htaccess`, a Netlify `_redirects` file or similar using a custom output format.
+
+### disableHugoGeneratorInject
+
+**Default value:** false
+
+Hugo will, by default, inject a generator meta tag in the HTML head on the _home page only_. You can turn it off, but we would really appreciate if you don't, as this is a good way to watch Hugo's popularity on the rise.
+
+### disableKinds
+
+**Default value:** []
+
+Enable disabling of all pages of the specified *Kinds*. Allowed values in this list: `"page"`, `"home"`, `"section"`, `"taxonomy"`, `"term"`, `"RSS"`, `"sitemap"`, `"robotsTXT"`, `"404"`.
+
+### disableLiveReload
+
+**Default value:** false
+
+Disable automatic live reloading of browser window.
+
+### disablePathToLower
+
+**Default value:** false
+
+: Do not convert the url/path to lowercase.
+
+### enableEmoji
+
+**Default value:** false
+
+Enable Emoji emoticons support for page content; see the [Emoji Cheat Sheet](https://www.webpagefx.com/tools/emoji-cheat-sheet/).
+
+### enableGitInfo
+
+**Default value:** false
+
+Enable `.GitInfo` object for each page (if the Hugo site is versioned by Git). This will then update the `Lastmod` parameter for each page using the last git commit date for that content file.
+
+### enableInlineShortcodes
+
+**Default value:** false
+
+Enable inline shortcode support. See [Inline Shortcodes](/templates/shortcode-templates/#inline-shortcodes).
+
+### enableMissingTranslationPlaceholders
+
+**Default value:** false
+
+Show a placeholder instead of the default value or an empty string if a translation is missing.
+
+### enableRobotsTXT
+
+**Default value:** false
+
+Enable generation of `robots.txt` file.
+
+### frontmatter
+
+See [Front matter Configuration](#configure-front-matter).
+
+### footnoteAnchorPrefix
+
+**Default value:** ""
+
+Prefix for footnote anchors.
+
+### footnoteReturnLinkContents
+
+**Default value:** ""
+
+Text to display for footnote return links.
+
+### googleAnalytics
+
+**Default value:** ""
+
+Google Analytics tracking ID.
+
+### hasCJKLanguage
+
+**Default value:** false
+
+If true, auto-detect Chinese/Japanese/Korean Languages in the content. This will make `.Summary` and `.WordCount` behave correctly for CJK languages.
+
+### imaging
+See [Image Processing Config](/content-management/image-processing/#image-processing-config).
+
++### languageCode
++
++**Default value:** ""
++
++A language tag as defined by [RFC 5646](https://datatracker.ietf.org/doc/html/rfc5646). The internal [RSS template](https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml) populates its `<language>` element with this value. The value is not used elsewhere.
++
+### languages
+See [Configure Languages](/content-management/multilingual/#configure-languages).
+
+### disableLanguages
+
+See [Disable a Language](/content-management/multilingual/#disable-a-language)
+
+### markup
+See [Configure Markup](/getting-started/configuration-markup).{{< new-in "0.60.0" >}}
+
+### mediaTypes
+See [Configure Media Types](/templates/output-formats/#media-types).
+
+### menus
+See [Add Non-content Entries to a Menu](/content-management/menus/#add-non-content-entries-to-a-menu).
+
+### minify
+See [Configure Minify](#configure-minify)
+
+### module
+Module config see [Module Config](/hugo-modules/configuration/).{{< new-in "0.56.0" >}}
+
+### newContentEditor
+The editor to use when creating new content.
+
+### noChmod
+Don't sync permission mode of files.
+
+### noTimes
+Don't sync modification time of files.
+
+### outputFormats
+See [Configure Output Formats](#configure-additional-output-formats).
+
+### paginate
+
+**Default value:** 10
+
+Default number of elements per page in [pagination](/templates/pagination/).
+
+### paginatePath
+
+**Default value:** "page"
+
+The path element used during pagination (`https://example.com/page/2`).
+
+### permalinks
+See [Content Management](/content-management/urls/#permalinks).
+
+### pluralizeListTitles
+
+**Default value:** true
+
+Pluralize titles in lists.
+
+### publishDir
+
+**Default value:** "public"
+
+The directory to where Hugo will write the final static site (the HTML files etc.).
+
+### related
+: See [Related Content](/content-management/related/#configure-related-content).{{< new-in "0.27" >}}
+
+### relativeURLs
+Enable this to make all relative URLs relative to content root. Note that this does not affect absolute URLs.
+
+### refLinksErrorLevel
+
+**Default value:** "ERROR"
+
+When using `ref` or `relref` to resolve page links and a link cannot resolved, it will be logged with this log level. Valid values are `ERROR` (default) or `WARNING`. Any `ERROR` will fail the build (`exit -1`).
+
+### refLinksNotFoundURL
+URL to be used as a placeholder when a page reference cannot be found in `ref` or `relref`. Is used as-is.
+
++### removePathAccents
++
++**Default value:** false
++
++Removes [non-spacing marks](https://www.compart.com/en/unicode/category/Mn) from [composite characters](https://en.wikipedia.org/wiki/Precomposed_character) in content paths.
++
++```text
++content/post/hügó.md --> https://example.org/post/hugo/
++```
++
++
+### rssLimit
+
+Maximum number of items in the RSS feed.
+
+### sectionPagesMenu
+See ["Section Menu for Lazy Bloggers"](/templates/menu-templates/#section-menu-for-lazy-bloggers).
+
+### sitemap
+Default [sitemap configuration](/templates/sitemap-template/#configure-sitemapxml).
+
+### summaryLength
+
+**Default value:** 70
+
+The length of text in words to show in a [`.Summary`](/content-management/summaries/#hugo-defined-automatic-summary-splitting).
+
+### taxonomies
+See [Configure Taxonomies](/content-management/taxonomies#configure-taxonomies).
+
+### theme
+: See [Module Config](/hugo-modules/configuration/#module-config-imports) for how to import a theme.
+
+### themesDir
+
+**Default value:** "themes"
+
+The directory where Hugo reads the themes from.
+
+### timeout
+
- Timeout for generating page contents, in milliseconds (defaults to 10 seconds). *Note:* this is used to bail out of recursive content generation, if your pages are slow to generate (e.g., because they require large image processing or depend on remote contents) you might need to raise this limit.
++**Default value:** "30s"
+
- for = "/**.html"
++Timeout for generating page contents, specified as a [duration](https://pkg.go.dev/time#Duration) or in milliseconds. *Note:* this is used to bail out of recursive content generation. You might need to raise this limit if your pages are slow to generate (e.g., because they require large image processing or depend on remote contents).
+
+### timeZone
+
+{{< new-in "0.87.0" >}}
+
+The time zone (or location), e.g. `Europe/Oslo`, used to parse front matter dates without such information and in the [`time` function](/functions/time/). The list of valid values may be system dependent, but should include `UTC`, `Local`, and any location in the [IANA Time Zone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
+
+### title
+Site title.
+
+### titleCaseStyle
+
+**Default value:** "AP"
+
+See [Configure Title Case](#configure-title-case)
+
+### uglyURLs
+When enabled, creates URL of the form `/filename.html` instead of `/filename/`.
+
+### watch
+
+Watch filesystem for changes and recreate as needed.
+
+{{% note %}}
+If you are developing your site on a \*nix machine, here is a handy shortcut for finding a configuration option from the command line:
+```
+cd ~/sites/yourhugosite
+hugo config | grep emoji
+```
+
+which shows output like
+
+```
+enableemoji: true
+```
+{{% /note %}}
+
+## Configure Build
+
+{{< new-in "0.66.0" >}}
+
+The `build` configuration section contains global build-related configuration options.
+
+{{< code-toggle file="config">}}
+[build]
+useResourceCacheWhen="fallback"
+writeStats = false
+noJSConfigInAssets = false
+{{< /code-toggle >}}
+
+
+useResourceCacheWhen
+: When to use the cached resources in `/resources/_gen` for PostCSS and ToCSS. Valid values are `never`, `always` and `fallback`. The last value means that the cache will be tried if PostCSS/extended version is not available.
+
+writeStats {{< new-in "0.69.0" >}}
+: When enabled, a file named `hugo_stats.json` will be written to your project root with some aggregated data about the build, e.g. list of HTML entities published to be used to do [CSS pruning](/hugo-pipes/postprocess/#css-purging-with-postcss). If you're only using this for the production build, you should consider placing it below [config/production](/getting-started/configuration/#configuration-directory). It's also worth mentioning that, due to the nature of the partial server builds, new HTML entities will be added when you add or change them while the server is running, but the old values will not be removed until you restart the server or run a regular `hugo` build.
+
+**Note** that the prime use case for this is purging of unused CSS; it is build for speed and there may be false positives (e.g. elements that isn't really a HTML element).
+
+noJSConfigInAssets {{< new-in "0.78.0" >}}
+: Turn off writing a `jsconfig.json` into your `/assets` folder with mapping of imports from running [js.Build](https://gohugo.io/hugo-pipes/js). This file is intended to help with intellisense/navigation inside code editors such as [VS Code](https://code.visualstudio.com/). Note that if you do not use `js.Build`, no file will be written.
+
+## Configure Server
+
+{{< new-in "0.67.0" >}}
+
+This is only relevant when running `hugo server`, and it allows to set HTTP headers during development, which allows you to test out your Content Security Policy and similar. The configuration format matches [Netlify's](https://docs.netlify.com/routing/headers/#syntax-for-the-netlify-configuration-file) with slightly more powerful [Glob matching](https://github.com/gobwas/glob):
+
+
+{{< code-toggle file="config">}}
+[server]
+[[server.headers]]
- for = "/**.html"
++for = "/**"
+
+[server.headers.values]
+X-Frame-Options = "DENY"
+X-XSS-Protection = "1; mode=block"
+X-Content-Type-Options = "nosniff"
+Referrer-Policy = "strict-origin-when-cross-origin"
+Content-Security-Policy = "script-src localhost:1313"
+{{< /code-toggle >}}
+
+Since this is is "development only", it may make sense to put it below the `development` environment:
+
+
+{{< code-toggle file="config/development/server">}}
+[[headers]]
- To exclude specific files from the content and data directories when rendering your site, set `ignoreFiles` to one or more regular expressions.
++for = "/**"
+
+[headers.values]
+X-Frame-Options = "DENY"
+X-XSS-Protection = "1; mode=block"
+X-Content-Type-Options = "nosniff"
+Referrer-Policy = "strict-origin-when-cross-origin"
+Content-Security-Policy = "script-src localhost:1313"
+{{< /code-toggle >}}
+
+
+{{< new-in "0.72.0" >}}
+
+You can also specify simple redirects rules for the server. The syntax is again similar to Netlify's.
+
+Note that a `status` code of 200 will trigger a [URL rewrite](https://docs.netlify.com/routing/redirects/rewrites-proxies/), which is what you want in SPA situations, e.g:
+
+{{< code-toggle file="config/development/server">}}
+[[redirects]]
+from = "/myspa/**"
+to = "/myspa/"
+status = 200
+force = false
+{{< /code-toggle >}}
+
+{{< new-in "0.76.0" >}} Setting `force=true` will make a redirect even if there is existing content in the path. Note that before Hugo 0.76 `force` was the default behaviour, but this is inline with how Netlify does it.
+
+## Configure Title Case
+
+Set `titleCaseStyle` to specify the title style used by the [title](/functions/title/) template function and the automatic section titles in Hugo. It defaults to [AP Stylebook](https://www.apstylebook.com/) for title casing, but you can also set it to `Chicago` or `Go` (every word starts with a capital letter).
+
+## Configuration Environment Variables
+
+HUGO_NUMWORKERMULTIPLIER
+: Can be set to increase or reduce the number of workers used in parallel processing in Hugo. If not set, the number of logical CPUs will be used.
+
+## Configuration Lookup Order
+
+Similar to the template [lookup order][], Hugo has a default set of rules for searching for a configuration file in the root of your website's source directory as a default behavior:
+
+1. `./config.toml`
+2. `./config.yaml`
+3. `./config.json`
+
+In your `config` file, you can direct Hugo as to how you want your website rendered, control your website's menus, and arbitrarily define site-wide parameters specific to your project.
+
+
+## Example Configuration
+
+The following is a typical example of a configuration file. The values nested under `params:` will populate the [`.Site.Params`][] variable for use in [templates][]:
+
+{{< code-toggle file="config">}}
+baseURL: "https://yoursite.example.com/"
+title: "My Hugo Site"
+footnoteReturnLinkContents: "↩"
+permalinks:
+ posts: /:year/:month/:title/
+params:
+ Subtitle: "Hugo is Absurdly Fast!"
+ AuthorName: "Jon Doe"
+ GitHubUser: "spf13"
+ ListOfFoo:
+ - "foo1"
+ - "foo2"
+ SidebarRecentLimit: 5
+{{< /code-toggle >}}
+
+## Configure with Environment Variables
+
+In addition to the 3 config options already mentioned, configuration key-values can be defined through operating system environment variables.
+
+For example, the following command will effectively set a website's title on Unix-like systems:
+
+```
+$ env HUGO_TITLE="Some Title" hugo
+```
+
+This is really useful if you use a service such as Netlify to deploy your site. Look at the Hugo docs [Netlify configuration file](https://github.com/gohugoio/hugoDocs/blob/master/netlify.toml) for an example.
+
+{{% note "Setting Environment Variables" %}}
+Names must be prefixed with `HUGO_` and the configuration key must be set in uppercase when setting operating system environment variables.
+
+To set config params, prefix the name with `HUGO_PARAMS_`
+{{% /note %}}
+
+{{< new-in "0.79.0" >}} If you are using snake_cased variable names, the above will not work, so since Hugo 0.79.0 Hugo determines the delimiter to use by the first character after `HUGO`. This allows you to define environment variables on the form `HUGOxPARAMSxAPI_KEY=abcdefgh`, using any [allowed](https://stackoverflow.com/questions/2821043/allowed-characters-in-linux-environment-variable-names#:~:text=So%20names%20may%20contain%20any,not%20begin%20with%20a%20digit.) delimiter.
+
+{{< todo >}}
+Test and document setting params via JSON env var.
+{{< /todo >}}
+
+## Ignore Content and Data Files when Rendering
+
- For example, to ignore content and data files ending with `.foo` and `.boo`:
++To exclude specific files from the `content` and `data` directories when rendering your site, set `ignoreFiles` to one or more regular expressions to match against the absolute file path.
++
++To ignore files ending with `.foo` or `.boo`:
++
++{{< code-toggle copy="false" >}}
++ignoreFiles = ['\.foo$', '\.boo$']
++{{< /code-toggle >}}
+
- {{< code-toggle >}}
- ignoreFiles = [ "\\.foo$","\\.boo$"]
++To ignore a file using the absolute file path:
+
++{{< code-toggle copy="false" >}}
++ignoreFiles = ['^/home/user/project/content/test\.md$']
+{{< /code-toggle >}}
+
+## Configure Front Matter
+
+### Configure Dates
+
+Dates are important in Hugo, and you can configure how Hugo assigns dates to your content pages. You do this by adding a `frontmatter` section to your `config.toml`.
+
+
+The default configuration is:
+
+{{< code-toggle file="config" >}}
+[frontmatter]
+date = ["date", "publishDate", "lastmod"]
+lastmod = [":git", "lastmod", "date", "publishDate"]
+publishDate = ["publishDate", "date"]
+expiryDate = ["expiryDate"]
+{{< /code-toggle >}}
+
+If you, as an example, have a non-standard date parameter in some of your content, you can override the setting for `date`:
+
+{{< code-toggle file="config" >}}
+[frontmatter]
+date = ["myDate", ":default"]
+{{< /code-toggle >}}
+
+The `:default` is a shortcut to the default settings. The above will set `.Date` to the date value in `myDate` if present, if not we will look in `date`,`publishDate`, `lastmod` and pick the first valid date.
+
+In the list to the right, values starting with ":" are date handlers with a special meaning (see below). The others are just names of date parameters (case insensitive) in your front matter configuration. Also note that Hugo have some built-in aliases to the above: `lastmod` => `modified`, `publishDate` => `pubdate`, `published` and `expiryDate` => `unpublishdate`. With that, as an example, using `pubDate` as a date in front matter, will, by default, be assigned to `.PublishDate`.
+
+The special date handlers are:
+
+
+`:fileModTime`
+: Fetches the date from the content file's last modification timestamp.
+
+An example:
+
+{{< code-toggle file="config" >}}
+[frontmatter]
+lastmod = ["lastmod", ":fileModTime", ":default"]
+{{< /code-toggle >}}
+
+
+The above will try first to extract the value for `.Lastmod` starting with the `lastmod` front matter parameter, then the content file's modification timestamp. The last, `:default` should not be needed here, but Hugo will finally look for a valid date in `:git`, `date` and then `publishDate`.
+
+
+`:filename`
+: Fetches the date from the content file's filename. For example, `2018-02-22-mypage.md` will extract the date `2018-02-22`. Also, if `slug` is not set, `mypage` will be used as the value for `.Slug`.
+
+An example:
+
+{{< code-toggle file="config" >}}
+[frontmatter]
+date = [":filename", ":default"]
+{{< /code-toggle >}}
+
+The above will try first to extract the value for `.Date` from the filename, then it will look in front matter parameters `date`, `publishDate` and lastly `lastmod`.
+
+
+`:git`
+: This is the Git author date for the last revision of this content file. This will only be set if `--enableGitInfo` is set or `enableGitInfo = true` is set in site config.
+
+## Configure Additional Output Formats
+
+Hugo v0.20 introduced the ability to render your content to multiple output formats (e.g., to JSON, AMP html, or CSV). See [Output Formats][] for information on how to add these values to your Hugo project's configuration file.
+
+## Configure Minify
+
+{{< new-in "0.68.0" >}}
+
+Default configuration:
+
+{{< code-toggle config="minify" />}}
+
+## Configure File Caches
+
+Since Hugo 0.52 you can configure more than just the `cacheDir`. This is the default configuration:
+
+{{< code-toggle >}}
+[caches]
+[caches.getjson]
+dir = ":cacheDir/:project"
+maxAge = -1
+[caches.getcsv]
+dir = ":cacheDir/:project"
+maxAge = -1
+[caches.getresource]
+dir = ":cacheDir/:project"
+maxAge = -1
+[caches.images]
+dir = ":resourceDir/_gen"
+maxAge = -1
+[caches.assets]
+dir = ":resourceDir/_gen"
+maxAge = -1
+[caches.modules]
+dir = ":cacheDir/modules"
+maxAge = -1
+{{< /code-toggle >}}
+
+You can override any of these cache settings in your own `config.toml`.
+
+### The keywords explained
+
+`:cacheDir`
+: This is the value of the `cacheDir` config option if set (can also be set via OS env variable `HUGO_CACHEDIR`). It will fall back to `/opt/build/cache/hugo_cache/` on Netlify, or a `hugo_cache` directory below the OS temp dir for the others. This means that if you run your builds on Netlify, all caches configured with `:cacheDir` will be saved and restored on the next build. For other CI vendors, please read their documentation. For an CircleCI example, see [this configuration](https://github.com/bep/hugo-sass-test/blob/6c3960a8f4b90e8938228688bc49bdcdd6b2d99e/.circleci/config.yml).
+
+`:project`
+: The base directory name of the current Hugo project. This means that, in its default setting, every project will have separated file caches, which means that when you do `hugo --gc` you will not touch files related to other Hugo projects running on the same PC.
+
+`:resourceDir`
+: This is the value of the `resourceDir` config option.
+
+maxAge
+: This is the duration before a cache entry will be evicted, -1 means forever and 0 effectively turns that particular cache off. Uses Go's `time.Duration`, so valid values are `"10s"` (10 seconds), `"10m"` (10 minutes) and `"10h"` (10 hours).
+
+dir
+: The absolute path to where the files for this cache will be stored. Allowed starting placeholders are `:cacheDir` and `:resourceDir` (see above).
+
+## Configuration Format Specs
+
+* [TOML Spec][toml]
+* [YAML Spec][yaml]
+* [JSON Spec][json]
+
+[`.Site.Params`]: /variables/site/
+[directory structure]: /getting-started/directory-structure
+[json]: https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf "Specification for JSON, JavaScript Object Notation"
+[lookup order]: /templates/lookup-order/
+[Output Formats]: /templates/output-formats/
+[templates]: /templates/
+[toml]: https://github.com/toml-lang/toml
+[yaml]: https://yaml.org/spec/
+[static-files]: /content-management/static-files/
--- /dev/null
+---
+title: Install Hugo
+linktitle: Install Hugo
+description: Install Hugo on macOS, Windows, Linux, OpenBSD, FreeBSD, and on any machine where the Go compiler tool chain can run.
+date: 2016-11-01
+publishdate: 2016-11-01
+lastmod: 2018-01-02
+categories: [getting started,fundamentals]
+authors: ["Michael Henderson"]
+keywords: [install,pc,windows,linux,macos,binary,tarball]
+menu:
+ docs:
+ parent: "getting-started"
+ weight: 30
+weight: 30
+sections_weight: 30
+draft: false
+aliases: [/tutorials/installing-on-windows/,/tutorials/installing-on-mac/,/overview/installing/,/getting-started/install,/install/]
+toc: true
+---
+
+
+{{% note %}}
+There is lots of talk about "Hugo being written in Go", but you don't need to install Go to enjoy Hugo. Just grab a precompiled binary!
+{{% /note %}}
+
+Hugo is written in [Go](https://golang.org/) with support for multiple platforms. The latest release can be found at [Hugo Releases][releases].
+
+Hugo currently provides pre-built binaries for the following:
+
+* macOS (Darwin) for x64, i386, and ARM architectures
+* Windows
+* Linux
+* OpenBSD
+* FreeBSD
+
+Hugo may also be compiled from source wherever the Go toolchain 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.
+
+## Quick Install
+
+### Binary (Cross-platform)
+
+Download the appropriate version for your platform from [Hugo Releases][releases]. Once downloaded, the binary can be run from anywhere. You don't need to install it into a global location. This works well for shared hosts and other systems where you don't have a privileged account.
+
+Ideally, you should install it somewhere in your `PATH` for easy use. `/usr/local/bin` is the most probable location.
+
+### Docker
+
+We currently do not offer official Hugo images for Docker, but we do recommend these up to date distributions: https://hub.docker.com/r/klakegg/hugo/
+
+### Homebrew (macOS)
+
+If you are on macOS and using [Homebrew][brew], you can install Hugo with the following one-liner:
+
+{{< code file="install-with-homebrew.sh" >}}
+brew install hugo
+{{< /code >}}
+
+For more detailed explanations, read the installation guides that follow for installing on macOS and Windows.
+
+### MacPorts (macOS)
+
+If you are on macOS and using [MacPorts][macports], you can install Hugo with the following one-liner:
+
+{{< code file="install-with-macports.sh" >}}
+port install hugo
+{{< /code >}}
+
+### Homebrew (Linux)
+
+If you are using [Homebrew][linuxbrew] on Linux, you can install Hugo with the following one-liner:
+
+{{< code file="install-with-linuxbrew.sh" >}}
+brew install hugo
+{{< /code >}}
+
+Installation guides for Homebrew on Linux are available on their [website][linuxbrew].
+
+### Chocolatey (Windows)
+
+If you are on a Windows machine and use [Chocolatey][] for package management, you can install Hugo with the following one-liner:
+
+{{< code file="install-with-chocolatey.ps1" >}}
+choco install hugo -confirm
+{{< /code >}}
+
+Or if you need the “extended” Sass/SCSS version:
+
+{{< code file="install-extended-with-chocolatey.ps1" >}}
+choco install hugo-extended -confirm
+{{< /code >}}
+
+### Scoop (Windows)
+
+If you are on a Windows machine and use [Scoop][] for package management, you can install Hugo with the following one-liner:
+
+```bash
+scoop install hugo
+```
+
+Or install the extended version with:
+
+```bash
+scoop install hugo-extended
+```
+
+### Source
+
+#### Prerequisite Tools
+
+* [Git][installgit]
+* [Go (at least Go 1.11)](https://golang.org/dl/)
+
+#### Fetch from GitHub
+
+Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build. The easiest way to get started is to clone Hugo in a directory outside of the GOPATH, as in the following example:
+
+{{< code file="from-gh.sh" >}}
+mkdir $HOME/src
+cd $HOME/src
+git clone https://github.com/gohugoio/hugo.git
+cd hugo
+go install --tags extended
+{{< /code >}}
+
+Remove `--tags extended` if you do not want/need Sass/SCSS support.
+
+{{% note %}}
+If you are a Windows user, substitute the `$HOME` environment variable above with `%USERPROFILE%`.
+{{% /note %}}
+
+## macOS
+
+### Assumptions
+
+1. You know how to open the macOS terminal.
+2. You're running a modern 64-bit Mac.
+3. You will use `~/Sites` as the starting point for your site. (`~/Sites` is used for example purposes. If you are familiar enough with the command line and file system, you should have no issues following along with the instructions.)
+
+### Pick Your Method
+
+There are three ways to install Hugo on your Mac
+
+1. A package manager, like [Homebrew][brew] (`brew`) or [MacPorts][macports] (`port`)
+2. Distribution (i.e., tarball)
+3. Building from Source
+
+There is no "best" way to install Hugo on your Mac. You should use the method that works best for your use case.
+
+#### Pros and Cons
+
+There are pros and cons to each of the aforementioned methods:
+
+1. **Package Manager.** Using a package manager is the simplest method and will require the least amount of work to maintain. The drawbacks aren't severe. The default package will be for the most recent release, so it will not have bug fixes until the next release (i.e., unless you install it with the `--HEAD` option in Homebrew). Releases may lag a few days behind because it has to be coordinated with another team. Nevertheless, this is the recommended installation method if you want to work from a stable, widely used source. Package managers work well and they are easy to update.
+
+2. **Tarball.** Downloading and installing from the tarball is also easy, although it requires a few more command line skills than does Homebrew. Updates are easy as well: you just repeat the process with the new binary. This gives you the flexibility to have multiple versions on your computer. If you don't want to use `brew`, then the tarball/binary is a good choice.
+
+3. **Building from Source.** Building from source is the most work. The advantage of building from source is that you don't have to wait for a release to add features or bug fixes. The disadvantage is that you need to spend more time managing the setup, which is manageable but requires more time than the preceding two options.
+
+{{% note %}}
+Since building from source is appealing to more seasoned command line users, this guide will focus more on installing Hugo via Homebrew and Tarball.
+{{% /note %}}
+
+### Install Hugo with Brew
+
+{{< youtube WvhCGlLcrF8 >}}
+
+#### Step 1: Install `brew` if you haven't already
+
+Go to the `brew` website, <https://brew.sh/>, and follow the directions there. The most important step is the installation from the command line:
+
+{{< code file="install-brew.sh" >}}
+ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
+{{< /code >}}
+
+#### Step 2: Run the `brew` Command to Install `hugo`
+
+Installing Hugo using `brew` is as easy as the following:
+
+{{< code file="install-brew.sh" >}}
+brew install hugo
+{{< /code >}}
+
+If Homebrew is working properly, you should see something similar to the following:
+
+```
+==> Downloading https://homebrew.bintray.com/bottles/hugo-0.21.sierra.bottle.tar.gz
+######################################################################### 100.0%
+==> Pouring hugo-0.21.sierra.bottle.tar.gz
+🍺 /usr/local/Cellar/hugo/0.21: 32 files, 17.4MB
+```
+
+{{% note "Installing the Latest Hugo with Brew" %}}
+Replace `brew install hugo` with `brew install hugo --HEAD` if you want the absolute latest in-development version.
+{{% /note %}}
+
+`brew` should have updated your path to include Hugo. You can confirm by opening a new terminal window and running a few commands:
+
+```
+$ # show the location of the hugo executable
+which hugo
+/usr/local/bin/hugo
+
+# show the installed version
+ls -l $( which hugo )
+lrwxr-xr-x 1 mdhender admin 30 Mar 28 22:19 /usr/local/bin/hugo -> ../Cellar/hugo/0.13_1/bin/hugo
+
+# verify that hugo runs correctly
+hugo version
+Hugo Static Site Generator v0.13 BuildDate: 2015-03-09T21:34:47-05:00
+```
+
+### Install Hugo from Tarball
+
+#### Step 1: Decide on the location
+
+When installing from the tarball, you have to decide if you're going to install the binary in `/usr/local/bin` or in your home directory. There are three camps on this:
+
+1. Install it in `/usr/local/bin` so that all the users on your system have access to it. This is a good idea because it's a fairly standard place for executables. The downside is that you may need elevated privileges to put software into that location. Also, if there are multiple users on your system, they will all run the same version. Sometimes this can be an issue if you want to try out a new release.
+
+2. Install it in `~/bin` so that only you can execute it. This is a good idea because it's easy to do, easy to maintain, and doesn't require elevated privileges. The downside is that only you can run Hugo. If there are other users on your site, they have to maintain their own copies. That can lead to people running different versions. Of course, this does make it easier for you to experiment with different releases.
+
+3. Install it in your `Sites` directory. This is not a bad idea if you have only one site that you're building. It keeps every thing in a single place. If you want to try out new releases, you can make a copy of the entire site and update the Hugo executable.
+
+All three locations will work for you. In the interest of brevity, this guide focuses on option #2.
+
+#### Step 2: Download the Tarball
+
+1. Open <https://github.com/gohugoio/hugo/releases> in your browser.
+
+2. Find the current release by scrolling down and looking for the green tag that reads "Latest Release."
+
+3. Download the current tarball for the Mac. The name will be something like `hugo_X.Y_osx-64bit.tgz`, where `X.YY` is the release number.
+
+4. By default, the tarball will be saved to your `~/Downloads` directory. If you choose to use a different location, you'll need to change that in the following steps.
+
+#### Step 3: Confirm your download
+
+Verify that the tarball wasn't corrupted during the download:
+
+```
+tar tvf ~/Downloads/hugo_X.Y_osx-64bit.tgz
+-rwxrwxrwx 0 0 0 0 Feb 22 04:02 hugo_X.Y_osx-64bit/hugo_X.Y_osx-64bit.tgz
+-rwxrwxrwx 0 0 0 0 Feb 22 03:24 hugo_X.Y_osx-64bit/README.md
+-rwxrwxrwx 0 0 0 0 Jan 30 18:48 hugo_X.Y_osx-64bit/LICENSE.md
+```
+
+The `.md` files are documentation for Hugo. The other file is the executable.
+
+#### Step 4: Install Into Your `bin` Directory
+
+```
+# create the directory if needed
+mkdir -p ~/bin
+
+# make it the working directory
+cd ~/bin
+
+# extract the tarball
+tar -xvzf ~/Downloads/hugo_X.Y_osx-64bit.tgz
+Archive: hugo_X.Y_osx-64bit.tgz
+ x ./
+ x ./hugo
+ x ./LICENSE.md
+ x ./README.md
+
+# verify that it runs
+./hugo version
+Hugo Static Site Generator v0.13 BuildDate: 2015-02-22T04:02:30-06:00
+```
+
+You may need to add your bin directory to your `PATH` environment variable. The `which` command will check for us. If it can find `hugo`, it will print the full path to it. Otherwise, it will not print anything.
+
+```
+# check if hugo is in the path
+which hugo
+/Users/USERNAME/bin/hugo
+```
+
+If `hugo` is not in your `PATH`:
+
+1. Determine your default shell (zsh or bash).
+
+ ```
+ echo $SHELL
+ ```
+
+2. Edit your profile.
+
+ If your default shell is zsh:
+
+ ```
+ nano ~/.zprofile
+ ```
+
+ If your default shell is bash:
+
+ ```
+ nano ~/.bash_profile
+ ```
+
+3. Insert a line to add `$HOME/bin` to your existing `PATH`.
+
+ ```
+ export PATH=$PATH:$HOME/bin
+ ```
+
+4. Save the file by pressing Control-X, then Y.
+
+5. Close the terminal and open a new terminal to pick up the changes to your profile. Verify the change by running the `which hugo` command again.
+
+You've successfully installed Hugo.
+
+### Build from Source on Mac
+
+If you want to compile Hugo yourself, you'll need to install Go (aka Golang). You can [install Go directly from the Go website](https://golang.org/dl/) or via Homebrew using the following command:
+
+```
+brew install go
+```
+
+#### Step 1: Get the Source
+
+If you want to compile a specific version of Hugo, go to <https://github.com/gohugoio/hugo/releases> and download the source code for the version of your choice. If you want to compile Hugo with all the latest changes (which might include bugs), clone the Hugo repository:
+
+```
+git clone https://github.com/gohugoio/hugo
+```
+
+{{% warning "Sometimes \"Latest\" = \"Bugs\""%}}
+Cloning the Hugo repository directly means taking the good with the bad. By using the bleeding-edge version of Hugo, you make your development susceptible to the latest features, as well as the latest bugs. Your feedback is appreciated. If you find a bug in the latest release, [please create an issue on GitHub](https://github.com/gohugoio/hugo/issues/new).
+{{% /warning %}}
+
+#### Step 2: Compiling
+
+Make the directory containing the source your working directory and then fetch Hugo's dependencies:
+
+```
+mkdir -p src/github.com/gohugoio
+ln -sf $(pwd) src/github.com/gohugoio/hugo
+
+go get
+```
+
+This will fetch the absolute latest version of the dependencies. If Hugo fails to build, it may be the result of a dependency's author introducing a breaking change.
+
+Once you have properly configured your directory, you can compile Hugo using the following command:
+
+```
+go build -o hugo main.go
+```
+
+Then place the `hugo` executable somewhere in your `$PATH`. You're now ready to start using Hugo.
+
+## Windows
+
+The following aims to be a complete guide to installing Hugo on your Windows PC.
+
+{{< youtube G7umPCU-8xc >}}
+
+### Assumptions
+
+1. You will use `C:\Hugo\Sites` as the starting point for your new project.
+2. You will use `C:\Hugo\bin` to store executable files.
+
+### Set up Your Directories
+
+You'll need a place to store the Hugo executable, your [content][], and the generated Hugo website:
+
+1. Open Windows Explorer.
+2. Create a new folder: `C:\Hugo`, assuming you want Hugo on your C drive, although this can go anywhere
+3. Create a subfolder in the Hugo folder: `C:\Hugo\bin`
+4. Create another subfolder in Hugo: `C:\Hugo\Sites`
+
+### Technical Users
+
+1. Download the latest zipped Hugo executable from [Hugo Releases][releases].
+2. Extract all contents to your `..\Hugo\bin` folder.
+3. In PowerShell or your preferred CLI, add the `hugo.exe` executable to your PATH by navigating to `C:\Hugo\bin` (or the location of your hugo.exe file) and use the command `set PATH=%PATH%;C:\Hugo\bin`. If the `hugo` command does not work after a reboot, you may have to run the command prompt as administrator.
+
+### Less-technical Users
+
+1. Go to the [Hugo Releases][releases] page.
+2. The latest release is announced on top. Scroll to the bottom of the release announcement to see the downloads. They're all ZIP files.
+3. Find the Windows files near the bottom (they're in alphabetical order, so Windows is last) – download either the 32-bit or 64-bit file depending on whether you have 32-bit or 64-bit Windows. (If you don't know, [see here](https://esupport.trendmicro.com/en-us/home/pages/technical-support/1038680.aspx).)
+4. Move the ZIP file into your `C:\Hugo\bin` folder.
+5. Double-click on the ZIP file and extract its contents. Be sure to extract the contents into the same `C:\Hugo\bin` folder – Windows will do this by default unless you tell it to extract somewhere else.
+6. You should now have three new files: The hugo executable (`hugo.exe`), `LICENSE`, and `README.md`.
+
+Now you need to add Hugo to your Windows PATH settings:
+
+#### For Windows 10 Users:
+
+* Right click on the **Start** button.
+* Click on **System**.
+* Click on **Advanced System Settings** on the left.
+* Click on the **Environment Variables...** button on the bottom.
+* In the User variables section, find the row that starts with PATH (PATH will be all caps).
+* Double-click on **PATH**.
+* Click the **New...** button.
+* Type in the folder where `hugo.exe` was extracted, which is `C:\Hugo\bin` if you went by the instructions above. *The PATH entry should be the folder where Hugo lives and not the binary.* Press <kbd>Enter</kbd> when you're done typing.
+* Click OK at every window to exit.
+
+{{% note "Path Editor in Windows 10"%}}
+The path editor in Windows 10 was added in the large [November 2015 Update](https://blogs.windows.com/windowsexperience/2015/11/12/first-major-update-for-windows-10-available-today/). You'll need to have that or a later update installed for the above steps to work. You can see what Windows 10 build you have by clicking on the <i class="fa fa-windows"></i> Start button → Settings → System → About. See [here](https://www.howtogeek.com/236195/how-to-find-out-which-build-and-version-of-windows-10-you-have/) for more.)
+{{% /note %}}
+
+#### For Windows 7 and 8.x users:
+
+Windows 7 and 8.1 do not include the easy path editor included in Windows 10, so non-technical users on those platforms are advised to install a free third-party path editor like [Windows Environment Variables Editor][Windows Environment Variables Editor] or [Path Editor](https://patheditor2.codeplex.com/).
+
+### Verify the Executable
+
+Run a few commands to verify that the executable is ready to run, and then build a sample site to get started.
+
+#### 1. Open a Command Prompt
+
+At the prompt, type `hugo help` and press the <kbd>Enter</kbd> key. You should see output that starts with:
+
+```
+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 https://gohugo.io/.
+```
+
+If you do, then the installation is complete. If you don't, double-check the path that you placed the `hugo.exe` file in and that you typed that path correctly when you added it to your `PATH` variable. If you're still not getting the output, search the [Hugo discussion forum][forum] to see if others have already figured out our problem. If not, add a note---in the "Support" category---and be sure to include your command and the output.
+
+At the prompt, change your directory to the `Sites` directory.
+
+```
+C:\Program Files> cd C:\Hugo\Sites
+C:\Hugo\Sites>
+```
+
+#### 2. Run the Command
+
+Run the command to generate a new site. I'm using `example.com` as the name of the site.
+
+```
+C:\Hugo\Sites> hugo new site example.com
+```
+
+You should now have a directory at `C:\Hugo\Sites\example.com`. Change into that directory and list the contents. You should get output similar to the following:
+
+```
+C:\Hugo\Sites> cd example.com
+C:\Hugo\Sites\example.com> dir
+Directory of C:\hugo\sites\example.com
+
+04/13/2015 10:44 PM <DIR> .
+04/13/2015 10:44 PM <DIR> ..
+04/13/2015 10:44 PM <DIR> archetypes
+04/13/2015 10:44 PM 83 config.toml
+04/13/2015 10:44 PM <DIR> content
+04/13/2015 10:44 PM <DIR> data
+04/13/2015 10:44 PM <DIR> layouts
+04/13/2015 10:44 PM <DIR> static
+ 1 File(s) 83 bytes
+ 7 Dir(s) 6,273,331,200 bytes free
+```
+
+### Troubleshoot Windows Installation
+
+[@dhersam][] has created a nice video on common issues:
+
+{{< youtube c8fJIRNChmU >}}
+
+## Linux
+
+### Snap Package
+
+In any of the [Linux distributions that support snaps][snaps], you may install the "extended" Sass/SCSS version with this command:
+
+ snap install hugo --channel=extended
+
+To install the non-extended version without Sass/SCSS support:
+
+ snap install hugo
+
+To switch between the two, use either `snap refresh hugo --channel=extended` or `snap refresh hugo --channel=stable`.
+
+{{% note %}}
+Hugo installed via 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
+
+[@anthonyfok](https://github.com/anthonyfok) and friends in the [Debian Go Packaging Team](https://go-team.pages.debian.net/) maintains an official hugo [Debian package](https://packages.debian.org/hugo) which is shared with [Ubuntu](https://packages.ubuntu.com/hugo) and is installable via `apt-get`:
+
+ sudo apt-get install hugo
+
+What this installs depends on your Debian/Ubuntu version. On Ubuntu bionic (18.04), this installs the non-extended version without Sass/SCSS support. On Ubuntu disco (19.04), this installs the extended version with Sass/SCSS support.
+
+This option is not recommended because the Hugo in Linux package managers for Debian and Ubuntu is usually a few versions behind as described [here](https://github.com/gcushen/hugo-academic/issues/703)
+
+### Arch Linux
+
+You can also install Hugo from the Arch Linux [community](https://www.archlinux.org/packages/community/x86_64/hugo/) repository. Applies also to derivatives such as Manjaro.
+
+```
+sudo pacman -Syu hugo
+```
+
+### Fedora, Red Hat and CentOS
+
+Fedora maintains an [official package for Hugo](https://apps.fedoraproject.org/packages/hugo) which may be installed with:
+
+ sudo dnf install hugo
+
+For the latest version, the Hugo package maintained by [@daftaupe](https://github.com/daftaupe) at Fedora Copr is recommended:
+
+* <https://copr.fedorainfracloud.org/coprs/daftaupe/hugo/>
+
+See the [related discussion in the Hugo forums][redhatforum].
+
++### openSUSE Tumbleweed
++
++openSUSE maintains an [official package](https://software.opensuse.org/package/hugo) for the Tumbleweed rolling release distribution, it may be installed with:
++
++````
++sudo zypper install hugo
++````
++
+### Solus
+
+Solus includes Hugo in its package repository, it may be installed with:
+
+```
+sudo eopkg install hugo
+```
+
+## OpenBSD
+
+OpenBSD provides a package for Hugo via `pkg_add`:
+
+ doas pkg_add hugo
+
+
+## Upgrade Hugo
+
+Upgrading Hugo is as easy as downloading and replacing the executable you’ve placed in your `PATH` or run `brew upgrade hugo` if using Homebrew.
+
+## Next Steps
+
+Now that you've installed Hugo, read the [Quick Start guide][quickstart] and explore the rest of the documentation. If you have questions, ask the Hugo community directly by visiting the [Hugo Discussion Forum][forum].
+
+[brew]: https://brew.sh/
+[macports]: https://www.macports.org/
+[Chocolatey]: https://chocolatey.org/
+[content]: /content-management/
+[@dhersam]: https://github.com/dhersam
+[forum]: https://discourse.gohugo.io
+[mage]: https://github.com/magefile/mage
+[dep]: https://github.com/golang/dep
+[highlight shortcode]: /content-management/shortcodes/#highlight
+[installgit]: https://git-scm.com/
+[installgo]: https://golang.org/dl/
+[linuxbrew]: https://docs.brew.sh/Homebrew-on-Linux
+[Path Editor]: https://patheditor2.codeplex.com/
+[quickstart]: /getting-started/quick-start/
+[redhatforum]: https://discourse.gohugo.io/t/solved-fedora-copr-repository-out-of-service/2491
+[releases]: https://github.com/gohugoio/hugo/releases
+[Scoop]: https://scoop.sh/
+[snaps]: https://snapcraft.io/docs/installing-snapd
+[windowsarch]: https://esupport.trendmicro.com/en-us/home/pages/technical-support/1038680.aspx
+[Windows Environment Variables Editor]: http://eveditor.com/
--- /dev/null
+---
+title: Host on GitHub
+linktitle: Host on GitHub
+description: Deploy Hugo as a GitHub Pages project or personal/organizational site and automate the whole process with Github Action Workflow
+date: 2014-03-21
+publishdate: 2014-03-21
+categories: [hosting and deployment]
+keywords: [github,git,deployment,hosting]
+authors: [Spencer Lyon, Gunnar Morling]
+menu:
+ docs:
+ parent: "hosting-and-deployment"
+ weight: 30
+weight: 30
+sections_weight: 30
+toc: true
+aliases: [/tutorials/github-pages-blog/]
+---
+
+GitHub provides free and fast static hosting over SSL for personal, organization, or project pages directly from a GitHub repository via its [GitHub Pages service][] and automating development workflows and build with [GitHub Actions].
+
+## Assumptions
+
+1. You have Git 2.8 or greater [installed on your machine][installgit].
+2. You have a GitHub account. [Signing up][ghsignup] for GitHub is free.
+3. You have a ready-to-publish Hugo website or have at least completed the [Quick Start][].
+
+## Types of GitHub Pages
+
+There are two types of GitHub Pages:
+
+- User/Organization Pages (`https://<USERNAME|ORGANIZATION>.github.io/`)
+- Project Pages (`https://<USERNAME|ORGANIZATION>.github.io/<PROJECT>/`)
+
+Please refer to the [GitHub Pages documentation][ghorgs] to decide which type of site you would like to create as it will determine which of the below methods to use.
+
+## GitHub User or Organization Pages
+
+As mentioned in the [GitHub Pages documentation][ghorgs], you can host a user/organization page in addition to project pages. Here are the key differences in GitHub Pages websites for Users and Organizations:
+
+1. You must use a `<USERNAME>.github.io` to host your **generated** content
+2. Content from the `main` branch will be used to publish your GitHub Pages site
+
+This is a much simpler setup as your Hugo files and generated content are published into two different repositories.
+
+## Build Hugo With GitHub Action
+
+GitHub executes your software development workflows. Everytime you push your code on the Github repository, Github Actions will build the site automatically.
+
+Create a file in `.github/workflows/gh-pages.yml` containing the following content (based on [actions-hugo](https://github.com/marketplace/actions/hugo-setup)):
+
+```yml
+name: github pages
+
+on:
+ push:
+ branches:
+ - main # Set a branch to deploy
+ pull_request:
+
+jobs:
+ deploy:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: true # Fetch Hugo themes (true OR recursive)
+ fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
+
+ - name: Setup Hugo
+ uses: peaceiris/actions-hugo@v2
+ with:
+ hugo-version: 'latest'
+ # extended: true
+
+ - name: Build
+ run: hugo --minify
+
+ - name: Deploy
+ uses: peaceiris/actions-gh-pages@v3
+ if: github.ref == 'refs/heads/main'
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ publish_dir: ./public
+```
+
+For more advanced settings [actions-hugo](https://github.com/marketplace/actions/hugo-setup) and [actions-gh-pages](https://github.com/marketplace/actions/github-pages-action).
+
++## Github pages setting
++By default, the GitHub action pushes the generated content to the `gh-pages` branch. This means GitHub has to serve your `gh-pages` branch as a GitHub Pages branch. You can change this setting by going to Settings > GitHub Pages, and change the source branch to `gh-pages`.
++
++## Change baseURL in config.toml
++Don't forget to rename your `baseURL` in `config.toml` with the value `https://<USERNAME>.github.io` for your user repository or `https://<USERNAME>.github.io/<REPOSITORY_NAME>` for a project repository.
++
++Unless this is present in your `config.toml`, your website won't work.
++
+## Use a Custom Domain
+
+If you'd like to use a custom domain for your GitHub Pages site, create a file `static/CNAME`. Your custom domain name should be the only contents inside `CNAME`. Since it's inside `static`, the published site will contain the CNAME file at the root of the published site, which is a requirement of GitHub Pages.
+
+Refer to the [official documentation for custom domains][domains] for further information.
+
+[config]: /getting-started/configuration/
+[domains]: https://help.github.com/articles/using-a-custom-domain-with-github-pages/
+[ghorgs]: https://help.github.com/articles/user-organization-and-project-pages/#user--organization-pages
+[ghpfromdocs]: https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/
+[ghsignup]: https://github.com/join
+[GitHub Pages service]: https://help.github.com/articles/what-is-github-pages/
+[installgit]: https://git-scm.com/downloads
+[orphan branch]: https://git-scm.com/docs/git-checkout/#Documentation/git-checkout.txt---orphanltnewbranchgt
+[Quick Start]: /getting-started/quick-start/
+[submodule]: https://github.com/blog/2104-working-with-submodules
+[worktree feature]: https://git-scm.com/docs/git-worktree
+[GitHub Actions]: https://docs.github.com/en/actions
--- /dev/null
- keywords: [render,hosting,deployment]
+---
+title: Host on Render
+linktitle: Host on Render
+description: Host your Hugo site for free with Render's global CDN, fully-managed SSL and auto deploys from GitHub.
+date: 2019-06-06
+publishdate: 2019-06-06
+lastmod: 2020-01-01
+categories: [hosting and deployment]
++keywords: [hosting,deployment]
+authors: [Anurag Goel]
+menu:
+ docs:
+ parent: "hosting-and-deployment"
+ weight: 10
+weight: 10
+sections_weight: 10
+draft: false
+aliases: []
+toc: true
+---
+
+## Introduction
+
+[Render](https://render.com) is a fully-managed cloud platform where you can host static sites, backend APIs, databases, cron jobs, and all your other apps in one place.
+
+Static sites are **completely free** on Render and include the following:
+
+- Continuous, automatic builds & deploys from [GitHub](https://render.com/docs/github) and [GitLab](https://render.com/docs/gitlab).
+- Automatic SSL certificates through [Let's Encrypt](https://letsencrypt.org).
+- Instant cache invalidation with a lightning fast, global CDN.
+- Unlimited collaborators.
+- Unlimited [custom domains](https://render.com/docs/custom-domains).
+- Automatic [Brotli compression](https://en.wikipedia.org/wiki/Brotli) for faster sites.
+- Native HTTP/2 support.
+- [Pull Request Previews](https://render.com/docs/pull-request-previews).
+- Automatic HTTP → HTTPS redirects.
+- Custom URL redirects and rewrites.
+
+## Assumptions
+
+* You have an account with GitHub or GitLab.
+* You have completed the [Quick Start][] or have a Hugo website you are ready to deploy and share with the world.
+* You have a Render account. You can sign up at https://render.com/register.
+
+## Deployment
+
+You can set up a Hugo site on Render in two quick steps:
+
+1. Create a new **Static Site** on Render, and give Render permission to access your GitHub/Gitlab repo.
+2. Use the following values during creation:
+
+ Field | Value
+ ------------------- | -------------------
+ **Build Command** | `hugo --gc --minify` (or your own build command)
+ **Publish Directory** | `public` (or your own output directory)
+
+That's it! Your site will be live on your Render URL (which looks like `yoursite.onrender.com`) as soon as the build is done.
+
+## Continuous Deploys
+
+Now that Render is connected to your repo, it will **automatically build and publish your site** any time you push to your GitHub/Gitlab.
+
+You can choose to disable auto deploys under the **Settings** section for your site and deploy it manually from the Render dashboard.
+
+## CDN and Cache Invalidation
+
+Render hosts your site on a global, lightning fast CDN which ensures the fastest possible download times for all your users across the globe.
+
+Every deploy automatically and instantly invalidates the CDN cache, so your users can always access the latest content on your site.
+
+## Custom Domains
+
+Add your own domains to your site easily using Render's [custom domains](https://render.com/docs/custom-domains) guide.
+
+## Pull Request Previews
+
+With Pull Request (PR) previews, you can visualize changes introduced in a pull request instead of simply relying on code reviews.
+
+Once enabled, every PR for your site will automatically generate a new static site based on the code in the PR. It will have its own URL, and it will be deleted automatically when the PR is closed.
+
+Read more about [Pull Request Previews](https://render.com/docs/pull-request-previews) on Render.
+
+## Hugo Themes
+
+Render automatically downloads all Git submodules defined in your Git repo on every build. This way Hugo themes added as submodules work as expected.
+
+## Support
+
+Chat with Render developers at https://render.com/chat or email `support@render.com` if you need help.
+
+
+[Quick Start]: /getting-started/quick-start/
--- /dev/null
- title: "0.89.0"
- description: "0.89.0"
+
+---
+date: 2021-11-02
-
- This release is a dependency refresh (the new Goldmark verion comes with a lot of bug fixes, as one example), many bug fixes, but also some nice new features:
++title: "Fine Grained File Filters"
++description: "Hugo 0.89.0 brings fine grained file filters, archetype rewrite, dependency refresh, and more ..."
+categories: ["Releases"]
+---
+
- This release represents **50 contributions by 13 contributors** to the main Hugo code base.[@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@dependabot[bot]](https://github.com/apps/dependabot), [@jmooring](https://github.com/jmooring), and [@anthonyfok](https://github.com/anthonyfok) for their ongoing contributions.
++This release is a dependency refresh (the new Goldmark version comes with a lot of bug fixes, as one example), many bug fixes, but also some nice new features:
+
+We have added the [configuration settings](https://gohugo.io/hugo-modules/configuration/#module-config-mounts) **includeFiles** and **excludeFiles** to the mount configuration. This allows fine grained control over what files to include, and it works for all of Hugo's file systems (including `/static`).
+
+We have also [reimplemented archetypes](https://github.com/gohugoio/hugo/pull/9045). The old implementation had some issues, mostly related to the context (e.g. name, file paths) passed to the template. This new implementation is using the exact same code path for evaluating the pages as in a regular build. This also makes it more robust and easier to reason about in a multilingual setup. Now, if you are explicit about the target path, Hugo will now always pick the correct mount and language:
+
+```
+hugo new content/en/posts/my-first-post.md
+```
+
- * We now only build AMD64 release binaries (see [this issue](https://github.com/gohugoio/hugo/issues/9102)) for the Unix OSes (e.g. NetBSD). If need, say, a binary for ARM64, you need to build it yourself.
- * We now build only one release binary/archive for MacOS, see [this issue](https://github.com/gohugoio/hugo/issues/9035) that works on both Intel and the new Arm M1 systems.
++This release represents **50 contributions by 13 contributors** to the main Hugo code base. [@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@dependabot[bot]](https://github.com/apps/dependabot), [@jmooring](https://github.com/jmooring), and [@anthonyfok](https://github.com/anthonyfok) for their ongoing contributions.
+And thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) for his ongoing work on keeping the themes site in pristine condition.
+
+Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs),
+which has received **23 contributions by 9 contributors**. A special thanks to [@jmooring](https://github.com/jmooring), [@bep](https://github.com/bep), [@coliff](https://github.com/coliff), and [@vipkr](https://github.com/vipkr) for their work on the documentation site.
+
+
+Hugo now has:
+
+* 54999+ [stars](https://github.com/gohugoio/hugo/stargazers)
+* 430+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
+* 413+ [themes](http://themes.gohugo.io/)
+
+
+## Notes
+
+* Hugo now writes an empty file named `.hugo_build.lock` to the root of the project when building (also when doing `hugo new mypost.md` and other commands that requires a build). We recommend you just leave this file alone. Put it in `.gitignore` or similar if you don't want the file in your source repository.
+* We have updated to ESBuild `v0.13.12`. The release notes for [v0.13.0](https://github.com/evanw/esbuild/releases/tag/v0.13.0) mentions a potential breaking change.
- * We have updated the Twitter shortcode to use Twitter's new API. See [thiss issue] for details.
++* We now only build AMD64 release binaries (see [this issue](https://github.com/gohugoio/hugo/issues/9102)) for the Unix OSes (e.g. NetBSD). If you need, say, a binary for ARM64, you need to build it yourself.
++* We now build only one release binary/archive for MacOS (see [this issue](https://github.com/gohugoio/hugo/issues/9035)) that works on both Intel and the new Arm M1 systems.
+* `.File.ContentBaseName` now returns the owning directory name for all bundles (branch an leaf). This is a bug fix, but worth mentioning. See [this issue](https://github.com/gohugoio/hugo/issues/9112).
-
-
-
-
-
++* We have updated the Twitter shortcode to use Twitter's new API. See [this issue](https://github.com/gohugoio/hugo/pull/9106) for details.
+
+## Enhancements
+
+### Templates
+
+* Use configured location when date passed to Format is string [e82cbd74](https://github.com/gohugoio/hugo/commit/e82cbd746fd4b07e40fedacc4247b9cd50ef70e7) [@bep](https://github.com/bep) [#9084](https://github.com/gohugoio/hugo/issues/9084)
+* Add path.Clean [e55466ce](https://github.com/gohugoio/hugo/commit/e55466ce70363418309d465a0f2aa6c7ada1e51d) [@bradcypert](https://github.com/bradcypert) [#8885](https://github.com/gohugoio/hugo/issues/8885)
+
+### Other
+
+* Regen CLI docs [f503b639](https://github.com/gohugoio/hugo/commit/f503b6395707f8e576af734efab83092d62fae37) [@bep](https://github.com/bep)
+* Make ContentBaseName() return the directory for branch bundles [30aba7fb](https://github.com/gohugoio/hugo/commit/30aba7fb099678363b0a4828936ed28e740e00e2) [@bep](https://github.com/bep) [#9112](https://github.com/gohugoio/hugo/issues/9112)
+* Update Twitter shortcode oEmbed endpoint [0cc39af6](https://github.com/gohugoio/hugo/commit/0cc39af68232f1a4981aae2e72cf65da762b5768) [@jmooring](https://github.com/jmooring) [#8130](https://github.com/gohugoio/hugo/issues/8130)
+* bump github.com/evanw/esbuild from 0.13.10 to 0.13.12 [7fa66425](https://github.com/gohugoio/hugo/commit/7fa66425aa0a918b4bf5eb9a21f6e567e0a7e876) [@dependabot[bot]](https://github.com/apps/dependabot)
+* bump github.com/yuin/goldmark from 1.4.1 to 1.4.2 [69210cfd](https://github.com/gohugoio/hugo/commit/69210cfdf341d1faef23f4e9290d51448dd5e0c6) [@dependabot[bot]](https://github.com/apps/dependabot)
+* bump github.com/aws/aws-sdk-go from 1.40.8 to 1.41.14 [3339c2bb](https://github.com/gohugoio/hugo/commit/3339c2bb618c29bb3ad442c71fe1542ad7195971) [@dependabot[bot]](https://github.com/apps/dependabot)
+* bump github.com/getkin/kin-openapi from 0.79.0 to 0.80.0 [03bbdba8](https://github.com/gohugoio/hugo/commit/03bbdba8be19929cb6a14243b690372fbfbc6aa6) [@dependabot[bot]](https://github.com/apps/dependabot)
+* bump github.com/evanw/esbuild from 0.13.8 to 0.13.10 [a772b8fc](https://github.com/gohugoio/hugo/commit/a772b8fc3833e010553c412dd5daa0175e6ccead) [@dependabot[bot]](https://github.com/apps/dependabot)
+* Rename excepted filenames for image golden testdata [dce49d13](https://github.com/gohugoio/hugo/commit/dce49d13336f3dbadaa1359322a277ad4cb55679) [@anthonyfok](https://github.com/anthonyfok) [#6387](https://github.com/gohugoio/hugo/issues/6387)
+* bump github.com/frankban/quicktest from 1.13.1 to 1.14.0 [61c5b7a2](https://github.com/gohugoio/hugo/commit/61c5b7a2e623255be99da7adf200f0591c9a1195) [@dependabot[bot]](https://github.com/apps/dependabot)
+* Validate the target path in hugo new [75c9b893](https://github.com/gohugoio/hugo/commit/75c9b893d98961a504cff9ed3c89055d16e315d6) [@bep](https://github.com/bep) [#9072](https://github.com/gohugoio/hugo/issues/9072)
+* Set zone of datetime from from `go-toml` [b959ecbc](https://github.com/gohugoio/hugo/commit/b959ecbc8175e2bf260f10b08965531bce9bcb7e) [@satotake](https://github.com/satotake) [#8895](https://github.com/gohugoio/hugo/issues/8895)
+* Added nodesource apt repository to snap package [70e45481](https://github.com/gohugoio/hugo/commit/70e454812ef684d02ffa881becf0f8ce6a1b5f8c) [@sergiogarciadev](https://github.com/sergiogarciadev)
+* Set HUGO_ENABLEGITINFO=false override in Set_in_string [355ff83e](https://github.com/gohugoio/hugo/commit/355ff83e74f6e27c79033b8dfb899e3a3b529049) [@anthonyfok](https://github.com/anthonyfok)
+* Add includeFiles and excludeFiles to mount configuration [471ed91c](https://github.com/gohugoio/hugo/commit/471ed91c60cd36645794925cb4892cc820eae626) [@bep](https://github.com/bep) [#9042](https://github.com/gohugoio/hugo/issues/9042)
+* bump github.com/mitchellh/mapstructure from 1.4.1 to 1.4.2 [94a5bac5](https://github.com/gohugoio/hugo/commit/94a5bac5b29bbba1ca4809752fe3fd04a58547b6) [@dependabot[bot]](https://github.com/apps/dependabot)
+* Always preserve the original transform error [9830ca9e](https://github.com/gohugoio/hugo/commit/9830ca9e319f6ce313f4e542a202bd0d0469a9ed) [@bep](https://github.com/bep)
+* Add hyperlink to the banner [b64fd057](https://github.com/gohugoio/hugo/commit/b64fd0577b0fb222bea22ae347acb5dd17b2aa04) [@itsAftabAlam](https://github.com/itsAftabAlam)
+* bump github.com/getkin/kin-openapi from 0.78.0 to 0.79.0 [2706437a](https://github.com/gohugoio/hugo/commit/2706437a7d593b66b0fbad0235dbaf917593971b) [@dependabot[bot]](https://github.com/apps/dependabot)
+* github.com/evanw/esbuild v0.13.5 => v0.13.8 [ec7c993c](https://github.com/gohugoio/hugo/commit/ec7c993cfe216b8a3c6fbac85669cefef59778dd) [@bep](https://github.com/bep)
+* Return error on no content dirs [32c6f656](https://github.com/gohugoio/hugo/commit/32c6f656d93ecf4308f7c30848b13b4c6f157436) [@bep](https://github.com/bep) [#9056](https://github.com/gohugoio/hugo/issues/9056)
+* Add a cross process build lock and use it in the archetype content builder [ba35e698](https://github.com/gohugoio/hugo/commit/ba35e69856900b6fc92681aa841cdcaefbb4b121) [@bep](https://github.com/bep) [#9048](https://github.com/gohugoio/hugo/issues/9048)
+* github.com/alecthomas/chroma v0.9.2 => v0.9.4 [bb053770](https://github.com/gohugoio/hugo/commit/bb053770337e214f41bc1c524d458ba7fbe1fc08) [@bep](https://github.com/bep) [#8532](https://github.com/gohugoio/hugo/issues/8532)
+* Reimplement archetypes [9185e11e](https://github.com/gohugoio/hugo/commit/9185e11effa682ea1ef7dc98f2943743671023a6) [@bep](https://github.com/bep) [#9032](https://github.com/gohugoio/hugo/issues/9032)[#7589](https://github.com/gohugoio/hugo/issues/7589)[#9043](https://github.com/gohugoio/hugo/issues/9043)[#9046](https://github.com/gohugoio/hugo/issues/9046)[#9047](https://github.com/gohugoio/hugo/issues/9047)
+* bump github.com/tdewolff/minify/v2 from 2.9.21 to 2.9.22 [168a3aab](https://github.com/gohugoio/hugo/commit/168a3aab4622786ccd0943137fce3912707f2a46) [@dependabot[bot]](https://github.com/apps/dependabot)
+* Update github.com/evanw/esbuild v0.13.5 [8bcfa3bd](https://github.com/gohugoio/hugo/commit/8bcfa3bdf65492329da8093d841dd04c7a5a10c8) [@bep](https://github.com/bep)
+* bump github.com/mattn/go-isatty from 0.0.13 to 0.0.14 [cd4e67af](https://github.com/gohugoio/hugo/commit/cd4e67af182a1b3aa19db7609c7581c424e9310f) [@dependabot[bot]](https://github.com/apps/dependabot)
+* bump github.com/getkin/kin-openapi from 0.75.0 to 0.78.0 [e6ad1f0e](https://github.com/gohugoio/hugo/commit/e6ad1f0e763ee891bf4d71df0168b6949369c793) [@dependabot[bot]](https://github.com/apps/dependabot)
+* Allow multiple plugins in the PostCSS options map [64abc83f](https://github.com/gohugoio/hugo/commit/64abc83fc4b70c70458c582ae2cf67fc9c67bb3f) [@jmooring](https://github.com/jmooring) [#9015](https://github.com/gohugoio/hugo/issues/9015)
+* Create path.Clean documentation [f8d132d7](https://github.com/gohugoio/hugo/commit/f8d132d731cf8e27c8c17931597fd975e8a7c3cc) [@jmooring](https://github.com/jmooring)
+* Skip a test assertion on CI [26f1919a](https://github.com/gohugoio/hugo/commit/26f1919ae0cf57d754bb029270c20e76cc32cf4d) [@bep](https://github.com/bep)
+* Remove tracking image [ecf025f0](https://github.com/gohugoio/hugo/commit/ecf025f006f22061728e78f2cf50257dde2225ee) [@kambojshalabh35](https://github.com/kambojshalabh35)
+* Revert "Remove credit from release notes" [fab1e43d](https://github.com/gohugoio/hugo/commit/fab1e43de59f3a7596ab23347387d846139bc3a3) [@digitalcraftsman](https://github.com/digitalcraftsman)
+* Pass minification errors to the user [e03f82ee](https://github.com/gohugoio/hugo/commit/e03f82eef2679ec8963894d0b911363eef40941a) [@ptgott](https://github.com/ptgott) [#8954](https://github.com/gohugoio/hugo/issues/8954)
+* Clarify "precision" in currency format functions [a864ffe9](https://github.com/gohugoio/hugo/commit/a864ffe9acf295034bb38e789a0efa62906b2ae4) [@ptgott](https://github.com/ptgott)
+* bump github.com/evanw/esbuild from 0.12.24 to 0.12.29 [b49da332](https://github.com/gohugoio/hugo/commit/b49da33280cb01795ce833e70c2b7b78cca1867e) [@dependabot[bot]](https://github.com/apps/dependabot)
+* Use default math/rand.Source for concurrency safety [7c21eca7](https://github.com/gohugoio/hugo/commit/7c21eca74f95b61d6813d0c0b155bf07c9aa8575) [@odeke-em](https://github.com/odeke-em) [#8981](https://github.com/gohugoio/hugo/issues/8981)
+* Make the error handling for the mod commands more lenient [13ad8408](https://github.com/gohugoio/hugo/commit/13ad8408fc6b645b12898fb8053388fc4848dfbd) [@bep](https://github.com/bep)
+* Add some help text to the 'unknown revision' error [1cabf61d](https://github.com/gohugoio/hugo/commit/1cabf61ddf96b89c95c3ba77a985168184920feb) [@bep](https://github.com/bep) [#6825](https://github.com/gohugoio/hugo/issues/6825)
+* Update github.com/yuin/goldmark v1.4.0 => v1.4.1 [268e3069](https://github.com/gohugoio/hugo/commit/268e3069f37df01a5a58b615844652fb75b8503a) [@jmooring](https://github.com/jmooring) [#8855](https://github.com/gohugoio/hugo/issues/8855)
+
+## Fixes
+
+### Templates
+
+* Fix time.Format with Go layouts [ed6fd26c](https://github.com/gohugoio/hugo/commit/ed6fd26ce884c49b02497728a99e90b92dd65f1f) [@bep](https://github.com/bep) [#9107](https://github.com/gohugoio/hugo/issues/9107)
+
+### Other
+
+* Fix description of lang.FormatNumberCustom [04a3b45d](https://github.com/gohugoio/hugo/commit/04a3b45db4cd28b4821b5c98cd67dfbf1d098957) [@jmooring](https://github.com/jmooring)
+* Fix typo in error message [1d60bd1e](https://github.com/gohugoio/hugo/commit/1d60bd1efa943349636edad3dd8c5427312ab0f1) [@jmooring](https://github.com/jmooring)
+* Fix panic when specifying multiple excludeFiles directives [64e1613f](https://github.com/gohugoio/hugo/commit/64e1613fb390bd893900dc0596e5c3f3c8e1cd8c) [@bep](https://github.com/bep) [#9076](https://github.com/gohugoio/hugo/issues/9076)
+* Fix file permissions in new archetype implementation [e02e0727](https://github.com/gohugoio/hugo/commit/e02e0727e57f123f9a8de506e9c098bb374f7a23) [@bep](https://github.com/bep) [#9057](https://github.com/gohugoio/hugo/issues/9057)
+* Fix the "page picker" logic in --navigateToChanged [096f5e19](https://github.com/gohugoio/hugo/commit/096f5e19217e985bccbf6c539e1b220541ffa6f6) [@bep](https://github.com/bep) [#9051](https://github.com/gohugoio/hugo/issues/9051)
+* Fix a typo on OpenBSD [c7957c90](https://github.com/gohugoio/hugo/commit/c7957c90e83ff2b2cc958bd61486a244f0fd8891) [@nabbisen](https://github.com/nabbisen)
+* Fix value of useResourceCacheWhen in TestResourceChainPostCSS [e6e44b7c](https://github.com/gohugoio/hugo/commit/e6e44b7c41a9b517ffc3775ea0a6aec2b1d4591b) [@jmooring](https://github.com/jmooring)
--- /dev/null
- title: "Hugo 0.89.4: A couple of Bug Fixes"
- description: "This version fixes a couple of bugs introduced in 0.89.0."
+
+---
+date: 2021-11-17
- This is a bug-fix release with one important fix.
++title: "Hugo 0.89.4: One Bug Fix"
++description: "This version fixes one bug introduced in 0.89.0."
+categories: ["Releases"]
+images:
+- images/blog/hugo-bug-poster.png
+
+---
+
+
+
++This is a bug-fix release with one important fix for people using `hugo new` to create new content:
+
+* Fix content dir resolution when main project is a Hugo Module [2e70f61f](https://github.com/gohugoio/hugo/commit/2e70f61fb04cea08ef6598728a57637ae2cc199c) [@bep](https://github.com/bep) [#9177](https://github.com/gohugoio/hugo/issues/9177)
+
+
+
--- /dev/null
- disqusShortname = "yourdiscussshortname"
+---
+title: Internal Templates
+linktitle: Internal Templates
+description: Hugo ships with a group of boilerplate templates that cover the most common use cases for static websites.
+date: 2017-03-06
+publishdate: 2017-03-06
+lastmod: 2017-03-06
+categories: [templates]
+keywords: [internal, analytics,]
+menu:
+ docs:
+ parent: "templates"
+ weight: 168
+weight: 168
+sections_weight: 168
+draft: false
+aliases: []
+toc: true
+wip: true
+---
+<!-- reference: https://discourse.gohugo.io/t/lookup-order-for-partials/5705/6
+code: https://github.com/gohugoio/hugo/blob/e445c35d6a0c7f5fc2f90f31226cd1d46e048bbc/tpl/template_embedded.go#L147 -->
+
+{{% warning %}}
+While the following internal templates are called similar to partials, they do *not* observe the partial template lookup order.
+{{% /warning %}}
+
+## Google Analytics
+
+Hugo ships with internal templates for Google Analytics tracking, including both synchronous and asynchronous tracking codes. As well as support for both v3 and v4 of Google Analytics.
+
+### Configure Google Analytics
+
+Provide your tracking id in your configuration file:
+
+**Google Analytics v3 (analytics.js)**
+{{< code-toggle file="config" >}}
+googleAnalytics = "UA-PROPERTY_ID"
+{{</ code-toggle >}}
+
+**Google Analytics v4 (gtag.js)**
+{{< code-toggle file="config" >}}
+googleAnalytics = "G-MEASUREMENT_ID"
+{{</ code-toggle >}}
+
+### Use the Google Analytics Template
+
+You can then include the Google Analytics internal template:
+
+```
+{{ template "_internal/google_analytics.html" . }}
+```
+
+
+```
+{{ template "_internal/google_analytics_async.html" . }}
+```
+
+When using Google Analytics v4 use `_internal/google_analytics.html`.
+
+A `.Site.GoogleAnalytics` variable is also exposed from the config.
+
+## Disqus
+
+Hugo also ships with an internal template for [Disqus comments][disqus], a popular commenting system for both static and dynamic websites. In order to effectively use Disqus, you will need to secure a Disqus "shortname" by [signing up for the free service][disqussignup].
+
+### Configure Disqus
+
+To use Hugo's Disqus template, you first need to set a single configuration value:
+
+{{< code-toggle file="config" >}}
- * `_internal/google_news.html`
++disqusShortname = "your-disqus-shortname"
+{{</ code-toggle >}}
+
+You also have the option to set the following in the front matter for a given piece of content:
+
+* `disqus_identifier`
+* `disqus_title`
+* `disqus_url`
+
+### Use the Disqus Template
+
+To add Disqus, include the following line in templates where you want your comments to appear:
+
+```
+{{ template "_internal/disqus.html" . }}
+```
+
+A `.Site.DisqusShortname` variable is also exposed from the config.
+
+### Conditional Loading of Disqus Comments
+
+Users have noticed that enabling Disqus comments when running the Hugo web server on `localhost` (i.e. via `hugo server`) causes the creation of unwanted discussions on the associated Disqus account.
+
+You can create the following `layouts/partials/disqus.html`:
+
+{{< code file="layouts/partials/disqus.html" download="disqus.html" >}}
+<div id="disqus_thread"></div>
+<script type="text/javascript">
+
+(function() {
+ // Don't ever inject Disqus on localhost--it creates unwanted
+ // discussions from 'localhost:1313' on your Disqus account...
+ if (window.location.hostname == "localhost")
+ return;
+
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+ var disqus_shortname = '{{ .Site.DisqusShortname }}';
+ dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="https://disqus.com/" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+{{< /code >}}
+
+The `if` statement skips the initialization of the Disqus comment injection when you are running on `localhost`.
+
+You can then render your custom Disqus partial template as follows:
+
+```
+{{ partial "disqus.html" . }}
+```
+
+## Open Graph
+An internal template for the [Open Graph protocol](https://ogp.me/), metadata that enables a page to become a rich object in a social graph.
+This format is used for Facebook and some other sites.
+
+### Configure Open Graph
+
+Hugo's Open Graph template is configured using a mix of configuration variables and [front-matter](/content-management/front-matter/) on individual pages.
+
+{{< code-toggle file="config" >}}
+[params]
+ title = "My cool site"
+ images = ["site-feature-image.jpg"]
+ description = "Text about my cool site"
+[taxonomies]
+ series = "series"
+{{</ code-toggle >}}
+
+{{< code-toggle file="content/blog/my-post" >}}
+title = "Post title"
+description = "Text about this post"
+date = "2006-01-02"
+images = ["post-cover.png"]
+audio = []
+videos = []
+series = []
+tags = []
+{{</ code-toggle >}}
+
+Hugo uses the page title and description for the title and description metadata.
+The first 6 URLs from the `images` array are used for image metadata.
+If [page bundles](/content-management/page-bundles/) are used and the `images` array is empty or undefined, images with filenames matching `*feature*` or `*cover*,*thumbnail*` are used for image metadata.
+
+Various optional metadata can also be set:
+
+- Date, published date, and last modified data are used to set the published time metadata if specified.
+- `audio` and `videos` are URL arrays like `images` for the audio and video metadata tags, respectively.
+- The first 6 `tags` on the page are used for the tags metadata.
+- The `series` taxonomy is used to specify related "see also" pages by placing them in the same series.
+
+If using YouTube this will produce a og:video tag like `<meta property="og:video" content="url">`. Use the `https://youtu.be/<id>` format with YouTube videos (example: `https://youtu.be/qtIqKaDlqXo`).
+
+### Use the Open Graph Template
+
+To add Open Graph metadata, include the following line between the `<head>` tags in your templates:
+
+```
+{{ template "_internal/opengraph.html" . }}
+```
+
+## Twitter Cards
+
+An internal template for [Twitter Cards](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards),
+metadata used to attach rich media to Tweets linking to your site.
+
+### Configure Twitter Cards
+
+Hugo's Twitter Card template is configured using a mix of configuration variables and [front-matter](/content-management/front-matter/) on individual pages.
+
+{{< code-toggle file="config" >}}
+[params]
+ images = ["site-feature-image.jpg"]
+ description = "Text about my cool site"
+{{</ code-toggle >}}
+
+{{< code-toggle file="content/blog/my-post" >}}
+title = "Post title"
+description = "Text about this post"
+images = ["post-cover.png"]
+{{</ code-toggle >}}
+
+If `images` aren't specified in the page front-matter, then hugo searches for [image page resources](/content-management/image-processing/) with `feature`, `cover`, or `thumbnail` in their name.
+If no image resources with those names are found, the images defined in the [site config](/getting-started/configuration/) are used instead.
+If no images are found at all, then an image-less Twitter `summary` card is used instead of `summary_large_image`.
+
+Hugo uses the page title and description for the card's title and description fields. The page summary is used if no description is given.
+
+### Use the Twitter Cards Template
+
+To add Twitter card metadata, include the following line between the `<head>` tags in your templates:
+
+```
+{{ template "_internal/twitter_cards.html" . }}
+```
+
+## The Internal Templates
+
+* `_internal/disqus.html`
+* `_internal/google_analytics.html`
+* `_internal/google_analytics_async.html`
+* `_internal/opengraph.html`
+* `_internal/pagination.html`
+* `_internal/schema.html`
+* `_internal/twitter_cards.html`
+
+[disqus]: https://disqus.com
+[disqussignup]: https://disqus.com/profile/signup/
--- /dev/null
- Note that both examples make use of Go Template's [math functions][].
+---
+title: Introduction to Hugo Templating
+linktitle: Introduction
+description: Hugo uses Go's `html/template` and `text/template` libraries as the basis for the templating.
+date: 2017-02-01
+publishdate: 2017-02-01
+lastmod: 2017-02-25
+categories: [templates,fundamentals]
+keywords: [go]
+menu:
+ docs:
+ parent: "templates"
+ weight: 10
+weight: 10
+sections_weight: 10
+draft: false
+aliases: [/layouts/introduction/,/layout/introduction/, /templates/go-templates/]
+toc: true
+---
+
+{{% note %}}
+The following is only a primer on Go Templates. For an in-depth look into Go Templates, check the official [Go docs](https://golang.org/pkg/text/template/).
+{{% /note %}}
+
+Go Templates provide an extremely simple template language that adheres to the belief that only the most basic of logic belongs in the template or view layer.
+
+## Basic Syntax
+
+Go Templates are HTML files with the addition of [variables][variables] and [functions][functions]. Go Template variables and functions are accessible within `{{ }}`.
+
+### Access a Predefined Variable
+
+A _predefined variable_ could be a variable already existing in the
+current scope (like the `.Title` example in the [Variables]({{< relref
+"#variables" >}}) section below) or a custom variable (like the
+`$address` example in that same section).
+
+
+```go-html-template
+{{ .Title }}
+{{ $address }}
+```
+
+Parameters for functions are separated using spaces. The general syntax is:
+
+```
+{{ FUNCTION ARG1 ARG2 .. }}
+```
+
+The following example calls the `add` function with inputs of `1` and `2`:
+
+```go-html-template
+{{ add 1 2 }}
+```
+
+#### Methods and Fields are Accessed via dot Notation
+
+Accessing the Page Parameter `bar` defined in a piece of content's [front matter][].
+
+```go-html-template
+{{ .Params.bar }}
+```
+
+#### Parentheses Can be Used to Group Items Together
+
+```go-html-template
+{{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }}
+```
+
+#### A Single Statement Can be Split over Multiple Lines
+
+```go-html-template
+{{ if or
+ (isset .Params "alt")
+ (isset .Params "caption")
+}}
+```
+
+#### Raw String Literals Can Include Newlines
+
+```go-html-template
+{{ $msg := `Line one.
+Line two.` }}
+```
+
+## Variables {#variables}
+
+Each Go Template gets a data object. In Hugo, each template is passed
+a `Page`. In the below example, `.Title` is one of the elements
+accessible in that [`Page` variable][pagevars].
+
+With the `Page` being the default scope of a template, the `Title`
+element in current scope (`.` -- "the **dot**") is accessible simply
+by the dot-prefix (`.Title`):
+
+```go-html-template
+<title>{{ .Title }}</title>
+```
+
+Values can also be stored in custom variables and referenced later:
+
+{{% note %}}
+The custom variables need to be prefixed with `$`.
+{{% /note %}}
+
+```go-html-template
+{{ $address := "123 Main St." }}
+{{ $address }}
+```
+
+{{% warning %}}
+For Hugo v0.47 and older versions, variables defined inside `if`
+conditionals and similar are not visible on the outside.
+See [https://github.com/golang/go/issues/10608](https://github.com/golang/go/issues/10608).
+
+Hugo has created a workaround for this issue in [Scratch](/functions/scratch).
+{{% /warning %}}
+
+For **Hugo v0.48** and newer, variables can be re-defined using the
+new `=` operator (new in Go 1.11).
+
+Below example will work only in these newer Hugo versions. The example
+prints "Var is Hugo Home" on the home page, and "Var is Hugo Page" on
+all other pages:
+
+```go-html-template
+{{ $var := "Hugo Page" }}
+{{ if .IsHome }}
+ {{ $var = "Hugo Home" }}
+{{ end }}
+Var is {{ $var }}
+```
+
+## Functions
+
+Go Templates only ship with a few basic functions but also provide a mechanism for applications to extend the original set.
+
+[Hugo template functions][functions] provide additional functionality specific to building websites. Functions are called by using their name followed by the required parameters separated by spaces. Template functions cannot be added without recompiling Hugo.
+
+### Example 1: Adding Numbers
+
+```go-html-template
+{{ add 1 2 }}
+<!-- prints 3 -->
+```
+
+### Example 2: Comparing Numbers
+
+```go-html-template
+{{ lt 1 2 }}
+<!-- prints true (i.e., since 1 is less than 2) -->
+```
+
- [*internal* templates][internal_templates]. The syntax is `{{ template
++Note that both examples make use of Go Template's [math]][] functions.
+
+{{% note "Additional Boolean Operators" %}}
+There are more boolean operators than those listed in the Hugo docs in the [Go Template documentation](https://golang.org/pkg/text/template/#hdr-Functions).
+{{% /note %}}
+
+## Includes
+
+When including another template, you will need to pass it the data that it would
+need to access.
+
+{{% note %}}
+To pass along the current context, please remember to include a trailing **dot**.
+{{% /note %}}
+
+The templates location will always be starting at the `layouts/` directory
+within Hugo.
+
+### Partial
+
+The [`partial`][partials] function is used to include *partial* templates using
+the syntax `{{ partial "<PATH>/<PARTIAL>.<EXTENSION>" . }}`.
+
+Example of including a `layouts/partials/header.html` partial:
+
+```go-html-template
+{{ partial "header.html" . }}
+```
+
+### Template
+
+The `template` function was used to include *partial* templates
+in much older Hugo versions. Now it's useful only for calling
- ## Example: Show Only Upcoming Events
++[*internal* templates][internal templates]. The syntax is `{{ template
+"_internal/<TEMPLATE>.<EXTENSION>" . }}`.
+
+{{% note %}}
+The available **internal** templates can be found
+[here](https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates).
+{{% /note %}}
+
+Example of including the internal `opengraph.html` template:
+
+```go-html-template
+{{ template "_internal/opengraph.html" . }}
+```
+
+## Logic
+
+Go Templates provide the most basic iteration and conditional logic.
+
+### Iteration
+
+The Go Templates make heavy use of `range` to iterate over a _map_,
+_array_, or _slice_. The following are different examples of how to
+use `range`.
+
+#### Example 1: Using Context (`.`)
+
+```go-html-template
+{{ range $array }}
+ {{ . }} <!-- The . represents an element in $array -->
+{{ end }}
+```
+
+#### Example 2: Declaring a variable name for an array element's value
+
+```go-html-template
+{{ range $elem_val := $array }}
+ {{ $elem_val }}
+{{ end }}
+```
+
+#### Example 3: Declaring variable names for an array element's index _and_ value
+
+For an array or slice, the first declared variable will map to each
+element's index.
+
+```go-html-template
+{{ range $elem_index, $elem_val := $array }}
+ {{ $elem_index }} -- {{ $elem_val }}
+{{ end }}
+```
+
+#### Example 4: Declaring variable names for a map element's key _and_ value
+
+For a map, the first declared variable will map to each map element's
+key.
+
+```go-html-template
+{{ range $elem_key, $elem_val := $map }}
+ {{ $elem_key }} -- {{ $elem_val }}
+{{ end }}
+```
+
+#### Example 5: Conditional on empty _map_, _array_, or _slice_.
+
+If the _map_, _array_, or _slice_ passed into the range is zero-length then the else statement is evaluated.
+
+```go-html-template
+{{ range $array }}
+ {{ . }}
+{{else}}
+ <!-- This is only evaluated if $array is empty -->
+{{ end }}
+```
+
+### Conditionals
+
+`if`, `else`, `with`, `or`, `and` and `not` provide the framework for handling conditional logic in Go Templates. Like `range`, `if` and `with` statements are closed with an `{{ end }}`.
+
+Go Templates treat the following values as **false**:
+
+- `false` (boolean)
+- 0 (integer)
+- any zero-length array, slice, map, or string
+
+#### Example 1: `with`
+
+It is common to write "if something exists, do this" kind of
+statements using `with`.
+
+{{% note %}}
+`with` rebinds the context `.` within its scope (just like in `range`).
+{{% /note %}}
+
+It skips the block if the variable is absent, or if it evaluates to
+"false" as explained above.
+
+```go-html-template
+{{ with .Params.title }}
+ <h4>{{ . }}</h4>
+{{ end }}
+```
+
+#### Example 2: `with` .. `else`
+
+Below snippet uses the "description" front-matter parameter's value if
+set, else uses the default `.Summary` [Page variable][pagevars]:
+
+
+```go-html-template
+{{ with .Param "description" }}
+ {{ . }}
+{{ else }}
+ {{ .Summary }}
+{{ end }}
+```
+
+See the [`.Param` function][param].
+
+#### Example 3: `if`
+
+An alternative (and a more verbose) way of writing `with` is using
+`if`. Here, the `.` does not get rebinded.
+
+Below example is "Example 1" rewritten using `if`:
+
+```go-html-template
+{{ if isset .Params "title" }}
+ <h4>{{ index .Params "title" }}</h4>
+{{ end }}
+```
+
+#### Example 4: `if` .. `else`
+
+Below example is "Example 2" rewritten using `if` .. `else`, and using
+[`isset` function][isset] + `.Params` variable (different from the
+[`.Param` **function**][param]) instead:
+
+```go-html-template
+{{ if (isset .Params "description") }}
+ {{ index .Params "description" }}
+{{ else }}
+ {{ .Summary }}
+{{ end }}
+```
+
+#### Example 5: `if` .. `else if` .. `else`
+
+Unlike `with`, `if` can contain `else if` clauses too.
+
+```go-html-template
+{{ if (isset .Params "description") }}
+ {{ index .Params "description" }}
+{{ else if (isset .Params "summary") }}
+ {{ index .Params "summary" }}
+{{ else }}
+ {{ .Summary }}
+{{ end }}
+```
+
+#### Example 6: `and` & `or`
+
+```go-html-template
+{{ if (and (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")) }}
+```
+
+## Pipes
+
+One of the most powerful components of Go Templates is the ability to stack actions one after another. This is done by using pipes. Borrowed from Unix pipes, the concept is simple: each pipeline's output becomes the input of the following pipe.
+
+Because of the very simple syntax of Go Templates, the pipe is essential to being able to chain together function calls. One limitation of the pipes is that they can only work with a single value and that value becomes the last parameter of the next pipeline.
+
+A few simple examples should help convey how to use the pipe.
+
+### Example 1: `shuffle`
+
+The following two examples are functionally the same:
+
+```go-html-template
+{{ shuffle (seq 1 5) }}
+```
+
+
+```go-html-template
+{{ (seq 1 5) | shuffle }}
+```
+
+### Example 2: `index`
+
+The following accesses the page parameter called "disqus_url" and escapes the HTML. This example also uses the [`index` function](/functions/index-function/), which is built into Go Templates:
+
+```go-html-template
+{{ index .Params "disqus_url" | html }}
+```
+
+### Example 3: `or` with `isset`
+
+```go-html-template
+{{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr") }}
+Stuff Here
+{{ end }}
+```
+
+Could be rewritten as
+
+```go-html-template
+{{ if isset .Params "caption" | or isset .Params "title" | or isset .Params "attr" }}
+Stuff Here
+{{ end }}
+```
+
+### Example 4: Internet Explorer Conditional Comments {#ie-conditional-comments}
+
+By default, Go Templates remove HTML comments from output. This has the unfortunate side effect of removing Internet Explorer conditional comments. As a workaround, use something like this:
+
+```go-html-template
+{{ "<!--[if lt IE 9]>" | safeHTML }}
+ <script src="html5shiv.js"></script>
+{{ "<![endif]-->" | safeHTML }}
+```
+
+Alternatively, you can use the backtick (`` ` ``) to quote the IE conditional comments, avoiding the tedious task of escaping every double quotes (`"`) inside, as demonstrated in the [examples](https://golang.org/pkg/text/template/#hdr-Examples) in the Go text/template documentation:
+
+```go-html-template
+{{ `<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7"><![endif]-->` | safeHTML }}
+```
+
+## Context (aka "the dot") {#the-dot}
+
+The most easily overlooked concept to understand about Go Templates is
+that `{{ . }}` always refers to the **current context**.
+
+- In the top level of your template, this will be the data set made
+ available to it.
+- Inside of an iteration, however, it will have the value of the
+ current item in the loop; i.e., `{{ . }}` will no longer refer to
+ the data available to the entire page.
+
+If you need to access page-level data (e.g., page params set in front
+matter) from within the loop, you will likely want to do one of the
+following:
+
+### 1. Define a Variable Independent of Context
+
+The following shows how to define a variable independent of the context.
+
+{{< code file="tags-range-with-page-variable.html" >}}
+{{ $title := .Site.Title }}
+<ul>
+{{ range .Params.tags }}
+ <li>
+ <a href="/tags/{{ . | urlize }}">{{ . }}</a>
+ - {{ $title }}
+ </li>
+{{ end }}
+</ul>
+{{< /code >}}
+
+{{% note %}}
+Notice how once we have entered the loop (i.e. `range`), the value of `{{ . }}` has changed. We have defined a variable outside of the loop (`{{$title}}`) that we've assigned a value so that we have access to the value from within the loop as well.
+{{% /note %}}
+
+### 2. Use `$.` to Access the Global Context
+
+`$` has special significance in your templates. `$` is set to the starting value of `.` ("the dot") by default. This is a [documented feature of Go text/template][dotdoc]. This means you have access to the global context from anywhere. Here is an equivalent example of the preceding code block but now using `$` to grab `.Site.Title` from the global context:
+
+{{< code file="range-through-tags-w-global.html" >}}
+<ul>
+{{ range .Params.tags }}
+ <li>
+ <a href="/tags/{{ . | urlize }}">{{ . }}</a>
+ - {{ $.Site.Title }}
+ </li>
+{{ end }}
+</ul>
+{{< /code >}}
+
+{{% warning "Don't Redefine the Dot" %}}
+The built-in magic of `$` would cease to work if someone were to mischievously redefine the special character; e.g. `{{ $ := .Site }}`. *Don't do it.* You may, of course, recover from this mischief by using `{{ $ := . }}` in a global context to reset `$` to its default value.
+{{% /warning %}}
+
+## Whitespace
+
+Go 1.6 includes the ability to trim the whitespace from either side of a Go tag by including a hyphen (`-`) and space immediately beside the corresponding `{{` or `}}` delimiter.
+
+For instance, the following Go Template will include the newlines and horizontal tab in its HTML output:
+
+```go-html-template
+<div>
+ {{ .Title }}
+</div>
+```
+
+Which will output:
+
+```html
+<div>
+ Hello, World!
+</div>
+```
+
+Leveraging the `-` in the following example will remove the extra white space surrounding the `.Title` variable and remove the newline:
+
+```go-html-template
+<div>
+ {{- .Title -}}
+</div>
+```
+
+Which then outputs:
+
+```html
+<div>Hello, World!</div>
+```
+
+Go considers the following characters _whitespace_:
+
+* <kbd>space</kbd>
+* horizontal <kbd>tab</kbd>
+* carriage <kbd>return</kbd>
+* newline
+
+## Comments
+
+In order to keep your templates organized and share information throughout your team, you may want to add comments to your templates. There are two ways to do that with Hugo.
+
+### Go Templates comments
+
+Go Templates support `{{/*` and `*/}}` to open and close a comment block. Nothing within that block will be rendered.
+
+For example:
+
+```go-html-template
+Bonsoir, {{/* {{ add 0 + 2 }} */}}Eliott.
+```
+
+Will render `Bonsoir, Eliott.`, and not care about the syntax error (`add 0 + 2`) in the comment block.
+
+### HTML comments
+
+If you need to produce HTML comments from your templates, take a look at the [Internet Explorer conditional comments](#ie-conditional-comments) example. If you need variables to construct such HTML comments, just pipe `printf` to `safeHTML`. For example:
+
+```go-html-template
+{{ printf "<!-- Our website is named: %s -->" .Site.Title | safeHTML }}
+```
+
+#### HTML comments containing Go Templates
+
+HTML comments are by default stripped, but their content is still evaluated. That means that although the HTML comment will never render any content to the final HTML pages, code contained within the comment may fail the build process.
+
+{{% note %}}
+Do **not** try to comment out Go Template code using HTML comments.
+{{% /note %}}
+
+```go-html-template
+<!-- {{ $author := "Emma Goldman" }} was a great woman. -->
+{{ $author }}
+```
+
+The templating engine will strip the content within the HTML comment, but will first evaluate any Go Template code if present within. So the above example will render `Emma Goldman`, as the `$author` variable got evaluated in the HTML comment. But the build would have failed if that code in the HTML comment had an error.
+
+## Hugo Parameters
+
+Hugo provides the option of passing values to your template layer through your [site configuration][config] (i.e. for site-wide values) or through the metadata of each specific piece of content (i.e. the [front matter][]). You can define any values of any type and use them however you want in your templates, as long as the values are supported by the [front matter format]({{< ref "front-matter.md#front-matter-formats" >}}).
+
+## Use Content (`Page`) Parameters
+
+You can provide variables to be used by templates in individual content's [front matter][].
+
+An example of this is used in the Hugo docs. Most of the pages benefit from having the table of contents provided, but sometimes the table of contents doesn't make a lot of sense. We've defined a `notoc` variable in our front matter that will prevent a table of contents from rendering when specifically set to `true`.
+
+Here is the example front matter (YAML):
+
+```
+---
+title: Roadmap
+lastmod: 2017-03-05
+date: 2013-11-18
+notoc: true
+---
+```
+
+Here is an example of corresponding code that could be used inside a `toc.html` [partial template][partials]:
+
+{{< code file="layouts/partials/toc.html" download="toc.html" >}}
+{{ if not .Params.notoc }}
+<aside>
+ <header>
+ <a href="#{{.Title | urlize}}">
+ <h3>{{.Title}}</h3>
+ </a>
+ </header>
+ {{.TableOfContents}}
+</aside>
+<a href="#" id="toc-toggle"></a>
+{{ end }}
+{{< /code >}}
+
+We want the *default* behavior to be for pages to include a TOC unless otherwise specified. This template checks to make sure that the `notoc:` field in this page's front matter is not `true`.
+
+## Use Site Configuration Parameters
+
+You can arbitrarily define as many site-level parameters as you want in your [site's configuration file][config]. These parameters are globally available in your templates.
+
+For instance, you might declare the following:
+
+{{< code-toggle file="config" >}}
+params:
+ copyrighthtml: "Copyright © 2017 John Doe. All Rights Reserved."
+ twitteruser: "spf13"
+ sidebarrecentlimit: 5
+{{< /code >}}
+
+Within a footer layout, you might then declare a `<footer>` that is only rendered if the `copyrighthtml` parameter is provided. If it *is* provided, you will then need to declare the string is safe to use via the [`safeHTML` function][safehtml] so that the HTML entity is not escaped again. This would let you easily update just your top-level config file each January 1st, instead of hunting through your templates.
+
+```go-html-template
+{{ if .Site.Params.copyrighthtml }}
+ <footer>
+ <div class="text-center">{{.Site.Params.CopyrightHTML | safeHTML}}</div>
+ </footer>
+{{ end }}
+```
+
+An alternative way of writing the "`if`" and then referencing the same value is to use [`with`][with] instead. `with` rebinds the context (`.`) within its scope and skips the block if the variable is absent:
+
+{{< code file="layouts/partials/twitter.html" >}}
+{{ with .Site.Params.twitteruser }}
+ <div>
+ <a href="https://twitter.com/{{.}}" rel="author">
+ <img src="/images/twitter.png" width="48" height="48" title="Twitter: {{.}}" alt="Twitter"></a>
+ </div>
+{{ end }}
+{{< /code >}}
+
+Finally, you can pull "magic constants" out of your layouts as well. The following uses the [`first`][first] function, as well as the [`.RelPermalink`][relpermalink] page variable and the [`.Site.Pages`][sitevars] site variable.
+
+```go-html-template
+<nav>
+ <h1>Recent Posts</h1>
+ <ul>
+ {{- range first .Site.Params.SidebarRecentLimit .Site.Pages -}}
+ <li><a href="{{.RelPermalink}}">{{.Title}}</a></li>
+ {{- end -}}
+ </ul>
+</nav>
+```
+
- Go allows you to do more than what's shown here. Using Hugo's [`where` function][where] and Go built-ins, we can list only the items from `content/events/` whose date (set in a content file's [front matter][]) is in the future. The following is an example [partial template][partials]:
++## Example: Show Future Events
+
- {{< code file="layouts/partials/upcoming-events.html" download="upcoming-events.html" >}}
- <h4>Upcoming Events</h4>
- <ul class="upcoming-events">
- {{ range where .Pages.ByDate "Section" "events" }}
- {{ if ge .Date.Unix now.Unix }}
- <li>
- <!-- add span for event type -->
- <span>{{ .Type | title }} —</span>
- {{ .Title }} on
- <!-- add span for event date -->
- <span>{{ .Date.Format "2 January at 3:04pm" }}</span>
- at {{ .Params.place }}
- </li>
++Given the following content structure and [front matter]:
+
- {{ end }}
++```text
++content/
++└── events/
++ ├── event-1.md
++ ├── event-2.md
++ └── event-3.md
++```
++
++{{< code-toggle file="content/events/event-1.md" copy="false" >}}
++title = 'Event 1'
++date = 2021-12-06T10:37:16-08:00
++draft = false
++start_date = 2021-12-05T09:00:00-08:00
++end_date = 2021-12-05T11:00:00-08:00
++{{< /code-toggle >}}
++
++This [partial template][partials] renders future events:
++
++{{< code file="layouts/partials/future-events.html" >}}
++<h2>Future Events</h2>
++<ul>
++ {{ range where site.RegularPages "Type" "events" }}
++ {{ if gt (.Params.start_date | time.AsTime) now }}
++ {{ $startDate := .Params.start_date | time.Format ":date_medium" }}
++ <li>
++ <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> - {{ $startDate }}
++ </li>
+ {{ end }}
- [`where` function]: /functions/where/
- [config]: /getting-started/configuration/
++ {{ end }}
+</ul>
+{{< /code >}}
+
++If you restrict front matter to the TOML format, and omit quotation marks surrounding date fields, you can perform date comparisons without casting.
++
++{{< code file="layouts/partials/future-events.html" >}}
++<h2>Future Events</h2>
++<ul>
++ {{ range where (where site.RegularPages "Type" "events") "Params.start_date" "gt" now }}
++ {{ $startDate := .Params.start_date | time.Format ":date_medium" }}
++ <li>
++ <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> - {{ $startDate }}
++ </li>
++ {{ end }}
++</ul>
++{{< /code >}}
+
- [first]: /functions/first/
- [front matter]: /content-management/front-matter/
- [functions]: /functions/ "See the full list of Hugo's templating functions with a quick start reference guide and basic and advanced examples."
- [Go html/template]: https://golang.org/pkg/html/template/ "Godocs references for Go's html templating"
- [gohtmltemplate]: https://golang.org/pkg/html/template/ "Godocs references for Go's html templating"
- [index]: /functions/index-function/
- [math functions]: /functions/math/
- [partials]: /templates/partials/ "Link to the partial templates page inside of the templating section of the Hugo docs"
- [internal_templates]: /templates/internal/
- [relpermalink]: /variables/page/
- [safehtml]: /functions/safehtml/
- [sitevars]: /variables/site/
- [pagevars]: /variables/page/
- [variables]: /variables/ "See the full extent of page-, site-, and other variables that Hugo make available to you in your templates."
- [where]: /functions/where/
- [with]: /functions/with/
- [godocsindex]: https://golang.org/pkg/text/template/ "Godocs page for index function"
- [param]: /functions/param/
- [isset]: /functions/isset/
++[config]: {{< relref "getting-started/configuration" >}}
+[dotdoc]: https://golang.org/pkg/text/template/#hdr-Variables
++[first]: {{< relref "functions/first" >}}
++[front matter]: {{< relref "content-management/front-matter" >}}
++[functions]: {{< relref "functions" >}}
++[internal templates]: {{< relref "templates/internal" >}}
++[isset]: {{< relref "functions/isset" >}}
++[math]: {{< relref "functions/math" >}}
++[pagevars]: {{< relref "variables/page" >}}
++[param]: {{< relref "functions/param" >}}
++[partials]: {{< relref "templates/partials" >}}
++[relpermalink]: {{< relref "variables/page#page-variables" >}}
++[safehtml]: {{< relref "functions/safehtml" >}}
++[sitevars]: {{< relref "variables/site" >}}
++[variables]: {{< relref "variables" >}}
++[with]: {{< relref "functions/with" >}}
--- /dev/null
- : a string representing the language as defined in the site configuration. This is mostly used to populate the RSS feeds with the right language code.
+---
+title: Site Variables
+linktitle: Site Variables
+description: Many, but not all, site-wide variables are defined in your site's configuration. However, Hugo provides a number of built-in variables for convenient access to global values in your templates.
+date: 2017-02-01
+publishdate: 2017-02-01
+lastmod: 2017-02-01
+categories: [variables and params]
+keywords: [global,site]
+draft: false
+menu:
+ docs:
+ parent: "variables"
+ weight: 10
+weight: 10
+sections_weight: 10
+aliases: [/variables/site-variables/]
+toc: true
+---
+
+The following is a list of site-level (aka "global") variables. Many of these variables are defined in your site's [configuration file][config], whereas others are built into Hugo's core for convenient usage in your templates.
+
+## Get the Site object from a partial
+
+All the methods below, e.g. `.Site.RegularPages` can also be reached via the global [`site`](/functions/site/) function, e.g. `site.RegularPages`, which can be handy in partials where the `Page` object isn't easily available. {{< new-in "0.53" >}}.
+
+## Site Variables List
+
+.Site.AllPages
+: array of all pages, regardless of their translation.
+
+.Site.Author
+: a map of the authors as defined in the site configuration.
+
+.Site.BaseURL
+: the base URL for the site as defined in the site configuration.
+
+.Site.BuildDrafts
+: a boolean (default: `false`) to indicate whether to build drafts as defined in the site configuration.
+
+.Site.Copyright
+: a string representing the copyright of your website as defined in the site configuration.
+
+.Site.Data
+: custom data, see [Data Templates](/templates/data-templates/).
+
+.Site.DisqusShortname
+: a string representing the shortname of the Disqus shortcode as defined in the site configuration.
+
+.Site.GoogleAnalytics
+: a string representing your tracking code for Google Analytics as defined in the site configuration.
+
+.Site.Home
+: reference to the homepage's [page object](https://gohugo.io/variables/page/)
+
+.Site.IsMultiLingual
+: whether there are more than one language in this site. See [Multilingual](/content-management/multilingual/) for more information.
+
+.Site.IsServer
+: a boolean to indicate if the site is being served with Hugo's built-in server. See [`hugo server`](/commands/hugo_server/) for more information.
+
+.Site.Language.Lang
+: the language code of the current locale (e.g., `en`).
+
+.Site.Language.LanguageName
+: the full language name (e.g. `English`).
+
+.Site.Language.Weight
+: the weight that defines the order in the `.Site.Languages` list.
+
+.Site.Language
+: indicates the language currently being used to render the website. This object's attributes are set in site configurations' language definition.
+
+.Site.LanguageCode
++: a string representing the language tag as defined in the site configuration.
+
+.Site.LanguagePrefix
+: this can be used to prefix URLs to point to the correct language. It will even work when only one defined language. See also the functions [absLangURL](/functions/abslangurl/) and [relLangURL](/functions/rellangurl).
+
+.Site.Languages
+: an ordered list (ordered by defined weight) of languages.
+
+.Site.LastChange
+: a string representing the date/time of the most recent change to your site. This string is based on the [`date` variable in the front matter](/content-management/front-matter) of your content pages.
+
+.Site.Menus
+: all of the menus in the site.
+
+.Site.Pages
+: array of all content ordered by Date with the newest first. This array contains only the pages in the current language. See [`.Site.Pages`](#site-pages).
+
+.Site.RegularPages
+: a shortcut to the *regular* page collection. `.Site.RegularPages` is equivalent to `where .Site.Pages "Kind" "page"`. See [`.Site.Pages`](#site-pages).
+
+.Site.Sections
+: top-level directories of the site.
+
+.Site.Taxonomies
+: the [taxonomies](/taxonomies/usage/) for the entire site. Also see section [Use `.Site.Taxonomies` Outside of Taxonomy Templates](/variables/taxonomy/#use-sitetaxonomies-outside-of-taxonomy-templates).
+
+.Site.Title
+: a string representing the title of the site.
+
+## The `.Site.Params` Variable
+
+`.Site.Params` is a container holding the values from the `params` section of your site configuration.
+
+### Example: `.Site.Params`
+
+The following `config.[yaml|toml|json]` defines a site-wide param for `description`:
+
+{{< code-toggle file="config" >}}
+baseURL = "https://yoursite.example.com/"
+
+[params]
+ description = "Tesla's Awesome Hugo Site"
+ author = "Nikola Tesla"
+{{</ code-toggle >}}
+
+You can use `.Site.Params` in a [partial template](/templates/partials/) to call the default site description:
+
+{{< code file="layouts/partials/head.html" >}}
+<meta name="description" content="{{if .IsHome}}{{ $.Site.Params.description }}{{else}}{{.Description}}{{end}}" />
+{{< /code >}}
+
+## The `.Site.Pages` Variable {#site-pages}
+
+### `.Site.Pages` compared to `.Pages`
+
+{{< getcontent path="readfiles/pages-vs-site-pages.md" >}}
+
+
+
+
+[config]: /getting-started/configuration/
--- /dev/null
- {{ highlight ($code | transform.Remarshal . | safeHTML) . ""}}
+{{ $file := .Get "file" }}
+{{ $code := "" }}
+{{ with .Get "config" }}
+ {{ $file = $file | default "config" }}
+ {{ $sections := (split . ".") }}
+ {{ $configSection := index $.Site.Data.docs.config $sections }}
+ {{ $code = dict $sections $configSection }}
+ {{ if $.Get "skipHeader"}}
+ {{ $code = $configSection }}
+ {{ end }}
+{{ else }}
+ {{ $code = $.Inner }}
+{{ end }}
+{{ $langs := (slice "yaml" "toml" "json") }}
+<div class="code relative" {{ with $file }}id="{{ . | urlize}}"{{ end }}>
+ <div class="code-nav flex flex-nowrap items-stretch">
+ {{- with $file -}}
+ <div class="san-serif f6 dib lh-solid pl2 pv2 mr2">
+ {{ . }}.
+ </div>
+ {{- end -}}
+ {{ range $langs }}
+ <button data-toggle-tab="{{ . }}" class="tab-button {{ cond (eq . "yaml") "active" ""}} ba san-serif f6 dib lh-solid ph2 pv2">
+ {{ . }}
+ </button>
+
+ {{ end }}
+ </div>
+ <div class="tab-content">
+ {{ range $langs }}
+ <div data-pane="{{ . }}" class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" ""}}">
-
++ {{ highlight ($code | transform.Remarshal . | replaceRE `\n+` "\n" | safeHTML) . "" }}
+ </div>
+ {{ if ne ($.Get "copy") "false" }}
+ <button class="needs-js copy copy-toggle bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button"></button>
+ {{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
+ {{end}}
+ {{ end }}
+ </div>
++
+</div>
--- /dev/null
- <h2>
- <a class="header-link" href="#{{ $func | anchorize | safeURL }}">
+{{ $pkg := .Params.package}}
+{{ $funcs := index site.Data.docs.tpl.funcs $pkg }}
+
+{{ range $k, $v := $funcs }}
+ {{ if $v.Description }}
+ {{ $func := printf "%s.%s" $pkg $k }}
++ {{ $id := $func | anchorize | safeURL }}
++ <h2 id="{{ $id }}">
++ <a class="header-link" href="#{{ $id }}">
+ <svg class="fill-current o-60 hover-accent-color-light" height="22px" viewBox="0 0 24 24" width="22px" xmlns="http://www.w3.org/2000/svg">
+ <path d="M0 0h24v24H0z" fill="none"/>
+ <path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/>
+ </svg>
+ </a>
+ {{ $func }}
+ </h2>
+ {{ with $v.Description }}
+ <p class="f4 lh-copy">
+ {{ . | $.RenderString | safeHTML }}
+ </p>
+ {{ end }}
+ <h4 class="minor mb3 pt2 primary-color-dark">
+ Syntax
+ </h4>
+ <div class="f5 mb4 ph3 pv2 bg-light-gray" style="border-left:4px solid #0594CB;">
+ {{ $pkg }}.{{ $k }}
+ {{ with $v.Args }}
+ <span class="ttu">
+ {{ delimit $v.Args ", "}}
+ </span>
+ {{ end }}
+ <span></span>
+ </div>
+ {{ if $v.Examples }}
+ <h4 class="minor mb3 pt2 primary-color-dark">
+ Examples
+ </h4>
+ {{ end }}
+ {{ range $v.Examples }}
+ {{ $input := index . 0 }}
+ {{ $result := index . 1 }}
+ {{ $example := printf "%s ---> %s" $input $result }}
+
+ {{ highlight $example "go-html-template" "" }}
+ {{ end }}
+ {{ with $v.Aliases }}
+ <h4 class="minor mb3 pt2 primary-color-dark">
+ Aliases
+ </h4>
+ <p>
+ {{ delimit . ", "}}
+ </p>
+ {{ end }}
+ {{ end }}
+{{ end }}
--- /dev/null
- HUGO_VERSION = "0.88.1"
+[build]
+publish = "public"
+command = "hugo --gc --minify"
+
+[context.production.environment]
- HUGO_VERSION = "0.88.1"
++HUGO_VERSION = "0.89.4"
+HUGO_ENV = "production"
+HUGO_ENABLEGITINFO = "true"
+
+[context.split1]
+command = "hugo --gc --minify --enableGitInfo"
+
+[context.split1.environment]
- HUGO_VERSION = "0.88.1"
++HUGO_VERSION = "0.89.4"
+HUGO_ENV = "production"
+
+[context.deploy-preview]
+command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
+
+[context.deploy-preview.environment]
- HUGO_VERSION = "0.88.1"
++HUGO_VERSION = "0.89.4"
+
+[context.branch-deploy]
+command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
+
+[context.branch-deploy.environment]
++HUGO_VERSION = "0.89.4"
+
+[context.next.environment]
+HUGO_ENABLEGITINFO = "true"
+
+[[redirects]]
+from = "/npmjs/*"
+to = "/npmjs/"
+status = 200