Merge commit '98293eaa1570b5aff4452021c8b6d6c8560b3f06'
|
@ -49,8 +49,10 @@ simple = false
|
|||
[privacy.twitter]
|
||||
disable = false
|
||||
enableDNT = false
|
||||
simple = false
|
||||
[privacy.vimeo]
|
||||
disable = false
|
||||
simple = false
|
||||
[privacy.youtube]
|
||||
disable = false
|
||||
privacyEnhanced = false
|
||||
|
@ -108,8 +110,25 @@ disableInlineCSS = true
|
|||
enableDNT
|
||||
: Enabling this for the twitter/tweet shortcode, the tweet and its embedded page on your site are not used for purposes that include personalized suggestions and personalized ads.
|
||||
|
||||
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 inlines styles provided by Hugo:
|
||||
|
||||
{{< code-toggle file="config">}}
|
||||
[services]
|
||||
[services.twitter]
|
||||
disableInlineCSS = true
|
||||
{{< /code-toggle >}}
|
||||
|
||||
### YouTube
|
||||
|
||||
privacyEnhanced
|
||||
: When you turn on privacy-enhanced mode, YouTube won’t store information about visitors on your website unless the user plays the embedded video.
|
||||
|
||||
### Vimeo
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
@ -35,14 +35,13 @@ help = "Help"
|
|||
title = "My blog"
|
||||
weight = 1
|
||||
[languages.en.params]
|
||||
linkedin = "english-link"
|
||||
linkedin = "https://linkedin.com/whoever"
|
||||
|
||||
[languages.fr]
|
||||
copyright = "Tout est à moi"
|
||||
title = "Mon blog"
|
||||
title = "Mon blogue"
|
||||
weight = 2
|
||||
[languages.fr.params]
|
||||
linkedin = "lien-francais"
|
||||
linkedin = "https://linkedin.com/fr/whoever"
|
||||
[languages.fr.params.navigation]
|
||||
help = "Aide"
|
||||
{{< /code-toggle >}}
|
||||
|
@ -55,11 +54,13 @@ and taxonomy pages will be rendered below `/` in English (your default content l
|
|||
|
||||
When working with front matter `Params` in [single page templates][singles], omit the `params` in the key for the translation.
|
||||
|
||||
If you want all of the languages to be put below their respective language code, enable `defaultContentLanguageInSubdir: true`.
|
||||
`defaultContentLanguage` sets the project's default language. If not set, the default language will be `en`.
|
||||
|
||||
If the default language needs to be rendererd below its own language code (`/en`) like the others, set `defaultContentLanguageInSubdir: true`.
|
||||
|
||||
Only the obvious non-global options can be overridden per language. Examples of global options are `baseURL`, `buildDrafts`, etc.
|
||||
|
||||
## Disable a Language
|
||||
### Disable a Language
|
||||
|
||||
You can disable one or more languages. This can be useful when working on a new translation.
|
||||
|
||||
|
@ -81,7 +82,7 @@ HUGO_DISABLELANGUAGES=" " hugo server
|
|||
```
|
||||
|
||||
|
||||
## Configure Multilingual Multihost
|
||||
### Configure Multilingual Multihost
|
||||
|
||||
From **Hugo 0.31** we support multiple languages in a multihost configuration. See [this issue](https://github.com/gohugoio/hugo/issues/4027) for details.
|
||||
|
||||
|
@ -94,11 +95,11 @@ Example:
|
|||
|
||||
{{< code-toggle file="config" >}}
|
||||
[languages]
|
||||
[languages.no]
|
||||
baseURL = "https://example.no"
|
||||
languageName = "Norsk"
|
||||
[languages.fr]
|
||||
baseURL = "https://example.fr"
|
||||
languageName = "Français"
|
||||
weight = 1
|
||||
title = "På norsk"
|
||||
title = "En Français"
|
||||
|
||||
[languages.en]
|
||||
baseURL = "https://example.com"
|
||||
|
@ -127,7 +128,7 @@ Press Ctrl+C to stop
|
|||
|
||||
Live reload and `--navigateToChanged` between the servers work as expected.
|
||||
|
||||
## Taxonomies and Blackfriday
|
||||
### Taxonomies and Blackfriday
|
||||
|
||||
Taxonomies and [Blackfriday configuration][config] can also be set per language:
|
||||
|
||||
|
@ -156,40 +157,113 @@ plaque = "plaques"
|
|||
|
||||
## Translate Your Content
|
||||
|
||||
Translated articles are identified by the name of the content file.
|
||||
There are two ways to manage your content translation, both ensures each page is assigned a language and linked to its translations.
|
||||
|
||||
### Examples of Translated Articles
|
||||
### Translation by filename
|
||||
|
||||
Considering the following example:
|
||||
|
||||
1. `/content/about.en.md`
|
||||
2. `/content/about.fr.md`
|
||||
|
||||
In this example, the `about.md` will be assigned the configured `defaultContentLanguage`.
|
||||
The first file is assigned the english language and linked to the second.
|
||||
The second file is assigned the french language and linked to the first.
|
||||
|
||||
1. `/content/about.md`
|
||||
2. `/content/about.fr.md`
|
||||
Their language is __assigned__ according to the language code added as __suffix to the filename__.
|
||||
|
||||
This way, you can slowly start to translate your current content without having to rename everything. If left unspecified, the default value for `defaultContentLanguage` is `en`.
|
||||
By having the same **path and base filename**, the content pieces are __linked__ together as translated pages.
|
||||
{{< note >}}
|
||||
|
||||
By having the same **directory and base filename**, the content pieces are linked together as translated pieces.
|
||||
If a file is missing any language code, it will be assigned the default language.
|
||||
|
||||
You can also set the key used to link the translations explicitly in front matter:
|
||||
{{</ note >}}
|
||||
### Translation by content directory
|
||||
|
||||
This system uses different content directories for each of the languages. Each language's content directory is set using the `contentDir` param.
|
||||
|
||||
{{< code-toggle file="config" >}}
|
||||
|
||||
languages:
|
||||
en:
|
||||
weight: 10
|
||||
languageName: "English"
|
||||
contentDir: "content/english"
|
||||
nn:
|
||||
weight: 20
|
||||
languageName: "Français"
|
||||
contentDir: "content/french"
|
||||
|
||||
{{< /code-toggle >}}
|
||||
|
||||
The value of `contentDir` can be any valid path, even absolute path references. The only restriction is that the content directories cannot overlap.
|
||||
|
||||
Considering the following example in conjunction with the configuration above:
|
||||
|
||||
1. `/content/english/about.md`
|
||||
2. `/content/french/about.md`
|
||||
|
||||
The first file is assigned the english language and is linked to the second.
|
||||
<br>The second file is assigned the french language and is linked to the first.
|
||||
|
||||
Their language is __assigned__ according to the content directory they are __placed__ in.
|
||||
|
||||
By having the same **path and basename** (relative to their language content directory), the content pieces are __linked__ together as translated pages.
|
||||
|
||||
### Bypassing default linking.
|
||||
|
||||
Any pages sharing the same `translationKey` set in front matter will be linked as translated pages regardless of basename or location.
|
||||
|
||||
Considering the following example:
|
||||
|
||||
1. `/content/about-us.en.md`
|
||||
2. `/content/om.nn.md`
|
||||
3. `/content/presentation/a-propos.fr.md`
|
||||
|
||||
```yaml
|
||||
translationKey: "my-story"
|
||||
# set in all three pages
|
||||
translationKey: "about"
|
||||
```
|
||||
|
||||
If you need distinct URLs per language, you can set the slug in the non-default language file. For example, you can define a custom slug for a French translation in the front matter of `content/about.fr.md` as follows:
|
||||
By setting the `translationKey` front matter param to `about` in all three pages, they will be __linked__ as translated pages.
|
||||
|
||||
```yaml
|
||||
|
||||
### Localizing permalinks
|
||||
|
||||
Because paths and filenames are used to handle linking, all translated pages, except for the language part, will be sharing the same url.
|
||||
|
||||
To localize the URLs, the [`slug`]({{< ref "content-management/organization/index.md#slug" >}}) or [`url`]({{< ref "content-management/organization/index.md#url" >}}) front matter param can be set in any of the non-default language file.
|
||||
|
||||
For example, a french translation (`content/about.fr.md`) can have its own localized slug.
|
||||
|
||||
{{< code-toggle >}}
|
||||
Title: A Propos
|
||||
slug: "a-propos"
|
||||
{{< /code-toggle >}}
|
||||
|
||||
```
|
||||
|
||||
At render, Hugo will build both `/about/` and `/a-propos/` as properly linked translated pages.
|
||||
At render, Hugo will build both `/about/` and `fr/a-propos/` while maintaning their translation linking.
|
||||
{{% note %}}
|
||||
If using `url`, remember to include the language part as well: `fr/compagnie/a-propos/`.
|
||||
{{%/ note %}}
|
||||
|
||||
For merging of content from other languages (i.e. missing content translations), see [lang.Merge](/functions/lang.merge/).
|
||||
### Page Bundles
|
||||
|
||||
## Link to Translated Content
|
||||
To avoid the burden of having to duplicate files, each Page Bundle inherits the resources of its linked translated pages' bundles except for the content files (markdown files, html files etc...).
|
||||
|
||||
Therefore, from within a template, the page will have access to the files from all linked pages' bundles.
|
||||
|
||||
If, across the linked bundles, two or more files share the same basenname, only one will be included and chosen as follows:
|
||||
|
||||
* File from current language Bundle, if present.
|
||||
* First file found across bundles by order of language `Weight`.
|
||||
|
||||
{{% note %}}
|
||||
|
||||
Page Bundle's resources follow the same language assignement logic as content files, be it by filename (`image.jpg`, `image.fr.jpg`) or by directory (`english/about/header.jpg`, `french/about/header.jpg`).
|
||||
|
||||
{{%/ note %}}
|
||||
|
||||
## Reference the Translated Content
|
||||
|
||||
To create a list of links to translated content, use a template similar to the following:
|
||||
|
||||
|
@ -210,7 +284,7 @@ The above can be put in a `partial` (i.e., inside `layouts/partials/`) and inclu
|
|||
|
||||
The above also uses the [`i18n` function][i18func] described in the next section.
|
||||
|
||||
## List All Available Languages
|
||||
### List All Available Languages
|
||||
|
||||
`.AllTranslations` on a `Page` can be used to list all translations, including itself. Called on the home page it can be used to build a language navigator:
|
||||
|
||||
|
|
|
@ -374,6 +374,10 @@ Using the preceding `youtube` example (without `autoplay="true"`), the following
|
|||
|
||||
{{< youtube w7Ft2ymGmfc >}}
|
||||
|
||||
## Privacy Config
|
||||
|
||||
To learn how to configure your Hugo site to meet the new EU privacy regulation, see [Hugo and the GDPR][].
|
||||
|
||||
## Create Custom Shortcodes
|
||||
|
||||
To learn more about creating custom shortcodes, see the [shortcode template documentation][].
|
||||
|
@ -382,6 +386,7 @@ To learn more about creating custom shortcodes, see the [shortcode template docu
|
|||
[contentmanagementsection]: /content-management/formats/
|
||||
[examplegist]: https://gist.github.com/spf13/7896402
|
||||
[figureelement]: http://html5doctor.com/the-figure-figcaption-elements/ "An article from HTML5 doctor discussing the fig and figcaption elements."
|
||||
[Hugo and the GDPR]: /about/hugo-and-gdpr/
|
||||
[Instagram]: https://www.instagram.com/
|
||||
[pagevariables]: /variables/page/
|
||||
[partials]: /templates/partials/
|
||||
|
|
|
@ -72,7 +72,13 @@ pygmentsCodefences
|
|||
: Set to true to enable syntax highlighting in code fences with a language tag in markdown (see below for an example).
|
||||
|
||||
pygmentsStyle
|
||||
: The style of code highlighting. See https://help.farbox.com/pygments.html for a gallery. Note that this option is not relevant when `pygmentsUseClasses` is set.
|
||||
: The style of code highlighting. Note that this option is not
|
||||
relevant when `pygmentsUseClasses` is set.
|
||||
|
||||
Syntax highlighting galleries:
|
||||
**Chroma** ([short snippets](https://xyproto.github.io/splash/docs/all.html),
|
||||
[long snippets](https://xyproto.github.io/splash/docs/longer/all.html)),
|
||||
[Pygments](https://help.farbox.com/pygments.html)
|
||||
|
||||
pygmentsUseClasses
|
||||
: Set to `true` to use CSS classes to format your highlighted code. See [Generate Syntax Highlighter CSS](#generate-syntax-highlighter-css).
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: errorf
|
||||
linktitle: errorf
|
||||
description: Evaluates a format string and logs it to ERROR.
|
||||
description: Log ERROR and fail the build from the templates.
|
||||
date: 2017-09-30
|
||||
publishdate: 2017-09-30
|
||||
lastmod: 2017-09-30
|
||||
|
@ -18,9 +18,12 @@ deprecated: false
|
|||
aliases: []
|
||||
---
|
||||
|
||||
`errorf` will evaluate a format string, then output the result to the ERROR log.
|
||||
This will also cause the build to fail.
|
||||
`errorf` will evaluate a format string, then output the result to the ERROR log (and only once per error message to avoid flooding the log).
|
||||
|
||||
This will also cause the build to fail (the `hugo` command will `exit -1`).
|
||||
|
||||
```
|
||||
{{ errorf "Something went horribly wrong! %s" err }}
|
||||
{{ errorf "Failed to handle page %q" .Path }}
|
||||
```
|
||||
|
||||
Note that `errorf` supports all the formatting verbs of the [fmt](https://golang.org/pkg/fmt/) package.
|
||||
|
|
|
@ -104,7 +104,7 @@ The most common usage is probably to run `hugo` with your current directory bein
|
|||
|
||||
This generates your website to the `public/` directory by default, although you can customize the output directory in your [site configuration][config] by changing the `publishDir` field.
|
||||
|
||||
The site Hugo renders into `public/` is ready to be deployed to your web server:
|
||||
The command `hugo` renders your site into `public/` dir and is ready to be deployed to your web server:
|
||||
|
||||
```
|
||||
hugo
|
||||
|
|
BIN
docs/content/en/news/0.42-relnotes/featured-hugo-42-poster.png
Normal file
After Width: | Height: | Size: 73 KiB |
|
@ -1,8 +1,8 @@
|
|||
|
||||
---
|
||||
date: 2018-06-12
|
||||
title: "0.42"
|
||||
description: "0.42"
|
||||
title: "Hugo 0.42: Theme Composition and Inheritance!"
|
||||
description: "Hugo 0.42 adds Theme Components support, a new and powerful way of composing your Hugo sites."
|
||||
categories: ["Releases"]
|
||||
---
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
---
|
||||
date: 2018-06-13
|
||||
title: "0.42.1"
|
||||
description: "0.42.1"
|
||||
title: "Hugo 0.42.1: Two Bug Fixes"
|
||||
description: "Hugo 0.42.1 fixes two issues."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
|
||||
---
|
||||
date: 2018-06-28
|
||||
title: "0.42.2"
|
||||
description: "0.42.2"
|
||||
title: "Hugo 0.42.2: One Bug Fix"
|
||||
description: "Hugo 0.42.2 fixes server reload on config changes."
|
||||
categories: ["Releases"]
|
||||
images:
|
||||
- images/blog/hugo-bug-poster.png
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
This release fixe broken server-reload on config changes. This is a regression from Hugo `0.42`. [3a7706b0](https://github.com/gohugoio/hugo/commit/3a7706b069107e5fa6112b3f7ce006f16867cb38) [@bep](https://github.com/bep) [#4878](https://github.com/gohugoio/hugo/issues/4878)
|
||||
This release fixes broken server-reload on config changes. This is a regression from Hugo `0.42`. [3a7706b0](https://github.com/gohugoio/hugo/commit/3a7706b069107e5fa6112b3f7ce006f16867cb38) [@bep](https://github.com/bep) [#4878](https://github.com/gohugoio/hugo/issues/4878)
|
||||
|
||||
|
||||
|
||||
|
|
After Width: | Height: | Size: 175 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 17 KiB |
108
docs/content/en/news/lets-celebrate-hugos-5th-birthday/index.md
Normal file
|
@ -0,0 +1,108 @@
|
|||
---
|
||||
date: 2018-07-04
|
||||
title: "Let’s celebrate Hugo’s 5th birthday"
|
||||
description: "How a side project became one of the most popular frameworks for building websites."
|
||||
categories: [blog]
|
||||
author: bep
|
||||
---
|
||||
|
||||
_By Bjørn Erik Pedersen ([@bepsays](https://twitter.com/bepsays) / [@bep](https://github.com/bep)), Hugo Lead_
|
||||
|
||||
**Five years ago today, [Steve Francia](https://github.com/spf13/) made his [first commit](https://github.com/gohugoio/hugo/commit/50a1d6f3f155ab837310e00ffb309a9199773c73
|
||||
) on the Hugo project: "Hugo: A Fast and Flexible Static Site Generator built with love by spf13 in GoLang".**
|
||||
|
||||
Steve was writing that on a train commute to New York. I'm writing this article running Hugo `v0.43-DEV`, the preview version of the next Hugo release. The release is scheduled for Monday and adds a powerful [assets pipeline](https://github.com/gohugoio/hugo/issues/4854#issue-333062459), with SCSS/SASS support, assets minification, fingerprinting/subresource integrity, ad-hoc image processing and much more.
|
||||
|
||||
**I cannot remember the last time I was this excited about a Hugo release. "Game changer" may be too strong, but it makes for a really nice integrated website design-workflow that, with Hugo's build speed, is hard to beat.**
|
||||
|
||||
{{< imgproc sunset Fill "600x300" >}}
|
||||
Fetch and scale an image in the upcoming Hugo 0.43.
|
||||
{{< /imgproc >}}
|
||||
|
||||
But that is a release for Monday. Now is a time to look at the current status of Hugo after the first five years.
|
||||
|
||||
## Hugo in Numbers
|
||||
|
||||
According to [BuiltWith](https://trends.builtwith.com/cms/Hugo), more than 29 000 live websites are built with Hugo. Of those, 390 are in the top 1 million. Wappalyzer [reports](https://www.wappalyzer.com/categories/static-site-generator) that Hugo serves almost 50% of the static sites.
|
||||
|
||||
Hugo is big in the [public sector](https://discourse.gohugo.io/t/hugo-in-public-administration/8792), with the US Government as a prominent user. Some examples are [vote.gov](https://vote.gov/) and [digital.gov](https://digital.gov/).
|
||||
|
||||
[Smashing Magazine](https://www.smashingmagazine.com/) is a big and very popular Hugo site. It is [reported](https://discourse.gohugo.io/t/smashing-magazine-s-redesign-powered-by-hugo-jamstack/5826/7) that they build their complex site with 7500 content pages in 13 seconds.
|
||||
|
||||
Some other example sites are [kubernetes.io](https://kubernetes.io/), [letsencrypt.org](https://gohugo.io/showcase/letsencrypt/), [support.1password.com](http://gohugo.io/showcase/1password-support/), [netlify.com](https://www.netlify.com), [litecoin.org](https://litecoin.org/), and [forestry.io](https://forestry.io/).
|
||||
|
||||
|
||||
{{< imgproc graph-stars Fit "600x400" >}}
|
||||
Number of GitHub stars in relation to the Hugo release dates.
|
||||
{{< /imgproc >}}
|
||||
|
||||
More numbers:
|
||||
|
||||
* 26800+ [stars](https://github.com/gohugoio/hugo/stargazers) on GitHub.
|
||||
* 444+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors) to the Hugo source repository, 654+ to [Hugo Docs](https://github.com/gohugoio/hugoDocs/graphs/contributors). [@bep](https://github.com/bep) is the most active with around 70% of the current code base (line count).
|
||||
* 235+ [themes](https://themes.gohugo.io/)
|
||||
* 50% increase in the number of user sessions on the [gohugo.io](https://gohugo.io/) web sites the last 12 months.[^2]
|
||||
* Hugo build release binaries for [a myriad](https://github.com/gohugoio/hugo/releases/tag/v0.42.2) of platforms. And since it can also be installed from Chocolatey on Windows, Brew on MacOs, Snap on Linux and `apt-get` on Debian/Ubuntu, it is impossible to give accurate download numbers. But the number is not small.
|
||||
|
||||
## Hugo Next
|
||||
|
||||
We're not finished with Hugo, but Hugo `0.43` very nicely wraps up the first five years. It started out as a small and fast static site generator. It is now [even faster](https://forestry.io/blog/hugo-vs-jekyll-benchmark/), and now so loaded with features that it has grown out of being just a "static site generator". It is a _framework for building websites_.
|
||||
|
||||
My interest in Hugo started on the Sunday when I moved my blog, [bepsays.com](https://bepsays.com/en/), twice. The second static generator choice of that day, Hugo, was a good match. I remember Steve being very enthusiastic about getting patches with fixes and enhancements, and I was eventually taken over by the simplicity and power of Go, the programming language, and started to implement lots of new features.
|
||||
|
||||
My goal with all of this, if there is one, is to get a single binary with native and really fast implementations of the complete stack I need for web development and content editing. The single binary takes most of the pain out of installation and upgrades (if you stick with the same binary, it will continue to just work for decades).
|
||||
|
||||
**With 0.43, we are almost there.** With that release, it should be possible to set up a Hugo-only project without any additional tools (Gulp, WebPack) for all aspects of website building. There will still be situations where those tools will still be needed, of course, but we will continue to fill the gaps in the feature set.
|
||||
|
||||
Hugo has stuck with the sub-zero versions to signal active development, with a new main release every 5-6 weeks. But we take stability very seriously (breaking things add lots of support work, we don't like that) and most site upgrades are [smooth](https://twitter.com/tmmx/status/1006288444459503616). But we are closing in on the first major stable version.
|
||||
|
||||
|
||||
### The Road to 1.0
|
||||
|
||||
We have some more technical tasks that needs to be done (there is ongoing work to get the page quries into a more consistent state, also a simpler `.GetPage` method), but also some cool new functionality. The following roadmap is taken from memory, and may not be complete, but should be a good indication of what's ahead.
|
||||
|
||||
Pages from "other data sources"
|
||||
: Currently, in addition to Hugo's list pages, every URL must be backed by a content file (Markdown, HTML etc.). This covers most use cases, but we need a flexible way to generate pages from other data sources. Think product catalogues and similar.
|
||||
|
||||
Upgrade Blackfriday to v2
|
||||
: [Blackfriday](https://github.com/russross/blackfriday) is the main content renderer in Hugo. It has been rewritten to a more flexible architecture, which should allow us to fix some of the current shortcomings.
|
||||
|
||||
We should be able to create a better and easier-to-use data structure from the rendered content: Summary, the content after the summary, being able to range over the footnotes and the ToC. Having ToC as a proper data structure also open up a few other potential uses; using it as an index in [Related Content](https://gohugo.io/content-management/related/) would be one example.
|
||||
|
||||
This should also enable us to _do more_ with [Custom Output Formats](/templates/output-formats). It is already very powerful. GettyPubs are using it in [Quire](https://github.com/gettypubs/quire) to build [beautiful multi-platform publications](http://www.getty.edu/publications/digital/digitalpubs.html). But it can be improved. For rendering of content files, you are currently restricted to HTML. It would be great if we could configure alternative renderers per output format, such as LaTeX and EPUB.
|
||||
|
||||
Related to this is also to add a configurable "Markdown URL rewriter", which should make more portable URLs in Markdown, e.g. image links that work both when viewed on GitHub and your published site.
|
||||
|
||||
### The Road to the Future
|
||||
|
||||
These are the items that first comes to mind if you ask me to think even further ahead:
|
||||
|
||||
Dependency manager for Theme Components
|
||||
: In Hugo `0.42` we added [Theme Components](/themes/theme-components/) and Theme Inheritance. With SCSS support in Hugo `0.43`, which also follows the same project/themes precedence order (add `_variables.scss` to your project, configure SASS colour variables in `config.toml`), we have a solid foundation for creating easy to use and extensible themes. But we are missing some infrastructure around this. We have a site with 235+ [themes](https://themes.gohugo.io/)[^themes] listed, but you currently need to do some added work to get the theme up and running for your site. In the Go world, we don't have NPM to use, which is a curse and a blessing, but I have some ideas about building a simple dependency manager into Hugo, modelled after how Go is doing it (`hugo install`). You should be able to configure what theme and theme components you want to use, and Hugo should handle the installation of the correct versions. This should make it easier for the user, but it would also enable community driven and even commercial "theme stores".
|
||||
|
||||
|
||||
{{< imgproc graph-themes Fit "600x400" >}}
|
||||
Number of Hugo themes on themes.gohugo.io in relation to the Hugo release dates.
|
||||
{{< /imgproc >}}
|
||||
|
||||
|
||||
The "New York Times on Hugo" Use Case
|
||||
: There are recurring questions on the support forum from [really big sites](https://discourse.gohugo.io/t/transition-2m-posts-from-wordpress-to-hugo/12704) that want to move to Hugo. There are many [good reasons](https://www.netlify.com/blog/2016/05/18/9-reasons-your-site-should-be-static/) why they want this (security, cost-saving, EU regulations etc.). And while there have been reports about companies building 600 000 pages with Hugo on very powerful hardware, we will have to rethink the build model to make this usable. Keywords are: streaming builds, segmented builds, partial rebuilds. There are other site generators also talking about this. It should be possible, and my instinct tells me that it should be easier to do when your starting point is "really fast". But this is not a small weekend project for me, and I have already talked to several companies about sponsoring this.
|
||||
|
||||
Plugins
|
||||
: A Theme Component could also be called a plugin. But there are several potential plugin hooks into Hugo's build pipeline: Resource transformations, content rendering etc. We will eventually get there, but we should do it without giving up too much of the Hugo speed and simplicity.
|
||||
|
||||
|
||||
## Thanks
|
||||
|
||||
So, thanks to everyone who have contributed to getting Hugo where it is today. It is hard to single out individuals, but a big shout-out to all the Hugo experts and moderators helping out making the [discourse.gohugo.io](https://discourse.gohugo.io/) a very active and possibly one of the best support forums out there.
|
||||
|
||||
And the last shout-out goes to two maintainers who have been there more or less from the start. [@digitalcraftsman](https://github.com/digitalcraftsman/) has been doing a fantastic job keeping the fast growing theme site and [repository](https://github.com/gohugoio/hugoThemes) in pristine condition. I have it on my watch list, but that is just out of curiosity. There are lots of activity, but it runs as clock work. [Anthony Fok](https://github.com/anthonyfok) has contributed with a variety of things but is most notable as the Linux expert on the team. He manages the Debian build and is the one to thank for up-to-date binaries on Debian and Ubuntu.
|
||||
|
||||
One final note: If you have not done so already, please visit [github.com/gohugoio/hugo](https://github.com/gohugoio/hugo) and push the "star button".
|
||||
|
||||
Gopher artwork by [Ashley McNamara](https://github.com/ashleymcnamara/gophers/) (licensed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)). Inspired by [Renee French](https://reneefrench.blogspot.com/).
|
||||
|
||||
[^2]: Numbers from Google Analytics. The Hugo websites are https://discourse.gohugo.io/, https://gohugo.io/ and https://themes.gohugo.io/. It is rumoured that when [Matt Biilman](https://twitter.com/biilmann?lang=en), CEO and Co-founder of Netlify, opened the first power bill after sponsoring Hugo's hosting, said: "Du må lave fis med mig, those Hugo sites have lots of web traffic!"
|
||||
[^sgen]: That was at the time of writing this article. _Next_, a React based static site generator, has momentum and is closing in on Hugo's 2nd place.
|
||||
[^themes]: We pull all the themes from GitHub and build the theme site and 235 demo sites on Netlify in 4 minutes. And that is impressing.
|
After Width: | Height: | Size: 378 KiB |
|
@ -5,7 +5,7 @@ description: Hugo searches for the layout to use for a given page in a well defi
|
|||
godocref:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-05-25
|
||||
lastmod: 2017-07-05
|
||||
categories: [templates,fundamentals]
|
||||
keywords: [templates]
|
||||
menu:
|
||||
|
@ -32,7 +32,7 @@ Output Format
|
|||
: See [Custom Output Formats](/templates/output-formats). An output format has both a `name` (e.g. `rss`, `amp`, `html`) and a `suffix` (e.g. `xml`, `html`). We prefer matches with both (e.g. `index.amp.html`, but look for less specific templates.
|
||||
|
||||
Language
|
||||
: We will consider a language code in the template name. If the site language is `fr`, `index.fr.amp.html` will win over `index.amp.html`, but we will `index.amp.html` will be chosen before `index.fr.html`.
|
||||
: 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`.
|
||||
|
||||
Layout
|
||||
: Can be set in page front matter.
|
||||
|
|
|
@ -25,16 +25,16 @@ theme = ["my-shortcodes", "base-theme", "hyde"]
|
|||
|
||||
You can even nest this, and have the theme component itself include theme components in its own `config.toml` (theme inheritance).[^1]
|
||||
|
||||
The theme definition example above in `config.toml` creates a theme with 3 theme components with presedence from left to right.
|
||||
The theme definition example above in `config.toml` creates a theme with 3 theme components with precedence from left to right.
|
||||
|
||||
So, Hugo will, for any given file, data entry etc., look first in the project, and then in `my-shortcode`, `base-theme` and lastly `hyde`.
|
||||
For any given file, data entry, etc., Hugo will look first in the project and then in `my-shortcode`, `base-theme`, and lastly `hyde`.
|
||||
|
||||
Hugo uses two different algorithms to merge the filesystems, depending on the file type:
|
||||
|
||||
* For `i18n` and `data` files, Hugo merges deeply using the translation id and data key inside the files.
|
||||
* For `static`, `layouts` (templates) and `archetypes` files, these are merged on file level. So the left-most file will be chosen.
|
||||
* For `static`, `layouts` (templates), and `archetypes` files, these are merged on file level. So the left-most file will be chosen.
|
||||
|
||||
The name used in the `theme` definition above must match a folder in `/your-site/themes`, e.g. `/your-site/themes/my-shortcodes`. There are plans to improve on this and get a URL scheme so this can be resolved automatically.
|
||||
The name used in the `theme` definition above must match a folder in `/your-site/themes`, e.g. `/your-site/themes/my-shortcodes`. There are plans to improve on this and get a URL scheme so this can be resolved automatically.
|
||||
|
||||
Also note that a component that is part of a theme can have its own configuration file, e.g. `config.toml`. There are currently some restrictions to what a theme component can configure:
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{{ $original := .Page.Resources.GetMatch (printf "%s*" (.Get 0)) }}
|
||||
{{ $original := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }}
|
||||
{{ $command := .Get 1 }}
|
||||
{{ $options := .Get 2 }}
|
||||
{{ if eq $command "Fit"}}
|
||||
|
@ -11,8 +11,8 @@
|
|||
{{ errorf "Invalid image processing command: Must be one of Fit, Fill or Resize."}}
|
||||
{{ end }}
|
||||
{{ $image := .Scratch.Get "image" }}
|
||||
<figure style="width: {{ add $image.Width 3 }}px; padding: 3px; background-color: #cccc">
|
||||
<img src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}">
|
||||
<figure style="padding: 0.25rem; margin: 2rem 0; background-color: #cccc">
|
||||
<img style="max-width: 100%; height: auto;" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}">
|
||||
<figcaption>
|
||||
<small>
|
||||
{{ with .Inner }}
|
||||
|
|
|
@ -3,7 +3,7 @@ publish = "public"
|
|||
command = "hugo"
|
||||
|
||||
[context.production.environment]
|
||||
HUGO_VERSION = "0.41"
|
||||
HUGO_VERSION = "0.42.2"
|
||||
HUGO_ENV = "production"
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
||||
|
@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true"
|
|||
command = "hugo --enableGitInfo"
|
||||
|
||||
[context.split1.environment]
|
||||
HUGO_VERSION = "0.41"
|
||||
HUGO_VERSION = "0.42.2"
|
||||
HUGO_ENV = "production"
|
||||
|
||||
[context.deploy-preview]
|
||||
command = "hugo -b $DEPLOY_PRIME_URL"
|
||||
command = "hugo --buildFuture -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.deploy-preview.environment]
|
||||
HUGO_VERSION = "0.41"
|
||||
HUGO_VERSION = "0.42.2"
|
||||
|
||||
[context.branch-deploy]
|
||||
command = "hugo -b $DEPLOY_PRIME_URL"
|
||||
|
||||
[context.branch-deploy.environment]
|
||||
HUGO_VERSION = "0.41"
|
||||
HUGO_VERSION = "0.42.2"
|
||||
|
||||
[context.next.environment]
|
||||
HUGO_ENABLEGITINFO = "true"
|
||||
|
|
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 102 KiB |