Squashed 'docs/' changes from 56c34962c..dce236ad1

dce236ad1 Wrap up the bundle etc. edits for now
27d058566 Add the bundle tree to the organization bundle
a83f750dd Move organization.md to its own bundle
01ec4f462 Make the image docs a bundle
60de1e090 Some more resources copy-edits
05d763c0c Some resource copy-edits
6299d6dbb Update the imgproc shortcode
59e0fc209 Add headless bundle documentation
a3bbf60bf Link Page Resources page from Front Matter page
830576f86 Update order significance section, add counter section
3b1836509 Revert the recent change made to default list template
886ed0e10 Page Bundles draft rev 2
f530d1a7a image processing and page resources made into regular .md
ec47cecda Finalised Page Resources and Image Processing Moved Page Resources and Impage Processing out of the Bundle section and at the root of the Content Management section
253092335 Modified front matter metadata exemple. Added yaml version.
da5e4f476 Adding date in the front-matter; missed in previous commit
6bc3ced13 Add rough draft for page and section bundles
a0e44458f Image processing first draft, Resources second read/fix
2367f0b78 data: Remove duplicate layouts in table
c2f179839 First draft of bundles/resources (covers resources and metadata)
2a3f9a613 Add weights to pages in Bundles branch
9a0146cc0 Switch front-matter format of Bundles doc to yaml; add front-matter
1295fc083 First draft for Bundles documentation organization structure
5a2e52231 Fix archetype paths
9c2e5c063 Merge commit '22cced34fc608256f8271ad591a5ccca991bb164'
22cced34f Squashed 'themes/gohugoioTheme/' changes from 75da2f6b..ecad8247
55d16c9a1 Fix broken sentence in multilingual sections
a76895ad2 Replace the outdated Emacs package with new one
e6cf1dec0 Remove obsolete link to hugo roadmap
dd2fd145b Add GitLab Pages to mentioned hosters (#309)
a05ce6bf6 Add 0.34 release notes poster
5c0ebdfca Release 0.34
13c2f3dc8 Merge branch 'temp34'
e6b5ffa04 Add 0.34 poster
1e1960496 releaser: Add release notes to /docs for release of 0.34
ac3efe182 releaser: Bump versions for release of 0.34
8f91f62d8 Fixes #222
cca35dbe4 Fix example
eaaa21ca1 Add missing params key
00d0b0363 Adding new Blogger utility to tools/migrations
7d36d579e Updated the line number for Dockerfile pointer
852188f85 Update installing.md with Fedora instructions
4d151a3ab Update search.md
4c2750bfb Update deployment-with-nanobox.md
c3cc9cd49 configuration: Remove defaultExtension from docs
f7c96b4b5 Update GitHub Pages documentation
55787f09a Merge branch 'rmetzler-menu-link-title'
2abbd9bd9 Merge branch 'master' into menu-link-title
e1fd710b7 Bring archetypes in from theme.
daf6f51c0 Mention the significance of leading 0 in int fn string input
07f498755 Add documentation for `cond` function.
050ccd12b Add documentation for the .HasShortcode function
919af9071 Correct anchor under 'Add custom metadata to a Taxonomy Term'
55600b4ff More layouts work
201cf4f67 Add some more single page layout variants
d5e7c03e2 Rework the layouts doc
84622e67c Cleans up the code sample
c231c9bd5 Add a new note to 0.33 relnotes
328ec9930 Release 0.33
b108fcc7b Merge branch 'temp33' into next
ab9d9ee65 releaser: Prepare repository for 0.34-DEV
e20c75320 releaser: Add release notes to /docs for release of 0.33
49f24dcd1 releaser: Bump versions for release of 0.33
9c8e5e207 Update 0.33 poster
7655603c8 Regenerate the docshelper data
16dc99583 Add Hugo 0.33 poster
ce40cc197 Merge commit '3cf4300097610bb8b5bd0686d96d1df5db641895'
9a3085523 releaser: Prepare repository for 0.33-DEV
a52db97d8 fixing typos and syntax for consistency
64525670f ádd title to some menu entries. This needs hugo >= v0.32
85d415ab2 ádd examples for menu .Title and .Page

git-subtree-dir: docs
git-subtree-split: dce236ad1258a9d9a0ee209f02b2e1f65b46f0fb
This commit is contained in:
Bjørn Erik Pedersen 2018-01-31 11:07:47 +01:00
parent 3cf4300097
commit 337d0c5f51
58 changed files with 1501 additions and 545 deletions

View file

@ -1,11 +1,13 @@
---
title: "{{ replace .TranslationBaseName "-" " " | title }}"
date: {{ .Date }}
linktitle: ""
description: ""
godocref: ""
publishdate: ""
lastmod: ""
categories: []
keywords: []
tags: []
weight: 00
slug: ""
aliases: []
toc: false
draft: true
---
---

View file

@ -71,7 +71,7 @@ twitter = "GoHugoIO"
[params]
description = "The worlds fastest framework for building websites"
## Used for views in rendered HTML (i.e., rather than using the .Hugo variable)
release = "0.32.4"
release = "0.34"
## Setting this to true will add a "noindex" to *EVERY* page on the site
removefromexternalsearch = false
## Gh repo for site footer (include trailing slash)
@ -98,7 +98,8 @@ twitter = "GoHugoIO"
## Configuration for BlackFriday markdown parser: https://github.com/russross/blackfriday
[blackfriday]
plainIDAnchors = true
hrefTargetBlank = true
# See https://github.com/gohugoio/hugo/issues/2424
hrefTargetBlank = false
angledQuotes = false
latexDashes = true

View file

@ -55,7 +55,6 @@ toc: true
* Support for [Go][], [Amber], and [Ace][] HTML templates
* [Syntax highlighting][] powered by [Pygments][]
See what's coming next in the [Hugo roadmap][].
[Ace]: /templates/alternatives/
[aliases]: /content-management/urls/#aliases
@ -71,7 +70,6 @@ See what's coming next in the [Hugo roadmap][].
[Google Analytics]: https://google-analytics.com/
[homepage]: /templates/homepage/
[hostanywhere]: /hosting-and-deployment/
[Hugo roadmap]: /about/roadmap
[install]: /getting-started/installing/
[LiveReload]: /getting-started/usage/
[organization for your projects]: /getting-started/directory-structure/

View file

@ -126,15 +126,15 @@ Image operations in Hugo currently **do not preserve EXIF data** as this is not
_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 Resize "300x" />}}
{{< imgproc sunset Fill "90x120 left" >}}
{{< imgproc sunset Fill "90x120 left" />}}
{{< imgproc sunset Fill "90x120 right" >}}
{{< imgproc sunset Fill "90x120 right" />}}
{{< imgproc sunset Fit "90x90" >}}
{{< imgproc sunset Fit "90x90" />}}
{{< imgproc sunset Resize "300x q10" >}}
{{< imgproc sunset Resize "300x q10" />}}
This is the shortcode used in the examples above:

View file

@ -19,7 +19,7 @@ toc: true
Hugo is a general-purpose website framework. Technically speaking, Hugo is a [static site generator][]. Unlike systems that dynamically build a page with each visitor request, Hugo builds pages when you create or update your content. Since websites are viewed far more often than they are edited, Hugo is designed to provide an optimal viewing experience for your website's end users and an ideal writing experience for website authors.
Websites built with Hugo are extremely fast and secure. Hugo sites can be hosted anywhere, including [Netlify][], [Heroku][], [GoDaddy][], [DreamHost][], [GitHub Pages][], [Surge][], [Aerobatic][], [Firebase][], [Google Cloud Storage][], [Amazon S3][], [Rackspace][], [Azure][], and [CloudFront][] and work well with CDNs. Hugo sites run without the need for a database or dependencies on expensive runtimes like Ruby, Python, or PHP.
Websites built with Hugo are extremely fast and secure. Hugo sites can be hosted anywhere, including [Netlify][], [Heroku][], [GoDaddy][], [DreamHost][], [GitHub Pages][], [GitLab Pages][], [Surge][], [Aerobatic][], [Firebase][], [Google Cloud Storage][], [Amazon S3][], [Rackspace][], [Azure][], and [CloudFront][] and work well with CDNs. Hugo sites run without the need for a database or dependencies on expensive runtimes like Ruby, Python, or PHP.
We think of Hugo as the ideal website creation tool with nearly instant build times, able to rebuild whenever a change is made.
@ -50,7 +50,7 @@ Hugo is for people building a blog, a company site, a portfolio site, documentat
[DreamHost]: http://www.dreamhost.com/
[Firebase]: https://firebase.google.com/docs/hosting/ "Firebase static hosting"
[GitHub Pages]: https://pages.github.com/
[GitLab]: https://about.gitlab.com
[GitLab Pages]: https://about.gitlab.com/features/pages/
[Go language]: https://golang.org/
[GoDaddy]: https://www.godaddy.com/ "Godaddy.com Hosting"
[Google Cloud Storage]: http://cloud.google.com/storage/

View file

@ -173,7 +173,7 @@ title = "post from custom archetype"
As an example of archetypes in practice, the following is the `functions` archetype from the Hugo docs:
{{< code file="archetypes/functions.md" >}}
{{< readfile file="/themes/gohugoioTheme/archetypes/functions.md" >}}
{{< readfile file="/archetypes/functions.md" >}}
{{< /code >}}
{{% note %}}

View file

