mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-14 20:37:55 -05:00
Merge commit '3902f9a4767fe6e62ac5146728d8311b8cd227e0'
This commit is contained in:
commit
4852a37653
33 changed files with 98 additions and 245 deletions
|
@ -163,7 +163,6 @@
|
|||
"Milli",
|
||||
"Mittwoch",
|
||||
"mkdir",
|
||||
"mmark",
|
||||
"modh",
|
||||
"monokai",
|
||||
"Morling",
|
||||
|
|
|
@ -60,7 +60,7 @@ toc: true
|
|||
[content summaries]: /content-management/summaries/
|
||||
[content types]: /content-management/types/
|
||||
[Disqus]: https://disqus.com/
|
||||
[Dynamic menu]: /templates/menus/
|
||||
[Dynamic menu]: /templates/menu-templates/
|
||||
[Extremely fast]: https://github.com/bep/hugo-benchmark
|
||||
[front matter]: /content-management/front-matter/
|
||||
[functions]: /functions/
|
||||
|
@ -73,13 +73,13 @@ toc: true
|
|||
[organization for your projects]: /getting-started/directory-structure/
|
||||
[pagevars]: /variables/page/
|
||||
[Permalink]: /content-management/urls/#permalinks
|
||||
[Powerful theming]: /themes/
|
||||
[Powerful theming]: /hugo-modules/theme-components/
|
||||
[Pretty URLs]: /content-management/urls/
|
||||
[RSS]: /templates/rss/
|
||||
[Shortcodes]: /content-management/shortcodes/
|
||||
[sort content]: /templates/
|
||||
[supported formats]: /content-management/formats/
|
||||
[Syntax highlighting]: /tools/syntax-highlighting/
|
||||
[Syntax highlighting]: /content-management/syntax-highlighting/
|
||||
[table of contents]: /content-management/toc/
|
||||
[taxonomies]: /content-management/taxonomies/
|
||||
[URLs]: /content-management/urls/
|
||||
|
|
|
@ -64,7 +64,7 @@ These are some alternatives to Disqus:
|
|||
* [Utterances](https://utteranc.es/) (Open source, GitHub comments widget built on GitHub issues)
|
||||
|
||||
[configuration]: /getting-started/configuration/
|
||||
[disquspartial]: /templates/partials/#disqus
|
||||
[disquspartial]: /templates/internal/#disqus
|
||||
[disqussetup]: https://disqus.com/profile/signup/
|
||||
[forum]: https://discourse.gohugo.io
|
||||
[front matter]: /content-management/front-matter/
|
||||
|
|
|
@ -5,7 +5,7 @@ description: Both HTML and Markdown are supported content formats.
|
|||
date: 2017-01-10
|
||||
publishdate: 2017-01-10
|
||||
categories: [content management]
|
||||
keywords: [markdown,asciidoc,mmark,pandoc,content format]
|
||||
keywords: [markdown,asciidoc,pandoc,content format]
|
||||
menu:
|
||||
docs:
|
||||
parent: "content-management"
|
||||
|
@ -30,7 +30,6 @@ The current list of content formats in Hugo:
|
|||
| ------------- | ------------- |-------------|
|
||||
| Goldmark | md, markdown, goldmark |Note that you can set the default handler of `md` and `markdown` to something else, see [Configure Markup](/getting-started/configuration-markup/).{{< new-in "0.60.0" >}} |
|
||||
| Blackfriday | blackfriday |Blackfriday will eventually be deprecated.|
|
||||
|MMark|mmark|Mmark is deprecated and will be removed in a future release.|
|
||||
|Emacs Org-Mode|org|See [go-org](https://github.com/niklasfasching/go-org).|
|
||||
|AsciiDoc|asciidocext, adoc, ad|Needs [Asciidoctor][ascii] installed.|
|
||||
|RST|rst|Needs [RST](https://docutils.sourceforge.io/rst.html) installed.|
|
||||
|
@ -131,7 +130,6 @@ Markdown syntax is simple enough to learn in a single sitting. The following are
|
|||
[ascii]: https://asciidoctor.org/
|
||||
[bfconfig]: /getting-started/configuration/#configuring-blackfriday-rendering
|
||||
[blackfriday]: https://github.com/russross/blackfriday
|
||||
[mmark]: https://github.com/miekg/mmark
|
||||
[config]: /getting-started/configuration/
|
||||
[developer tools]: /tools/
|
||||
[emojis]: https://www.webpagefx.com/tools/emoji-cheat-sheet/
|
||||
|
@ -146,7 +144,6 @@ Markdown syntax is simple enough to learn in a single sitting. The following are
|
|||
[mdcheatsheet]: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet
|
||||
[mdguide]: https://www.markdownguide.org/
|
||||
[mdtutorial]: https://www.markdowntutorial.com/
|
||||
[Miek Gieben's website]: https://miek.nl/2016/march/05/mmark-syntax-document/
|
||||
[org]: https://orgmode.org/
|
||||
[pandoc]: https://www.pandoc.org/
|
||||
[rest]: https://docutils.sourceforge.io/rst.html
|
||||
|
|
|
@ -92,7 +92,7 @@ keywords
|
|||
: the meta keywords for the content.
|
||||
|
||||
layout
|
||||
: the layout Hugo should select from the [lookup order][lookup] when rendering the content. If a `type` is not specified in the front matter, Hugo will look for the layout of the same name in the layout directory that corresponds with a content's section. See ["Defining a Content Type"][definetype]
|
||||
: the layout Hugo should select from the [lookup order][lookup] when rendering the content. If a `type` is not specified in the front matter, Hugo will look for the layout of the same name in the layout directory that corresponds with a content's section. See [Content Types][content type].
|
||||
|
||||
lastmod
|
||||
: the datetime at which the content was last modified.
|
||||
|
@ -232,10 +232,9 @@ It's possible to set some options for Markdown rendering in a content's front ma
|
|||
[config]: /getting-started/configuration/ "Hugo documentation for site configuration"
|
||||
[content type]: /content-management/types/
|
||||
[contentorg]: /content-management/organization/
|
||||
[definetype]: /content-management/types/#defining-a-content-type "Learn how to specify a type and a layout in a content's front matter"
|
||||
[headless-bundle]: /content-management/page-bundles/#headless-bundle
|
||||
[json]: https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf "Specification for JSON, JavaScript Object Notation"
|
||||
[lists]: /templates/lists/#ordering-content "See how to order content in list pages; for example, templates that look to specific _index.md for content and front matter."
|
||||
[lists]: /templates/lists/#order-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"
|
||||
|
|
|
@ -571,7 +571,7 @@ If there is more than one language defined, the `LanguagePrefix` variable will e
|
|||
[lang.FormatAccounting]: /functions/lang/#langformataccounting
|
||||
[lang.FormatCurrency]: /functions/lang/#langformatcurrency
|
||||
[lang.FormatNumber]: /functions/lang/#langformatnumber
|
||||
[lang.FormatNumberCustom]: functions/lang/#langformatnumbercustom
|
||||
[lang.FormatNumberCustom]: /functions/lang/#langformatnumbercustom
|
||||
[lang.FormatPercent]: /functions/lang/#langformatpercent
|
||||
[lang.Merge]: /functions/lang.merge/
|
||||
[menus]: /content-management/menus/
|
||||
|
|
|
@ -183,7 +183,7 @@ To demonstrate the remarkably efficiency of Hugo's shortcode feature, we have em
|
|||
|
||||
### `highlight`
|
||||
|
||||
This shortcode will convert the source code provided into syntax-highlighted HTML. Read more on [highlighting](/tools/syntax-highlighting/). `highlight` takes exactly one required `language` parameter and requires a closing shortcode.
|
||||
This shortcode will convert the source code provided into syntax-highlighted HTML. Read more on [highlighting](/content-management/syntax-highlighting/). `highlight` takes exactly one required `language` parameter and requires a closing shortcode.
|
||||
|
||||
#### Example `highlight` Input
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ Moonrise Kingdom <- Value
|
|||
|
||||
Hugo natively supports taxonomies.
|
||||
|
||||
Without adding a single line to your [site config][config] file, Hugo will automatically create taxonomies for `tags` and `categories`. That would be the same as manually [configuring your taxonomies](#configuring-taxonomies) as below:
|
||||
Without adding a single line to your [site config][config] file, Hugo will automatically create taxonomies for `tags` and `categories`. That would be the same as manually [configuring your taxonomies](#configure-taxonomies) as below:
|
||||
|
||||
{{< code-toggle copy="false" >}}
|
||||
[taxonomies]
|
||||
|
@ -189,7 +189,7 @@ categories_weight = 44
|
|||
By using taxonomic weight, the same piece of content can appear in different positions in different taxonomies.
|
||||
|
||||
{{% note "Limits to Ordering Taxonomies" %}}
|
||||
Currently taxonomies only support the [default `weight => date` ordering of list content](/templates/lists/#default-weight-date). For more information, see the documentation on [taxonomy templates](/templates/taxonomy-templates/).
|
||||
Currently taxonomies only support the [default `weight => date` ordering of list content](/templates/lists/#default-weight--date--linktitle--filepath). For more information, see the documentation on [taxonomy templates](/templates/taxonomy-templates/).
|
||||
{{% /note %}}
|
||||
|
||||
## Add custom metadata to a Taxonomy or Term
|
||||
|
@ -209,7 +209,7 @@ wikipedia: "https://en.wikipedia.org/wiki/Bruce_Willis"
|
|||
[content type]: /content-management/types/
|
||||
[documentation on archetypes]: /content-management/archetypes/
|
||||
[front matter]: /content-management/front-matter/
|
||||
[taxonomy list templates]: /templates/taxonomy-templates/#taxonomy-page-templates
|
||||
[taxonomy list templates]: /templates/taxonomy-templates/#taxonomy-list-templates
|
||||
[taxonomy templates]: /templates/taxonomy-templates/
|
||||
[terms within the taxonomy]: /templates/taxonomy-templates/#taxonomy-terms-templates "See how to order terms associated with a taxonomy"
|
||||
[config]: /getting-started/configuration/
|
||||
|
|
|
@ -49,10 +49,6 @@ Hugo will take this Markdown and create a table of contents from `## Introductio
|
|||
|
||||
The built-in `.TableOfContents` variables outputs a `<nav id="TableOfContents">` element with a child `<ul>`, whose child `<li>` elements begin with appropriate HTML headings. See [the available settings](/getting-started/configuration-markup/#table-of-contents) to configure what heading levels you want to include in TOC.
|
||||
|
||||
{{% note "Table of contents not available for MMark" %}}
|
||||
Hugo documents created in the [MMark](/content-management/formats/#mmark) Markdown dialect do not currently display TOCs. TOCs are, however, compatible with all other supported Markdown formats.
|
||||
{{% /note %}}
|
||||
|
||||
## Template Example: Basic TOC
|
||||
|
||||
The following is an example of a very basic [single page template][]:
|
||||
|
|
|
@ -175,7 +175,7 @@ Assuming a `baseURL` of `example.com`, the contents of the auto-generated alias
|
|||
</html>
|
||||
```
|
||||
|
||||
The `http-equiv="refresh"` line is what performs the redirect, in 0 seconds in this case. If an end user of your website goes to `https://example.com/posts/my-old-url`, they will now be automatically redirected to the newer, correct URL. The addition of `<meta name="robots" content="noindex">` lets search engine bots know that they should not crawl and index your new alias page.
|
||||
The `http-equiv="refresh"` line is what performs the redirect, in 0 seconds in this case. If an end user of your website goes to `https://example.com/posts/my-old-url`, they will now be automatically redirected to the newer, correct URL. The addition of `<meta name="robots" content="noindex">` lets search engine bots know that they should not index your alias page (`https://example.com/posts/my-old-url/`).
|
||||
|
||||
### Customize
|
||||
|
||||
|
|
|
@ -416,7 +416,6 @@ Feel free to [open an issue][newissue] if you think you found a bug or you have
|
|||
* [Code School and GitHub's "Try Git" Tutorial][trygit] (Free)
|
||||
* [The Git Book][gitbook] (Free)
|
||||
* [Go Bootcamp][gobootcamp]
|
||||
* [GitHub Pull Request Tutorial, Thinkful][thinkful]
|
||||
|
||||
|
||||
[codecademy]: https://www.codecademy.com/learn/learn-git
|
||||
|
@ -432,5 +431,4 @@ Feel free to [open an issue][newissue] if you think you found a bug or you have
|
|||
[newissue]: https://github.com/gohugoio/hugo/issues/new
|
||||
[releases]: /getting-started/
|
||||
[setupgopath]: https://golang.org/doc/code.html#Workspaces
|
||||
[thinkful]: https://www.thinkful.com/learn/github-pull-request-tutorial/
|
||||
[trygit]: https://try.github.io/levels/1/challenges/1
|
||||
|
|
|
@ -86,7 +86,7 @@ Here is a review of the front matter fields automatically generated for you usin
|
|||
`{{.Content}}`
|
||||
: an extended description of the new function; examples are not only welcomed but encouraged.
|
||||
|
||||
In the body of your function, expand the short description used in the front matter. Include as many examples as possible, and leverage the Hugo docs [`code` shortcode](#adding-code-blocks). If you are unable to add examples but would like to solicit help from the Hugo community, add `needsexample: true` to your front matter.
|
||||
In the body of your function, expand the short description used in the front matter. Include as many examples as possible, and leverage the Hugo docs [`code` shortcode](#add-code-blocks). If you are unable to add examples but would like to solicit help from the Hugo community, add `needsexample: true` to your front matter.
|
||||
|
||||
## Add Code Blocks
|
||||
|
||||
|
|
|
@ -19,3 +19,4 @@ layout: documentation-home
|
|||
Hugo is the **world's fastest static website engine.** It's written in Go (aka Golang) and developed by [bep](https://github.com/bep), [spf13](https://github.com/spf13) and [friends](https://github.com/gohugoio/hugo/graphs/contributors).
|
||||
|
||||
Below you will find some of the most common and helpful pages from our documentation.
|
||||
foo
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: .AddDate
|
||||
description: Returns the time corresponding to adding the given number of years, months, and days passed to the function.
|
||||
description: Returns the time corresponding to adding the given number of years, months, and days to the given time.Time value.
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
|
@ -17,35 +17,29 @@ deprecated: false
|
|||
aliases: []
|
||||
---
|
||||
|
||||
```go-html-template
|
||||
{{ $d := "2022-01-01" | time.AsTime }}
|
||||
|
||||
The `AddDate` function takes three arguments in logical order of `years`, `months`, and `days`.
|
||||
{{ $d.AddDate 0 0 1 | time.Format "2006-01-02" }} --> 2022-01-02
|
||||
{{ $d.AddDate 0 1 1 | time.Format "2006-01-02" }} --> 2022-02-02
|
||||
{{ $d.AddDate 1 1 1 | time.Format "2006-01-02" }} --> 2023-02-02
|
||||
|
||||
## Example: Randomized Tweets from the Last 2 Years
|
||||
{{ $d.AddDate -1 -1 -1 | time.Format "2006-01-02" }} --> 2020-11-30
|
||||
```
|
||||
|
||||
Let's assume you have a file at `data/tweets.toml` that contains a list of Tweets to display on your site's homepage. The file is filled with `[[tweet]]` blocks; e.g.---
|
||||
{{% note %}}
|
||||
When adding months or years, Hugo normalizes the final `time.Time` value if the resulting day does not exist. For example, adding one month to 31 January produces 2 March or 3 March, depending on the year.
|
||||
|
||||
{{< code-toggle file="data/tweets" >}}
|
||||
[[tweet]]
|
||||
name = "Steve Francia"
|
||||
twitter_handle = "@spf13"
|
||||
quote = "I'm creator of Hugo. #metadocreference"
|
||||
link = "https://twitter.com/spf13"
|
||||
date = "2017-01-07T00:00:00Z"
|
||||
{{< /code-toggle >}}
|
||||
See [this explanation](https://github.com/golang/go/issues/31145#issuecomment-479067967) from the Go team.
|
||||
{{% /note %}}
|
||||
|
||||
Let's assume you want to grab Tweets from the last two years and present them in a random order. In conjunction with the [`where`](/functions/where/) and [`now`](/functions/now/) functions, you can limit our range to the last two years via `now.AddDate -2 0 0`, which represents a point in time 2 years, 0 months, and 0 days before the time of your last site build.
|
||||
```go-html-template
|
||||
{{ $d := "2023-01-31" | time.AsTime }}
|
||||
{{ $d.AddDate 0 1 0 | time.Format "2006-01-02" }} --> 2023-03-03
|
||||
|
||||
{{< code file="partials/templates/random-tweets.html" download="tweets.html" >}}
|
||||
{{ range where $.Site.Data.tweets.tweet "date" "ge" (now.AddDate -2 0 0) | shuffle }}
|
||||
<div class="item">
|
||||
<blockquote>
|
||||
<p>
|
||||
{{ .quote | safeHTML }}
|
||||
</p>
|
||||
— {{ .name }} ({{ .twitter_handle }}) <a href="{{ .link }}">
|
||||
{{ dateFormat "January 2, 2006" .date }}
|
||||
</a>
|
||||
</blockquote>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{< /code >}}
|
||||
{{ $d := "2024-01-31" | time.AsTime }}
|
||||
{{ $d.AddDate 0 1 0 | time.Format "2006-01-02" }} --> 2024-03-02
|
||||
|
||||
{{ $d := "2024-02-29" | time.AsTime }}
|
||||
{{ $d.AddDate 1 0 0 | time.Format "2006-01-02" }} --> 2025-03-01
|
||||
```
|
||||
|
|
|
@ -17,7 +17,7 @@ deprecated: false
|
|||
aliases: []
|
||||
---
|
||||
|
||||
`absLangURL` and `relLangURL` functions are similar to their [`absURL`](/functions/absurl/) and [`relURL`](/functions/relurl/) relatives but will add the correct language prefix when the site is configured with more than one language. (See [Configuring Multilingual][multiliconfig].)
|
||||
`absLangURL` and `relLangURL` functions are similar to their [`absURL`](/functions/absurl/) and [`relURL`](/functions/relurl/) relatives but will add the correct language prefix when the site is configured with more than one language. (See [Configure Languages][multiliconfig].)
|
||||
|
||||
So for a site `baseURL` set to `https://example.com/hugo/` and the current language is `en`:
|
||||
|
||||
|
@ -26,4 +26,4 @@ So for a site `baseURL` set to `https://example.com/hugo/` and the current lang
|
|||
{{ "blog/" | relLangURL }} → "/hugo/en/blog/"
|
||||
```
|
||||
|
||||
[multiliconfig]: /content-management/multilingual/#configuring-multilingual-mode
|
||||
[multiliconfig]: /content-management/multilingual/#configure-languages
|
||||
|
|
|
@ -268,7 +268,7 @@ If true, auto-detect Chinese/Japanese/Korean Languages in the content. This will
|
|||
|
||||
### imaging
|
||||
|
||||
See [Image Processing Config](/content-management/image-processing/#image-processing-config).
|
||||
See [Image Processing Config](/content-management/image-processing/#imaging-configuration).
|
||||
|
||||
### languageCode
|
||||
|
||||
|
@ -390,13 +390,13 @@ See ["Section Menu for Lazy Bloggers"](/templates/menu-templates/#section-menu-f
|
|||
See [Security Policy](/about/security-model/#security-policy)
|
||||
|
||||
### sitemap
|
||||
Default [sitemap configuration](/templates/sitemap-template/#configure-sitemapxml).
|
||||
Default [sitemap configuration](/templates/sitemap-template/#configuration).
|
||||
|
||||
### summaryLength
|
||||
|
||||
**Default value:** 70
|
||||
|
||||
The length of text in words to show in a [`.Summary`](/content-management/summaries/#hugo-defined-automatic-summary-splitting).
|
||||
The length of text in words to show in a [`.Summary`](/content-management/summaries/#automatic-summary-splitting).
|
||||
|
||||
### taxonomies
|
||||
See [Configure Taxonomies](/content-management/taxonomies#configure-taxonomies).
|
||||
|
|
|
@ -48,7 +48,7 @@ By default, Hugo will create new content files with at least `date`, `title` (in
|
|||
: Stores all the files which need be processed by [Hugo Pipes]({{< ref "/hugo-pipes" >}}). Only the files whose `.Permalink` or `.RelPermalink` are used will be published to the `public` directory. Note: assets directory is not created by default.
|
||||
|
||||
[`config`](/getting-started/configuration/)
|
||||
: Hugo ships with a large number of [configuration directives](https://gohugo.io/getting-started/configuration/#all-variables-yaml).
|
||||
: Hugo ships with a large number of [configuration directives][].
|
||||
The [config directory](/getting-started/configuration/#configuration-directory) is where those directives are stored as JSON, YAML, or TOML files. Every root setting object can stand as its own file and structured by environments.
|
||||
Projects with minimal settings and no need for environment awareness can use a single `config.toml` file at its root.
|
||||
|
||||
|
@ -76,7 +76,7 @@ resources
|
|||
|
||||
|
||||
[archetypes]: /content-management/archetypes/
|
||||
[configuration directives]: /getting-started/configuration/#all-variables-yaml
|
||||
[configuration directives]: /getting-started/configuration/#all-configuration-settings
|
||||
[`content`]: /content-management/organization/
|
||||
[content section]: /content-management/sections/
|
||||
[content types]: /content-management/types/
|
||||
|
|
|
@ -401,7 +401,7 @@ Now you need to add Hugo to your Windows PATH settings:
|
|||
|
||||
#### For Windows 7 and 8.x users:
|
||||
|
||||
Windows 7 and 8.1 do not include the easy path editor included in Windows 10, so non-technical users on those platforms are advised to install a free third-party path editor like [Windows Environment Variables Editor][Windows Environment Variables Editor] or [Path Editor](https://patheditor2.codeplex.com/).
|
||||
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].
|
||||
|
||||
### Verify the Executable
|
||||
|
||||
|
@ -553,7 +553,6 @@ Now that you've installed Hugo, read the [Quick Start guide][quickstart] and exp
|
|||
[installgit]: https://git-scm.com/
|
||||
[installgo]: https://golang.org/dl/
|
||||
[linuxbrew]: https://docs.brew.sh/Homebrew-on-Linux
|
||||
[Path Editor]: https://patheditor2.codeplex.com/
|
||||
[quickstart]: /getting-started/quick-start/
|
||||
[redhatforum]: https://discourse.gohugo.io/t/solved-fedora-copr-repository-out-of-service/2491
|
||||
[releases]: https://github.com/gohugoio/hugo/releases
|
||||
|
|
|
@ -21,7 +21,7 @@ toc: true
|
|||
{{% note %}}
|
||||
This quick start uses `macOS` in the examples. For instructions about how to install Hugo on other operating systems, see [install](/getting-started/installing).
|
||||
|
||||
It is recommended to have [Git installed](https://git-scm.com/downloads) to run this tutorial.
|
||||
It is required to have [Git installed](https://git-scm.com/downloads) to run this tutorial.
|
||||
|
||||
For other approaches to learning Hugo (like books or video tutorials), refer to the [external learning resources](/getting-started/external-learning-resources/) page.
|
||||
{{% /note %}}
|
||||
|
@ -68,13 +68,6 @@ git init
|
|||
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
|
||||
```
|
||||
|
||||
*Note for non-git users:*
|
||||
- If you do not have git installed, you can download the archive of the latest
|
||||
version of this theme from:
|
||||
https://github.com/theNewDynamic/gohugo-theme-ananke/archive/master.zip
|
||||
- Extract that .zip file to get a "gohugo-theme-ananke-master" directory.
|
||||
- Rename that directory to "ananke", and move it into the "themes/" directory.
|
||||
|
||||
Then, add the theme to the site configuration:
|
||||
|
||||
```bash
|
||||
|
|
|
@ -1,141 +0,0 @@
|
|||
---
|
||||
title: Host on Bitbucket
|
||||
linktitle: Host on Bitbucket
|
||||
description: You can use Bitbucket in conjunction with Aerobatic to build, deploy, and host a Hugo website.
|
||||
date: 2017-02-04
|
||||
publishdate: 2017-02-04
|
||||
lastmod: 2017-02-04
|
||||
categories: [hosting and deployment]
|
||||
keywords: [hosting,bitbucket,deployment,aerobatic]
|
||||
authors: [Jason Gowans]
|
||||
menu:
|
||||
docs:
|
||||
parent: "hosting-and-deployment"
|
||||
weight: 50
|
||||
weight: 50
|
||||
sections_weight: 50
|
||||
draft: false
|
||||
toc: true
|
||||
aliases: [/tutorials/hosting-on-bitbucket/]
|
||||
---
|
||||
|
||||
You can use [Bitbucket](https://bitbucket.org/) and [Aerobatic](https://www.aerobatic.com) to build, deploy, and host a Hugo website. Aerobatic is a static hosting service that integrates with Bitbucket and provides a free hosting tier.
|
||||
|
||||
## Assumptions
|
||||
|
||||
* Working familiarity with Git for version control
|
||||
* A [Bitbucket account](https://bitbucket.org/account/signup/)
|
||||
|
||||
## Install Aerobatic CLI
|
||||
|
||||
If you haven't previously used Aerobatic, you'll first need to install the Command Line Interface (CLI) and create an account. For a list of all commands available, see the [Aerobatic CLI](https://www.aerobatic.com/docs/cli/) docs.
|
||||
|
||||
```
|
||||
npm install aerobatic-cli -g
|
||||
aero register
|
||||
```
|
||||
|
||||
## Create and Deploy Site
|
||||
|
||||
```
|
||||
hugo new site my-new-hugo-site
|
||||
cd my-new-hugo-site
|
||||
cd themes; git clone https://github.com/eliasson/liquorice
|
||||
hugo -t liquorice
|
||||
aero create # create the Aerobatic site
|
||||
hugo --baseURL https://my-new-hugo-site.aerobatic.io # build the site overriding baseURL
|
||||
aero deploy -d public # deploy output to Aerobatic
|
||||
|
||||
Version v1 deployment complete.
|
||||
View now at https://hugo-docs-test.aerobatic.io
|
||||
```
|
||||
|
||||
In the rendered page response, the `https://__baseurl__` will be replaced with your actual site url (in this example, `https://my-new-hugo-site.aerobatic.io`). You can always rename your Aerobatic website with the `aero rename` command.
|
||||
|
||||
## Push Hugo site to Bitbucket
|
||||
|
||||
We will now create a git repository and then push our code to Bitbucket. In Bitbucket, create a repository.
|
||||
|
||||
![Bitbucket Screenshot][1]
|
||||
|
||||
[1]: /images/hosting-and-deployment/hosting-on-bitbucket/bitbucket-create-repo.png
|
||||
|
||||
```
|
||||
# initialize new git repository
|
||||
git init
|
||||
|
||||
# set up our .gitignore file
|
||||
echo -e "/public \n/themes \naero-deploy.tar.gz" >> .gitignore
|
||||
|
||||
# commit and push code to master branch
|
||||
git add --all
|
||||
git commit -m "Initial commit"
|
||||
git remote add origin git@bitbucket.org:YourUsername/my-new-hugo-site.git
|
||||
git push -u origin master
|
||||
```
|
||||
|
||||
## Continuous Deployment With Bitbucket Pipelines
|
||||
|
||||
In the example above, we pushed the compiled assets in the `/public` folder to Aerobatic. In the following example, we use Bitbucket Pipelines to continuously create and deploy the compiled assets to Aerobatic.
|
||||
|
||||
### Step 1: Configure Bitbucket Pipelines
|
||||
|
||||
In your Hugo website's Bitbucket repo;
|
||||
|
||||
1. Click the Pipelines link in the left nav menu of your Bitbucket repository.
|
||||
2. Click the Enable Pipelines button.
|
||||
3. On the next screen, leave the default template and click Next.
|
||||
4. In the editor, paste in the yaml contents below and click Commit.
|
||||
|
||||
```
|
||||
image: beevelop/nodejs-python
|
||||
pipelines:
|
||||
branches:
|
||||
master:
|
||||
- step:
|
||||
script:
|
||||
- apt-get update -y && apt-get install wget
|
||||
- apt-get -y install git
|
||||
- wget https://github.com/gohugoio/hugo/releases/download/v0.18/hugo_0.18-64bit.deb
|
||||
- dpkg -i hugo*.deb
|
||||
- git clone https://github.com/eliasson/liquorice themes/liquorice
|
||||
- hugo --theme=liquorice --baseURL https://__baseurl__ --buildDrafts
|
||||
- npm install -g aerobatic-cli
|
||||
- aero deploy
|
||||
```
|
||||
|
||||
### Step 2: Create `AEROBATIC_API_KEY` environment variable.
|
||||
|
||||
This step only needs to be done once per account. From the command line;
|
||||
|
||||
```
|
||||
aero apikey
|
||||
```
|
||||
|
||||
1. Navigate to the Bitbucket account settings for the account that the website repo belongs to.
|
||||
2. Scroll down to the bottom of the left nav and click the Environment variables link in the PIPELINES section.
|
||||
3. Create a new environment variable called AEROBATIC_API_KEY with the value you got by running the `aero apikey` command. Be sure to click the Secured checkbox.
|
||||
|
||||
### Step 3: Edit and Commit Code
|
||||
|
||||
```
|
||||
hugo new posts/good-to-great.md
|
||||
hugo server --buildDrafts -t liquorice #Check that all looks good
|
||||
|
||||
# commit and push code to master branch
|
||||
git add --all
|
||||
git commit -m "New blog post"
|
||||
git push -u origin master
|
||||
```
|
||||
|
||||
Your code will be committed to Bitbucket, Bitbucket Pipelines will run your build, and a new version of your site will be deployed to Aerobatic.
|
||||
|
||||
At this point, you can now create and edit blog posts directly in the Bitbucket UI.
|
||||
|
||||
![Bitbucket blog Screenshot][2]
|
||||
|
||||
[2]: /images/hosting-and-deployment/hosting-on-bitbucket/bitbucket-blog-post.png
|
||||
|
||||
## Suggested next steps
|
||||
|
||||
The code for this example can be found in this Bitbucket [repository](https://bitbucket.org/dundonian/hugo-docs-test). Aerobatic also provides a number of additional [plugins](https://www.aerobatic.com/docs) such as auth and redirects that you can use for your Hugo site.
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: Host on Cloudflare Pages
|
||||
linktitle: Host on Cloudflare Pages
|
||||
description: Cloudflare Pages can host your Hugo site with CDN, continuous deployment, 1-click HTTPS, an admin GUI, and its own environment variables.
|
||||
date: 2022-04-07
|
||||
publishdate: 2022-04-07
|
||||
categories: [hosting and deployment]
|
||||
menu:
|
||||
docs:
|
||||
parent: "hosting-and-deployment"
|
||||
weight: 50
|
||||
weight: 50
|
||||
sections_weight: 50
|
||||
toc: true
|
||||
---
|
||||
|
||||
You can host your Hugo site using [Cloudflare Pages](https://developers.cloudflare.com/pages/). Pages are super fast, always up-to-date, and deployed directly from your Git provider (currently supports only GitHub and GitLab).
|
||||
|
||||
Cloudflare Pages has a handy tutorial on [how to deploy a Hugo site](https://developers.cloudflare.com/pages/framework-guides/deploy-a-hugo-site/).
|
|
@ -18,7 +18,7 @@ This release represents over 90 code commits from 28 different contributors.
|
|||
- [views](/templates/views/) support in themes
|
||||
- inner [shortcode](/extras/shortcodes/) content now treated as markdown
|
||||
- support for header ids in markdown (# header {#myid})
|
||||
- [where](/templates/lists/#where) template function to filter lists of content, taxonomies, etc
|
||||
- [where](/functions/where/) template function to filter lists of content, taxonomies, etc.
|
||||
- [groupby](/templates/list) & [groupbydate](/templates/list) methods to group pages
|
||||
- taxonomy [pages list](/taxonomies/methods/) now sortable, filterable, limitable & groupable
|
||||
- general cleanup to taxonomies & documentation to make it more clear and consistent
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
**StackImpact** is a production-grade performance profiler for production and development environments.
|
||||
|
||||
The [stackimpact.com](https://stackimpact.com/) website is built with awesome Hugo. Grunt is used for CSS minification and bundling.
|
Binary file not shown.
Before Width: | Height: | Size: 150 KiB |
|
@ -1,16 +0,0 @@
|
|||
---
|
||||
title: StackImpact
|
||||
date: 2018-02-20
|
||||
description: "\"Hugo is a perfect choice for a product website.\""
|
||||
siteURL: https://stackimpact.com/
|
||||
---
|
||||
|
||||
After gradually handing over the control of our website to WordPress plugins, we realized that we needed to act.
|
||||
|
||||
Static web sites have natural advantages such as security, performance and content versioning (e.g. with Git). Static site generators such as Hugo made static websites cool again. Importantly, the best practices of software development (e.g. peer reviews, multi-stage deployments, rollbacks) can now be easily applied to websites.
|
||||
|
||||
Besides the blog and documentation sections, our website needed custom sections with own templates. Hugo supported it beautifully.
|
||||
|
||||
Hugo is written in Go language and uses Go templates. StackImpact is a performance profiler that has an advanced support for Go applications. Being aware of the advantages of Go in terms of speed and productivity, this was another strong reason for choosing Hugo.
|
||||
|
||||
Thanks to all Hugo contributors for making such a beautiful and fast site generator!
|
|
@ -54,6 +54,7 @@ Your 404.html file can be set to load automatically when a visitor enters a mist
|
|||
* Caddy Server. Use the `handle_errors` directive to specify error pages for one or more status codes. [Details here](https://caddyserver.com/docs/caddyfile/directives/handle_errors)
|
||||
* Netlify. Add `/* /404.html 404` to `content/_redirects`. [Details Here](https://www.netlify.com/docs/redirects/#custom-404)
|
||||
* Azure Static website. You can specify the `Error document path` in the Static website configuration page of the Azure portal. [More details are available in the Static website documentation](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website).
|
||||
* DigitalOcean App Platform. You can specify `error_document` in your app specification file or use control panel to set up error document. [Details here](https://docs.digitalocean.com/products/app-platform/references/app-specification-reference/).
|
||||
|
||||
{{% note %}}
|
||||
`hugo server` will not automatically load your custom `404.html` file, but you
|
||||
|
|
|
@ -421,6 +421,8 @@ In the above example, you may want `{{.Title}}` to point the `title` field you h
|
|||
{{ end }}
|
||||
{{< /code >}}
|
||||
|
||||
{{< new-in "0.97.0" >}} `GroupByDate` accepts the same time layouts as in [time.Format](/functions/dateformat/) and The `.Key` in the result will be localized for the current language.
|
||||
|
||||
### By Publish Date
|
||||
|
||||
{{< code file="layouts/partials/by-page-publish-date.html" >}}
|
||||
|
@ -438,6 +440,7 @@ In the above example, you may want `{{.Title}}` to point the `title` field you h
|
|||
{{ end }}
|
||||
{{< /code >}}
|
||||
|
||||
{{< new-in "0.97.0" >}} `GroupByDate` accepts the same time layouts as in [time.Format](/functions/dateformat/) and The `.Key` in the result will be localized for the current language.
|
||||
|
||||
### By Lastmod
|
||||
|
||||
|
@ -456,6 +459,8 @@ In the above example, you may want `{{.Title}}` to point the `title` field you h
|
|||
{{ end }}
|
||||
{{< /code >}}
|
||||
|
||||
{{< new-in "0.97.0" >}} `GroupByDate` accepts the same time layouts as in [time.Format](/functions/dateformat/) and The `.Key` in the result will be localized for the current language.
|
||||
|
||||
### By Expiry Date
|
||||
|
||||
{{< code file="layouts/partials/by-page-expiry-date.html" >}}
|
||||
|
@ -473,6 +478,8 @@ In the above example, you may want `{{.Title}}` to point the `title` field you h
|
|||
{{ end }}
|
||||
{{< /code >}}
|
||||
|
||||
{{< new-in "0.97.0" >}} `GroupByDate` accepts the same time layouts as in [time.Format](/functions/dateformat/) and The `.Key` in the result will be localized for the current language.
|
||||
|
||||
### By Page Parameter
|
||||
|
||||
{{< code file="layouts/partials/by-page-param.html" >}}
|
||||
|
|
|
@ -13,7 +13,7 @@ menu:
|
|||
weight: 20
|
||||
---
|
||||
|
||||
{{< new-in "0.62.0" >}} Note that this is only supported with the [Goldmark](#goldmark) renderer.
|
||||
{{< new-in "0.62.0" >}} Note that this is only supported with the [Goldmark](/getting-started/configuration-markup#goldmark) renderer.
|
||||
|
||||
|
||||
You can override certain parts of the default Markdown rendering to HTML by creating templates with base names `render-{kind}` in `layouts/_default/_markup`.
|
||||
|
|
|
@ -83,7 +83,7 @@ To easily generate new instances of a content type (e.g., new `.md` files in a s
|
|||
[dry]: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself
|
||||
[`.Format` function]: /functions/format/
|
||||
[front matter]: /content-management/front-matter/
|
||||
[pagetaxonomy]: /templates/taxonomy-templates/#displaying-a-single-piece-of-content-s-taxonomies
|
||||
[pagetaxonomy]: /templates/taxonomy-templates/#display-a-single-piece-of-contents-taxonomies
|
||||
[pagevars]: /variables/page/
|
||||
[partials]: /templates/partials/
|
||||
[section]: /content-management/sections/
|
||||
|
|
|
@ -25,8 +25,8 @@ Hugo includes support for user-defined groupings of content called **taxonomies*
|
|||
|
||||
Hugo provides multiple ways to use taxonomies throughout your project templates:
|
||||
|
||||
* Order the way content associated with a taxonomy term is displayed in a [taxonomy list template](#taxonomy-list-template)
|
||||
* Order the way the terms for a taxonomy are displayed in a [taxonomy terms template](#taxonomy-terms-template)
|
||||
* Order the way content associated with a taxonomy term is displayed in a [taxonomy list template](#taxonomy-list-templates)
|
||||
* Order the way the terms for a taxonomy are displayed in a [taxonomy terms template](#taxonomy-terms-templates)
|
||||
* List a single content's taxonomy terms within a [single page template][]
|
||||
|
||||
## Taxonomy List Templates
|
||||
|
@ -37,7 +37,7 @@ Taxonomy list page templates are lists and therefore have all the variables and
|
|||
|
||||
See [Template Lookup](/templates/lookup-order/).
|
||||
|
||||
## Taxonomy Terms Template
|
||||
## Taxonomy Terms Templates
|
||||
|
||||
### Taxonomy Terms Templates Lookup Order
|
||||
|
||||
|
@ -103,7 +103,7 @@ type WeightedPages []WeightedPage
|
|||
|
||||
## Displaying custom metadata in Taxonomy Terms Templates
|
||||
|
||||
If you need to display custom metadata for each taxonomy term, you will need to create a page for that term at `/content/<TAXONOMY>/<TERM>/_index.md` and add your metadata in its front matter, [as explained in the taxonomies documentation](/content-management/taxonomies/#add-custom-meta-data-to-a-taxonomy-term). Based on the Actors taxonomy example shown there, within your taxonomy terms template, you may access your custom fields by iterating through the variable `.Pages` as such:
|
||||
If you need to display custom metadata for each taxonomy term, you will need to create a page for that term at `/content/<TAXONOMY>/<TERM>/_index.md` and add your metadata in its front matter, [as explained in the taxonomies documentation](/content-management/taxonomies/#add-custom-metadata-to-a-taxonomy-or-term). Based on the Actors taxonomy example shown there, within your taxonomy terms template, you may access your custom fields by iterating through the variable `.Pages` as such:
|
||||
|
||||
```go-html-template
|
||||
<ul>
|
||||
|
|
|
@ -56,3 +56,14 @@ error: failed to transform resource: TOCSS: failed to transform "scss/main.scss"
|
|||
We release two set of binaries for technical reasons. The extended version is not what you get by default for some installation methods. On the [release page](https://github.com/gohugoio/hugo/releases), look for archives with `extended` in the name. To build `hugo-extended`, use `go install --tags extended`
|
||||
|
||||
To confirm, run `hugo version` and look for the word `extended`.
|
||||
|
||||
## Do I need to install Git to create, deploy, and maintain a website with Hugo?
|
||||
|
||||
>Technically, no.
|
||||
>
|
||||
>Practically, yes.
|
||||
|
||||
* The primary installation method documented by most (perhaps all) themes is via Git or the Hugo Modules feature.
|
||||
* The Hugo Modules feature requires Go, and Go “gets” with Git.
|
||||
* A Git repository is required by CI/CD hosting (Bitbucket, Cloudflare, GitHub Pages, GitLab Pages, Netlify, et. al.).
|
||||
* The canonical “last modified” date for content is its Git committer date; using anything else is error-prone.
|
||||
|
|
|
@ -96,10 +96,10 @@ See also `.ExpiryDate`, `.Date`, `.PublishDate`, and [`.GitInfo`][gitinfo].
|
|||
: access when creating links to the content. If set, Hugo will use the `linktitle` from the front matter before `title`.
|
||||
|
||||
.Next
|
||||
: Points up to the next [regular page](/variables/site/#site-pages) (sorted by Hugo's [default sort](/templates/lists#default-weight-date-linktitle-filepath)). Example: `{{with .Next}}{{.Permalink}}{{end}}`. Calling `.Next` from the first page returns `nil`.
|
||||
: Points up to the next [regular page](/variables/site/#site-pages) (sorted by Hugo's [default sort](/templates/lists#default-weight--date--linktitle--filepath)). Example: `{{with .Next}}{{.Permalink}}{{end}}`. Calling `.Next` from the first page returns `nil`.
|
||||
|
||||
.NextInSection
|
||||
: Points up to the next [regular page](/variables/site/#site-pages) below the same top level section (e.g. in `/blog`)). Pages are sorted by Hugo's [default sort](/templates/lists#default-weight-date-linktitle-filepath). Example: `{{with .NextInSection}}{{.Permalink}}{{end}}`. Calling `.NextInSection` from the first page returns `nil`.
|
||||
: Points up to the next [regular page](/variables/site/#site-pages) below the same top level section (e.g. in `/blog`)). Pages are sorted by Hugo's [default sort](/templates/lists#default-weight--date--linktitle--filepath). Example: `{{with .NextInSection}}{{.Permalink}}{{end}}`. Calling `.NextInSection` from the first page returns `nil`.
|
||||
|
||||
.OutputFormats
|
||||
: contains all formats, including the current format, for a given page. Can be combined the with [`.Get` function](/functions/get/) to grab a specific format. (See [Output Formats](/templates/output-formats/).)
|
||||
|
@ -118,10 +118,10 @@ See also `.ExpiryDate`, `.Date`, `.PublishDate`, and [`.GitInfo`][gitinfo].
|
|||
: the slice of strings that results from splitting .Plain into words, as defined in Go's [strings.Fields](https://golang.org/pkg/strings/#Fields).
|
||||
|
||||
.Prev
|
||||
: Points down to the previous [regular page](/variables/site/#site-pages) (sorted by Hugo's [default sort](/templates/lists#default-weight-date-linktitle-filepath)). Example: `{{if .Prev}}{{.Prev.Permalink}}{{end}}`. Calling `.Prev` from the last page returns `nil`.
|
||||
: Points down to the previous [regular page](/variables/site/#site-pages) (sorted by Hugo's [default sort](/templates/lists#default-weight--date--linktitle--filepath)). Example: `{{if .Prev}}{{.Prev.Permalink}}{{end}}`. Calling `.Prev` from the last page returns `nil`.
|
||||
|
||||
.PrevInSection
|
||||
: Points down to the previous [regular page](/variables/site/#site-pages) below the same top level section (e.g. `/blog`). Pages are sorted by Hugo's [default sort](/templates/lists#default-weight-date-linktitle-filepath). Example: `{{if .PrevInSection}}{{.PrevInSection.Permalink}}{{end}}`. Calling `.PrevInSection` from the last page returns `nil`.
|
||||
: Points down to the previous [regular page](/variables/site/#site-pages) below the same top level section (e.g. `/blog`). Pages are sorted by Hugo's [default sort](/templates/lists#default-weight--date--linktitle--filepath). Example: `{{if .PrevInSection}}{{.PrevInSection.Permalink}}{{end}}`. Calling `.PrevInSection` from the last page returns `nil`.
|
||||
|
||||
.PublishDate
|
||||
: the date on which the content was or will be published; `.Publishdate` pulls from the `publishdate` field in a content's front matter. See also `.ExpiryDate`, `.Date`, and `.Lastmod`.
|
||||
|
|
|
@ -3,7 +3,7 @@ publish = "public"
|
|||
command = "hugo --gc --minify"
|
||||
|
||||
[context.production.environment]
|
||||
HUGO_VERSION = "0.96.0"
|
||||
HUGO_VERSION = "0.97.3"
|
||||
HUGO_ENV = "production"
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
||||
|
@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true"
|
|||
command = "hugo --gc --minify --enableGitInfo"
|
||||
|
||||
[context.split1.environment]
|
||||
HUGO_VERSION = "0.96.0"
|
||||
HUGO_VERSION = "0.97.3"
|
||||
HUGO_ENV = "production"
|
||||
|
||||
[context.deploy-preview]
|
||||
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.deploy-preview.environment]
|
||||
HUGO_VERSION = "0.96.0"
|
||||
HUGO_VERSION = "0.97.3"
|
||||
|
||||
[context.branch-deploy]
|
||||
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.branch-deploy.environment]
|
||||
HUGO_VERSION = "0.96.0"
|
||||
HUGO_VERSION = "0.97.3"
|
||||
|
||||
[context.next.environment]
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
|
Loading…
Reference in a new issue