Markdown linting fixes (#1846)

This commit is contained in:
Christian Oliff
2022-10-20 01:06:32 +09:00
committed by GitHub
parent 527ec59416
commit b6cb5ae483
76 changed files with 178 additions and 223 deletions
+3
View File
@@ -82,6 +82,7 @@
"eparis",
"errorf",
"erroridf",
"esbuild",
"Evernote",
"Exif",
"exitwp",
@@ -231,6 +232,7 @@
"Poupin",
"prerender",
"println",
"Pritchard",
"publishdate",
"Pygments",
"qref",
@@ -259,6 +261,7 @@
"safejs",
"Samsa",
"schemaorg",
"setx",
"Shekhar",
"Shortcode",
"Shortcodes",
-1
View File
@@ -33,7 +33,6 @@ jobs:
VALIDATE_HTML: false
VALIDATE_JAVASCRIPT_STANDARD: false
VALIDATE_JSCPD: false
VALIDATE_MARKDOWN: false
VALIDATE_NATURAL_LANGUAGE: false
VALIDATE_SHELL_SHFMT: false
VALIDATE_XML: false
+25 -2
View File
@@ -1,4 +1,27 @@
# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
MD013: false # Line length
MD033: false # Inline HTML
MD002: false
MD003: false
MD004: false
MD007: false
MD012:
maximum: 2
MD013: false
MD014: false
MD022: false
MD024: false
MD026: false
MD031: false
MD032: false
MD033: false
MD034: false
MD036: false
MD037: false
MD038: false
MD040: false
MD041: false
MD046: false
MD049: false
MD050: false
MD051: false
MD053: false
+5
View File
@@ -0,0 +1,5 @@
**/commands/**
**/news/**
**/showcase/**
**/zh/**
**/license.md
-1
View File
@@ -34,7 +34,6 @@ This has many benefits. The most noticeable is performance. HTTP servers are *ve
* ["Top 10 Static Website Generators", Netlify blog][]
* ["The Resurgence of Static", dotCMS][dotcms]
["An Introduction to Static Site Generators", David Walsh]: https://davidwalsh.name/introduction-static-site-generators
["Static Site Generators", O'Reilly]: https://github.com/gohugoio/hugoDocs/files/1242701/static-site-generators.pdf
["Top 10 Static Website Generators", Netlify blog]: https://www.netlify.com/blog/2016/05/02/top-ten-static-website-generators/
-1
View File
@@ -54,7 +54,6 @@ toc: true
* Support for [Go][] HTML templates
* [Syntax highlighting][] powered by [Chroma][]
[aliases]: /content-management/urls/#aliases
[Chroma]: https://github.com/alecthomas/chroma
[content summaries]: /content-management/summaries/
+1 -3
View File
@@ -16,7 +16,6 @@ aliases: [/privacy/,/gdpr/]
toc: true
---
General Data Protection Regulation ([GDPR](https://en.wikipedia.org/wiki/General_Data_Protection_Regulation)) is a regulation in EU law on data protection and privacy for all individuals within the European Union and the European Economic Area. It became enforceable on 25 May 2018.
**Hugo is a static site generator. By using Hugo you are already standing on very solid ground. Static HTML files on disk are much easier to reason about compared to server and database driven web sites.**
@@ -95,6 +94,7 @@ useSessionStorage
{{% warning %}}
`useSessionStorage` is not supported when using Google Analytics v4 (gtag.js).
{{% /warning %}}
### Instagram
simple
@@ -116,7 +116,6 @@ enableDNT
simple
: If simple mode is enabled, a static and no-JS version of a tweet will be built.
**Note:** If you use the _simple mode_ for Twitter, you may want to disable the inline styles provided by Hugo:
{{< code-toggle file="config">}}
@@ -137,4 +136,3 @@ enableDNT
simple
: If simple mode is enabled, the video thumbnail is fetched from Vimeo's servers and it is overlayed with a play button. If the user clicks to play the video, it will open in a new tab directly on Vimeo's website.
+1 -2
View File
@@ -28,7 +28,6 @@ But when developing and building your site, the runtime is the `hugo` executable
* User-defined components have read-only access to the filesystem.
* We shell out to some external binaries to support [Asciidoctor](/content-management/formats/#list-of-content-formats) and similar, but those binaries and their flags are predefined and disabled by default (see [Security Policy](#security-policy)). General functions to run arbitrary external OS commands have been [discussed](https://github.com/gohugoio/hugo/issues/796), but not implemented because of security concerns.
## Security Policy
{{< new-in "0.91.0" >}}
@@ -57,7 +56,7 @@ These are the security threats as defined by [OWASP](https://en.wikipedia.org/wi
For HTML output, this is the core security model:
https://golang.org/pkg/html/template/#hdr-Security_Model
<https://golang.org/pkg/html/template/#hdr-Security_Model>
In short:
@@ -12,7 +12,6 @@ menu:
weight: 70
quicklinks:
weight: 70 #rem
draft: false
aliases: [/content/archetypes/]
toc: true
---
@@ -69,7 +68,6 @@ It will create a new newsletter type of content file based on the archetype temp
The above _newsletter type archetype_ illustrates the possibilities: The full Hugo `.Site` and all of Hugo&#39;s template funcs can be used in the archetype file.
## Directory based archetypes
Since Hugo `0.49` you can use complete directories as archetype templates. Given this archetype directory:
@@ -90,8 +88,6 @@ hugo new --kind post-bundle posts/my-post
Will create a new folder in `/content/posts/my-post` with the same set of files as in the `post-bundle` archetypes folder. All content files (`index.md` etc.) can contain template logic, and will receive the correct `.Site` for the content's language.
[archetypes directory]: /getting-started/directory-structure/
[content types]: /content-management/types/
[front matter]: /content-management/front-matter/
@@ -26,6 +26,7 @@ _build:
{{< /code-toggle >}}
#### render
If `always`, the page will be treated as a published page, holding its dedicated output files (`index.html`, etc...) and permalink.
{{< new-in "0.76.0" >}} We extended this property from a boolean to an enum in Hugo 0.76.0. Valid values are:
@@ -58,7 +59,7 @@ If true, the page will be treated as part of the project's collections and, when
#### publishResources
If set to true the [Bundle's Resources]({{< relref "content-management/page-bundles" >}}) will be published.
If set to true the [Bundle's Resources]({{< relref "content-management/page-bundles" >}}) will be published.
Setting this to false will still publish Resources on demand (when a resource's `.Permalink` or `.RelPermalink` is invoked from the templates) but will skip the others.
{{% note %}}
@@ -70,6 +71,7 @@ Any page, regardless of their build options, will always be available using the
### Illustrative use cases
#### Not publishing a page
Project needs a "Who We Are" content file for Front Matter and body to be used by the homepage but nowhere else.
```yaml
@@ -116,7 +116,7 @@ produces this HTML:
The behavior can, since Hugo 0.45, be configured in `config.toml`:
refLinksErrorLevel ("ERROR")
refLinksErrorLevel ("ERROR")
: When using `ref` or `relref` to resolve page links and a link cannot resolved, it will be logged with this log level. Valid values are `ERROR` (default) or `WARNING`. Any `ERROR` will fail the build (`exit -1`).
refLinksNotFoundURL
+5 -12
View File
@@ -45,14 +45,9 @@ Will be rendered as:
1 2 3 4 1 2 3 4 1 2 3 4 '--- 4 '-- 4 \ 4
```
## Mermaid Diagrams
Hugo currently does not provide default templates for Mermaid diagrams. But you can easily add your own. One way to do it would be to create ` layouts/_default/_markup/render-codeblock-mermaid.html`:
Hugo currently does not provide default templates for Mermaid diagrams. But you can easily add your own. One way to do it would be to create `layouts/_default/_markup/render-codeblock-mermaid.html`:
```go-html-template
<div class="mermaid">
@@ -88,8 +83,6 @@ sequenceDiagram
Bob-->>John: Jolly good!
```
## Goat Ascii Diagram Examples
### Graphics
@@ -160,7 +153,7 @@ sequenceDiagram
### File tree
Created from https://arthursonzogni.com/Diagon/#Tree
Created from <https://arthursonzogni.com/Diagon/#Tree>
```goat { width=300 color="orange" }
───Linux─┬─Android
@@ -176,7 +169,7 @@ Created from https://arthursonzogni.com/Diagon/#Tree
### Sequence Diagram
https://arthursonzogni.com/Diagon/#Sequence
<https://arthursonzogni.com/Diagon/#Sequence>
```goat { class="w-40" }
┌─────┐ ┌───┐
@@ -197,7 +190,7 @@ https://arthursonzogni.com/Diagon/#Sequence
### Flowchart
https://arthursonzogni.com/Diagon/#Flowchart
<https://arthursonzogni.com/Diagon/#Flowchart>
```goat
_________________
@@ -243,7 +236,7 @@ https://arthursonzogni.com/Diagon/#Flowchart
### Table
https://arthursonzogni.com/Diagon/#Table
<https://arthursonzogni.com/Diagon/#Table>
```goat { class="w-80 dark-blue" }
┌────────────────────────────────────────────────┐
+4 -4
View File
@@ -55,13 +55,13 @@ Because additional formats are external commands, generation performance will re
### External Helper AsciiDoc
[AsciiDoc](https://github.com/asciidoc/asciidoc) implementation EOLs in Jan 2020 and is no longer supported.
AsciiDoc development is being continued under [Asciidoctor](https://github.com/asciidoctor). The format AsciiDoc
[AsciiDoc](https://github.com/asciidoc/asciidoc) implementation EOLs in Jan 2020 and is no longer supported.
AsciiDoc development is being continued under [Asciidoctor](https://github.com/asciidoctor). The format AsciiDoc
remains of course. Please continue with the implementation Asciidoctor.
### External Helper Asciidoctor
The Asciidoctor community offers a wide set of tools for the AsciiDoc format that can be installed additionally to Hugo.
The Asciidoctor community offers a wide set of tools for the AsciiDoc format that can be installed additionally to Hugo.
[See the Asciidoctor docs for installation instructions](https://asciidoctor.org/docs/install-toolchain/). Make sure that also all
optional extensions like `asciidoctor-diagram` or `asciidoctor-html5s` are installed if required.
@@ -109,7 +109,7 @@ Example of how to set extensions and attributes:
my-attribute-name = "my value"
```
In a complex Asciidoctor environment it is sometimes helpful to debug the exact call to your external helper with all
In a complex Asciidoctor environment it is sometimes helpful to debug the exact call to your external helper with all
parameters. Run Hugo with `-v`. You will get an output like
```
@@ -137,7 +137,7 @@ weight
: used for [ordering your content in lists][ordering]. Lower weight gets higher precedence. So content with lower weight will come first. If set, weights should be non-zero, as 0 is interpreted as an *unset* weight.
\<taxonomies\>
: field name of the *plural* form of the index. See `tags` and `categories` in the above front matter examples. _Note that the plural form of user-defined taxonomies cannot be the same as any of the predefined front matter variables._
: field name of the *plural* form of the index. See `tags` and `categories` in the above front matter examples. *Note that the plural form of user-defined taxonomies cannot be the same as any of the predefined front matter variables.*
{{% note "Hugo's Default URL Destinations" %}}
If neither `slug` nor `url` is present and [permalinks are not configured otherwise in your site `config` file](/content-management/urls/#permalinks), Hugo will use the filename of your content to create the output URL. See [Content Organization](/content-management/organization) for an explanation of paths in Hugo and [URL Management](/content-management/urls/) for ways to customize Hugo's default behaviors.
@@ -192,7 +192,7 @@ lang
environment
: A Glob pattern matching the build environment, e.g. "{production,development}"
Any of the above can be omitted.
Any of the above can be omitted.
### Example
@@ -206,11 +206,9 @@ cascade:
With the above example the Blog section page and its descendants will return `images/typewriter.jpg` when `.Params.banner` is invoked unless:
- Said descendant has its own `banner` value set
- Said descendant has its own `banner` value set
- Or a closer ancestor node has its own `cascade.banner` value set.
## Order Content Through Front Matter
You can assign content-specific `weight` in the front matter of your content. These values are especially useful for [ordering][ordering] in list views. You can use `weight` for ordering of content and the convention of [`<TAXONOMY>_weight`][taxweight] for ordering content within a taxonomy. See [Ordering and Grouping Hugo Lists][lists] to see how `weight` can be used to organize your content in list views.
@@ -221,9 +219,9 @@ It's possible to set some options for Markdown rendering in a content's front ma
## Front Matter Format Specs
* [TOML Spec][toml]
* [YAML Spec][yaml]
* [JSON Spec][json]
- [TOML Spec][toml]
- [YAML Spec][yaml]
- [JSON Spec][json]
[variables]: /variables/
[aliases]: /content-management/urls/#aliases
@@ -507,6 +507,7 @@ The rendering of the main navigation works as usual. `.Site.Menus` will just con
```
### Dynamically localizing menus with i18n
While customizing menus per language is useful, your config file can become hard to maintain if you have a lot of languages
If your menus are the same in all languages (ie. if the only thing that changes is the translated name) you can use the `.Identifier` as a translation key for the menu name:
@@ -569,10 +570,9 @@ If there is more than one language defined, the `LanguagePrefix` variable will e
## Generate multilingual content with `hugo new`
Currently, `hugo new` is not ready to support generating multilingual content. But there is a [proposal topic](https://github.com/gohugoio/hugo/issues/7732) about this in GitHub issue to discuss how it should work.
[abslangurl]: /functions/abslangurl
[config]: /getting-started/configuration/
[contenttemplate]: /templates/single-page-templates/
+9 -10
View File
@@ -72,13 +72,13 @@ bundles:
: This leaf bundle has the `index.md`, two other content
Markdown files and two image files.
- image1, image2:
- image1, image2:
These images are page resources of `my-post`
and only available in `my-post/index.md` resources.
- content1, content2:
- content1, content2:
These content files are page resources of `my-post`
and only available in `my-post/index.md` resources.
and only available in `my-post/index.md` resources.
They will **not** be rendered as individual pages.
`my-other-post`
@@ -99,8 +99,8 @@ as long as it is not inside another **leaf** 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.
- 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:
@@ -121,9 +121,9 @@ _In this example, we are assuming the `some-headless-bundle` to be a headless
Explanation of the above example:
1. Get the `some-headless-bundle` Page "object".
2. Collect a *slice* of resources in this *Page Bundle* that matches
2. Collect a _slice_ of resources in this _Page Bundle_ that matches
`"author*"` using `.Resources.Match`.
3. Loop through that *slice* of nested pages, and output their `.Title` and
3. Loop through that _slice_ of nested pages, and output their `.Title` and
`.Content`.
---
@@ -137,9 +137,8 @@ headless = true
There are many use cases of such headless page bundles:
- Shared media galleries
- Reusable page content "snippets"
- Shared media galleries
- Reusable page content "snippets"
## Branch Bundles {#branch-bundles}
@@ -90,6 +90,7 @@ MediaType.Suffixes
: A slice of possible suffixes for the resource's MIME type.
## Methods
ByType
: Returns the page resources of the given type.
@@ -107,6 +108,7 @@ 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*" ✅
@@ -140,8 +142,7 @@ title
params
: A map of custom key/values.
### Resources metadata example
### Resources metadata example
{{< code-toggle copy="false">}}
title: Application
+7 -3
View File
@@ -25,9 +25,9 @@ To list up to 5 related pages (which share the same _date_ or _keyword_ paramete
{{ with $related }}
<h3>See Also</h3>
<ul>
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
{{ end }}
{{< /code >}}
@@ -37,6 +37,7 @@ To list up to 5 related pages (which share the same _date_ or _keyword_ paramete
Here is the list of "Related" methods available on a page collection such `.RegularPages`.
#### .Related PAGE
Returns a collection of pages related the given one.
```
@@ -44,6 +45,7 @@ Returns a collection of pages related the given one.
```
#### .RelatedIndices PAGE INDICE1 [INDICE2 ...]
Returns a collection of pages related to a given one restricted to a list of indices.
```
@@ -51,6 +53,7 @@ Returns a collection of pages related to a given one restricted to a list of ind
```
#### .RelatedTo KEYVALS [KEYVALS2 ...]
Returns a collection of pages related together by a set of indices and their match.
In order to build those set and pass them as argument, one must use the `keyVals` function where the first argument would be the `indice` and the consecutive ones its potential `matches`.
@@ -64,6 +67,7 @@ Read [this blog article](https://regisphilibert.com/blog/2018/04/hugo-optmized-r
{{% /note %}}
## Configure Related Content
Hugo provides a sensible default configuration of Related Content, but you can fine-tune this in your configuration, on the global or language level if needed.
### Default configuration
+5 -9
View File
@@ -71,10 +71,9 @@ If you want the old behavior, you can put the following line in the start of you
{{ $_hugo_config := `{ "version": 1 }` }}
```
### Shortcodes Without Markdown
The `<` character indicates that the shortcode's inner content does *not* need further rendering. Often shortcodes without markdown include internal HTML:
The `<` character indicates that the shortcode's inner content does *not* need further rendering. Often shortcodes without Markdown include internal HTML:
```
{{</* myshortcode */>}}<p>Hello <strong>World!</strong></p>{{</* /myshortcode */>}}
@@ -86,11 +85,11 @@ You can call shortcodes within other shortcodes by creating your own templates t
## Use Hugo's Built-in Shortcodes
Hugo ships with a set of predefined shortcodes that represent very common usage. These shortcodes are provided for author convenience and to keep your markdown content clean.
Hugo ships with a set of predefined shortcodes that represent very common usage. These shortcodes are provided for author convenience and to keep your Markdown content clean.
### `figure`
`figure` is an extension of the image syntax in markdown, which does not provide a shorthand for the more semantic [HTML5 `<figure>` element][figureelement].
`figure` is an extension of the image syntax in Markdown, which does not provide a shorthand for the more semantic [HTML5 `<figure>` element][figureelement].
The `figure` shortcode can use the following named parameters:
@@ -254,7 +253,6 @@ Using the preceding `instagram` with `hidecaption` example above, the following
{{< instagram BWNjjyYFxVx hidecaption >}}
{{% note %}}
The `instagram`-shortcode refers an endpoint of Instagram's API, that's deprecated since October 24th, 2020. Thus, no images can be fetched from this API endpoint, resulting in an error when the `instagram`-shortcode is used. For more information please have a look at GitHub issue [#7879](https://github.com/gohugoio/hugo/issues/7879).
{{% /note %}}
@@ -360,7 +358,7 @@ Using the preceding `vimeo` example, the following HTML will be added to your re
{{< /output >}}
{{% tip %}}
If you want to further customize the visual styling of the YouTube or Vimeo output, add a `class` named parameter when calling the shortcode. The new `class` will be added to the `<div>` that wraps the `<iframe>` *and* will remove the inline styles. Note that you will need to call the `id` as a named parameter as well. You can also give the vimeo video a descriptive title with `title`.
If you want to further customize the visual styling of the YouTube or Vimeo output, add a `class` named parameter when calling the shortcode. The new `class` will be added to the `<div>` that wraps the `<iframe>` *and* will remove the inline styles. Note that you will need to call the `id` as a named parameter as well. You can also give the vimeo video a descriptive title with `title`.
```
{{</* vimeo id="146022717" class="my-vimeo-wrapper-class" title="My vimeo video" */>}}
@@ -381,7 +379,6 @@ The `youtube` shortcode embeds a responsive video player for [YouTube videos][].
https://www.youtube.com/watch?v=w7Ft2ymGmfc
```
#### Example `youtube` Input
Copy the YouTube video ID that follows `v=` in the video's URL and pass it to the `youtube` shortcode:
@@ -390,7 +387,7 @@ Copy the YouTube video ID that follows `v=` in the video's URL and pass it to th
{{</* youtube w7Ft2ymGmfc */>}}
{{< /code >}}
Furthermore, you can automatically start playback of the embedded video by setting the `autoplay` parameter to `true`. Remember that you can't mix named and unnamed parameters, so you'll need to assign the yet unnamed video id to the parameter `id`:
Furthermore, you can automatically start playback of the embedded video by setting the `autoplay` parameter to `true`. Remember that you can't mix named and unnamed parameters, so you'll need to assign the yet unnamed video ID to the parameter `id`:
{{< code file="example-youtube-input-with-autoplay.md" >}}
@@ -403,7 +400,6 @@ For [accessibility reasons](https://dequeuniversity.com/tips/provide-iframe-titl
{{</* youtube id="w7Ft2ymGmfc" title="A New Hugo Site in Under Two Minutes" */>}}
{{< /code >}}
#### Example `youtube` Output
Using the preceding `youtube` example, the following HTML will be added to your rendered website's markup:
@@ -65,6 +65,5 @@ Note 2
: The example above is a [multihost setup][]. In a regular setup, all
the static directories will be available to all sites.
[site config]: /getting-started/configuration/#all-configuration-settings
[multihost setup]: /content-management/multilingual/#configure-multilingual-multihost
+2 -2
View File
@@ -41,9 +41,9 @@ The Hugo-defined summaries are set to use word count calculated by splitting the
### Manual Summary Splitting
Alternatively, you may add the <code>&#60;&#33;&#45;&#45;more&#45;&#45;&#62;</code> summary divider where you want to split the article.
Alternatively, you may add the <code>&#60;&#33;&#45;&#45;more&#45;&#45;&#62;</code> summary divider where you want to split the article.
For [Org mode content][org], use `# more` where you want to split the article.
For [Org mode content][org], use `# more` where you want to split the article.
Content that comes before the summary divider will be used as that content's summary and stored in the `.Summary` page variable with all HTML formatting intact.
+4 -6
View File
@@ -3,12 +3,12 @@ title: Content Types
description: Hugo is built around content organized in sections.
date: 2017-02-01
categories: [content management]
keywords: [lists,sections,content types,types,organization]
keywords: [lists, sections, content types, types, organization]
menu:
docs:
parent: "content-management"
weight: 60
weight: 60 #rem
weight: 60 #rem
draft: false
aliases: [/content/types]
toc: true
@@ -18,7 +18,5 @@ A **content type** is a way to organize your content. Hugo resolves the content
A content type is used to
* Determine how the content is rendered. See [Template Lookup Order](/templates/lookup-order/) and [Content Views](https://gohugo.io/templates/views) for more.
* Determine which [archetype](/content-management/archetypes/) template to use for new content.
- Determine how the content is rendered. See [Template Lookup Order](/templates/lookup-order/) and [Content Views](https://gohugo.io/templates/views) for more.
- Determine which [archetype](/content-management/archetypes/) template to use for new content.
+2 -2
View File
@@ -133,7 +133,7 @@ aliases:
---
{{< /code >}}
Now when you visit any of the locations specified in aliases---i.e., *assuming the same site domain*---you'll be redirected to the page they are specified on. For example, a visitor to `example.com/posts/my-original-url/` will be immediately redirected to `example.com/posts/my-awesome-post/`.
Now when you visit any of the locations specified in aliases---i.e., _assuming the same site domain_---you'll be redirected to the page they are specified on. For example, a visitor to `example.com/posts/my-original-url/` will be immediately redirected to `example.com/posts/my-awesome-post/`.
### Example: Aliases in Multilingual
@@ -148,7 +148,7 @@ aliases:
---
```
From Hugo 0.55 you can also have page-relative aliases, so ` /es/posts/my-original-post/` can be simplified to the more portable `my-original-post/`
From Hugo 0.55 you can also have page-relative aliases, so `/es/posts/my-original-post/` can be simplified to the more portable `my-original-post/`
### How Hugo Aliases Work
+9 -9
View File
@@ -95,7 +95,7 @@ Finally, check again with `git version` if Git was installed successfully.
### Git Graphical Front Ends
There are several [GUI clients](https://git-scm.com/downloads/guis) that help you to operate Git. Not all are available for all operating systems and maybe differ in their usage. Because of this we will document how to use the command line, since the commands are the same everywhere.
There are several [GUI clients](https://git-scm.com/downloads/guis) that help you to operate Git. Not all are available for all operating systems and maybe differ in their usage. Because of this we will document how to use the command-line, since the commands are the same everywhere.
### Install Hub on Your System (Optional)
@@ -140,7 +140,7 @@ cd $HOME/src
git clone https://github.com/gohugoio/hugo.git
```
> Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build.
> Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build.
> The easiest is to clone Hugo in a directory outside of GOPATH
And then, install dependencies of Hugo by running the following in the cloned directory:
@@ -150,7 +150,6 @@ cd $HOME/src/hugo
go install
```
Hugo relies on [mage](https://github.com/magefile/mage) for some convenient build and test targets. If you don't already have it, get it:
```
@@ -169,7 +168,7 @@ Open the [Hugo repository](https://github.com/gohugoio/hugo) on GitHub and click
![Fork button](/images/contribute/development/forking-a-repository.png)
Now open your fork repository on GitHub and copy the remote url of your fork. You can choose between HTTPS and SSH as protocol that Git should use for the following operations. HTTPS works always [if you're not sure](https://help.github.com/articles/which-remote-url-should-i-use/).
Now open your fork repository on GitHub and copy the remote URL of your fork. You can choose between HTTPS and SSH as protocol that Git should use for the following operations. HTTPS works always [if you're not sure](https://help.github.com/articles/which-remote-url-should-i-use/).
![Copy remote url](/images/contribute/development/copy-remote-url.png)
@@ -257,10 +256,11 @@ If you want to install the binary in `$GOPATH/bin`, run
mage install
```
### Test
### Test
Sometimes changes on the codebase can cause unintended side effects. Or they don't work as expected. Most functions have their own test cases. You can find them in files ending with `_test.go`.
Make sure the commands
Make sure the commands
```
mage -v check
@@ -268,8 +268,9 @@ mage -v check
passes.
### Formatting
The Go code styleguide maybe is opinionated but it ensures that the codebase looks the same, regardless who wrote the code. Go comes with its own formatting tool. Let's apply the styleguide to our additions:
### Formatting
The Go code style guide maybe is opinionated but it ensures that the codebase looks the same, regardless who wrote the code. Go comes with its own formatting tool. Let's apply the style guide to our additions:
```
mage fmt
@@ -417,7 +418,6 @@ Feel free to [open an issue][newissue] if you think you found a bug or you have
* [The Git Book][gitbook] (Free)
* [Go Bootcamp][gobootcamp]
[codecademy]: https://www.codecademy.com/learn/learn-git
[contributors]: https://github.com/gohugoio/hugo/graphs/contributors
[docscontrib]: /contribute/documentation/
-2
View File
@@ -4,7 +4,6 @@ linktitle: Documentation
description: Documentation is an integral part of any open source project. The Hugo docs are as much a work in progress as the source it attempts to cover.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [contribute]
keywords: [docs,documentation,community, contribute]
menu:
@@ -13,7 +12,6 @@ menu:
weight: 20
weight: 20
sections_weight: 20
draft: false
aliases: [/contribute/docs/]
toc: true
---
+1 -1
View File
@@ -10,7 +10,7 @@ keywords: [markdown,goldmark,render]
signature: [".RenderString MARKUP"]
---
{{< new-in "0.62.0" >}}
{{< new-in "0.62.0" >}}
`.RenderString` is a method on `Page` that renders some markup to HTML using the content renderer defined for that page (if not set in the options).
-5
View File
@@ -22,8 +22,3 @@ Example:
```
The above is an imaginary use case for the home page where you want to display different page listings in sections/boxes on different places on the page: 5 from `news`, 5 from the `blog` and then 10 of the pages not shown in the other listings, to _complement_ them.
+3 -7
View File
@@ -3,7 +3,6 @@ title: dict
description: Creates a dictionary from a list of key and value pairs.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-26
categories: [functions]
menu:
docs:
@@ -25,21 +24,20 @@ Note that the `key` can be either a `string` or a `string slice`. The latter is
{{ $m := dict (slice "a" "b" "c") "value" }}
```
## Example: Using `dict` to pass multiple values to a `partial`
The partial below creates a SVG and expects `fill`, `height` and `width` from the caller:
**Partial definition**
### Partial definition
{{< code file="layouts/partials/svgs/external-links.svg" download="external-links.svg" >}}
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
fill="{{ .fill }}" width="{{ .width }}" height="{{ .height }}" viewBox="0 0 32 32" aria-label="External Link">
<path d="M25.152 16.576v5.696q0 2.144-1.504 3.648t-3.648 1.504h-14.848q-2.144 0-3.648-1.504t-1.504-3.648v-14.848q0-2.112 1.504-3.616t3.648-1.536h12.576q0.224 0 0.384 0.16t0.16 0.416v1.152q0 0.256-0.16 0.416t-0.384 0.16h-12.576q-1.184 0-2.016 0.832t-0.864 2.016v14.848q0 1.184 0.864 2.016t2.016 0.864h14.848q1.184 0 2.016-0.864t0.832-2.016v-5.696q0-0.256 0.16-0.416t0.416-0.16h1.152q0.256 0 0.416 0.16t0.16 0.416zM32 1.152v9.12q0 0.48-0.352 0.8t-0.8 0.352-0.8-0.352l-3.136-3.136-11.648 11.648q-0.16 0.192-0.416 0.192t-0.384-0.192l-2.048-2.048q-0.192-0.16-0.192-0.384t0.192-0.416l11.648-11.648-3.136-3.136q-0.352-0.352-0.352-0.8t0.352-0.8 0.8-0.352h9.12q0.48 0 0.8 0.352t0.352 0.8z"></path>
</svg>
{{< /code >}}
**Partial call**
### Partial call
The `fill`, `height` and `width` values can be stored in one object with `dict` and passed to the partial:
@@ -47,6 +45,4 @@ The `fill`, `height` and `width` values can be stored in one object with `dict`
{{ partial "svgs/external-links.svg" (dict "fill" "#01589B" "width" 10 "height" 20 ) }}
{{< /code >}}
[partials]: /templates/partials/
+1 -1
View File
@@ -93,7 +93,7 @@ More examples can be found in Go's [documentation for the time package][timecons
### Cardinal Numbers and Ordinal Abbreviations
Spelled-out cardinal numbers (e.g. "one", "two", and "three") are not currently supported.
Spelled-out cardinal numbers (e.g. "one", "two", and "three") are not currently supported.
Ordinal abbreviations (i.e., with shorted suffixes like "1st", "2nd", and "3rd") are not currently directly supported. By using `{{.Date.Format "Jan 2nd 2006"}}`, Hugo assumes you want to append `nd` as a string to the day of the month. However, you can chain functions together to create something like this:
+2 -2
View File
@@ -77,10 +77,10 @@ If the `LANG` parameter is blank or an unrecognized language, auto-detect the la
{{% note %}}
Instead of specifying both `lineNos` and `lineNumbersInTable`, you can use the following shorthand notation:
`lineNos=inline`
`lineNos=inline`
: equivalent to `lineNos=true` and `lineNumbersInTable=false`
`lineNos=table`
`lineNos=table`
: equivalent to `lineNos=true` and `lineNumbersInTable=true`
{{% /note %}}
+1 -1
View File
@@ -38,7 +38,7 @@ this purpose.
{{ int ("00987" | strings.TrimLeft "0") }}
```
**Explanation**
### Explanation
The `int` function eventually calls the `ParseInt` function from the Go library
`strconv`.
+1 -1
View File
@@ -45,6 +45,6 @@ To return the absolute permalink to another Output Format of a page:
{{ ref . (dict "path" "about.md" "outputFormat" "rss") }}
```
Hugo emits an error or warning if the page cannot be uniquely resolved. The error behavior is configurable; see [Ref and RelRef Configuration](/content-management/cross-references/#ref-and-relref-configuration).
Hugo emits an error or warning if the page cannot be uniquely resolved. The error behavior is configurable; see [Ref and RelRef Configuration](/content-management/cross-references/#ref-and-relref-configuration).
This function is used by Hugo's built-in [`ref`](/content-management/shortcodes/#ref-and-relref) shortcode. For a detailed explanation of how to leverage this shortcode for content management, see [Links and Cross References](/content-management/cross-references/).
+1 -1
View File
@@ -52,6 +52,6 @@ To return the relative permalink to another Output Format of a page:
{{ relref . (dict "path" "about.md" "outputFormat" "rss") }}
```
Hugo emits an error or warning if the page cannot be uniquely resolved. The error behavior is configurable; see [Ref and RelRef Configuration](/content-management/cross-references/#ref-and-relref-configuration).
Hugo emits an error or warning if the page cannot be uniquely resolved. The error behavior is configurable; see [Ref and RelRef Configuration](/content-management/cross-references/#ref-and-relref-configuration).
This function is used by Hugo's built-in [`relref`](/content-management/shortcodes/#ref-and-relref) shortcode. For a detailed explanation of how to leverage this shortcode for content management, see [Links and Cross References](/content-management/cross-references/).
+1 -1
View File
@@ -77,7 +77,7 @@ Get the value of a given key.
#### .Add
Add a given value to existing value(s) of the given key.
Add a given value to existing value(s) of the given key.
For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the following adds will be appended to that list.
-5
View File
@@ -21,8 +21,3 @@ Example:
The above will print `[1 2 4]`.
Also see https://en.wikipedia.org/wiki/Symmetric_difference
-2
View File
@@ -68,6 +68,4 @@ The preceding partial would then output to the rendered page as follows, assumin
</header>
{{< /output >}}
[singletemplate]: /templates/single-page-templates/
+1 -1
View File
@@ -163,7 +163,7 @@ section names to hard-coded values like `"posts"` or `"post"`.
```
If the user has not set this config parameter in their site config, it
will default to the _section with the most pages_.
will default to the *section with the most pages*.
The user can override the default:
@@ -77,7 +77,7 @@ Note that attributes in [code fences](/content-management/syntax-highlighting/#h
````
autoHeadingIDType ("github") {{< new-in "0.62.2" >}}
: The strategy used for creating auto IDs (anchor names). Available types are `github`, `github-ascii` and `blackfriday`. `github` produces GitHub-compatible IDs, `github-ascii` will drop any non-Ascii characters after accent normalization, and `blackfriday` will make the IDs compatible with [Blackfriday](#blackfriday), the default Markdown engine before Hugo 0.60. Note that if Goldmark is your default Markdown engine, this is also the strategy used in the [anchorize](/functions/anchorize/) template func.
: The strategy used for creating auto IDs (anchor names). Available types are `github`, `github-ascii` and `blackfriday`. `github` produces GitHub-compatible IDs, `github-ascii` will drop any non-Ascii characters after accent normalization, and `blackfriday` will make the IDs compatible with Blackfriday, the default Markdown engine before Hugo 0.60. Note that if Goldmark is your default Markdown engine, this is also the strategy used in the [anchorize](/functions/anchorize/) template func.
### Highlight
+12 -5
View File
@@ -136,9 +136,11 @@ The directory where Hugo finds archetype files (content templates). {{% module-m
The directory where Hugo finds asset files used in [Hugo Pipes](/hugo-pipes/). {{% module-mounts-note %}}
### baseURL
Hostname (and path) to the root, e.g. https://bep.is/
### build
See [Configure Build](#configure-build)
### buildDrafts (false)
@@ -160,6 +162,7 @@ Include content already expired.
Include content with publishdate in the future.
### caches
See [Configure File Caches](#configure-file-caches)
### cascade
@@ -340,6 +343,7 @@ Don't sync permission mode of files.
Don't sync modification time of files.
### outputFormats
See [Configure Output Formats](#configure-additional-output-formats).
### paginate
@@ -355,6 +359,7 @@ Default number of elements per page in [pagination](/templates/pagination/).
The path element used during pagination (`https://example.com/page/2`).
### permalinks
See [Content Management](/content-management/urls/#permalinks).
### pluralizeListTitles
@@ -370,9 +375,10 @@ Pluralize titles in lists.
The directory to where Hugo will write the final static site (the HTML files etc.).
### related
: See [Related Content](/content-management/related/#configure-related-content).{{< new-in "0.27" >}}
### relativeURLs
### relativeURLs
**Default value:** false
@@ -459,6 +465,7 @@ Site title.
See [Configure Title Case](#configure-title-case)
### uglyURLs
When enabled, creates URL of the form `/filename.html` instead of `/filename/`.
### watch
@@ -544,7 +551,7 @@ Content-Security-Policy = "script-src localhost:1313"
{{< new-in "0.72.0" >}}
You can also specify simple redirects rules for the server. The syntax is again similar to Netlify's.
You can also specify simple redirects rules for the server. The syntax is again similar to Netlify's.
Note that a `status` code of 200 will trigger a [URL rewrite](https://docs.netlify.com/routing/redirects/rewrites-proxies/), which is what you want in SPA situations, e.g:
@@ -769,9 +776,9 @@ dir
## Configuration Format Specs
* [TOML Spec][toml]
* [YAML Spec][yaml]
* [JSON Spec][json]
- [TOML Spec][toml]
- [YAML Spec][yaml]
- [JSON Spec][json]
[`.Site.Params`]: /variables/site/
[directory structure]: /getting-started/directory-structure
+4 -4
View File
@@ -300,9 +300,9 @@ If `hugo` is not in your `PATH`:
```
nano ~/.zprofile
```
If your default shell is bash:
```
nano ~/.bash_profile
```
@@ -402,7 +402,7 @@ You'll need a place to store the Hugo executable, your [content][], and the gene
Now you need to add Hugo to your Windows PATH settings:
#### For Windows 10 Users:
#### For Windows 10 Users
* Right click on the **Start** button.
* Click on **System**.
@@ -412,7 +412,7 @@ Now you need to add Hugo to your Windows PATH settings:
* Click the **Browse...** button and select the directory to which `hugo.exe` was extracted, which is `C:\Hugo\bin` if you went by the instructions above. *The path entry should be the folder where Hugo lives and not the binary itself.*
* Click OK at every window to exit.
#### For Windows 7 and 8.x users:
#### For Windows 7 and 8.x users
Windows 7 and 8.1 do not include the easy path editor included in Windows 10, so non-technical users on those platforms are advised to install a free third-party path editor like [Windows Environment Variables Editor].
+1 -1
View File
@@ -176,7 +176,7 @@ Hugo injects the LiveReload `<script>` before the closing `</body>` in your temp
### Redirect automatically to the page you just saved
When you are working with more than one document and want to see the markup as real-time as possible it's not ideal to keep jumping between them.
When you are working with more than one document and want to see the markup as real-time as possible it's not ideal to keep jumping between them.
Fortunately Hugo has an easy, embedded and simple solution for this. It's the flag `--navigateToChanged`.
### Disable LiveReload
@@ -61,4 +61,5 @@ Every deploy automatically and instantly invalidates the CDN cache, so your user
Add your own domains to your site easily using 21YunBox's [custom domains](https://www.21yunbox.com/docs/#/custom-domains) guide.
## Support
Click [here](https://www.21yunbox.com/docs/#/contact) to contact with 21YunBox' experts if you need help.
@@ -37,7 +37,7 @@ AWS Amplify is a combination of client library, CLI toolchain, and a Console for
1. Connect a branch from your GitHub, Bitbucket, GitLab, or AWS CodeCommit repository. Connecting your repository allows Amplify to deploy updates on every code commit to a branch.
![Hugo Amplify](/images/hosting-and-deployment/hosting-on-aws-amplify/amplify-connect-repo.gif)
1. Accept the default build settings. The Amplify Console automatically detects your Hugo build settings and output directory.
1. Accept the default build settings. The Amplify Console automatically detects your Hugo build settings and output directory.
![Hugo Amplify](/images/hosting-and-deployment/hosting-on-aws-amplify/amplify-build-settings.png)
1. Review your changes and then choose **Save and deploy**. The Amplify Console will pull code from your repository, build changes to the backend and frontend, and deploy your build artifacts at `https://master.unique-id.amplifyapp.com`. Bonus: Screenshots of your app on different devices to find layout issues.
@@ -38,11 +38,13 @@ Log in to Firebase (setup on your local machine) using `firebase login`, which o
```
firebase login
```
In the root of your Hugo project, initialize the Firebase project with the `firebase init` command:
```
firebase init
```
From here:
1. Choose Hosting in the feature question
@@ -63,12 +65,11 @@ hugo && firebase deploy
You can generate a deploy token using
```
firebase login:ci
```
You can also set up your CI (e.g., with [Wercker][]) and add the token to a private variable like `$FIREBASE_DEPLOY_TOKEN`.
You can also set up your CI (e.g., with Wercker) and add the token to a private variable like `$FIREBASE_DEPLOY_TOKEN`.
{{% note %}}
This is a private secret and it should not appear in a public repository. Make sure you understand your chosen CI and that it's not visible to others.
@@ -142,7 +142,6 @@ You now have a live website served over HTTPS, distributed through CDN, and conf
2. [Setting up HTTPS on Custom Domains][httpscustom]
3. [Redirects and Rewrite Rules][]
[app.netlify.com]: https://app.netlify.com
[build command]: /getting-started/usage/#the-hugo-command
[config]: /getting-started/configuration/
@@ -37,9 +37,9 @@ Static sites are **completely free** on Render and include the following:
## Assumptions
* You have an account with GitHub or GitLab.
* You have completed the [Quick Start][] or have a Hugo website you are ready to deploy and share with the world.
* You have a Render account. You can sign up at https://render.com/register.
- You have an account with GitHub or GitLab.
- You have completed the [Quick Start][] or have a Hugo website you are ready to deploy and share with the world.
- You have a Render account. You can sign up at https://render.com/register.
## Deployment
+1 -4
View File
@@ -26,7 +26,6 @@ replacements = ""
workspace = ""
{{< /code-toggle >}}
noVendor {{< new-in "0.75.0" >}}
: A optional Glob pattern matching module paths to skip when vendoring, e.g. "github.com/**"
@@ -113,7 +112,6 @@ noVendor
{{< gomodules-info >}}
## Module Config: mounts
{{% note %}}
@@ -160,7 +158,7 @@ lang
: The language code, e.g. "en". Only relevant for `content` mounts, and `static` mounts when in multihost mode.
includeFiles (string or slice)
: One or more [glob](https://github.com/gobwas/glob) patterns matching files or directories to include. If `excludeFiles` is not set, the files matching `includeFiles` will be the files mounted.
: One or more [glob](https://github.com/gobwas/glob) patterns matching files or directories to include. If `excludeFiles` is not set, the files matching `includeFiles` will be the files mounted.
The glob patterns are matched to the filenames starting from the `source` root, they should have Unix styled slashes even on Windows, `/` matches the mount root and `**` can be used as a super-asterisk to match recursively down all directories, e.g `/posts/**.jpg`.
@@ -170,4 +168,3 @@ The search is case-insensitive.
excludeFiles (string or slice)
: One or more glob patterns matching files to exclude.
+1 -1
View File
@@ -46,4 +46,4 @@ Also note that a component that is part of a theme can have its own configuratio
The same rules apply here: The left-most param/menu etc. with the same ID will win. There are some hidden and experimental namespace support in the above, which we will work to improve in the future, but theme authors are encouraged to create their own namespaces to avoid naming conflicts.
[^1]: For themes hosted on the [Hugo Themes Showcase](https://themes.gohugo.io/) components need to be added as git submodules that point to the directory `exampleSite/themes`
[^1]: For themes hosted on the [Hugo Themes Showcase](https://themes.gohugo.io/) components need to be added as git submodules that point to the directory `exampleSite/themes`
-1
View File
@@ -93,7 +93,6 @@ Note that since v.0.77.0 you can use modules config [`replacements`](https://goh
## Print Dependency Graph
Use `hugo mod graph` from the relevant module directory and it will print the dependency graph, including vendoring, module replacement or disabled status.
E.g.:
-1
View File
@@ -22,7 +22,6 @@ Hugo Pipe's Babel requires the `@babel/cli` and `@babel/core` JavaScript package
If you are using the Hugo Snap package, Babel and plugin(s) need to be installed locally within your Hugo site directory, e.g., `npm install @babel/cli @babel/core --save-dev` without the `-g` flag.
{{% /note %}}
### Config
{{< new-in "v0.75.0" >}}
+1 -4
View File
@@ -31,10 +31,8 @@ Note that you can mount any directory into Hugo's virtual `assets` folder using
| `resources.GetMatch` | `GetMatch` finds the first Resource matching the given pattern, or nil if none found. See Match for a more complete explanation about the rules used. |
| `resources.Match` | `Match` gets all resources matching the given base path prefix, e.g "*.png" will match all png files. The "*" does not match path delimiters (/), so if you organize your resources in sub-folders, you need to be explicit about it, e.g.: "images/*.png". To match any PNG image anywhere in the bundle you can do "\*\*.png", and to match all PNG images below the images folder, use "images/\*\*.jpg". The matching is case insensitive. Match matches by using the files name with path relative to the file system root with Unix style slashes (/) and no leading slash, e.g. "images/logo.png". See https://github.com/gobwas/glob for the full rules set.|
See the [GoDoc Page](https://pkg.go.dev/github.com/gohugoio/hugo@v0.93.1/tpl/resources) for the `resources` package for an up to date overview of all template functions in this namespace.
## Get Resource with resources.Get and resources.GetRemote
In order to process an asset with Hugo Pipes, it must be retrieved as a `Resource` using `resources.Get` or `resources.GetRemote`.
@@ -68,7 +66,6 @@ With `resources.GetRemote`, the first argument is a remote URL:
By default, Hugo calculates a cache key based on the `URL` and the `options` (e.g. headers) given.
{{< new-in "0.97.0" >}} You can override this by setting a `key` in the options map. This can be used to get more fine grained control over how often a remote resource is fetched, e.g.:
@@ -156,7 +153,7 @@ The example above can therefore also be written as follows:
## Caching
Hugo Pipes invocations are cached based on the entire _pipe chain_.
Hugo Pipes invocations are cached based on the entire *pipe chain*.
An example of a pipe chain is:
-3
View File
@@ -3,7 +3,6 @@ title: Asset minification
description: Hugo Pipes allows the minification of any CSS, JS, JSON, HTML, SVG or XML resource.
date: 2018-07-14
publishdate: 2018-07-14
lastmod: 2018-07-14
categories: [asset management]
keywords: []
menu:
@@ -15,10 +14,8 @@ sections_weight: 50
draft: false
---
Any resource of the aforementioned types can be minified using `resources.Minify` which takes for argument the resource object.
```go-html-template
{{ $css := resources.Get "css/main.css" }}
{{ $style := $css | resources.Minify }}
@@ -4,7 +4,6 @@ linkTitle: Resource from String
description: Hugo Pipes allows the creation of a resource from a string.
date: 2018-07-14
publishdate: 2018-07-14
lastmod: 2018-07-14
categories: [asset management]
keywords: []
menu:
@@ -13,7 +12,6 @@ menu:
weight: 90
weight: 90
sections_weight: 90
draft: false
---
It is possible to create a resource directly from the template using `resources.FromString` which takes two arguments, the given string and the resource target path.
@@ -4,7 +4,6 @@ linkTitle: Resource from Template
description: Hugo Pipes allows the creation of a resource from an asset file using Go Template.
date: 2018-07-14
publishdate: 2018-07-14
lastmod: 2018-07-14
categories: [asset management]
keywords: []
menu:
@@ -13,7 +12,6 @@ menu:
weight: 80
weight: 80
sections_weight: 80
draft: false
---
In order to use Hugo Pipes function on an asset file containing Go Template magic the function `resources.ExecuteAsTemplate` must be used.
@@ -25,13 +23,12 @@ The function takes three arguments: the resource target path, the template conte
$backgroundColor: {{ .Param "backgroundColor" }};
$textColor: {{ .Param "textColor" }};
body{
background-color:$backgroundColor;
color: $textColor;
background-color:$backgroundColor;
color: $textColor;
}
// [...]
```
```go-html-template
{{ $sassTemplate := resources.Get "sass/template.scss" }}
{{ $style := $sassTemplate | resources.ExecuteAsTemplate "main.scss" . | resources.ToCSS }}
-7
View File
@@ -1,4 +1,3 @@
---
date: 2021-11-17
title: "Hugo 0.89.4: One Bug Fix"
@@ -6,14 +5,8 @@ description: "This version fixes one bug introduced in 0.89.0."
categories: ["Releases"]
images:
- images/blog/hugo-bug-poster.png
---
This is a bug-fix release with one important fix for people using `hugo new` to create new content:
* Fix content dir resolution when main project is a Hugo Module [2e70f61f](https://github.com/gohugoio/hugo/commit/2e70f61fb04cea08ef6598728a57637ae2cc199c) [@bep](https://github.com/bep) [#9177](https://github.com/gohugoio/hugo/issues/9177)
+1 -1
View File
@@ -84,4 +84,4 @@ In conjunction with the [`dateFormat` function][dateFormat], you can also conver
[dateFormat]: /functions/dateformat/
[gdex]: https://golang.org/pkg/time/#example_Time_Format
[pagevars]: /variables/page/
[time]: https://golang.org/pkg/time/
[time]: https://golang.org/pkg/time/
-2
View File
@@ -4,7 +4,6 @@ linktitle: Alternative Templating
description: DEPRECATED - Support for Ace & Amber templating has been removed in version 0.62
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-20
categories: [templates]
keywords: [amber,ace,templating languages]
menu:
@@ -13,7 +12,6 @@ menu:
weight: 170
weight: 170
sections_weight: 170
draft: false
aliases: [/templates/ace/,/templates/amber/]
toc: true
---
-1
View File
@@ -4,7 +4,6 @@ linktitle:
description: The base and block constructs allow you to define the outer shell of your master templates (i.e., the chrome of the page).
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [templates,fundamentals]
keywords: [blocks,base]
menu:
+1 -3
View File
@@ -43,7 +43,7 @@ To use the `readFile` function in your templates, make sure the path is relative
### `readFile` Example: Add a Project File to Content
As `readFile` is a function, it is only available to you in your templates and not your content. However, we can create a simple [shortcode template][sct] that calls `readFile`, passes the first argument through the function, and then allows an optional second argument to send the file through the markdown processor. The pattern for adding this shortcode to your content will be as follows:
As `readFile` is a function, it is only available to you in your templates and not your content. However, we can create a simple [shortcode template][sct] that calls `readFile`, passes the first argument through the function, and then allows an optional second argument to send the file through the Markdown processor. The pattern for adding this shortcode to your content will be as follows:
```
{{</* readfile file="/path/to/local/file.txt" markdown="true" */>}}
@@ -53,8 +53,6 @@ As `readFile` is a function, it is only available to you in your templates and n
If you are going to create [custom shortcodes](/templates/shortcode-templates/) with `readFile` for a theme, note that usage of the shortcode will refer to the project root and *not* your `themes` directory.
{{% /warning %}}
[called directly in the Hugo docs]: https://github.com/gohugoio/hugoDocs/blob/master/content/en/templates/files.md
[dirindex]: https://github.com/gohugoio/hugo/blob/master/docs/layouts/shortcodes/directoryindex.html
[osfileinfo]: https://golang.org/pkg/os/#FileInfo
+1
View File
@@ -127,6 +127,7 @@ You can then render your custom Disqus partial template as follows:
```
## Open Graph
An internal template for the [Open Graph protocol](https://ogp.me/), metadata that enables a page to become a rich object in a social graph.
This format is used for Facebook and some other sites.
+5 -4
View File
@@ -107,6 +107,7 @@ The custom variables need to be prefixed with `$`.
{{ $address := "123 Main St." }}
{{ $address }}
```
Variables can be re-defined using the `=` operator. The example below
prints "Var is Hugo Home" on the home page, and "Var is Hugo Page" on
all other pages:
@@ -159,7 +160,7 @@ within Hugo.
### Partial
The [`partial`][partials] function is used to include *partial* templates using
The [`partial`][partials] function is used to include _partial_ templates using
the syntax `{{ partial "<PATH>/<PARTIAL>.<EXTENSION>" . }}`.
Example of including a `layouts/partials/header.html` partial:
@@ -170,9 +171,9 @@ Example of including a `layouts/partials/header.html` partial:
### Template
The `template` function was used to include *partial* templates
The `template` function was used to include _partial_ templates
in much older Hugo versions. Now it's useful only for calling
[*internal* templates][internal templates]. The syntax is `{{ template
[_internal_ templates][internal templates]. The syntax is `{{ template
"_internal/<TEMPLATE>.<EXTENSION>" . }}`.
{{% note %}}
@@ -234,7 +235,7 @@ key.
{{ end }}
```
#### Example 5: Conditional on empty _map_, _array_, or _slice_.
#### Example 5: Conditional on empty _map_, _array_, or _slice_
If the _map_, _array_, or _slice_ passed into the range is zero-length then the else statement is evaluated.
+1 -1
View File
@@ -39,7 +39,7 @@ 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 `index.amp.html` will be chosen before `index.fr.html`.
Type
: Is value of `type` if set in front matter, else it is the name of the root section (e.g. "blog"). It will always have a value, so if not set, the value is "page".
: Is value of `type` if set in front matter, else it is the name of the root section (e.g. "blog"). It will always have a value, so if not set, the value is "page".
Section
: Is relevant for `section`, `taxonomy` and `term` types.
-1
View File
@@ -93,7 +93,6 @@ The _shadow_ implies that the pages isn't represented by a menu-item themselves,
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.
## 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 file:
@@ -4,7 +4,6 @@ linktitle: List Ordering and Grouping
description: You can group or order your content in both your templating and content front matter.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [templates]
keywords: []
menu:
@@ -25,7 +24,7 @@ In Hugo, a list template is any template that will be used to render multiple pi
### Section Template
This list template is used for [spf13.com](https://spf13.com/). It makes use of [partial templates][partials]. All examples use a [view](/templates/views/) called either "li" or "summary."
This list template is used for [spf13.com](https://spf13.com/). It makes use of [partial templates](/templates/partials/). All examples use a [view](/templates/views/) called either "li" or "summary."
{{< code file="layouts/section/post.html" >}}
{{ partial "header.html" . }}
@@ -145,7 +144,6 @@ your list templates:
{{ end }}
{{< /code >}}
### By Title
{{< code file="layouts/partials/by-title.html" >}}
@@ -302,7 +300,6 @@ While these are logical defaults, they are not always the desired order. There a
{{ range (.Pages.GroupByDate "2006-01").Reverse }}
```
#### Provide the Alternate Direction
```
@@ -339,6 +336,5 @@ within each group is ordered alphabetically by title.
See the [_Lists/Filtering and Limiting Lists_
section][filteringandlimitinglists] for details.
[views]: /templates/views/
[filteringandlimitinglists]: /templates/lists/#filtering-and-limiting-lists
+2 -1
View File
@@ -135,6 +135,7 @@ A `Page` in Hugo can be rendered to multiple *output formats* on the file
system.
### Default Output Formats
Every `Page` has a [`Kind`][page_kinds] attribute, and the default Output
Formats are set based on that.
@@ -186,7 +187,7 @@ outputs:
---
```
## List Output formats
## List Output formats
Each `Page` has both an `.OutputFormats` (all formats, including the current) and an `.AlternativeOutputFormats` variable, the latter of which is useful for creating a `link rel` list in your site's `<head>`:
-1
View File
@@ -152,7 +152,6 @@ The pages are built on the following form (`BLANK` means no value):
....
```
[`first`]: /functions/first/
[`last`]: /functions/last/
[`after`]: /functions/after/
+1 -1
View File
@@ -78,7 +78,7 @@ This means the partial will *only* be able to access those variables. The partia
## Returning a value from a Partial
In addition to outputting markup, partials can be used to return a value of any type. In order to return a value, a partial must include a lone `return` statement _at the end of the partial_.
In addition to outputting markup, partials can be used to return a value of any type. In order to return a value, a partial must include a lone `return` statement *at the end of the partial*.
### Example GetFeatured
+2 -2
View File
@@ -85,7 +85,7 @@ PlainText
Attributes (map) {{< new-in "0.82.0" >}}
: A map of attributes (e.g. `id`, `class`)
### Link with title Markdown example:
### Link with title Markdown example
```md
[Text](https://www.gohugo.io "Title")
@@ -97,7 +97,7 @@ Here is a code example for how the render-link.html template could look:
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>
{{< /code >}}
### Image Markdown example:
### Image Markdown example
```md
![Text](https://gohugo.io/images/hugo-logo-wide.svg "Title")
+1 -1
View File
@@ -57,7 +57,7 @@ copyright = "This work is licensed under a Creative Commons Attribution-ShareAli
This is the default RSS template that ships with Hugo:
https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml
<https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml>
## Reference your RSS Feed in `<head>`
@@ -107,7 +107,6 @@ Which then returns the following:
<h1>Events</h1>
```
[contentorg]: /content-management/organization/
[getpage]: /functions/getpage/
[lists]: /templates/lists/
+2 -7
View File
@@ -79,7 +79,7 @@ To access a parameter by position, use the `.Get` followed by a numeric position
{{ .Get 0 }}
```
For the second position, you would just use:
For the second position, you would just use:
```
{{ .Get 1 }}
@@ -102,9 +102,7 @@ most helpful when the condition depends on either of the values, or both:
If a closing shortcode is used, the `.Inner` variable will be populated with all of the content between the opening and closing shortcodes. If a closing shortcode is required, you can check the length of `.Inner` as an indicator of its existence.
A shortcode with content declared via the `.Inner` variable can also be declared without the
content and without the closing
by using the self-closing syntax:
A shortcode with content declared via the `.Inner` variable can also be declared without the content and without the closing by using the self-closing syntax:
```
{{</* innershortcode /*/>}}
@@ -349,7 +347,6 @@ This will output the following HTML. Note how the first two `img` shortcodes inh
<img src="/images/three.jpg">
```
## Error Handling in Shortcodes
Use the [errorf](/functions/errorf) template func and [.Position](/variables/shortcodes/) variable to get useful error messages in shortcodes:
@@ -371,7 +368,6 @@ ERROR 2018/11/07 10:05:55 missing value for param name: "/Users/bep/dev/go/gohug
More shortcode examples can be found in the [shortcodes directory for spf13.com][spfscs] and the [shortcodes directory for the Hugo docs][docsshortcodes].
## Inline Shortcodes
{{< new-in "0.52" >}}
@@ -403,7 +399,6 @@ The same inline shortcode can be reused later in the same content file, with dif
```go-text-template
{{</* time.inline /*/>}}
```
[basic content files]: /content-management/formats/ "See how Hugo leverages markdown--and other supported formats--to create content for your website."
[built-in shortcode]: /content-management/shortcodes/
+8 -10
View File
@@ -6,7 +6,7 @@ date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [developer tools]
keywords: [frontend,gui]
keywords: [frontend, gui]
menu:
docs:
parent: "tools"
@@ -18,15 +18,13 @@ aliases: []
toc: false
---
* [enwrite](https://github.com/zzamboni/enwrite). Enwrite enables evernote-powered, statically generated blogs and websites. Now posting to your blog or updating your website is as easy as writing a new note in Evernote!
* [Lipi](https://github.com/SohanChy/Lipi). Lipi is a native GUI frontend written in Java to manage your Hugo websites.
* [Netlify CMS](https://netlifycms.org). Netlify CMS is an open source, serverless solution for managing Git based content in static sites, and it works on any platform that can host static sites. A [Hugo/Netlify CMS starter](https://github.com/netlify-templates/one-click-hugo-cms) is available to get new projects running quickly.
* [Hokus CMS](https://github.com/julianoappelklein/hokus). Hokus CMS is an open source, multi-platform, easy to use, desktop application for Hugo. Build from simple to complex user interfaces for Hugo websites by choosing from a dozen ready-to-use components — all for free, with no vendor lock-in.
- [enwrite](https://github.com/zzamboni/enwrite). Enwrite enables evernote-powered, statically generated blogs and websites. Now posting to your blog or updating your website is as easy as writing a new note in Evernote!
- [Lipi](https://github.com/SohanChy/Lipi). Lipi is a native GUI frontend written in Java to manage your Hugo websites.
- [Netlify CMS](https://netlifycms.org). Netlify CMS is an open source, serverless solution for managing Git based content in static sites, and it works on any platform that can host static sites. A [Hugo/Netlify CMS starter](https://github.com/netlify-templates/one-click-hugo-cms) is available to get new projects running quickly.
- [Hokus CMS](https://github.com/julianoappelklein/hokus). Hokus CMS is an open source, multi-platform, easy to use, desktop application for Hugo. Build from simple to complex user interfaces for Hugo websites by choosing from a dozen ready-to-use components — all for free, with no vendor lock-in.
## Commercial Services
* [DATOCMS](https://www.datocms.com) DatoCMS is a fully customizable administrative area for your static websites. Use your favorite website generator, let your clients publish new content independently, and the host the site anywhere you like.
* [Forestry.io](https://forestry.io/). Forestry is a git-backed CMS for Hugo, Gatsby, Jekyll and VuePress websites with support for GitHub, GitLab, Bitbucket and Azure Devops. Forestry provides a nice user interface to edit and model content for non technical editors. It supports S3, Cloudinary and Netlify Large Media integrations for storing media. Every time an update is made via the CMS, Forestry will commit changes back to your repo and vice-versa.
* [CloudCannon](https://cloudcannon.com/hugo-cms/). The intuitive Git-based CMS for your Hugo website. CloudCannon syncs changes from your Git repository and pushes content changes back, so your development and content teams are always in sync. Edit all of your content on the page with visual editing, build entire pages with reusable custom components and then publish confidently.
- [DATOCMS](https://www.datocms.com) DatoCMS is a fully customizable administrative area for your static websites. Use your favorite website generator, let your clients publish new content independently, and the host the site anywhere you like.
- [Forestry.io](https://forestry.io/). Forestry is a git-backed CMS for Hugo, Gatsby, Jekyll and VuePress websites with support for GitHub, GitLab, Bitbucket and Azure Devops. Forestry provides a nice user interface to edit and model content for non technical editors. It supports S3, Cloudinary and Netlify Large Media integrations for storing media. Every time an update is made via the CMS, Forestry will commit changes back to your repo and vice-versa.
- [CloudCannon](https://cloudcannon.com/hugo-cms/). The intuitive Git-based CMS for your Hugo website. CloudCannon syncs changes from your Git repository and pushes content changes back, so your development and content teams are always in sync. Edit all of your content on the page with visual editing, build entire pages with reusable custom components and then publish confidently.
+8 -10
View File
@@ -4,26 +4,24 @@ linktitle: Other Projects
description: Some interesting projects developed by the Hugo community that don't quite fit into our other developer tool categories.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [developer tools]
keywords: [frontend,gui]
keywords: [frontend, gui]
menu:
docs:
parent: "tools"
weight: 70
weight: 70
sections_weight: 70
draft: false
aliases: []
toc: false
---
And for all the other small things around Hugo:
* [hugo-gallery](https://github.com/icecreammatt/hugo-gallery) lets you create an image gallery for Hugo sites.
* [flickr-hugo-embed](https://github.com/nikhilm/flickr-hugo-embed) prints shortcodes to embed a set of images from an album on Flickr into Hugo.
* [hugo-openapispec-shortcode](https://github.com/tenfourty/hugo-openapispec-shortcode) A shortcode that allows you to include [Open API Spec](https://openapis.org) (formerly known as Swagger Spec) in a page.
* [HugoPhotoSwipe](https://github.com/GjjvdBurg/HugoPhotoSwipe) makes it easy to create image galleries using PhotoSwipe.
* [Hugo SFTP Upload](https://github.com/thomasmey/HugoSftpUpload) Syncs the local build of your Hugo website with your remote webserver via SFTP.
* [Emacs Easy Hugo](https://github.com/masasam/emacs-easy-hugo) Emacs package for writing blog posts in markdown or org-mode and building your site with Hugo.
* [JAMStack Themes](https://jamstackthemes.dev/ssg/hugo/). JAMStack themes is a collection of site themes filterable by static site generator and supported CMS to help build CMS-connected sites using Hugo (linking to Hugo-specific themes).
- [hugo-gallery](https://github.com/icecreammatt/hugo-gallery) lets you create an image gallery for Hugo sites.
- [flickr-hugo-embed](https://github.com/nikhilm/flickr-hugo-embed) prints shortcodes to embed a set of images from an album on Flickr into Hugo.
- [hugo-openapispec-shortcode](https://github.com/tenfourty/hugo-openapispec-shortcode) A shortcode that allows you to include [Open API Spec](https://openapis.org) (formerly known as Swagger Spec) in a page.
- [HugoPhotoSwipe](https://github.com/GjjvdBurg/HugoPhotoSwipe) makes it easy to create image galleries using PhotoSwipe.
- [Hugo SFTP Upload](https://github.com/thomasmey/HugoSftpUpload) Syncs the local build of your Hugo website with your remote webserver via SFTP.
- [Emacs Easy Hugo](https://github.com/masasam/emacs-easy-hugo) Emacs package for writing blog posts in markdown or org-mode and building your site with Hugo.
- [JAMStack Themes](https://jamstackthemes.dev/ssg/hugo/). JAMStack themes is a collection of site themes filterable by static site generator and supported CMS to help build CMS-connected sites using Hugo (linking to Hugo-specific themes).
+3 -4
View File
@@ -67,9 +67,9 @@ a string representing HTML.
.Weight
: _int_ <br />
Value of the `weight` key if set for the menu entry. By default the entries in
a menu are sorted ascending by their `weight`. If that key is not set, and if
the menu entry is set in a page front-matter, this value defaults to the page's
Value of the `weight` key if set for the menu entry. By default the entries in
a menu are sorted ascending by their `weight`. If that key is not set, and if
the menu entry is set in a page front-matter, this value defaults to the page's
`.Weight`.
.Parent
@@ -123,6 +123,5 @@ See [`.IsMenuCurrent` method](/functions/ismenucurrent/).
: _(menu string, menuEntry *MenuEntry) boolean_ <br />
See [`.HasMenuCurrent` method](/functions/hasmenucurrent/).
[menu-template]: /templates/menu-templates/
[page-object]: /variables/page/
-3
View File
@@ -129,7 +129,4 @@ You can use `.Site.Params` in a [partial template](/templates/partials/) to call
{{< getcontent path="readfiles/pages-vs-site-pages.md" >}}
[config]: /getting-started/configuration/
+1 -2
View File
@@ -4,7 +4,6 @@ linktitle: Sitemap Variables
description:
date: 2017-03-12
publishdate: 2017-03-12
lastmod: 2017-03-12
categories: [variables and params]
keywords: [sitemap]
draft: false
@@ -29,4 +28,4 @@ A sitemap is a `Page` and therefore has all the [page variables][pagevars] avail
.Sitemap.Filename
: the sitemap filename
[pagevars]: /variables/page/
[pagevars]: /variables/page/