@ -103,6 +103,9 @@ There are a few predefined variables that Hugo is aware of. See [Page Variables]
`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].
`isCJKLanguage`
: if `true`, Hugo will explicitly treat the content as a CJK language; both `.Summary` and `.WordCount` work properly in CJK languages.
@ -127,6 +130,9 @@ There are a few predefined variables that Hugo is aware of. See [Page Variables]
`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].
`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.
@ -186,11 +192,13 @@ It's possible to set some options for Markdown rendering in a content's front ma
[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/

View file

@ -0,0 +1,141 @@
---
title: "Image Processing"
description: "Image Page resources can be resized and cropped."
date: 2018-01-24T13:10:00-05:00
lastmod: 2018-01-26T15:59:07-05:00
linktitle: "Image Processing"
categories: ["content management"]
keywords: [bundle,content,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 does not work on images inside your `/static` folder.
To get all images in a [Page Bundle]({{< relref "content-management/organization#page-bundles" >}}):
```html
{{ with .Resources.ByType "image" }}
{{ end }}
```
## Image Processing Methods
The `image` resource implements the methods `Resize`, `Fit` and `Fill`, each returning the transformed image using the specified dimensions and processing options.
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" }}
```
{{% note %}}
Image operations in Hugo currently **do not preserve EXIF data** as this is not supported by Go's [image package](https://github.com/golang/go/search?q=exif&type=Issues&utf8=%E2%9C%93). This will be improved on in the future.
{{% /note %}}
## Image Processing Options
In addition to the dimensions (e.g. `600x400`), Hugo supports a set of additional image options.
JPEG Quality
: Only relevant for JPEG images, values 1 to 100 inclusive, higher is better. Default is 75.
```go
{{ $image.Resize "600x q50" }}
```
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 are `Center`, `TopLeft`, `Top`, `TopRight`, `Left`, `Right`, `BottomLeft`, `Bottom`, `BottomRight`.
```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" }}
```
### 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:
```html
{{</* 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 %}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View file

@ -17,7 +17,7 @@ aliases: [/content/multilingual/,/content-management/multilingual/,/tutorials/cr
toc: true
---
You should define the available languages in a `Languages` section in your site configuration.
You should define the available languages in a `languages` section in your site configuration.
## Configure Languages
@ -30,22 +30,24 @@ copyright = "Everything is mine"
[params.navigation]
help = "Help"
[Languages]
[Languages.en]
[languages]
[languages.en]
title = "My blog"
weight = 1
linkedin = "english-link"
[Languages.fr]
[languages.fr]
copyright = "Tout est à moi"
title = "Mon blog"
weight = 2
linkedin = "lien-francais"
[Languages.fr.navigation]
# skip params key for front matter
[languages.fr.navigation]
help = "Aide"
{{< /code >}}
Anything not defined in a `[Languages]` block will fall back to the global
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).
With the configuration above, all content, sitemap, RSS feeds, paginations,
@ -116,17 +118,17 @@ tag = "tags"
angledQuotes = true
hrefTargetBlank = true
[Languages]
[Languages.en]
[languages]
[languages.en]
weight = 1
title = "English"
[Languages.en.blackfriday]
[languages.en.blackfriday]
angledQuotes = false
[Languages.fr]
[languages.fr]
weight = 2
title = "Français"
[Languages.fr.Taxonomies]
[languages.fr.Taxonomies]
plaque = "plaques"
{{< /code >}}
@ -186,7 +188,7 @@ To create a list of links to translated content, use a template similar to the f
{{ end }}
{{< /code >}}
The above can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template, be it for a [single content page][contenttemplate] or the [homepage][]. It will not print anything if there are no translations for a given page, or if there are translations---in the case of the homepage, section listing, etc.---a site with only render one language.
The above can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template, be it for 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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View file

@ -6,7 +6,7 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [content management,fundamentals]
keywords: [sections,content,organization]
keywords: [sections,content,organization,bundle,resources]
menu:
docs:
parent: "content-management"
@ -17,17 +17,24 @@ aliases: [/content/sections/]
toc: true
---
{{< youtube 0GZxidrlaRM >}}
## Page Bundles
## Content Bundles and Image Processing
Hugo `0.32` announced page-relative images and other resources packaged into `Page Bundles`.
See [This Page](/about/new-in-032/). We will get the relevant parts of the rest of the Hugo docs updated. Eventually.
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.
{{< todo >}}
Remove the above when done.
{{< /todo >}}
{{% imgproc 1-featured Resize "300x" %}}
The illustration shows 3 bundles. Note that the home page bundle cannot contain other content pages, but other files (images etc.) are fine.
{{% /imgproc %}}
{{% note %}}
The bundle docuementation is **work in progress**. We will publish more comprehensive docs about this soon.
{{% /note %}}
# Organization of Content Source
## Organization of Content Source
In Hugo, your content should be organized in a manner that reflects the rendered website.

View file

@ -0,0 +1,182 @@
---
title : "Page Bundles"
description : "Content organization using Page Bundles"
date : 2018-01-24T13:09:00-05:00
lastmod : 2018-01-28T22:26:40-05:00
linktitle : "Page Bundles"
keywords : ["page", "bundle", "leaf", "branch"]
categories : ["content management"]
draft : true
toc : true
menu :
docs:
identifier : "page-bundles"
parent : "content-management"
weight : 11
---
Page Bundles are a way to organize the content files. It's useful for
cases where a page or section's content needs to be split into
multiple content pages for convenience or has associated attachments
like documents or images.
A Page Bundle can be one of two types:
- Leaf Bundle
- Branch Bundle
| | Leaf Bundle | Branch Bundle |
|-----------------|--------------------------------------------------------|---------------------------------------------------------|
| Usage | Collection of content and attachments for single pages | Collection of content and attachments for section pages |
| Index file name | `index.md` [^fn:1] | `_index.md` [^fn:1] |
| Layout type | `single` | `list` |
| Nesting | Doesn't allow nesting of more bundles under it | Allows nesting of leaf/branch bundles under it |
| Example | `content/posts/my-post/index.md` | `content/posts/_index.md` |
## Leaf Bundles {#leaf-bundles}
A _Leaf Bundle_ is a directory at any hierarchy within the `content/`
directory, that contains at least an **`index.md`** file.
{{% note %}}
Here `md` (markdown) is used just as an example. You can use any file
type as a content resource as long as it is a MIME type recognized by
Hugo (`json` files will, as one example, work fine). If you want to
get exotic, you can define your own media type.
{{% /note %}}
### Examples of Leaf Bundle organization {#examples-of-leaf-bundle-organization}
```text
content/
├── about
│ ├── index.md
├── posts
│ ├── my-post
│ │ ├── content1.md
│ │ ├── content2.md
│ │ ├── image1.jpg
│ │ ├── image2.png
│ │ └── index.md
│ └── my-another-post
   └── index.md
└── another-section
├── ..
   └── not-a-leaf-bundle
├── ..
   └── another-leaf-bundle
   └── index.md
```
In the above example `content/` directory, there are four leaf
bundles:
about
: This leaf bundle is at the root level (directly under
`content` directory) and has only the `index.md`.
my-post
: This leaf bundle has the `index.md`, two other content
Markdown files and two image files.
my-another-post
: This leaf bundle has only the `index.md`.
another-leaf-bundle
: This leaf bundle is nested under couple of
directories. This bundle also has only the `index.md`.
{{% note %}}
The hierarchy depth at which a leaf bundle is created does not matter,
as long as it is not inside another **leaf** bundle.
{{% /note %}}
### Headless Bundle {#headless-bundle}
A headless bundle is a bundle that is configured to not get published
anywhere:
- It will have no `Permalink` and no rendered HTML in `public/`.
- It will not be part of `.Site.RegularPages`, etc.
But you can get it by `.Site.GetPage`. Here is an example:
```html
{{ $headless := .Site.GetPage "page" "some-headless-bundle" }}
{{ $reusablePages := $headless.Resources.Match "author*" }}
<h2>Authors</h2>
{{ range $reusablePages }}
<h3>{{ .Title }}</h3>
{{ .Content }}
{{ end }}
```
A leaf bundle can be made headless by adding below in the Front Matter
(in the `index.md`):
```toml
headless = true
```
{{% note %}}
Only leaf bundles can be made headless.
{{% /note %}}
There are many use cases of such headless page bundles:
- Shared media galleries
- Reusable page content "snippets"
## Branch Bundles {#branch-bundles}
A _Branch Bundle_ is any directory at any hierarchy within the
`content/` directory, that contains at least an **`_index.md`** file.
This `_index.md` can also be directly under the `content/` directory.
{{% note %}}
Here `md` (markdown) is used just as an example. You can use any file
type as a content resource as long as it is a MIME type recognized by
Hugo (`json` files will, as one example, work fine). If you want to
get exotic, you can define your own media type.
{{% /note %}}
### Examples of Branch Bundle organization {#examples-of-branch-bundle-organization}
```text
content/
├── branch-bundle-1
│   ├── branch-content1.md
│   ├── branch-content2.md
│   ├── image1.jpg
│   ├── image2.png
│   └── _index.md
└── branch-bundle-2
├── _index.md
└── a-leaf-bundle
└── index.md
```
In the above example `content/` directory, there are two branch
bundles (and a leaf bundle):
`branch-bundle-1`
: This branch bundle has the `_index.md`, two
other content Markdown files and two image files.
`branch-bundle-2`
: This branch bundle has the `_index.md` and a
nested leaf bundle.
{{% note %}}
The hierarchy depth at which a branch bundle is created does not
matter.
{{% /note %}}
[^fn:1]: The `.md` extension is just an example. The extension can be `.html`, `.json` or any of any valid MIME type.

View file

@ -0,0 +1,184 @@
---
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
---
## Properties
ResourceType
: The main type of the resource. For example, a file of MIME type `image/jpg` has for ResourceType `image`.
Name
: Default value is the filename (relative to the owning page). Can be set in front matter.
Title
: Default blank. 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.
## 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
Page Resources' metadata is managed from their page's front matter with an array/table parameter named `resources`. You can batch assign values using a [wildcards](http://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: YAML Example
~~~yaml
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"
~~~
### Resources metadata: TOML Example
~~~toml
title = Application
date : 2018-01-25
[[resources]]
src = "images/sunset.jpg"
name = "header"
[[resources]]
src = "documents/photo_specs.pdf"
title = "Photo Specifications"
[resources.params]
icon = "photo"
[[resources]]
src = "documents/guide.pdf"
title = "Instruction Guide"
[[resources]]
src = "documents/checklist.pdf"
title = "Document Checklist"
[[resources]]
src = "documents/payment.docx"
title = "Proof of Payment"
[[resources]]
src = "**.pdf"
name = "pdf-file-:counter"
[resources.params]
icon = "pdf"
[[resources]]
src = "**.docx"
[resources.params]
icon = "word"
~~~
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`](#counter), 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. For example, in the above example, `.Params.icon` is already 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:
~~~toml
[[resources]]
src = "*specs.pdf"
title = "Specification #:counter"
[[resources]]
src = "**.pdf"
name = "pdf-file-:counter"
~~~
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"` |

View file

@ -240,7 +240,7 @@ If you need to add custom metadata to your taxonomy terms, you will need to crea
---
{{< /code >}}
You can later use your custom metadata as shown in the [Taxonomy Terms Templates documentation](/templates/taxonomy-templates/#displaying-custom-meta-data-in-taxonomy-terms-templates).
You can later use your custom metadata as shown in the [Taxonomy Terms Templates documentation](/templates/taxonomy-templates/#displaying-custom-metadata-in-taxonomy-terms-templates).
[`urlize` template function]: /functions/urlize/
[content section]: /content-management/sections/

View file

@ -46,10 +46,10 @@ Once you have cloned the Hugo repository, you can create a new function via the
hugo new functions/newfunction.md
```
The archetype for `functions` according to the Hugo theme is as follows:
The archetype for `functions` according to the Hugo docs is as follows:
{{< code file="archetypes/functions.md" >}}
{{< readfile file="/themes/gohugoioTheme/archetypes/functions.md">}}
{{< readfile file="/archetypes/functions.md">}}
{{< /code >}}
#### New Function Required Fields

26
content/functions/cond.md Normal file
View file

@ -0,0 +1,26 @@
---
title: "cond"
date: 2017-09-08
description: "Return one of two arguments, depending on the value of a third argument."
categories: [functions]
menu:
docs:
parent: "functions"
signature: ["cond CONTROL VAR1 VAR2"]
aliases: [/functions/cond/]
hugoversion: 0.27
relatedfuncs: [default]
toc: false
draft: false
needsexamples: false
---
`cond` returns *VAR1* if *CONTROL* is true, or *VAR2* if it is not.
Example:
```
{{ cond (eq (len $geese) 1) "goose" "geese" }}
```
Would emit "goose" if the `$geese` array has exactly 1 item, or "geese" otherwise.

View file

@ -24,3 +24,28 @@ Useful for turning strings into numbers.
```
{{ int "123" }} → 123
```
{{% note "Usage Note" %}}
If the input string is supposed to represent a decimal number, and if it has
leading 0's, then those 0's will have to be removed before passing the string
to the `int` function, else that string will be tried to be parsed as an octal
number representation.
The [`strings.TrimLeft` function](/functions/strings.trimleft/) can be used for
this purpose.
```
{{ int ("0987" | strings.TrimLeft "0") }}
{{ int ("00987" | strings.TrimLeft "0") }}
```
**Explanation**
The `int` function eventually calls the `ParseInt` function from the Go library
`strconv`.
From its [documentation](https://golang.org/pkg/strconv/#ParseInt):
> the base is implied by the string's prefix: base 16 for "0x", base 8 for "0",
> and base 10 otherwise.
{{% /note %}}

View file

@ -73,7 +73,6 @@ canonifyURLs: false
config: "config.toml"
contentDir: "content"
dataDir: "data"
defaultExtension: "html"
defaultLayout: "post"
# Missing translations will default to this content language
defaultContentLanguage: "en"
@ -216,7 +215,6 @@ canonifyURLs = false
config = "config.toml"
contentDir = "content"
dataDir = "data"
defaultExtension = "html"
defaultLayout = "post"
# Missing translations will default to this content language
defaultContentLanguage = "en"

View file

@ -4,7 +4,7 @@ linktitle: Install Hugo
description: Install Hugo on macOS, Windows, Linux, FreeBSD, and on any machine where the Go compiler tool chain can run.
date: 2016-11-01
publishdate: 2016-11-01
lastmod: 2017-02-20
lastmod: 2018-01-02
categories: [getting started,fundamentals]
authors: ["Michael Henderson"]
keywords: [install,pc,windows,linux,macos,binary,tarball]
@ -453,7 +453,15 @@ You can also install Hugo from the Arch Linux [community](https://www.archlinux.
sudo pacman -Sy hugo
```
### Fedora, CentOS, and Red Hat
### Fedora
Fedora provides a package for Hugo. The installation is done with the command :
```
sudo dnf install hugo
```
### CentOS, and Red Hat
* <https://copr.fedorainfracloud.org/coprs/daftaupe/hugo/>

View file

@ -115,8 +115,8 @@ Do this by adding a custom install script at the root of your project that will
if [[ ! -f /data/bin/hugo ]]; then
cd /tmp
wget https://github.com/gohugoio/hugo/releases/download/v0.25.1/hugo_0.25.1_Linux-64bit.tar.gz
tar -xzf hugo_0.25.1_Linux-64bit.tar.gz
wget https://github.com/gohugoio/hugo/releases/download/v0.31.1/hugo_0.31.1_Linux-64bit.tar.gz
tar -xzf hugo_0.31.1_Linux-64bit.tar.gz
mv hugo /data/bin/hugo
cd -
rm -rf /tmp/*
@ -127,6 +127,9 @@ fi
{{% note %}}
If the install script fails during `nanobox run` you may need to make it executable with `chmod +x install.sh`
{{% /note %}}
{{% note %}}
Make sure to check the version of Hugo you have installed and update the install script to match.
{{% /note %}}
### Generating a New Hugo App

View file

@ -27,13 +27,84 @@ GitHub provides free and fast static hosting over SSL for personal, organization
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][].
If you are working within an Organization account or want to set up a User website on GitHub and would like more information, refer to the [GitHub Pages documentation][ghorgs].
## Types of GitHub Pages
There are 2 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.
To create a User/Organization Pages site, follow the single method in the *GitHub User and Organization Pages* section below.
To create a Project Pages site, choose a method from the *Project Pages* section below.
## GitHub User or Organization Pages
As mentioned [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 `master` 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.
### Step-by-step Instructions
1. Create a `<YOUR-PROJECT>` (e.g. `blog`) repository on GitHub. This repository will contain Hugo's content and other source files.
2. Create a `<USERNAME>.github.io` GitHub repository. This is the repository that will contain the fully rendered version of your Hugo website.
3. `git clone <YOUR-PROJECT-URL> && cd <YOUR-PROJECT>`
4. Make your website work locally (`hugo server` or `hugo server -t <YOURTHEME>`) and open your browser to <http://localhost:1313>.
5. Once you are happy with the results:
* Press <kbd>Ctrl</kbd>+<kbd>C</kbd> to kill the server
* `rm -rf public` to completely remove the `public` directory
6. `git submodule add -b master git@github.com:<USERNAME>/<USERNAME>.github.io.git public`. This creates a git [submodule][]. Now when you run the `hugo` command to build your site to `public`, the created `public` directory will have a different remote origin (i.e. hosted GitHub repository). You can automate some of these steps with the following script.
### Put it Into a Script
You're almost done. You can also add a `deploy.sh` script to automate the preceding steps for you. You can also make it executable with `chmod +x deploy.sh`.
The following are the contents of the `deploy.sh` script:
```
#!/bin/bash
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
# Build the project.
hugo # if using a theme, replace with `hugo -t <YOURTHEME>`
# Go To Public folder
cd public
# Add changes to git.
git add .
# Commit changes.
msg="rebuilding site `date`"
if [ $# -eq 1 ]
then msg="$1"
fi
git commit -m "$msg"
# Push source and build repos.
git push origin master
# Come Back up to the Project Root
cd ..
```
You can then run `./deploy.sh "Your optional commit message"` to send changes to `<USERNAME>.github.io`. Note that you likely will want to commit changes to your `<YOUR-PROJECT>` repository as well.
That's it! Your personal page should be up and running at `https://<USERNAME>.github.io` within a couple minutes.
## GitHub Project Pages
{{% note %}}
Make sure your `baseURL` key-value in your [site configuration](/getting-started/configuration/) reflects the full URL of your GitHub pages repository if you're using the default GH Pages URL (e.g., `username.github.io/myprojectname/`) and not a custom domain.
Make sure your `baseURL` key-value in your [site configuration](/getting-started/configuration/) reflects the full URL of your GitHub pages repository if you're using the default GH Pages URL (e.g., `<USERNAME>.github.io/<PROJECT>/`) and not a custom domain.
{{% /note %}}
## Deployment via `/docs` Folder on Master Branch
### Deployment of Project Pages from `/docs` folder on `master` branch
[As described in the GitHub Pages documentation][ghpfromdocs], you can deploy from a folder called `docs/` on your master branch. To effectively use this feature with Hugo, you need to change the Hugo publish directory in your [site's][config] `config.toml` and `config.yaml`, respectively:
@ -53,18 +124,18 @@ After running `hugo`, push your master branch to the remote repository and choos
The `docs/` option is the simplest approach but requires you set a publish directory in your site configuration. You cannot currently configure GitHub pages to publish from another directory on master, and not everyone prefers the output site live concomitantly with source files in version control.
{{% /note %}}
## Deployment From Your `gh-pages` Branch
### Deployment of Project Pages From Your `gh-pages` branch
You can also tell GitHub pages to treat your `master` branch as the published site or point to a separate `gh-pages` branch. The latter approach is a bit more complex but has some advantages:
* It keeps your source and generated website in different branches and therefore maintains version control history for both.
* Unlike the preceding `docs/` option, it uses the default `public` folder.
### Preparations for `gh-pages` Branch
#### Preparations for `gh-pages` Branch
These steps only need to be done once. Replace `upstream` with the name of your remote; e.g., `origin`:
#### Add the Public Folder
##### Add the `public` Folder
First, add the `public` folder to your `.gitignore` file at the project root so that the directory is ignored on the master branch:
@ -72,7 +143,7 @@ First, add the `public` folder to your `.gitignore` file at the project root so
echo "public" >> .gitignore
```
#### Initialize Your `gh-pages` Branch
##### Initialize Your `gh-pages` Branch
You can now initialize your `gh-pages` branch as an empty [orphan branch][]:
@ -84,7 +155,7 @@ git push upstream gh-pages
git checkout master
```
### Build and Deployment
#### Build and Deployment
Now check out the `gh-pages` branch into your `public` folder using git's [worktree feature][]. Essentially, the worktree allows you to have multiple branches of the same local repository to be checked out in different directories:
@ -106,7 +177,7 @@ If the changes in your local `gh-pages` branch look alright, push them to the re
git push upstream gh-pages
```
#### Set `gh-pages` as Your Publish Branch
##### Set `gh-pages` as Your Publish Branch
In order to use your `gh-pages` branch as your publishing branch, you'll need to configure the repository within the GitHub UI. This will likely happen automatically once GitHub realizes you've created this branch. You can also set the branch manually from within your GitHub project:
@ -115,7 +186,7 @@ In order to use your `gh-pages` branch as your publishing branch, you'll need to
After a short while, you'll see the updated contents on your GitHub Pages site.
### Put it Into a Script
#### Put it Into a Script
To automate these steps, you can create a script with the following contents:
@ -153,7 +224,7 @@ cd public && git add --all && git commit -m "Publishing to gh-pages (publish.sh)
This will abort if there are pending changes in the working directory and also makes sure that all previously existing output files are removed. Adjust the script to taste, e.g. to include the final push to the remote repository if you don't need to take a look at the gh-pages branch before pushing. Or adding `echo yourdomainname.com >> CNAME` if you set up for your gh-pages to use customize domain.
## Deployment From Your `master` Branch
### Deployment of Project Pages from Your `master` Branch
To use `master` as your publishing branch, you'll need your rendered website to live at the root of the GitHub repository. Steps should be similar to that of the `gh-pages` branch, with the exception that you will create your GitHub repository with the `public` directory as the root. Note that this does not provide the same benefits of the `gh-pages` branch in keeping your source and output in separate, but version controlled, branches within the same repo.
@ -162,64 +233,6 @@ You will also need to set `master` as your publishable branch from within the Gi
1. Go to **Settings** &rarr; **GitHub Pages**
2. From **Source**, select "master branch" and then **Save**.
## Host GitHub User or Organization Pages
As mentioned [in this GitHub Help article](https://help.github.com/articles/user-organization-and-project-pages/), 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 the `<USERNAME>.github.io` naming scheme for your GitHub repo.
2. Content from the `master` branch will be used to publish your GitHub Pages site.
It becomes much simpler in this case: we'll create two separate repos, one for Hugo's content, and a git submodule with the `public` folder's content in it.
### Step-by-step Instructions
1. Create a `<YOUR-PROJECT>` git repository on GitHub. This repository will contain Hugo's content and other source files.
2. Create a `<USERNAME>.github.io` GitHub repository. This is the repository that will contain the fully rendered version of your Hugo website.
3. `git clone <YOUR-PROJECT-URL> && cd <YOUR-PROJECT>`
4. Make your website work locally (`hugo server` or `hugo server -t <YOURTHEME>`) and open your browser to <http://localhost:1313>.
5. Once you are happy with the results:
* Press <kbd>Ctrl</kbd>+<kbd>C</kbd> to kill the server
* `rm -rf public` to completely remove the `public` directory if there
6. `git submodule add -b master git@github.com:<USERNAME>/<USERNAME>.github.io.git public`. This creates a git [submodule][]. Now when you run the `hugo` command to build your site to `public`, the created `public` directory will have a different remote origin (i.e. hosted GitHub repository). You can automate some of these steps with the following script.
#### Put it Into a Script
You're almost done. You can also add a `deploy.sh` script to automate the preceding steps for you. You can also make it executable with `chmod +x deploy.sh`.
The following are the contents of the `deploy.sh` script:
```
#!/bin/bash
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
# Build the project.
hugo # if using a theme, replace with `hugo -t <YOURTHEME>`
# Go To Public folder
cd public
# Add changes to git.
git add .
# Commit changes.
msg="rebuilding site `date`"
if [ $# -eq 1 ]
then msg="$1"
fi
git commit -m "$msg"
# Push source and build repos.
git push origin master
# Come Back up to the Project Root
cd ..
```
You can then run `./deploy.sh "Your optional commit message"` to send changes to `<USERNAME>.github.io`. Note that you likely will want to commit changes to your `<YOUR-PROJECT>` repository as well.
That's it! Your personal page should be up and running at `https://yourusername.github.io` within a couple minutes.
## 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 requirements of GitHub Pages.

View file

@ -145,7 +145,7 @@ You now have a live website served over https, distributed through CDN, and conf
[ghsm]: https://github.com/blog/2104-working-with-submodules
[gitsm]: https://git-scm.com/book/en/v2/Git-Tools-Submodules
[httpscustom]: https://www.netlify.com/docs/ssl/
[hugoversions]: https://github.com/netlify/build-image/blob/master/Dockerfile#L166
[hugoversions]: https://github.com/netlify/build-image/blob/master/Dockerfile#L216
[installthemes]: /themes/installing/
[netlify]: https://www.netlify.com/
[netlifysignup]: https://app.netlify.com/signup

View file

@ -0,0 +1,80 @@
---
date: 2018-01-18
title: "Hugo 0.33: The New Kinder Surprise!"
description: "Hugo 0.33 comes with resource (images etc.) metadata, `type` and `layout` for all page types, `url` in front matter for list pages …"
slug: "0.33-relnotes"
categories: ["Releases"]
images:
- images/blog/hugo-33-poster.png
---
Hugo `0.33` is the first main Hugo release of the new year, and it is safe to say that [@bep](https://github.com/bep) has turned off his lazy Christmas mode :smiley:
This is a full makeover of the layout selection logic with full custom `layout` and `type` support (many have asked for this). Also, Hugo now respects the `url` value in front matter for all page types, including sections. Also, you can now configure `uglyURLs` per section.
But this release is also a follow-up to the `0.32` release which was all about bundles with resources and powerful image processing. With this release it is now simple to add metadata to your images and other bundle resources.
[@bep](https://github.com/bep) has added a section with examples of both `resources` configuration in both `YAML` and `TOML` front matter in his [test site](http://hugotest.bep.is/resourcemeta/). The example below shows a sample of how it would look like in `YAML`:
```yaml
date: 2017-01-17
title: My Bundle With YAML Resource Metadata
resources:
- src: "image-4.png"
title: "The Fourth Image"
- src: "*.png"
name: "my-cool-image-:counter"
title: "The Image #:counter"
params:
byline: "bep"
```
This release represents **41 contributions by 3 contributors** to the main Hugo code base.
Hugo now has:
* 22553+ [stars](https://github.com/gohugoio/hugo/stargazers)
* 448+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
* 197+ [themes](http://themes.gohugo.io/)
## Notes
* We have re-implemented and unified the template layout lookup logic. This has made it more powerful and much simpler to understand. We don't expect any sites to break because of this. We have tested lots of Hugo sites, including the 200 [themes](http://themes.gohugo.io/).
* The `indexes` type is removed from template lookup. It's not in the documentation, and is a legacy term inherited from very old Hugo versions.
* If you have sub-dirs in your shiny new bundles (e.g. `my-bundle/images`) and use the `*Prefix*` methods to find them, we have made an unintended change that affects you. See [this issue](https://github.com/gohugoio/hugo/issues/4295).
## Enhancements
### Templates
* Respect `Type` and `Layout` for list template selection [51dd462c](https://github.com/gohugoio/hugo/commit/51dd462c3958f7cf032b06503f1f200a6aceebb9) [@bep](https://github.com/bep) [#3005](https://github.com/gohugoio/hugo/issues/3005)[#3245](https://github.com/gohugoio/hugo/issues/3245)
### Core
* Allow `url` in front matter for list type pages [8a409894](https://github.com/gohugoio/hugo/commit/8a409894bdb0972e152a2eccc47a2738568e1cfc) [@bep](https://github.com/bep) [#4263](https://github.com/gohugoio/hugo/issues/4263)
* Improve `.Site.GetPage` for regular translated pages. Before this change it was not possible to say "get me the current language edition of the given content page if possible." Now you can do that by doing a lookup without any extensions: `.Site.GetPage "page" "post/mypost"` [9409bc0f](https://github.com/gohugoio/hugo/commit/9409bc0f799a8057836a14ccdf2833a55902175e) [@bep](https://github.com/bep) [#4285](https://github.com/gohugoio/hugo/issues/4285)
* Add front matter metadata to `Resource` [20c9b6ec](https://github.com/gohugoio/hugo/commit/20c9b6ec81171d1c586ea31d5d08b40b0edaffc6) [@bep](https://github.com/bep) [#4244](https://github.com/gohugoio/hugo/issues/4244)
* Implement `Resources.ByPrefix` [46db900d](https://github.com/gohugoio/hugo/commit/46db900dab9c0e6fcd9d227f10a32fb24f5c8bd9) [@bep](https://github.com/bep) [#4266](https://github.com/gohugoio/hugo/issues/4266)
* Make `GetByPrefix` work for Page resources [60c9f3b1](https://github.com/gohugoio/hugo/commit/60c9f3b1c34b69771e25a66906f150f460d73223) [@bep](https://github.com/bep) [#4264](https://github.com/gohugoio/hugo/issues/4264)
* Make `Resources.GetByPrefix` case insensitive [db85e834](https://github.com/gohugoio/hugo/commit/db85e83403913cff4b8737b138932b28e5bf6160) [@bep](https://github.com/bep) [#4258](https://github.com/gohugoio/hugo/issues/4258)
* Update `Chroma` and other third-party deps [64f0e9d1](https://github.com/gohugoio/hugo/commit/64f0e9d1c1d4ff2249fd9cf9749e70485002b36d) [@bep](https://github.com/bep) [#4267](https://github.com/gohugoio/hugo/issues/4267)
* Remove superflous `BuildDate` logic [13d53b31](https://github.com/gohugoio/hugo/commit/13d53b31f19240879122d6b7e4aaeb60b5130a3c) [@bep](https://github.com/bep) [#4272](https://github.com/gohugoio/hugo/issues/4272)
* Run benchmarks 3 times [b6ea6d07](https://github.com/gohugoio/hugo/commit/b6ea6d07d0b072d850fb066c78976acd6c2f5e81) [@bep](https://github.com/bep)
* Support `uglyURLs` per section [57e10f17](https://github.com/gohugoio/hugo/commit/57e10f174e51cc5e1cf5f37eed30a0f3b153dd64) [@bep](https://github.com/bep) [#4256](https://github.com/gohugoio/hugo/issues/4256)
* Update CONTRIBUTING.md [1046e936](https://github.com/gohugoio/hugo/commit/1046e9363f2e382fd0b4aac838735ae4cbbebe5a) [@vassudanagunta](https://github.com/vassudanagunta)
* Support offline builds [d5803da1](https://github.com/gohugoio/hugo/commit/d5803da1befba5446d1b2c1ad16f6467dc7b3991) [@vassudanagunta](https://github.com/vassudanagunta)
## Fixes
* Fix handling of mixed-case taxonomy folders with content file [2d3189b2](https://github.com/gohugoio/hugo/commit/2d3189b22760e0a8995dae082a6bc5480f770bfe) [@bep](https://github.com/bep) [#4238](https://github.com/gohugoio/hugo/issues/4238)
* Fix handling of very long image file names [ecaf1451](https://github.com/gohugoio/hugo/commit/ecaf14514e06321823bdd10235cf23e7d654ba77) [@bep](https://github.com/bep) [#4261](https://github.com/gohugoio/hugo/issues/4261)
* Update `Afero` to avoid panic on "file name is too long" [f8a119b6](https://github.com/gohugoio/hugo/commit/f8a119b606d55aa4f31f16e5a3cadc929c99e4f8) [@bep](https://github.com/bep) [#4240](https://github.com/gohugoio/hugo/issues/4240)
* And now really fix the server watch logic [d4f8f88e](https://github.com/gohugoio/hugo/commit/d4f8f88e67f958b8010f90cb9b9854114e52dac2) [@bep](https://github.com/bep) [#4275](https://github.com/gohugoio/hugo/issues/4275)
* Fix server without watch [4e524ffc](https://github.com/gohugoio/hugo/commit/4e524ffcfff48c017717e261c6067416aa56410f) [@bep](https://github.com/bep) [#4275](https://github.com/gohugoio/hugo/issues/4275)

View file

@ -0,0 +1,53 @@
---
date: 2018-01-22
title: "Hugo 0.34: Pattern matching to filter images and other resources"
description: "Hugo 0.34 adds full glob with super-asterisk support, for example `*.jpg`."
slug: "0.34-relnotes"
categories: ["Releases"]
images:
- images/blog/hugo-34-poster.png
---
Hugo `0.34` is a small release. It contains a few smaller bug-fixes, but more important is an overhaul of the API used to find images and other resources in your page bundles.
We have added two simple methods on the `Resources` object:
* `.Match` finds every resource matching a pattern. Examples: `.Match "images/*.jpg"` finds every JPEG image in `images` and `.Match "**.jpg"` finds every JPEG image in the bundle.
* `.GetMatch` finds the first resource matching the pattern given.
**Note: The path separators used are Unix-style forward slashes, even on Windows.**
It uses [standard wildcard syntax](http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm) with the addition of the `**`, aka super-asterisk, which matches across path boundaries.
Thanks to [@gobwas](https://github.com/gobwas/glob) for a fast and easy-to-use Glob library.
This release represents **5 contributions by 1 contributors** to the main Hugo code base.
Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs),
which has received **25 contributions by 16 contributors**. A special thanks to [@bep](https://github.com/bep), [@rmetzler](https://github.com/rmetzler), [@chris-rudmin](https://github.com/chris-rudmin), and [@stkevintan](https://github.com/stkevintan) for their work on the documentation site.
Hugo now has:
* 22689+ [stars](https://github.com/gohugoio/hugo/stargazers)
* 448+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
* 197+ [themes](http://themes.gohugo.io/)
## Notes
* `Resources.GetByPrefix` and `Resources.ByPrefix` are depracated. They still work, but will eventually be removed. Use `Resources.Match` (many) and `Resources.GetMatch` (one).
* When filtering bundles pages in sub-folders, you need to include the sub-folder when matching. This was a bug introduced in `0.33` and gets it in line with images and other resources.
## Enhancements
* Add `Resources.Match` and `Resources.GetMatch` [94213801](https://github.com/gohugoio/hugo/commit/9421380168f66620cb73203e1267814b3086d805) [@bep](https://github.com/bep) [#4301](https://github.com/gohugoio/hugo/issues/4301)
## Fixes
* Add validation for `defaultContentLanguage` [4d5e4f37](https://github.com/gohugoio/hugo/commit/4d5e4f379a890a3c6cbc11ddb40d77a90f14c015) [@bep](https://github.com/bep) [#4298](https://github.com/gohugoio/hugo/issues/4298)
* Fix lookup of pages bundled in sub-folders in `ByPrefix` etc. [5d030869](https://github.com/gohugoio/hugo/commit/5d03086981b4a7d4bc450269a6a2e0fd22dbeed7) [@bep](https://github.com/bep) [#4295](https://github.com/gohugoio/hugo/issues/4295)

View file

@ -28,12 +28,7 @@ The homepage template is the *only* required template for building a site and th
## Homepage Template Lookup Order
The [lookup order][lookup] for the homepage template is as follows:
1. `/layouts/index.html`
2. `/layouts/_default/list.html`
3. `/themes/<THEME>/layouts/index.html`
4. `/themes/<THEME>/layouts/_default/list.html`
See [Template Lookup](/templates/lookup-order/).
## Add Content and Front Matter to the Homepage

View file

@ -31,6 +31,8 @@ Hugo uses the term *list* in its truest sense; i.e. a sequential arrangement of
* [Section list pages][sectiontemps]
* [RSS][rss]
For template lookup order, see [Template Lookup](/templates/lookup-order/).
The idea of a list page comes from the [hierarchical mental model of the web][mentalmodel] and is best demonstrated visually:
![Image demonstrating a hierarchical website sitemap.](/images/site-hierarchy.svg)

View file

@ -1,13 +1,13 @@
---
title: Hugo's Lookup Order
linktitle: Template Lookup Order
description: The lookup order is a prioritized list used by Hugo as it traverses your files looking for the appropriate corresponding file to render your content.
description: Hugo searches for the layout to use for a given page in a well defined order, starting from the most specific.
godocref:
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-05-25
categories: [templates,fundamentals]
keywords: [lookup]
keywords: [templates]
menu:
docs:
parent: "templates"
@ -20,172 +20,73 @@ aliases: [/templates/lookup/]
toc: true
---
Before creating your templates, it's important to know how Hugo looks for files within your project's [directory structure][].
## Hugo Layouts Lookup Rules
Hugo uses a prioritized list called the **lookup order** as it traverses your `layouts` folder in your Hugo project *looking* for the appropriate template to render your content.
Hugo takes the parameters listed below into consideration when choosing a layout for a given page. They are listed in a priority order. This should feel natural, but look at the table below for concrete examples of the different parameter variations.
The template lookup order is an inverted cascade: if template A isnt present or specified, Hugo will look to template B. If template B isn't present or specified, Hugo will look for template C...and so on until it reaches the `_default/` directory for your project or theme. In many ways, the lookup order is similar to the programming concept of a [switch statement without fallthrough][switch].
The power of the lookup order is that it enables you to craft specific layouts and keep your templating [DRY][].
Kind
: The page `Kind` (the home page is one). See the example tables below per kind. This also determines if it is a **single page** (i.e. a regular content page. We then look for a template in `_default/single.html` for HTML) or a **list page** (section listings, home page, taxonomy lists, taxonomy terms. We then look for a template in `_default/list.html` for HTML).
Output Format
: See [Custom Output Formats](/templates/output-formats). An output format has both a `name` (e.g. `rss`, `amp`, `html`) and a `suffix` (e.g. `xml`, `html`). We prefer matches with both (e.g. `index.amp.html`, but look for less specific templates.
Language
: We will consider a language code in the template name. If the site language is `fr`, `index.fr.amp.html` will win over `index.amp.html`, but we will `index.amp.html` will be chosen before `index.fr.html`.
Layout
: Can be set in page front matter.
Type
: Is value of `type` if set in front matter, else it is the name of the root section (e.g. "blog"). If will always have a value, so if not set, the value is "page".
Section
: Is relevant for `section`, `taxonomy` and `taxonomyTerm` types.
{{% note %}}
Most Hugo websites will only need the default template files at the end of the lookup order (i.e. `_default/*.html`).
{{% /note %}}
## Lookup Orders
The respective lookup order for each of Hugo's templates has been defined throughout the Hugo docs:
* [Homepage Template][home]
* [Base Templates][base]
* [Section Page Templates][sectionlookup]
* [Taxonomy List Templates][taxonomylookup]
* [Taxonomy Terms Templates][termslookup]
* [Single Page Templates][singlelookup]
* [RSS Templates][rsslookup]
* [Shortcode Templates][sclookup]
## Template Lookup Examples
The lookup order is best illustrated through examples. The following shows you the process Hugo uses for finding the appropriate template to render your [single page templates][], but the concept holds true for all templates in Hugo.
1. The project is using the theme `mytheme` (specified in the project's [configuration][config]).
2. The layouts and content directories for the project are as follows:
**Tip:** The examples below looks long and complex. That is the flexibility talking. Most Hugo sites contain just a handful of templates:
```bash
├── _default
│   ├── baseof.html
│   ├── list.html
│   └── single.html
└── index.html
```
.
├── content
│ ├── events
│ │ ├── _index.md
│ │ └── my-first-event.md
│ └── posts
│ ├── my-first-post.md
│ └── my-second-post.md
├── layouts
│ ├── _default
│ │ └── single.html
│ ├── posts
│ │ └── single.html
│ └── reviews
│ └── reviewarticle.html
└── themes
└── mytheme
└── layouts
├── _default
│ ├── list.html
│ └── single.html
└── posts
├── list.html
└── single.html
```
Now we can look at the front matter for the three content (i.e.`.md`) files.
{{% note %}}
Only three of the four markdown files in the above project are subject to the *single* page lookup order. `_index.md` is a specific `kind` in Hugo. Whereas `my-first-post.md`, `my-second-post.md`, and `my-first-event.md` are all of kind `page`, all `_index.md` files in a Hugo project are used to add content and front matter to [list pages](/templates/lists/). In this example, `events/_index.md` will render according to its [section template](/templates/section-templates/) and respective lookup order.
{{% /note %}}
### Example: `my-first-post.md`
{{< code file="content/posts/my-first-post.md" copy="false" >}}
---
title: My First Post
date: 2017-02-19
description: This is my first post.
---
{{< /code >}}
## Hugo Layouts Lookup Rules With Theme
In Hugo, layouts can live in either the project's or theme's layout folder, and the most specific layout will be chosen. Hugo will interleave the lookups:
1. layouts/page/index.html
2. demoTheme/layouts/page/index.html
3. layouts/...
This way it is possible to override specific templates from the theme.
## Examples: Layout Lookup for Regular Pages
{{< datatable-filtered "output" "layouts" "Kind == page" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
## Examples: Layout Lookup for Home Page
{{< datatable-filtered "output" "layouts" "Kind == home" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
## Examples: Layout Lookup for Section Pages
{{< datatable-filtered "output" "layouts" "Kind == section" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
## Examples: Layout Lookup for Taxonomy List Pages
{{< datatable-filtered "output" "layouts" "Kind == taxonomy" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
## Examples: Layout Lookup for Taxonomy Terms Pages
{{< datatable-filtered "output" "layouts" "Kind == taxonomyTerm" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
When building your site, Hugo will go through the lookup order until it finds what it needs for `my-first-post.md`:
1. ~~`/layouts/UNSPECIFIED/UNSPECIFIED.html`~~
2. ~~`/layouts/posts/UNSPECIFIED.html`~~
3. ~~`/layouts/UNSPECIFIED/single.html`~~
4. <span class="yes">`/layouts/posts/single.html`</span>
<br><span class="break">BREAK</span>
5. <span class="na">`/layouts/_default/single.html`</span>
6. <span class="na">`/themes/<THEME>/layouts/UNSPECIFIED/UNSPECIFIED.html`</span>
7. <span class="na">`/themes/<THEME>/layouts/posts/UNSPECIFIED.html`</span>
8. <span class="na">`/themes/<THEME>/layouts/UNSPECIFIED/single.html`</span>
9. <span class="na">`/themes/<THEME>/layouts/posts/single.html`</span>
10. <span class="na">`/themes/<THEME>/layouts/_default/single.html`</span>
Notice the term `UNSPECIFIED` rather than `UNDEFINED`. If you don't tell Hugo the specific type and layout, it makes assumptions based on sane defaults. `my-first-post.md` does not specify a content `type` in its front matter. Therefore, Hugo assumes the content `type` and `section` (i.e. `posts`, which is defined by file location) are one in the same. ([Read more on sections][sections].)
`my-first-post.md` also does not specify a `layout` in its front matter. Therefore, Hugo assumes that `my-first-post.md`, which is of type `page` and a *single* piece of content, should default to the next occurrence of a `single.html` template in the lookup (#4).
### Example: `my-second-post.md`
{{< code file="content/posts/my-second-post.md" copy="false" >}}
---
title: My Second Post
date: 2017-02-21
description: This is my second post.
type: review
layout: reviewarticle
---
{{< /code >}}
Here is the way Hugo traverses the single-page lookup order for `my-second-post.md`:
1. <span class="yes">`/layouts/review/reviewarticle.html`</span>
<br><span class="break">BREAK</span>
2. <span class="na">`/layouts/posts/reviewarticle.html`</span>
3. <span class="na">`/layouts/review/single.html`</span>
4. <span class="na">`/layouts/posts/single.html`</span>
5. <span class="na">`/layouts/_default/single.html`</span>
6. <span class="na">`/themes/<THEME>/layouts/review/reviewarticle.html`</span>
7. <span class="na">`/themes/<THEME>/layouts/posts/reviewarticle.html`</span>
8. <span class="na">`/themes/<THEME>/layouts/review/single.html`</span>
9. <span class="na">`/themes/<THEME>/layouts/posts/single.html`</span>
10. <span class="na">`/themes/<THEME>/layouts/_default/single.html`</span>
The front matter in `my-second-post.md` specifies the content `type` (i.e. `review`) as well as the `layout` (i.e. `reviewarticle`). Hugo finds the layout it needs at the top level of the lookup (#1) and does not continue to search through the other templates.
{{% note "Type and not Types" %}}
Notice that the directory for the template for `my-second-post.md` is `review` and not `reviews`. This is because *type is always singular when defined in front matter*.
{{% /note%}}
### Example: `my-first-event.md`
{{< code file="content/events/my-first-event.md" copy="false" >}}
---
title: My First
date: 2017-02-21
description: This is an upcoming event..
---
{{< /code >}}
Here is the way Hugo traverses the single-page lookup order for `my-first-event.md`:
1. ~~`/layouts/UNSPECIFIED/UNSPECIFIED.html`~~
2. ~~`/layouts/events/UNSPECIFIED.html`~~
3. ~~`/layouts/UNSPECIFIED/single.html`~~
4. ~~`/layouts/events/single.html`~~
5. <span class="yes">`/layouts/_default/single.html`</span>
<br><span class="break">BREAK</span>
6. <span class="na">`/themes/<THEME>/layouts/UNSPECIFIED/UNSPECIFIED.html`</span>
7. <span class="na">`/themes/<THEME>/layouts/events/UNSPECIFIED.html`</span>
8. <span class="na">`/themes/<THEME>/layouts/UNSPECIFIED/single.html`</span>
9. <span class="na">`/themes/<THEME>/layouts/events/single.html`</span>
10. <span class="na">`/themes/<THEME>/layouts/_default/single.html`</span>
{{% note %}}
`my-first-event.md` is significant because it demonstrates the role of the lookup order in Hugo themes. Both the root project directory *and* the `mytheme` themes directory have a file at `_default/single.html`. Understanding this order allows you to [customize Hugo themes](/themes/customizing/) by creating template files with identical names in your project directory that step in front of theme template files in the lookup. This allows you to customize the look and feel of your website while maintaining compatibility with the theme's upstream.
{{% /note %}}
[base]: /templates/base/#base-template-lookup-order
[config]: /getting-started/configuration/
[directory structure]: /getting-started/directory-structure/
[DRY]: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself
[home]: /templates/homepage/#homepage-template-lookup-order
[rsslookup]: /templates/rss/#rss-template-lookup-order
[sclookup]: /templates/shortcode-templates/#shortcode-template-lookup-order
[sections]: /content-management/sections/
[sectionlookup]: /templates/section-templates/#section-template-lookup-order
[single page templates]: /templates/single-page-templates/
[singlelookup]: /templates/single-page-templates/#single-page-template-lookup-order
[switch]: https://en.wikipedia.org/wiki/Switch_statement#Fallthrough
[taxonomylookup]: /templates/taxonomy-templates/#taxonomy-list-template-lookup-order
[termslookup]: /templates/taxonomy-templates/#taxonomy-terms-template-lookup-order

View file

@ -9,6 +9,7 @@ categories: [templates]
keywords: [lists,sections,menus]
menu:
docs:
title: "how to use menus in templates"
parent: "templates"
weight: 130
weight: 130
@ -27,40 +28,35 @@ The following is an example:
{{< code file="layouts/partials/sidebar.html" download="sidebar.html" >}}
<!-- sidebar start -->
<aside>
<div id="sidebar" class="nav-collapse">
<!-- sidebar menu start-->
<ul class="sidebar-menu">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<li class="sub-menu{{if $currentPage.HasMenuCurrent "main" . }} active{{end}}">
<a href="javascript:;" class="">
{{ .Pre }}
<span>{{ .Name }}</span>
<span class="menu-arrow arrow_carrot-right"></span>
</a>
<ul class="sub">
{{ range .Children }}
<li{{if $currentPage.IsMenuCurrent "main" . }} class="active"{{end}}><a href="{{.URL}}"> {{ .Name }} </a> </li>
{{ end }}
</ul>
{{else}}
<li>
<a href="{{.URL}}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
{{end}}
</li>
{{end}}
<li> <a href="https://github.com/gohugoio/hugo/issues" target="blank">Questions and Issues</a> </li>
<li> <a href="#" target="blank">Edit this Page</a> </li>
</ul>
<!-- sidebar menu end-->
</div>
<ul>
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<li class="{{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}">
<a href="#">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
<ul class="sub-menu">
{{ range .Children }}
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
<a href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
</ul>
{{else}}
<li>
<a href="{{.URL}}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
{{end}}
{{end}}
<li>
<a href="#" target="blank">Hardcoded Link 1</a>
<li>
<a href="#" target="blank">Hardcoded Link 2</a>
</ul>
</aside>
<!--sidebar end-->
{{< /code >}}
{{% note "`absLangURL` and `relLangURL`" %}}
@ -83,18 +79,22 @@ This will create a menu with all the sections as menu items and all the sections
<nav class="sidebar-nav">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
<a class="sidebar-nav-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{.URL}}">{{ .Name }}</a>
<a class="sidebar-nav-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a>
{{ end }}
</nav>
```
In the above, the menu item is marked as active if on the current section's list page or on a page in that section.
The above is all that's needed. But if you want custom menu items, e.g. changing weight or name, you can define them manually in the site config, i.e. `config.toml`:
## Site Config menus
The above is all that's needed. But if you want custom menu items, e.g. changing weight, name, or link title attribute, you can define them manually in the site config, i.e. `config.toml`:
```
[[menu.main]]
name = "This is the blog section"
title = "blog section"
weight = -110
identifier = "blog"
url = "/blog/"
@ -103,3 +103,55 @@ The above is all that's needed. But if you want custom menu items, e.g. changing
{{% note %}}
The `identifier` *must* match the section name.
{{% /note %}}
## Menu Entries from the Page's front matter
It's also possible to create menu entries from the page (i.e. the `.md`-file).
Here is a `yaml` example:
```
---
title: Menu Templates
linktitle: Menu Templates
menu:
docs:
title: "how to use menus in templates"
parent: "templates"
weight: 130
---
...
```
{{% note %}}
You can define more than one menu. It also doesn't have to be a complex value,
`menu` can also be a string, an array of strings, or an array of complex values
like in the example above.
{{% /note %}}
### Using .Page in Menus
If you use the front matter method of defining menu entries, you'll get access to the `.Page` variable.
This allows to use every variable that's reachable from the [page variable](/variables/page/).
This variable is only set when the menu entry is defined in the page's front matter.
Menu entries from the site config don't know anything about `.Page`.
That's why you have to use the go template's `with` keyword or something similar in your templating language.
Here's an example:
```
<nav class="sidebar-nav">
{{ range .Site.Menus.main }}
<a href="{{ .URL }}" title="{{ .Title }}">
{{- .Name -}}
{{- with .Page -}}
<span class="date">
{{- dateFormat " (2006-01-02)" .Date -}}
</span>
{{- end -}}
</a>
{{ end }}
</nav>
```

View file

@ -5,7 +5,7 @@ description: Hugo ships with its own RSS 2.0 template that requires almost no co
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
keywords: [rss, xml]
keywords: [rss, xml, templates]
categories: [templates]
menu:
docs:
@ -20,12 +20,7 @@ toc: true
## RSS Template Lookup Order
You can use a single RSS template to generate all of your RSS feeds or create a specific template for each individual feed.
1. `/layouts/section/<section>.rss.xml`
2. `/layouts/_default/rss.xml`
3. `/themes/<theme>/layouts/section/<section>.rss.xml`
4. `/themes/<theme>/layouts/_default/rss.xml`
See [Template Lookup](/templates/lookup-order/).
{{% note "Hugo Ships with an RSS Template" %}}
Hugo ships with its own [RSS 2.0 template](#the-embedded-rss-xml). The embedded template will be sufficient for most use cases.

View file

@ -6,7 +6,7 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [templates]
keywords: [lists,sections]
keywords: [lists,sections,templates]
menu:
docs:
parent: "templates"
@ -24,18 +24,7 @@ To effectively leverage section page templates, you should first understand Hugo
## Section Template Lookup Order
The [lookup order][lookup] for section templates is as follows:
1. `/layouts/section/<SECTION>.html`
2. `/layouts/<SECTION>/list.html`
3. `/layouts/_default/section.html`
4. `/layouts/_default/list.html`
5. `/themes/<THEME>/layouts/section/<SECTION>.html`
6. `/themes/<THEME>/layouts/<SECTION>/list.html`
7. `/themes/<THEME>/layouts/_default/section.html`
8. `/themes/<THEME>/layouts/_default/list.html`
{{< youtube jrMClsB3VsY >}}
See [Template Lookup](/templates/lookup-order/).
## `.Site.GetPage` with Sections

View file

@ -6,7 +6,7 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [templates]
keywords: [shortcodes]
keywords: [shortcodes,templates]
menu:
docs:
parent: "templates"
@ -137,6 +137,10 @@ You can also use the variable `.Page` to access all the normal [page variables][
A shortcodes can also be nested. In a nested shortcode, you can access the parent shortcode context with [`.Parent` variable][shortcodesvars]. This can be very useful for inheritance of common shortcode parameters from the root.
### Checking for Existence
You can check if a specific shortcode is used on a page by calling `.HasShortcode` in that page template, providing the name of the shortcode. This is sometimes useful when you want to include specific scripts or styles in the header that are only used by that shortcode.
## Custom Shortcode Examples
The following are examples of the different types of shortcodes you can create via shortcode template files in `/layouts/shortcodes`.

View file

@ -6,7 +6,7 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-04-06
categories: [templates]
keywords: [page]
keywords: [page,templates]
menu:
docs:
parent: "templates"
@ -20,22 +20,7 @@ toc: true
## Single Page Template Lookup Order
You can specify a [content's `type`][content type] and `layout` in a single content file's [front matter][]. However, you cannot specify `section` because this is determined based on file location (see [content section][section]).
Hugo assumes your content section and content type are the same unless you tell Hugo otherwise by providing a `type` directly in the front matter of a content file. This is why #1 and #3 come before #2 and #4, respectively, in the following lookup order. Values in angle brackets (`<>`) are variable.
1. `/layouts/<TYPE>/<LAYOUT>.html`
2. `/layouts/<SECTION>/<LAYOUT>.html`
3. `/layouts/<TYPE>/single.html`
4. `/layouts/<SECTION>/single.html`
5. `/layouts/_default/single.html`
6. `/themes/<THEME>/layouts/<TYPE>/<LAYOUT>.html`
7. `/themes/<THEME>/layouts/<SECTION>/<LAYOUT>.html`
8. `/themes/<THEME>/layouts/<TYPE>/single.html`
9. `/themes/<THEME>/layouts/<SECTION>/single.html`
10. `/themes/<THEME>/layouts/_default/single.html`
{{< youtube ZYQ5k0RQzmo >}}
See [Template Lookup](/templates/lookup-order/).
## Example Single Page Templates

View file

@ -6,7 +6,7 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [templates]
keywords: [sitemap, xml]
keywords: [sitemap, xml, templates]
menu:
docs:
parent: "templates"

View file

@ -6,7 +6,7 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [templates]
keywords: [taxonomies,metadata,front matter,terms]
keywords: [taxonomies,metadata,front matter,terms,templates]
menu:
docs:
parent: "templates"
@ -35,32 +35,13 @@ Taxonomy list page templates are lists and therefore have all the variables and
### Taxonomy List Template Lookup Order
A taxonomy will be rendered at /`PLURAL`/`TERM`/ (e.g., http://spf13.com/topics/golang/) according to the following lookup order:
1. `/layouts/taxonomy/<SINGULAR>.html`
2. `/layouts/_default/taxonomy.html`
3. `/layouts/_default/list.html`
4. `/themes/<THEME>/layouts/taxonomy/<SINGULAR>.html`
5. `/themes/<THEME>/layouts/_default/taxonomy.html`
6. `/themes/<THEME>/layouts/_default/list.html`
See [Template Lookup](/templates/lookup-order/).
## Taxonomy Terms Template
### Taxonomy Terms Templates Lookup Order
A taxonomy terms page will be rendered at `example.com/<PLURALTAXONOMYNAME>`/ (e.g., http://spf13.com/topics/) according to the following lookup order:
1. `/layouts/taxonomy/<SINGULAR>.terms.html`
2. `/layouts/_default/terms.html`
3. `/themes/<THEME>/layouts/taxonomy/<SINGULAR>.terms.html`
4. `/themes/<THEME>/layouts/_default/terms.html`
{{% warning "The Taxonomy Terms Template has a Unique Lookup Order" %}}
If Hugo does not find a terms template in `layout/` or `/themes/<THEME>/layouts/`, Hugo will *not* render a taxonomy terms page.
{{% /warning %}}
<!-- Begin /taxonomies/methods/ -->
Hugo makes a set of values and methods available on the various Taxonomy structures.
See [Template Lookup](/templates/lookup-order/).
### Taxonomy Methods

View file

@ -30,7 +30,7 @@ The Hugo community uses a wide range of preferred tools and has developed plug-i
## Emacs
* [hugo.el](https://github.com/yewton/hugo.el). Some helper functions for creating a Website with Hugo. Note that Hugo also supports [Org-mode][formats].
* [emacs-easy-hugo](https://github.com/masasam/emacs-easy-hugo). Emacs major mode for managing hugo blogs. Note that Hugo also supports [Org-mode][formats].
* [ox-hugo.el](https://ox-hugo.scripter.co). Native Org-mode exporter that exports to Blackfriday Markdown with Hugo front-matter. `ox-hugo` supports two common Org blogging flows --- exporting multiple Org sub-trees in a single file to multiple Hugo posts, and exporting a single Org file to a single Hugo post. It also leverages the Org tag and property inheritance features. See [*Why ox-hugo?*](https://ox-hugo.scripter.co/doc/why-ox-hugo/) for more.
## Vim

View file

@ -65,6 +65,7 @@ Alternatively, you can use the new [Jekyll import command](/commands/hugo_import
## Blogger
- [blogimport](https://github.com/natefinch/blogimport) - A tool to import from Blogger posts to Hugo.
- [blogger-to-hugo](https://bitbucket.org/petraszd/blogger-to-hugo) - Another tool to import Blogger posts to Hugo. It also downloads embedded images so they will be stored locally.
## Contentful

View file

@ -23,7 +23,8 @@ A static website with a dynamic search function? Yes. As alternatives to embedda
* [Hugoidx](https://github.com/blevesearch/hugoidx) is an experimental application to create a search index. It's built on top of [Bleve](http://www.blevesearch.com/).
* [GitHub Gist for Hugo Workflow](https://gist.github.com/sebz/efddfc8fdcb6b480f567). This gist contains a simple workflow to create a search index for your static website. It uses a simple Grunt script to index all your content files and [lunr.js](http://lunrjs.com/) to serve the search results.
* [hugo-lunr](https://www.npmjs.com/package/hugo-lunr). A simple way to add site search to your static Hugo site using [lunr.js](http://lunrjs.com/). Hugo-lunr will create an index file of any html and markdown documents in your Hugo project.
* [hugo-lunr-zh](https://www.npmjs.com/package/hugo-lunr-zh). A bit like Hugo-lunr, but Hugo-lunr-zh can help you seperate the Chinese keywords.
## Commercial Search Services
* [Algolia](https://www.algolia.com/)'s Search API makes it easy to deliver a great search experience in your apps and websites. Algolia Search provides hosted full-text, numerical, faceted, and geolocalized search.
* [Algolia](https://www.algolia.com/)'s Search API makes it easy to deliver a great search experience in your apps and websites. Algolia Search provides hosted full-text, numerical, faceted, and geolocalized search.

View file

@ -10,6 +10,7 @@ keywords: [menus]
draft: false
menu:
docs:
title: "variables defined by a menu entry"
parent: "variables"
weight: 50
weight: 50
@ -26,6 +27,22 @@ The [menu template][] has the following properties:
.Name
: string
.Title
: string
This is a link title, meant to be used in `title`-Attributes of the menu's `<a>`-tags.
By default it returns `.Page.LinkTitle`, as long as the menu entry was created
through the page's front matter and not through the site config.
Setting it explicitly in the site config or the page's front matter overrides this behaviour.
.Page
: [Page Object](/variables/page/)
The `.Page` variable holds a reference to the page.
It's only set when the menu entry is created from the page's front matter,
not when it's created from the site config.
.Menu
: string
@ -47,4 +64,4 @@ The [menu template][] has the following properties:
.Children
: Menu
[menu template]: /templates/menu-templates/
[menu template]: /templates/menu-templates/

View file

@ -10,6 +10,7 @@ keywords: [pages]
draft: false
menu:
docs:
title: "variables defined by a page"
parent: "variables"
weight: 20
weight: 20

View file

@ -220,131 +220,457 @@
],
"layouts": [
{
"Example": "AMP home, with theme \"demoTheme\".",
"OutputFormat": "AMP",
"Suffix": "html",
"Template Lookup Order": [
"layouts/index.amp.html",
"layouts/index.html",
"layouts/_default/list.amp.html",
"layouts/_default/list.html",
"demoTheme/layouts/index.amp.html",
"demoTheme/layouts/index.html",
"demoTheme/layouts/_default/list.amp.html",
"demoTheme/layouts/_default/list.html"
]
},
{
"Example": "AMP home, French language\".",
"OutputFormat": "AMP",
"Suffix": "html",
"Template Lookup Order": [
"layouts/index.fr.amp.html",
"layouts/index.amp.html",
"layouts/index.fr.html",
"layouts/index.html",
"layouts/_default/list.fr.amp.html",
"layouts/_default/list.amp.html",
"layouts/_default/list.fr.html",
"layouts/_default/list.html"
]
},
{
"Example": "RSS home, no theme.",
"OutputFormat": "RSS",
"Suffix": "xml",
"Template Lookup Order": [
"layouts/rss.xml",
"layouts/_default/rss.xml",
"layouts/_internal/_default/rss.xml"
]
},
{
"Example": "JSON home, no theme.",
"OutputFormat": "JSON",
"Suffix": "json",
"Template Lookup Order": [
"layouts/index.json.json",
"layouts/index.json",
"layouts/_default/list.json.json",
"layouts/_default/list.json"
]
},
{
"Example": "CSV regular, \"layout: demolayout\" in front matter.",
"OutputFormat": "CSV",
"Suffix": "csv",
"Template Lookup Order": [
"layouts/_default/demolayout.csv.csv",
"layouts/_default/demolayout.csv"
]
},
{
"Example": "JSON regular, \"type: demotype\" in front matter.",
"OutputFormat": "JSON",
"Suffix": "json",
"Template Lookup Order": [
"layouts/demotype/single.json.json",
"layouts/demotype/single.json",
"layouts/_default/single.json.json",
"layouts/_default/single.json"
]
},
{
"Example": "HTML regular.",
"Example": "Single page in \"posts\" section",
"Kind": "page",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/posts/single.html.html",
"layouts/posts/single.html",
"layouts/_default/single.html.html",
"layouts/_default/single.html"
]
},
{
"Example": "AMP regular.",
"Example": "Single page in \"posts\" section with layout set",
"Kind": "page",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/posts/demolayout.html.html",
"layouts/posts/single.html.html",
"layouts/posts/demolayout.html",
"layouts/posts/single.html",
"layouts/_default/demolayout.html.html",
"layouts/_default/single.html.html",
"layouts/_default/demolayout.html",
"layouts/_default/single.html"
]
},
{
"Example": "Single page in \"posts\" section with theme",
"Kind": "page",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/posts/single.html.html",
"demoTheme/layouts/posts/single.html.html",
"layouts/posts/single.html",
"demoTheme/layouts/posts/single.html",
"layouts/_default/single.html.html",
"demoTheme/layouts/_default/single.html.html",
"layouts/_default/single.html",
"demoTheme/layouts/_default/single.html"
]
},
{
"Example": "AMP single page",
"Kind": "page",
"OutputFormat": "AMP",
"Suffix": "html",
"Template Lookup Order": [
"layouts/posts/single.amp.html",
"layouts/posts/single.html",
"layouts/_default/single.amp.html",
"layouts/_default/single.html"
]
},
{
"Example": "Calendar blog section.",
"OutputFormat": "Calendar",
"Suffix": "ics",
"Example": "AMP single page, French language",
"Kind": "page",
"OutputFormat": "AMP",
"Suffix": "html",
"Template Lookup Order": [
"layouts/section/blog.calendar.ics",
"layouts/section/blog.ics",
"layouts/blog/list.calendar.ics",
"layouts/blog/list.ics",
"layouts/_default/section.calendar.ics",
"layouts/_default/section.ics",
"layouts/_default/list.calendar.ics",
"layouts/_default/list.ics"
"layouts/posts/single.fr.amp.html",
"layouts/posts/single.amp.html",
"layouts/posts/single.fr.html",
"layouts/posts/single.html",
"layouts/_default/single.fr.amp.html",
"layouts/_default/single.amp.html",
"layouts/_default/single.fr.html",
"layouts/_default/single.html"
]
},
{
"Example": "Calendar taxonomy list.",
"OutputFormat": "Calendar",
"Suffix": "ics",
"Example": "Home page",
"Kind": "home",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/taxonomy/tag.calendar.ics",
"layouts/taxonomy/tag.ics",
"layouts/_default/taxonomy.calendar.ics",
"layouts/_default/taxonomy.ics",
"layouts/_default/list.calendar.ics",
"layouts/_default/list.ics"
"layouts/page/index.html.html",
"layouts/page/home.html.html",
"layouts/page/list.html.html",
"layouts/page/index.html",
"layouts/page/home.html",
"layouts/page/list.html",
"layouts/index.html.html",
"layouts/home.html.html",
"layouts/list.html.html",
"layouts/index.html",
"layouts/home.html",
"layouts/list.html",
"layouts/_default/index.html.html",
"layouts/_default/home.html.html",
"layouts/_default/list.html.html",
"layouts/_default/index.html",
"layouts/_default/home.html",
"layouts/_default/list.html"
]
},
{
"Example": "Calendar taxonomy term.",
"OutputFormat": "Calendar",
"Suffix": "ics",
"Example": "Home page with type set",
"Kind": "home",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/taxonomy/tag.terms.calendar.ics",
"layouts/taxonomy/tag.terms.ics",
"layouts/_default/terms.calendar.ics",
"layouts/_default/terms.ics"
"layouts/demotype/index.html.html",
"layouts/demotype/home.html.html",
"layouts/demotype/list.html.html",
"layouts/demotype/index.html",
"layouts/demotype/home.html",
"layouts/demotype/list.html",
"layouts/index.html.html",
"layouts/home.html.html",
"layouts/list.html.html",
"layouts/index.html",
"layouts/home.html",
"layouts/list.html",
"layouts/_default/index.html.html",
"layouts/_default/home.html.html",
"layouts/_default/list.html.html",
"layouts/_default/index.html",
"layouts/_default/home.html",
"layouts/_default/list.html"
]
},
{
"Example": "Home page with layout set",
"Kind": "home",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/page/demolayout.html.html",
"layouts/page/index.html.html",
"layouts/page/home.html.html",
"layouts/page/list.html.html",
"layouts/page/demolayout.html",
"layouts/page/index.html",
"layouts/page/home.html",
"layouts/page/list.html",
"layouts/demolayout.html.html",
"layouts/index.html.html",
"layouts/home.html.html",
"layouts/list.html.html",
"layouts/demolayout.html",
"layouts/index.html",
"layouts/home.html",
"layouts/list.html",
"layouts/_default/demolayout.html.html",
"layouts/_default/index.html.html",
"layouts/_default/home.html.html",
"layouts/_default/list.html.html",
"layouts/_default/demolayout.html",
"layouts/_default/index.html",
"layouts/_default/home.html",
"layouts/_default/list.html"
]
},
{
"Example": "Home page with theme",
"Kind": "home",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/page/index.html.html",
"demoTheme/layouts/page/index.html.html",
"layouts/page/home.html.html",
"demoTheme/layouts/page/home.html.html",
"layouts/page/list.html.html",
"demoTheme/layouts/page/list.html.html",
"layouts/page/index.html",
"demoTheme/layouts/page/index.html",
"layouts/page/home.html",
"demoTheme/layouts/page/home.html",
"layouts/page/list.html",
"demoTheme/layouts/page/list.html",
"layouts/index.html.html",
"demoTheme/layouts/index.html.html",
"layouts/home.html.html",
"demoTheme/layouts/home.html.html",
"layouts/list.html.html",
"demoTheme/layouts/list.html.html",
"layouts/index.html",
"demoTheme/layouts/index.html",
"layouts/home.html",
"demoTheme/layouts/home.html",
"layouts/list.html",
"demoTheme/layouts/list.html",
"layouts/_default/index.html.html",
"demoTheme/layouts/_default/index.html.html",
"layouts/_default/home.html.html",
"demoTheme/layouts/_default/home.html.html",
"layouts/_default/list.html.html",
"demoTheme/layouts/_default/list.html.html",
"layouts/_default/index.html",
"demoTheme/layouts/_default/index.html",
"layouts/_default/home.html",
"demoTheme/layouts/_default/home.html",
"layouts/_default/list.html",
"demoTheme/layouts/_default/list.html"
]
},
{
"Example": "AMP home, French language\"",
"Kind": "home",
"OutputFormat": "AMP",
"Suffix": "html",
"Template Lookup Order": [
"layouts/page/index.fr.amp.html",
"layouts/page/home.fr.amp.html",
"layouts/page/list.fr.amp.html",
"layouts/page/index.amp.html",
"layouts/page/home.amp.html",
"layouts/page/list.amp.html",
"layouts/page/index.fr.html",
"layouts/page/home.fr.html",
"layouts/page/list.fr.html",
"layouts/page/index.html",
"layouts/page/home.html",
"layouts/page/list.html",
"layouts/index.fr.amp.html",
"layouts/home.fr.amp.html",
"layouts/list.fr.amp.html",
"layouts/index.amp.html",
"layouts/home.amp.html",
"layouts/list.amp.html",
"layouts/index.fr.html",
"layouts/home.fr.html",
"layouts/list.fr.html",
"layouts/index.html",
"layouts/home.html",
"layouts/list.html",
"layouts/_default/index.fr.amp.html",
"layouts/_default/home.fr.amp.html",
"layouts/_default/list.fr.amp.html",
"layouts/_default/index.amp.html",
"layouts/_default/home.amp.html",
"layouts/_default/list.amp.html",
"layouts/_default/index.fr.html",
"layouts/_default/home.fr.html",
"layouts/_default/list.fr.html",
"layouts/_default/index.html",
"layouts/_default/home.html",
"layouts/_default/list.html"
]
},
{
"Example": "JSON home",
"Kind": "home",
"OutputFormat": "JSON",
"Suffix": "json",
"Template Lookup Order": [
"layouts/page/index.json.json",
"layouts/page/home.json.json",
"layouts/page/list.json.json",
"layouts/page/index.json",
"layouts/page/home.json",
"layouts/page/list.json",
"layouts/index.json.json",
"layouts/home.json.json",
"layouts/list.json.json",
"layouts/index.json",
"layouts/home.json",
"layouts/list.json",
"layouts/_default/index.json.json",
"layouts/_default/home.json.json",
"layouts/_default/list.json.json",
"layouts/_default/index.json",
"layouts/_default/home.json",
"layouts/_default/list.json"
]
},
{
"Example": "RSS home",
"Kind": "home",
"OutputFormat": "RSS",
"Suffix": "xml",
"Template Lookup Order": [
"layouts/page/index.rss.xml",
"layouts/page/home.rss.xml",
"layouts/page/rss.xml",
"layouts/page/list.rss.xml",
"layouts/page/index.xml",
"layouts/page/home.xml",
"layouts/page/list.xml",
"layouts/index.rss.xml",
"layouts/home.rss.xml",
"layouts/rss.xml",
"layouts/list.rss.xml",
"layouts/index.xml",
"layouts/home.xml",
"layouts/list.xml",
"layouts/_default/index.rss.xml",
"layouts/_default/home.rss.xml",
"layouts/_default/rss.xml",
"layouts/_default/list.rss.xml",
"layouts/_default/index.xml",
"layouts/_default/home.xml",
"layouts/_default/list.xml",
"layouts/_internal/_default/rss.xml"
]
},
{
"Example": "Section list for \"posts\" section",
"Kind": "section",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/posts/posts.html.html",
"layouts/posts/section.html.html",
"layouts/posts/list.html.html",
"layouts/posts/posts.html",
"layouts/posts/section.html",
"layouts/posts/list.html",
"layouts/section/posts.html.html",
"layouts/section/section.html.html",
"layouts/section/list.html.html",
"layouts/section/posts.html",
"layouts/section/section.html",
"layouts/section/list.html",
"layouts/_default/posts.html.html",
"layouts/_default/section.html.html",
"layouts/_default/list.html.html",
"layouts/_default/posts.html",
"layouts/_default/section.html",
"layouts/_default/list.html"
]
},
{
"Example": "Section list for \"posts\" section with type set to \"blog\"",
"Kind": "section",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/blog/posts.html.html",
"layouts/blog/section.html.html",
"layouts/blog/list.html.html",
"layouts/blog/posts.html",
"layouts/blog/section.html",
"layouts/blog/list.html",
"layouts/posts/posts.html.html",
"layouts/posts/section.html.html",
"layouts/posts/list.html.html",
"layouts/posts/posts.html",
"layouts/posts/section.html",
"layouts/posts/list.html",
"layouts/section/posts.html.html",
"layouts/section/section.html.html",
"layouts/section/list.html.html",
"layouts/section/posts.html",
"layouts/section/section.html",
"layouts/section/list.html",
"layouts/_default/posts.html.html",
"layouts/_default/section.html.html",
"layouts/_default/list.html.html",
"layouts/_default/posts.html",
"layouts/_default/section.html",
"layouts/_default/list.html"
]
},
{
"Example": "Section list for \"posts\" section with layout set to \"demoLayout\"",
"Kind": "section",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/posts/demolayout.html.html",
"layouts/posts/posts.html.html",
"layouts/posts/section.html.html",
"layouts/posts/list.html.html",
"layouts/posts/demolayout.html",
"layouts/posts/posts.html",
"layouts/posts/section.html",
"layouts/posts/list.html",
"layouts/section/demolayout.html.html",
"layouts/section/posts.html.html",
"layouts/section/section.html.html",
"layouts/section/list.html.html",
"layouts/section/demolayout.html",
"layouts/section/posts.html",
"layouts/section/section.html",
"layouts/section/list.html",
"layouts/_default/demolayout.html.html",
"layouts/_default/posts.html.html",
"layouts/_default/section.html.html",
"layouts/_default/list.html.html",
"layouts/_default/demolayout.html",
"layouts/_default/posts.html",
"layouts/_default/section.html",
"layouts/_default/list.html"
]
},
{
"Example": "Taxonomy list in categories",
"Kind": "taxonomy",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/categories/category.html.html",
"layouts/categories/taxonomy.html.html",
"layouts/categories/list.html.html",
"layouts/categories/category.html",
"layouts/categories/taxonomy.html",
"layouts/categories/list.html",
"layouts/taxonomy/category.html.html",
"layouts/taxonomy/taxonomy.html.html",
"layouts/taxonomy/list.html.html",
"layouts/taxonomy/category.html",
"layouts/taxonomy/taxonomy.html",
"layouts/taxonomy/list.html",
"layouts/category/category.html.html",
"layouts/category/taxonomy.html.html",
"layouts/category/list.html.html",
"layouts/category/category.html",
"layouts/category/taxonomy.html",
"layouts/category/list.html",
"layouts/_default/category.html.html",
"layouts/_default/taxonomy.html.html",
"layouts/_default/list.html.html",
"layouts/_default/category.html",
"layouts/_default/taxonomy.html",
"layouts/_default/list.html"
]
},
{
"Example": "Taxonomy term in categories",
"Kind": "taxonomyTerm",
"OutputFormat": "HTML",
"Suffix": "html",
"Template Lookup Order": [
"layouts/categories/category.terms.html.html",
"layouts/categories/terms.html.html",
"layouts/categories/list.html.html",
"layouts/categories/category.terms.html",
"layouts/categories/terms.html",
"layouts/categories/list.html",
"layouts/taxonomy/category.terms.html.html",
"layouts/taxonomy/terms.html.html",
"layouts/taxonomy/list.html.html",
"layouts/taxonomy/category.terms.html",
"layouts/taxonomy/terms.html",
"layouts/taxonomy/list.html",
"layouts/category/category.terms.html.html",
"layouts/category/terms.html.html",
"layouts/category/list.html.html",
"layouts/category/category.terms.html",
"layouts/category/terms.html",
"layouts/category/list.html",
"layouts/_default/category.terms.html.html",
"layouts/_default/terms.html.html",
"layouts/_default/list.html.html",
"layouts/_default/category.terms.html",
"layouts/_default/terms.html",
"layouts/_default/list.html"
]
}
]
@ -1427,7 +1753,7 @@
],
"Examples": [
[
"{{chomp \"\u003cp\u003eBlockhead\u003c/p\u003e\\n\" }}",
"{{chomp \"\u003cp\u003eBlockhead\u003c/p\u003e\\n\" | safeHTML }}",
"\u003cp\u003eBlockhead\u003c/p\u003e"
]
]

View file

@ -0,0 +1,28 @@
{{ $package := (index .Params 0) }}
{{ $listname := (index .Params 1) }}
{{ $filter := split (index .Params 2) " " }}
{{ $filter1 := index $filter 0 }}
{{ $filter2 := index $filter 1 }}
{{ $filter3 := index $filter 2 }}
{{ $list := (index (index .Site.Data.docs $package) $listname) }}
{{ $fields := after 3 .Params }}
{{ $list := where $list $filter1 $filter2 $filter3 }}
<table class="table table-bordered">
<tr>
{{ range $fields }}
<th>{{ . }}</th>
{{ end }}
</tr>
{{ range $list }}
<tr>
{{ range $k, $v := . }}
{{ $.Scratch.Set $k $v }}
{{ end }}
{{ range $fields }}
<td>{{ $.Scratch.Get . }}</td>
{{ end }}
</tr>
{{ end }}
</table>

View file

@ -1,4 +1,4 @@
{{ $original := .Page.Resources.GetByPrefix (.Get 0) }}
{{ $original := .Page.Resources.GetMatch (printf "%s*" (.Get 0)) }}
{{ $command := .Get 1 }}
{{ $options := .Get 2 }}
{{ if eq $command "Fit"}}
@ -14,6 +14,12 @@
<figure style="width: {{ add $image.Width 3 }}px; padding: 3px; background-color: #cccc">
<img src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}">
<figcaption>
<small>.{{ $command }} "{{ $options }}"</small>
<small>
{{ with .Inner }}
{{ . }}
{{ else }}
.{{ $command }} "{{ $options }}"
{{ end }}
</small>
</figcaption>
</figure>

View file

@ -3,15 +3,15 @@
command = "hugo"
[context.production.environment]
HUGO_VERSION = "0.32.4"
HUGO_VERSION = "0.34"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"
[context.deploy-preview.environment]
HUGO_VERSION = "0.32.4"
HUGO_VERSION = "0.34"
[context.branch-deploy.environment]
HUGO_VERSION = "0.32.4"
HUGO_VERSION = "0.34"
[context.next.environment]
HUGO_BASEURL = "https://next--gohugoio.netlify.com/"

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View file

@ -1,13 +0,0 @@
---
linktitle: ""
description: ""
godocref: ""
publishdate: ""
lastmod: ""
categories: []
tags: []
weight: 00
slug: ""
aliases: []
toc: false
---

View file

@ -1,13 +0,0 @@
---
description: ""
lastmod: ""
license: ""
licenseLink: ""
sitelink: ""
sourcelink: ""
categories: [showcase]
tags: []
image: ""
toc: false
notesforauthors: "Go to gohugo.io/contribute/documentation for more info"
---

View file

@ -1,16 +0,0 @@
---
linktitle: ""
description: ""
godocref: ""
publishdate: ""
lastmod: ""
categories: [tutorials]
tags: []
author: ""
authorurl: ""
originalurl: ""
draft: false
aliases: []
notesforauthors: "Go to gohugo.io/contribute/documentation for more info."
---

View file

@ -9,7 +9,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
{{/* NOTE: the Site's title, and if there is a page title, that is set too */}}
<title>{{ block "title" . }}{{ .Site.Title }} {{ with .Title }} | {{ . }}{{ end }}{{ end }}</title>
<title>{{ block "title" . }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title>
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
@ -27,7 +27,7 @@
{{- template "_internal/opengraph.html" . -}}
{{- template "_internal/google_news.html" . -}}
{{- template "_internal/schema.html" . -}}
{{- partial "twitter_cards.html" . -}}
{{- template "_internal/twitter_cards.html" . -}}
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
{{ template "_internal/google_analytics_async.html" . }}

View file

@ -1,17 +0,0 @@
{{- with $.Param "images" -}}
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image:src" content="{{ index . 0 | absURL }}"/>
{{ else -}}
<meta name="twitter:card" content="summary"/>
{{- end -}}
<meta name="twitter:title" content="{{ .Title }}"/>
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
{{ with .Site.Social.twitter -}}
<meta name="twitter:site" content="@{{ . }}"/>
{{ end -}}
{{ range .Site.Authors }}
{{ with .twitter -}}
<meta name="twitter:creator" content="@{{ . }}"/>
{{ end -}}
{{ end -}}