Merge commit '98293eaa1570b5aff4452021c8b6d6c8560b3f06'
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 6 Jul 2018 15:53:17 +0000 (17:53 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 6 Jul 2018 15:53:17 +0000 (17:53 +0200)
26 files changed:
1  2 
docs/content/en/about/hugo-and-gdpr.md
docs/content/en/content-management/multilingual.md
docs/content/en/content-management/shortcodes.md
docs/content/en/content-management/syntax-highlighting.md
docs/content/en/functions/errorf.md
docs/content/en/getting-started/usage.md
docs/content/en/news/0.42-relnotes/featured-hugo-42-poster.png
docs/content/en/news/0.42-relnotes/index.md
docs/content/en/news/0.42.1-relnotes/index.md
docs/content/en/news/0.42.2-relnotes/index.md
docs/content/en/news/lets-celebrate-hugos-5th-birthday/featured.png
docs/content/en/news/lets-celebrate-hugos-5th-birthday/graph-stars.png
docs/content/en/news/lets-celebrate-hugos-5th-birthday/graph-themes.png
docs/content/en/news/lets-celebrate-hugos-5th-birthday/index.md
docs/content/en/news/lets-celebrate-hugos-5th-birthday/sunset-get.png
docs/content/en/templates/lookup-order.md
docs/content/en/themes/theme-components.md
docs/layouts/shortcodes/imgproc.html
docs/netlify.toml
docs/resources/_gen/images/news/0.42-relnotes/featured-hugo-42-poster_hue0604c0846526b6d2f8ba376edd013b6_74852_480x0_resize_catmullrom_2.png
docs/resources/_gen/images/news/0.42-relnotes/featured-hugo-42-poster_hue0604c0846526b6d2f8ba376edd013b6_74852_640x0_resize_catmullrom_2.png
docs/resources/_gen/images/news/lets-celebrate-hugos-5th-birthday/featured_hu30cb938a182ebd06b50ed15d006d8f64_179291_480x0_resize_catmullrom_2.png
docs/resources/_gen/images/news/lets-celebrate-hugos-5th-birthday/featured_hu30cb938a182ebd06b50ed15d006d8f64_179291_640x0_resize_catmullrom_2.png
docs/resources/_gen/images/news/lets-celebrate-hugos-5th-birthday/graph-stars_hu169ba15a8bcaf4ddd6a5a1aa8505c448_15599_600x400_fit_catmullrom_2.png
docs/resources/_gen/images/news/lets-celebrate-hugos-5th-birthday/graph-themes_hu25707bee0ec3007199f71bb29226f30c_16956_600x400_fit_catmullrom_2.png
docs/resources/_gen/images/news/lets-celebrate-hugos-5th-birthday/sunset-get_hu69849a7cdb847c2393a7b3a7f6061c86_387442_600x300_fill_catmullrom_smart1_2.png

index 0a95e602dc1c7787c151e5b9ffbf27843cf8b91a,0000000000000000000000000000000000000000..15352ae7c5921505cc61facb34567cab8cfc827c
mode 100644,000000..100644
--- /dev/null
@@@ -1,115 -1,0 +1,134 @@@
 +
 +
 +---
 +title: Hugo and the  General Data Protection Regulation (GDPR)
 +linktitle: Hugo and GDPR
 +description: About how to configure your Hugo site to meet the new regulations.
 +date: 2018-05-25
 +layout: single
 +keywords: ["GDPR", "Privacy", "Data Protection"]
 +menu:
 +  docs:
 +    parent: "about"
 +    weight: 5
 +weight: 5
 +sections_weight: 5
 +draft: false
 +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.**
 +
 + But even static websites can integrate with external services, so from version `0.41`, Hugo provides a **Privacy Config** that covers the relevant built-in templates.
 +
 + Note that:
 +
 + * These settings have their defaults setting set to _off_, i.e. how it worked before Hugo `0.41`. You must do your own evaluation of your site and apply the appropriate settings.
 + * We will continue this work and improve this further in future Hugo versions.
 +
 +## All Privacy Settings
 +
 +Below are all privacy settings and their default value. These settings need to be put in your site config (e.g. `config.toml`).
 +
 + {{< code-toggle file="config">}}
 +[privacy]
 +[privacy.disqus]
 +disable = false
 +[privacy.googleAnalytics]
 +disable = false
 +respectDoNotTrack = false
 +anonymizeIP = false
 +useSessionStorage = false
 +[privacy.instagram]
 +disable = false
 +simple = false
 +[privacy.twitter]
 +disable = false
 +enableDNT = false
++simple = false
 +[privacy.vimeo]
 +disable = false
++simple = false
 +[privacy.youtube]
 +disable = false
 +privacyEnhanced = false
 +{{< /code-toggle >}}
 +
 +
 +## Disable All Services
 +
 +An example Privacy Config that disables all the relevant services in Hugo. With this configuration, the other settings will not matter.
 +
 + {{< code-toggle file="config">}}
 +[privacy]
 +[privacy.disqus]
 +disable = true
 +[privacy.googleAnalytics]
 +disable = true
 +[privacy.instagram]
 +disable = true
 +[privacy.twitter]
 +disable = true
 +[privacy.vimeo]
 +disable = true
 +[privacy.youtube]
 +disable = true
 +{{< /code-toggle >}}
 +
 +## The Privacy Settings Explained
 +
 +### GoogleAnalytics
 +
 +anonymizeIP
 +: Enabling this will make it so the users' IP addresses are anonymized within Google Analytics.
 +
 +respectDoNotTrack
 +: Enabling this will make the GA templates respect the "Do Not Track" HTTP header.
 +
 +useSessionStorage
 +: Enabling this will disable the use of Cookies and use Session Storage to Store the GA Client ID.
 +
 +### Instagram
 +
 +simple
 +: If simple mode is enabled, a static and no-JS version of the Instagram image card will be built. Note that this only supports image cards and the image itself will be fetched from Instagram's servers.
 +
 +**Note:** If you use the _simple mode_ for Instagram and a site styled with Bootstrap 4, you may want to disable the inlines styles provided by Hugo:
 +
 + {{< code-toggle file="config">}}
 +[services]
 +[services.instagram]
 +disableInlineCSS = true
 +{{< /code-toggle >}}
 +
 +### Twitter
 +
 +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.
++
index 34dafaa306e09a050a6d653b6b66aa06a69f65aa,0000000000000000000000000000000000000000..5894a16e5f13f94c6229b2d772e5f46d6b56f880
mode 100644,000000..100644
--- /dev/null
@@@ -1,386 -1,0 +1,460 @@@
- linkedin = "english-link"
 +---
 +title: Multilingual Mode
 +linktitle: Multilingual and i18n
 +description: Hugo supports the creation of websites with multiple languages side by side.
 +date: 2017-01-10
 +publishdate: 2017-01-10
 +lastmod: 2017-01-10
 +categories: [content management]
 +keywords: [multilingual,i18n, internationalization]
 +menu:
 +  docs:
 +    parent: "content-management"
 +    weight: 150
 +weight: 150   #rem
 +draft: false
 +aliases: [/content/multilingual/,/content-management/multilingual/,/tutorials/create-a-multilingual-site/]
 +toc: true
 +---
 +
 +You should define the available languages in a `languages` section in your site configuration.
 +
 +## Configure Languages
 +
 +The following is an example of a site configuration for a multilingual Hugo project:
 +
 +{{< code-toggle file="config" >}}
 +DefaultContentLanguage = "en"
 +copyright = "Everything is mine"
 +
 +[params.navigation]
 +help  = "Help"
 +
 +[languages]
 +[languages.en]
 +title = "My blog"
 +weight = 1
 +[languages.en.params]
- copyright = "Tout est à moi"
- title = "Mon blog"
++linkedin = "https://linkedin.com/whoever"
 +
 +[languages.fr]
- linkedin = "lien-francais"
++title = "Mon blogue"
 +weight = 2
 +[languages.fr.params]
- If you want all of the languages to be put below their respective language code, enable `defaultContentLanguageInSubdir: true`.
++linkedin = "https://linkedin.com/fr/whoever"
 +[languages.fr.params.navigation]
 +help  = "Aide"
 +{{< /code-toggle >}}
 +
 +Anything not defined in a `[languages]` block will fall back to the global
 +value for that key (e.g., `copyright` for the English [`en`] language).
 +
 +With the configuration above, all content, sitemap, RSS feeds, paginations,
 +and taxonomy pages will be rendered below `/` in English (your default content language) and then below `/fr` in French.
 +
 +When working with front matter `Params` in [single page templates][singles], omit the `params` in the key for the translation.
 +
- ## Disable a Language
++`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.
 +
- ## Configure Multilingual Multihost
++### Disable a Language
 +
 +You can disable one or more languages. This can be useful when working on a new translation.
 +
 +```toml
 +disableLanguages = ["fr", "jp"]
 +```
 +
 +Note that you cannot disable the default content language.
 +
 +We kept this as a standalone setting to make it easier to set via [OS environment](/getting-started/configuration/#configure-with-environment-variables):
 +
 +```bash
 +HUGO_DISABLELANGUAGES="fr jp" hugo
 +```
 +If you have already a list of disabled languages in `config.toml`, you can enable them in development like this:
 +
 +```bash
 +HUGO_DISABLELANGUAGES=" " hugo server
 +```
 +
 +
- [languages.no]
- baseURL = "https://example.no"
- languageName = "Norsk"
++### Configure Multilingual Multihost
 +
 +From **Hugo 0.31** we support multiple languages in a multihost configuration. See [this issue](https://github.com/gohugoio/hugo/issues/4027) for details.
 +
 +This means that you can now configure a `baseURL` per `language`:
 +
 +
 +> If a `baseURL` is set on the `language` level, then all languages must have one and they must all be different.
 +
 +Example:
 +
 +{{< code-toggle file="config" >}}
 +[languages]
- title = "På norsk"
++[languages.fr]
++baseURL = "https://example.fr"
++languageName = "Français"
 +weight = 1
- ## Taxonomies and Blackfriday
++title = "En Français"
 +
 +[languages.en]
 +baseURL = "https://example.com"
 +languageName = "English"
 +weight = 2
 +title = "In English"
 +{{</ code-toggle >}}
 +
 +With the above, the two sites will be generated into `public` with their own root:
 +
 +```bash
 +public
 +├── en
 +└── no
 +```
 +
 +**All URLs (i.e `.Permalink` etc.) will be generated from that root. So the English home page above will have its `.Permalink` set to `https://example.com/`.**
 +
 +When you run `hugo server` we will start multiple HTTP servers. You will typlically see something like this in the console:
 +
 +```bash
 +Web Server is available at 127.0.0.1:1313 (bind address 127.0.0.1)
 +Web Server is available at 127.0.0.1:1314 (bind address 127.0.0.1)
 +Press Ctrl+C to stop
 +```
 +
 +Live reload and `--navigateToChanged` between the servers work as expected.
 +
- Translated articles are identified by the name of the content file.
++### Taxonomies and Blackfriday
 +
 +Taxonomies and [Blackfriday configuration][config] can also be set per language:
 +
 +
 +{{< code-toggle file="config" >}}
 +[Taxonomies]
 +tag = "tags"
 +
 +[blackfriday]
 +angledQuotes = true
 +hrefTargetBlank = true
 +
 +[languages]
 +[languages.en]
 +weight = 1
 +title = "English"
 +[languages.en.blackfriday]
 +angledQuotes = false
 +
 +[languages.fr]
 +weight = 2
 +title = "Français"
 +[languages.fr.Taxonomies]
 +plaque = "plaques"
 +{{</ code-toggle >}}
 +
 +## Translate Your Content
 +
- ### Examples of Translated Articles
++There are two ways to manage your content translation, both ensures each page is assigned a language and linked to its translations.
++
++### Translation by filename
 +
- In this example, the `about.md` will be assigned the configured `defaultContentLanguage`. 
++Considering the following example:
 +
 +1. `/content/about.en.md`
 +2. `/content/about.fr.md`
 +
- 1. `/content/about.md`
- 2. `/content/about.fr.md`
++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.
 +
- 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`.
++Their language is __assigned__ according to the language code added as __suffix to the filename__. 
++
++By having the same **path and base filename**, the content pieces are __linked__ together as translated pages.
++{{< note >}}
++
++If a file is missing any language code, it will be assigned the default language.
++
++{{</ note >}}
++### Translation by content directory
++
++This system uses different content directories for each of the languages. Each language's content directory is set using the `contentDir` param.
++
++{{< code-toggle file="config" >}}
++
++languages:
++  en:
++    weight: 10
++    languageName: "English"
++    contentDir: "content/english"
++  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.
 +
- By having the same **directory and base filename**, the content pieces are linked together as translated pieces.
++### Bypassing default linking.
 +
- You can also set the key used to link the translations explicitly in front matter:
++Any pages sharing the same `translationKey`  set in front matter will be linked as translated pages regardless of basename or location.
 +
- translationKey: "my-story"
++Considering the following example:
++
++1. `/content/about-us.en.md`
++2. `/content/om.nn.md`
++3. `/content/presentation/a-propos.fr.md`
 +
 +```yaml
- 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:
++# set in all three pages
++translationKey: "about"
 +```
 +
- ```yaml
++By setting the `translationKey` front matter param to `about` in all three pages, they will be __linked__ as translated pages.
 +
- ```
++
++### 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.
 +
- For merging of content from other languages (i.e. missing content translations), see [lang.Merge](/functions/lang.merge/).
++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 %}}
++
++### Page Bundles
++
++To avoid the burden of having to duplicate files, each Page Bundle inherits the resources of its linked translated pages' bundles except for the content files (markdown files, html files etc...).
++
++Therefore, from within a template, the page will have access to the files from all linked pages' bundles.
++
++If, across the linked bundles, two or more files share the same 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`).
 +
- ## Link to Translated Content
++{{%/ note %}}
 +
- ## List All Available Languages
++## Reference the Translated Content
 +
 +To create a list of links to translated content, use a template similar to the following:
 +
 +{{< code file="layouts/partials/i18nlist.html" >}}
 +{{ if .IsTranslated }}
 +<h4>{{ i18n "translations" }}</h4>
 +<ul>
 +    {{ range .Translations }}
 +    <li>
 +        <a href="{{ .Permalink }}">{{ .Lang }}: {{ .Title }}{{ if .IsPage }} ({{ i18n "wordCount" . }}){{ end }}</a>
 +    </li>
 +    {{ end}}
 +</ul>
 +{{ end }}
 +{{< /code >}}
 +
 +The above can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template, be it for a [single content page][contenttemplate] or the [homepage][]. It will not print anything if there are no translations for a given page.
 +
 +The above also uses the [`i18n` function][i18func] described in the next section.
 +
++### 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:
 +
 +
 +{{< code file="layouts/partials/allLanguages.html" >}}
 +<ul>
 +{{ range $.Site.Home.AllTranslations }}
 +<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
 +{{ end }}
 +</ul>
 +{{< /code >}}
 +
 +## Translation of Strings
 +
 +Hugo uses [go-i18n][] to support string translations. [See the project's source repository][go-i18n-source] to find tools that will help you manage your translation workflows.
 +
 +Translations are collected from the `themes/<THEME>/i18n/` folder (built into the theme), as well as translations present in `i18n/` at the root of your project. In the `i18n`, the translations will be merged and take precedence over what is in the theme folder. Language files should be named according to [RFC 5646][] with names such as `en-US.toml`, `fr.toml`, etc.
 +
 +{{% note %}}
 +From **Hugo 0.31** you no longer need to use a valid language code. It _can be_ anything.
 +
 +See https://github.com/gohugoio/hugo/issues/3564
 +
 +{{% /note %}}
 +
 +From within your templates, use the `i18n` function like this:
 +
 +```
 +{{ i18n "home" }}
 +```
 +
 +This uses a definition like this one in `i18n/en-US.toml`:
 +
 +```
 +[home]
 +other = "Home"
 +```
 +
 +Often you will want to use to the page variables in the translations strings. To do that, pass on the "." context when calling `i18n`:
 +
 +```
 +{{ i18n "wordCount" . }}
 +```
 +
 +This uses a definition like this one in `i18n/en-US.toml`:
 +
 +```
 +[wordCount]
 +other = "This article has {{ .WordCount }} words."
 +```
 +An example of singular and plural form:
 +
 +```
 +[readingTime]
 +one = "One minute read"
 +other = "{{.Count}} minutes read"
 +```
 +And then in the template:
 +
 +```
 +{{ i18n "readingTime" .ReadingTime }}
 +```
 +To track down missing translation strings, run Hugo with the `--i18n-warnings` flag:
 +
 +```
 + hugo --i18n-warnings | grep i18n
 +i18n|MISSING_TRANSLATION|en|wordCount
 +```
 +
 +## Customize Dates
 +
 +At the time of this writing, Go does not yet have support for internationalized locales, but if you do some work, you can simulate it. For example, if you want to use French month names, you can add a data file like ``data/mois.yaml`` with this content:
 +
 +~~~yaml
 +1: "janvier"
 +2: "février"
 +3: "mars"
 +4: "avril"
 +5: "mai"
 +6: "juin"
 +7: "juillet"
 +8: "août"
 +9: "septembre"
 +10: "octobre"
 +11: "novembre"
 +12: "décembre"
 +~~~
 +
 +... then index the non-English date names in your templates like so:
 +
 +~~~html
 +<time class="post-date" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}">
 +  Article publié le {{ .Date.Day }} {{ index $.Site.Data.mois (printf "%d" .Date.Month) }} {{ .Date.Year }} (dernière modification le {{ .Lastmod.Day }} {{ index $.Site.Data.mois (printf "%d" .Lastmod.Month) }} {{ .Lastmod.Year }})
 +</time>
 +~~~
 +
 +This technique extracts the day, month and year by specifying ``.Date.Day``, ``.Date.Month``, and ``.Date.Year``, and uses the month number as a key, when indexing the month name data file.
 +
 +## Menus
 +
 +You can define your menus for each language independently. The [creation of a menu][menus] works analogous to earlier versions of Hugo, except that they have to be defined in their language-specific block in the configuration file:
 +
 +```
 +defaultContentLanguage = "en"
 +
 +[languages.en]
 +weight = 0
 +languageName = "English"
 +
 +[[languages.en.menu.main]]
 +url    = "/"
 +name   = "Home"
 +weight = 0
 +
 +
 +[languages.de]
 +weight = 10
 +languageName = "Deutsch"
 +
 +[[languages.de.menu.main]]
 +url    = "/"
 +name   = "Startseite"
 +weight = 0
 +```
 +
 +The rendering of the main navigation works as usual. `.Site.Menus` will just contain the menu of the current language. Pay attention to the generation of the menu links. `absLangURL` takes care that you link to the correct locale of your website. Otherwise, both menu entries would link to the English version as the default content language that resides in the root directory.
 +
 +```
 +<ul>
 +    {{- $currentPage := . -}}
 +    {{ range .Site.Menus.main -}}
 +    <li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
 +        <a href="{{ .URL | absLangURL }}">{{ .Name }}</a>
 +    </li>
 +    {{- end }}
 +</ul>
 +
 +```
 +
 +## Missing Translations
 +
 +If a string does not have a translation for the current language, Hugo will use the value from the default language. If no default value is set, an empty string will be shown.
 +
 +While translating a Hugo website, it can be handy to have a visual indicator of missing translations. The [`enableMissingTranslationPlaceholders` configuration option][config] will flag all untranslated strings with the placeholder `[i18n] identifier`, where `identifier` is the id of the missing translation.
 +
 +{{% note %}}
 +Hugo will generate your website with these missing translation placeholders. It might not be suited for production environments.
 +{{% /note %}}
 +
 +For merging of content from other languages (i.e. missing content translations), see [lang.Merge](/functions/lang.merge/).
 +
 +## Multilingual Themes support
 +
 +To support Multilingual mode in your themes, some considerations must be taken for the URLs in the templates. If there is more than one language, URLs must meet the following criteria:
 +
 +* Come from the built-in `.Permalink` or `.RelPermalink`
 +* Be constructed with
 +    * The [`relLangURL` template function][rellangurl] or the [`absLangURL` template function][abslangurl] **OR**
 +    * Prefixed with `{{ .LanguagePrefix }}`
 +
 +If there is more than one language defined, the `LanguagePrefix` variable will equal `/en` (or whatever your `CurrentLanguage` is). If not enabled, it will be an empty string and is therefore harmless for single-language Hugo websites.
 +
 +[abslangurl]: /functions/abslangurl
 +[config]: /getting-started/configuration/
 +[contenttemplate]: /templates/single-page-templates/
 +[go-i18n-source]: https://github.com/nicksnyder/go-i18n
 +[go-i18n]: https://github.com/nicksnyder/go-i18n
 +[homepage]: /templates/homepage/
 +[i18func]: /functions/i18n/
 +[menus]: /content-management/menus/
 +[rellangurl]: /functions/rellangurl
 +[RFC 5646]: https://tools.ietf.org/html/rfc5646
 +[singles]: /templates/single-page-templates/
index edb7168ccb95b2565cf22704db6c3f33b9695cec,0000000000000000000000000000000000000000..0116078f4254e2536a14e97af9657d60d1854202
mode 100644,000000..100644
--- /dev/null
@@@ -1,395 -1,0 +1,400 @@@
 +---
 +title: Shortcodes
 +linktitle:
 +description: Shortcodes are simple snippets inside your content files calling built-in or custom templates.
 +godocref:
 +date: 2017-02-01
 +publishdate: 2017-02-01
 +lastmod: 2017-03-31
 +menu:
 +  docs:
 +    parent: "content-management"
 +    weight: 35
 +weight: 35    #rem
 +categories: [content management]
 +keywords: [markdown,content,shortcodes]
 +draft: false
 +aliases: [/extras/shortcodes/]
 +toc: true
 +---
 +
 +## What a Shortcode is
 +
 +Hugo loves Markdown because of its simple content format, but there are times when Markdown falls short. Often, content authors are forced to add raw HTML (e.g., video `<iframes>`) to Markdown content. We think this contradicts the beautiful simplicity of Markdown's syntax.
 +
 +Hugo created **shortcodes** to circumvent these limitations.
 +
 +A shortcode is a simple snippet inside a content file that Hugo will render using a predefined template. Note that shortcodes will not work in template files. If you need the type of drop-in functionality that shortcodes provide but in a template, you most likely want a [partial template][partials] instead.
 +
 +In addition to cleaner Markdown, shortcodes can be updated any time to reflect new classes, techniques, or standards. At the point of site generation, Hugo shortcodes will easily merge in your changes. You avoid a possibly complicated search and replace operation.
 +
 +## Use Shortcodes
 +
 +{{< youtube 2xkNJL4gJ9E >}}
 +
 +In your content files, a shortcode can be called by calling `{{%/* shortcodename parameters */%}}`. Shortcode parameters are space delimited, and parameters with internal spaces can be quoted.
 +
 +The first word in the shortcode declaration is always the name of the shortcode. Parameters follow the name. Depending upon how the shortcode is defined, the parameters may be named, positional, or both, although you can't mix parameter types in a single call. The format for named parameters models that of HTML with the format `name="value"`.
 +
 +Some shortcodes use or require closing shortcodes. Again like HTML, the opening and closing shortcodes match (name only) with the closing declaration, which is prepended with a slash.
 +
 +Here are two examples of paired shortcodes:
 +
 +```
 +{{%/* mdshortcode */%}}Stuff to `process` in the *center*.{{%/* /mdshortcode */%}}
 +```
 +
 +```
 +{{</* highlight go */>}} A bunch of code here {{</* /highlight */>}}
 +```
 +
 +The examples above use two different delimiters, the difference being the `%` character in the first and the `<>` characters in the second.
 +
 +### Shortcodes with Markdown
 +
 +The `%` character indicates that the shortcode's inner content---called in the [shortcode template][sctemps] with the [`.Inner` variable][scvars]---needs further processing by the page's rendering processor (i.e. markdown via Blackfriday). In the following example, Blackfriday would convert `**World**` to `<strong>World</strong>`:
 +
 +```
 +{{%/* myshortcode */%}}Hello **World!**{{%/* /myshortcode */%}}
 +```
 +
 +### Shortcodes Without Markdown
 +
 +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 */>}}
 +```
 +
 +### Nested Shortcodes
 +
 +You can call shortcodes within other shortcodes by creating your own templates that leverage the `.Parent` variable. `.Parent` allows you to check the context in which the shortcode is being called. See [Shortcode templates][sctemps].
 +
 +## 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.
 +
 +### `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].
 +
 +The `figure` shortcode can use the following named parameters:
 +
 +src
 +: URL of the image to be displayed.
 +
 +link
 +: If the image needs to be hyperlinked, URL of the destination.
 +
 +target
 +: Optional `target` attribute for the URL if `link` parameter is set.
 +
 +rel
 +: Optional `rel` attribute for the URL if `link` parameter is set.
 +
 +alt
 +: Alternate text for the image if the image cannot be displayed.
 +
 +title
 +: Image title.
 +
 +caption
 +: Image caption.
 +
 +class
 +: `class` attribute of the HTML `figure` tag.
 +
 +height
 +: `height` attribute of the image.
 +
 +width
 +: `width` attribute of the image.
 +
 +attr
 +: Image attribution text.
 +
 +attrlink
 +: If the attribution text needs to be hyperlinked, URL of the destination.
 +
 +#### Example `figure` Input
 +
 +{{< code file="figure-input-example.md" >}}
 +{{</* figure src="/media/spf13.jpg" title="Steve Francia" */>}}
 +{{< /code >}}
 +
 +#### Example `figure` Output
 +
 +{{< output file="figure-output-example.html" >}}
 +<figure>
 +  <img src="/media/spf13.jpg"  />
 +  <figcaption>
 +      <h4>Steve Francia</h4>
 +  </figcaption>
 +</figure>
 +{{< /output >}}
 +
 +### `gist`
 +
 +Bloggers often want to include GitHub gists when writing posts. Let's suppose we want to use the [gist at the following url][examplegist]:
 +
 +```
 +https://gist.github.com/spf13/7896402
 +```
 +
 +We can embed the gist in our content via username and gist ID pulled from the URL:
 +
 +```
 +{{</* gist spf13 7896402 */>}}
 +```
 +
 +#### Example `gist` Input
 +
 +If the gist contains several files and you want to quote just one of them, you can pass the filename (quoted) as an optional third argument:
 +
 +{{< code file="gist-input.md" >}}
 +{{</* gist spf13 7896402 "img.html" */>}}
 +{{< /code >}}
 +
 +#### Example `gist` Output
 +
 +{{< output file="gist-output.html" >}}
 +{{< gist spf13 7896402 >}}
 +{{< /output >}}
 +
 +#### Example `gist` Display
 +
 +To demonstrate the remarkably efficiency of Hugo's shortcode feature, we have embedded the `spf13` `gist` example in this page. The following simulates the experience for visitors to your website. Naturally, the final display will be contingent on your stylesheets and surrounding markup.
 +
 +{{< gist spf13 7896402 >}}
 +
 +### `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.
 +
 +#### Example `highlight` Input
 +
 +{{< code file="content/tutorials/learn-html.md" >}}
 +{{</* highlight html */>}}
 +<section id="main">
 +  <div>
 +   <h1 id="title">{{ .Title }}</h1>
 +    {{ range .Data.Pages }}
 +        {{ .Render "summary"}}
 +    {{ end }}
 +  </div>
 +</section>
 +{{</* /highlight */>}}
 +{{< /code >}}
 +
 +#### Example `highlight` Output
 +
 +The `highlight` shortcode example above would produce the following HTML when the site is rendered:
 +
 +{{< output file="tutorials/learn-html/index.html" >}}
 +<span style="color: #f92672">&lt;section</span> <span style="color: #a6e22e">id=</span><span style="color: #e6db74">&quot;main&quot;</span><span style="color: #f92672">&gt;</span>
 +  <span style="color: #f92672">&lt;div&gt;</span>
 +   <span style="color: #f92672">&lt;h1</span> <span style="color: #a6e22e">id=</span><span style="color: #e6db74">&quot;title&quot;</span><span style="color: #f92672">&gt;</span>{{ .Title }}<span style="color: #f92672">&lt;/h1&gt;</span>
 +    {{ range .Data.Pages }}
 +        {{ .Render &quot;summary&quot;}}
 +    {{ end }}
 +  <span style="color: #f92672">&lt;/div&gt;</span>
 +<span style="color: #f92672">&lt;/section&gt;</span>
 +{{< /output >}}
 +
 +{{% note "More on Syntax Highlighting" %}}
 +To see even more options for adding syntax-highlighted code blocks to your website, see [Syntax Highlighting in Developer Tools](/tools/syntax-highlighting/).
 +{{% /note %}}
 +
 +### `instagram`
 +
 +If you'd like to embed a photo from [Instagram][], you only need the photo's ID. You can discern an Instagram photo ID from the URL:
 +
 +```
 +https://www.instagram.com/p/BWNjjyYFxVx/
 +```
 +
 +#### Example `instagram` Input
 +
 +{{< code file="instagram-input.md" >}}
 +{{</* instagram BWNjjyYFxVx */>}}
 +{{< /code >}}
 +
 +You also have the option to hide the caption:
 +
 +{{< code file="instagram-input-hide-caption.md" >}}
 +{{</* instagram BWNjjyYFxVx hidecaption */>}}
 +{{< /code >}}
 +
 +#### Example `instagram` Output
 +
 +By adding the preceding `hidecaption` example, the following HTML will be added to your rendered website's markup:
 +
 +{{< output file="instagram-hide-caption-output.html" >}}
 +{{< instagram BWNjjyYFxVx hidecaption >}}
 +{{< /output >}}
 +
 +#### Example `instagram` Display
 +
 +Using the preceding `instagram` with `hidecaption` example above, the following simulates the displayed experience for visitors to your website. Naturally, the final display will be contingent on your stylesheets and surrounding markup.
 +
 +{{< instagram BWNjjyYFxVx hidecaption >}}
 +
 +
 +### `ref` and `relref`
 +
 +These shortcodes will look up the pages by their relative path (e.g., `blog/post.md`) or their logical name (`post.md`) and return the permalink (`ref`) or relative permalink (`relref`) for the found page.
 +
 +`ref` and `relref` also make it possible to make fragmentary links that work for the header links generated by Hugo.
 +
 +{{% note "More on Cross References" %}}
 +Read a more extensive description of `ref` and `relref` in the [cross references](/content-management/cross-references/) documentation.
 +{{% /note %}}
 +
 +`ref` and `relref` take exactly one required parameter of _reference_, quoted and in position `0`.
 +
 +#### Example `ref` and `relref` Input
 +
 +```
 +[Neat]({{</* ref "blog/neat.md" */>}})
 +[Who]({{</* relref "about.md#who" */>}})
 +```
 +
 +#### Example `ref` and `relref` Output
 +
 +Assuming that standard Hugo pretty URLs are turned on.
 +
 +```
 +<a href="/blog/neat">Neat</a>
 +<a href="/about/#who:c28654c202e73453784cfd2c5ab356c0">Who</a>
 +```
 +
 +### `tweet`
 +
 +You want to include a single tweet into your blog post? Everything you need is the URL of the tweet:
 +
 +```
 +https://twitter.com/spf13/status/877500564405444608
 +```
 +
 +#### Example `tweet` Input
 +
 +Pass the tweet's ID from the URL as a parameter to the `tweet` shortcode:
 +
 +{{< code file="example-tweet-input.md" >}}
 +{{</* tweet 877500564405444608 */>}}
 +{{< /code >}}
 +
 +#### Example `tweet` Output
 +
 +Using the preceding `tweet` example, the following HTML will be added to your rendered website's markup:
 +
 +{{< output file="example-tweet-output.html" >}}
 +{{< tweet 877500564405444608 >}}
 +{{< /output >}}
 +
 +#### Example `tweet` Display
 +
 +Using the preceding `tweet` example, the following simulates the displayed experience for visitors to your website. Naturally, the final display will be contingent on your stylesheets and surrounding markup.
 +
 +{{< tweet 877500564405444608 >}}
 +
 +### `vimeo`
 +
 +Adding a video from [Vimeo][] is equivalent to the YouTube shortcode above.
 +
 +```
 +https://vimeo.com/channels/staffpicks/146022717
 +```
 +
 +#### Example `vimeo` Input
 +
 +Extract the ID from the video's URL and pass it to the `vimeo` shortcode:
 +
 +{{< code file="example-vimeo-input.md" >}}
 +{{</* vimeo 146022717 */>}}
 +{{< /code >}}
 +
 +#### Example `vimeo` Output
 +
 +Using the preceding `vimeo` example, the following HTML will be added to your rendered website's markup:
 +
 +{{< output file="example-vimeo-output.html" >}}
 +{{< vimeo 146022717 >}}
 +{{< /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.
 +
 +```
 +{{</* vimeo id="146022717" class="my-vimeo-wrapper-class" */>}}
 +```
 +{{% /tip %}}
 +
 +#### Example `vimeo` Display
 +
 +Using the preceding `vimeo` example, the following simulates the displayed experience for visitors to your website. Naturally, the final display will be contingent on your stylesheets and surrounding markup.
 +
 +{{< vimeo 146022717 >}}
 +
 +### `youtube`
 +
 +The `youtube` shortcode embeds a responsive video player for [YouTube videos][]. Only the ID of the video is required, e.g.:
 +
 +```
 +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:
 +
 +{{< code file="example-youtube-input.md" >}}
 +{{</* 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 an 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" >}}
 +{{</* youtube id="w7Ft2ymGmfc" autoplay="true" */>}}
 +{{< /code >}}
 +
 +#### Example `youtube` Output
 +
 +Using the preceding `youtube` example, the following HTML will be added to your rendered website's markup:
 +
 +{{< code file="example-youtube-output.html" >}}
 +{{< youtube id="w7Ft2ymGmfc" autoplay="true" >}}
 +{{< /code >}}
 +
 +#### Example `youtube` Display
 +
 +Using the preceding `youtube` example (without `autoplay="true"`), the following simulates the displayed experience for visitors to your website. Naturally, the final display will be contingent on your stylesheets and surrounding markup. The video is also include in the [Quick Start of the Hugo documentation][quickstart].
 +
 +{{< 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][].
 +
 +[`figure` shortcode]: #figure
 +[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/
 +[Pygments]: http://pygments.org/
 +[quickstart]: /getting-started/quick-start/
 +[sctemps]: /templates/shortcode-templates/
 +[scvars]: /variables/shortcodes/
 +[shortcode template documentation]: /templates/shortcode-templates/
 +[templatessection]: /templates/
 +[Vimeo]: https://vimeo.com/
 +[YouTube Videos]: https://www.youtube.com/
index 517968e3c0ecb6b8c718700bdf71ba65029a8128,0000000000000000000000000000000000000000..4576624d0cb14786cbe4b5495900838329661129
mode 100644,000000..100644
--- /dev/null
@@@ -1,193 -1,0 +1,199 @@@
- : 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.
 +---
 +title: Syntax Highlighting
 +description: Hugo comes with really fast syntax highlighting from Chroma.
 +date: 2017-02-01
 +publishdate: 2017-02-01
 +keywords: [highlighting,pygments,chroma,code blocks,syntax]
 +categories: [content management]
 +menu:
 +  docs:
 +    parent: "content-management"
 +    weight: 300
 +weight: 20
 +sections_weight: 20
 +draft: false
 +aliases: [/extras/highlighting/,/extras/highlight/,/tools/syntax-highlighting/]
 +toc: true
 +---
 +
 +From Hugo 0.28, the default syntax hightlighter in Hugo is [Chroma](https://github.com/alecthomas/chroma); it is built in Go and is really, really fast -- and for the most important parts compatible with Pygments.
 +
 +If you want to continue to use Pygments (see below), set `pygmentsUseClassic=true` in your site config.
 +
 +The example below shows a simple code snippet from the Hugo source highlighted with the `highlight` shortcode. Note that the gohugo.io site is generated with `pygmentsUseClasses=true` (see [Generate Syntax Highlighter CSS](#generate-syntax-highlighter-css)).
 +
 +* `linenos=inline` or `linenos=table` (`table` will give copy-and-paste friendly code blocks) turns on line numbers.
 +* `hl_lines` lists a set of line numbers or line number ranges to be highlighted. Note that the hyphen range syntax is only supported for Chroma.
 +* `linenostart=199` starts the line number count from 199.
 +
 +With that, this:
 +
 +```
 +{{</* highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" */>}}
 +// ... code
 +{{</* / highlight */>}}
 +```
 +
 +Gives this:
 +
 +{{< highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" >}}
 +// GetTitleFunc returns a func that can be used to transform a string to
 +// title case.
 +//
 +// The supported styles are
 +//
 +// - "Go" (strings.Title)
 +// - "AP" (see https://www.apstylebook.com/)
 +// - "Chicago" (see http://www.chicagomanualofstyle.org/home.html)
 +//
 +// If an unknown or empty style is provided, AP style is what you get.
 +func GetTitleFunc(style string) func(s string) string {
 +  switch strings.ToLower(style) {
 +  case "go":
 +    return strings.Title
 +  case "chicago":
 +    tc := transform.NewTitleConverter(transform.ChicagoStyle)
 +    return tc.Title
 +  default:
 +    tc := transform.NewTitleConverter(transform.APStyle)
 +    return tc.Title
 +  }
 +}
 +{{< / highlight >}}
 +
 +
 +## Configure Syntax Highlighter
 +To make the transition from Pygments to Chroma seamless, they share a common set of configuration options:
 +
 +pygmentsOptions
 +:  A comma separated list of options. See below for a full list.
 +
 +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. 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).
 +
 +pygmentsCodefencesGuessSyntax
 +: Set to `true` to try to do syntax highlighting on code fenced blocks in markdown without a language tag.
 +
 +pygmentsUseClassic
 +: Set to true to use Pygments instead of the much faster Chroma.
 +
 +### Options
 +
 +`pygmentsOptions` can be set either in site config or overridden per code block in the Highlight shortcode or template func.
 +
 +noclasses
 +: Use inline style.
 +
 +linenos
 +: For Chroma, any value in this setting will print line numbers. Pygments has some more fine grained control.
 +
 +linenostart
 +: Start the line numbers from this value (default is 1).
 +
 +
 +hl_lines
 +: Highlight a space separated list of line numbers. For Chroma, you can provide a list of ranges, i.e. "3-8 10-20".
 +
 +
 +The full set of supported options for Pygments is: `encoding`, `outencoding`, `nowrap`, `full`, `title`, `style`, `noclasses`, `classprefix`, `cssclass`, `cssstyles`, `prestyles`, `linenos`, `hl_lines`, `linenostart`, `linenostep`, `linenospecial`, `nobackground`, `lineseparator`, `lineanchors`, `linespans`, `anchorlinenos`, `startinline`. See the [Pygments HTML Formatter Documentation](http://pygments.org/docs/formatters/#HtmlFormatter) for details.
 +
 +
 +## Generate Syntax Highlighter CSS
 +
 +If you run with `pygmentsUseClasses=true` in your site config, you need a style sheet.
 +
 +You can generate one with Hugo:
 +
 +```bash
 +hugo gen chromastyles --style=monokai > syntax.css
 +```
 +
 +Run `hugo gen chromastyles -h` for more options. See https://help.farbox.com/pygments.html for a gallery of available styles.
 +
 +
 +## Highlight Shortcode
 +
 +Highlighting is carried out via the [built-in shortcode](/content-management/shortcodes/) `highlight`. `highlight` takes exactly one required parameter for the programming language to be highlighted and requires a closing shortcode. Note that `highlight` is *not* used for client-side javascript highlighting.
 +
 +### Example `highlight` Shortcode
 +
 +{{< code file="example-highlight-shortcode-input.md" >}}
 +{{</* highlight html */>}}
 +<section id="main">
 +  <div>
 +    <h1 id="title">{{ .Title }}</h1>
 +    {{ range .Data.Pages }}
 +      {{ .Render "summary"}}
 +    {{ end }}
 +  </div>
 +</section>
 +{{</* /highlight */>}}
 +{{< /code >}}
 +
 +
 +
 +## Highlight Template Func
 +
 +See [Highlight](/functions/highlight/).
 +
 +## Highlight in Code Fences
 +
 +It is also possible to add syntax highlighting with GitHub flavored code fences. To enable this, set the `pygmentsCodeFences` to `true` in Hugo's [configuration file](/getting-started/configuration/);
 +
 +````
 +```go-html-template
 +<section id="main">
 +  <div>
 +    <h1 id="title">{{ .Title }}</h1>
 +    {{ range .Data.Pages }}
 +      {{ .Render "summary"}}
 +    {{ end }}
 +  </div>
 +</section>
 +```
 +````
 +
 +## List of Chroma Highlighting Languages
 +
 +The full list of Chroma lexers and their aliases (which is the identifier used in the `hightlight` template func or when doing highlighting in code fences):
 +
 +{{< chroma-lexers >}}
 +
 +## Highlight with Pygments Classic
 +
 +If you for some reason don't want to use the built-in Chroma highlighter, you can set `pygmentsUseClassic=true` in your config and add Pygments to your path.
 +
 +{{% note "Disclaimers on Pygments" %}}
 +* Pygments is relatively slow and _causes a performance hit when building your site_, but Hugo has been designed to cache the results to disk.
 +* The caching can be turned off by setting the `--ignoreCache` flag to `true`.
 +* The languages available for highlighting depend on your Pygments installation.
 +{{% /note %}}
 +
 +If you have never worked with Pygments before, here is a brief primer:
 +
 ++ Install Python from [python.org](https://www.python.org/downloads/). Version 2.7.x is already sufficient.
 ++ Run `pip install Pygments` in order to install Pygments. Once installed, Pygments gives you a command `pygmentize`. Make sure it sits in your PATH; otherwise, Hugo will not be able to find and use it.
 +
 +On Debian and Ubuntu systems, you may also install Pygments by running `sudo apt-get install python3-pygments`.
 +
 +
 +
 +[Prism]: http://prismjs.com
 +[prismdownload]: http://prismjs.com/download.html
 +[Highlight.js]: http://highlightjs.org/
 +[Rainbow]: http://craig.is/making/rainbows
 +[Syntax Highlighter]: http://alexgorbatchev.com/SyntaxHighlighter/
 +[Google Prettify]: https://github.com/google/code-prettify
 +[Yandex]: http://yandex.ru/
index 9105ff840a4d17be7ff6fa37e97998d9307b2514,0000000000000000000000000000000000000000..73c13da09d30c3244f2374393b28301fcffc99cb
mode 100644,000000..100644
--- /dev/null
@@@ -1,26 -1,0 +1,29 @@@
- description: Evaluates a format string and logs it to ERROR.
 +---
 +title: errorf
 +linktitle: errorf
- `errorf` will evaluate a format string, then output the result to the ERROR log.
- This will also cause the build to fail.
++description: Log ERROR and fail the build from the templates.
 +date: 2017-09-30
 +publishdate: 2017-09-30
 +lastmod: 2017-09-30
 +categories: [functions]
 +menu:
 +  docs:
 +    parent: "functions"
 +keywords: [strings, log, error]
 +signature: ["errorf FORMAT INPUT"]
 +workson: []
 +hugoversion:
 +relatedfuncs: [printf]
 +deprecated: false
 +aliases: []
 +---
 +
- {{ errorf "Something went horribly wrong! %s" err }}
++`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 "Failed to handle page %q" .Path }}
 +```
++
++Note that `errorf` supports all the formatting verbs of the [fmt](https://golang.org/pkg/fmt/) package.
index 2ad2910f8c67df8dadfaf06a2501fe83ed2a72b4,0000000000000000000000000000000000000000..7bbd59564814e2fe4327a22fecad766c49d44595
mode 100644,000000..100644
--- /dev/null
@@@ -1,230 -1,0 +1,230 @@@
- The site Hugo renders into `public/` is ready to be deployed to your web server:
 +---
 +title: Basic Usage
 +linktitle: Basic Usage
 +description: Hugo's CLI is fully featured but simple to use, even for those who have very limited experience working from the command line.
 +date: 2017-02-01
 +publishdate: 2017-02-01
 +lastmod: 2017-02-01
 +categories: [getting started]
 +keywords: [usage,livereload,command line,flags]
 +menu:
 +  docs:
 +    parent: "getting-started"
 +    weight: 40
 +weight: 40
 +sections_weight: 40
 +draft: false
 +aliases: [/overview/usage/,/extras/livereload/,/doc/usage/,/usage/]
 +toc: true
 +---
 +
 +The following is a description of the most common commands you will use while developing your Hugo project. See the [Command Line Reference][commands] for a comprehensive view of Hugo's CLI.
 +
 +## Test Installation
 +
 +Once you have [installed Hugo][install], make sure it is in your `PATH`. You can test that Hugo has been installed correctly via the `help` command:
 +
 +```
 +hugo help
 +```
 +
 +The output you see in your console should be similar to the following:
 +
 +```
 +hugo is the main command, used to build your Hugo site.
 +
 +Hugo is a Fast and Flexible Static Site Generator
 +built with love by spf13 and friends in Go.
 +
 +Complete documentation is available at http://gohugo.io/.
 +
 +Usage:
 +  hugo [flags]
 +  hugo [command]
 +
 +Available Commands:
 +  benchmark   Benchmark Hugo by building a site a number of times.
 +  check       Contains some verification checks
 +  config      Print the site configuration
 +  convert     Convert your content to different formats
 +  env         Print Hugo version and environment info
 +  gen         A collection of several useful generators.
 +  help        Help about any command
 +  import      Import your site from others.
 +  list        Listing out various types of content
 +  new         Create new content for your site
 +  server      A high performance webserver
 +  version     Print the version number of Hugo
 +
 +Flags:
 +  -b, --baseURL string             hostname (and path) to the root, e.g. http://spf13.com/
 +  -D, --buildDrafts                include content marked as draft
 +  -E, --buildExpired               include expired content
 +  -F, --buildFuture                include content with publishdate in the future
 +      --cacheDir string            filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
 +      --canonifyURLs               (deprecated) if true, all relative URLs will be canonicalized using baseURL
 +      --cleanDestinationDir        remove files from destination not found in static directories
 +      --config string              config file (default is path/config.yaml|json|toml)
 +  -c, --contentDir string          filesystem path to content directory
 +      --debug                      debug output
 +  -d, --destination string         filesystem path to write files to
 +      --disableKinds stringSlice   disable different kind of pages (home, RSS etc.)
 +      --enableGitInfo              add Git revision, date and author info to the pages
 +      --forceSyncStatic            copy all files when static is changed.
 +      --gc                         enable to run some cleanup tasks (remove unused cache files) after the build
 +  -h, --help                       help for hugo
 +      --i18n-warnings              print missing translations
 +      --ignoreCache                ignores the cache directory
 +  -l, --layoutDir string           filesystem path to layout directory
 +      --log                        enable Logging
 +      --logFile string             log File path (if set, logging enabled automatically)
 +      --noChmod                    don't sync permission mode of files
 +      --noTimes                    don't sync modification time of files
 +      --pluralizeListTitles        (deprecated) pluralize titles in lists using inflect (default true)
 +      --preserveTaxonomyNames      (deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
 +      --quiet                      build in quiet mode
 +      --renderToMemory             render to memory (only useful for benchmark testing)
 +  -s, --source string              filesystem path to read files relative from
 +      --stepAnalysis               display memory and timing of different steps of the program
 +      --templateMetrics            display metrics about template executions
 +      --templateMetricsHints       calculate some improvement hints when combined with --templateMetrics
 +  -t, --theme string               theme to use (located in /themes/THEMENAME/)
 +      --themesDir string           filesystem path to themes directory
 +      --uglyURLs                   (deprecated) if true, use /filename.html instead of /filename/
 +  -v, --verbose                    verbose output
 +      --verboseLog                 verbose logging
 +  -w, --watch                      watch filesystem for changes and recreate as needed
 +
 +Use "hugo [command] --help" for more information about a command.
 +```
 +
 +## The `hugo` Command
 +
 +The most common usage is probably to run `hugo` with your current directory being the input directory.
 +
 +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 command `hugo` renders your site into `public/` dir and is ready to be deployed to your web server:
 +
 +```
 +hugo
 +0 draft content
 +0 future content
 +99 pages created
 +0 paginator pages created
 +16 tags created
 +0 groups created
 +in 90 ms
 +```
 +
 +## Draft, Future, and Expired Content
 +
 +Hugo allows you to set `draft`, `publishdate`, and even `expirydate` in your content's [front matter][]. By default, Hugo will not publish:
 +
 +1. Content with a future `publishdate` value
 +2. Content with `draft: true` status
 +3. Content with a past `expirydate` value
 +
 +All three of these can be overridden during both local development *and* deployment by adding the following flags to `hugo` and `hugo server`, respectively, or by changing the boolean values assigned to the fields of the same name (without `--`) in your [configuration][config]:
 +
 +1. `--buildFuture`
 +2. `--buildDrafts`
 +3. `--buildExpired`
 +
 +## LiveReload
 +
 +Hugo comes with [LiveReload](https://github.com/livereload/livereload-js) built in. There are no additional packages to install. A common way to use Hugo while developing a site is to have Hugo run a server with the `hugo server` command and watch for changes:
 +
 +```
 +hugo server
 +0 draft content
 +0 future content
 +99 pages created
 +0 paginator pages created
 +16 tags created
 +0 groups created
 +in 120 ms
 +Watching for changes in /Users/yourname/sites/yourhugosite/{data,content,layouts,static}
 +Serving pages from /Users/yourname/sites/yourhugosite/public
 +Web Server is available at http://localhost:1313/
 +Press Ctrl+C to stop
 +```
 +
 +This will run a fully functioning web server while simultaneously watching your file system for additions, deletions, or changes within the following areas of your [project organization][dirs]:
 +
 +* `/static/*`
 +* `/content/*`
 +* `/data/*`
 +* `/i18n/*`
 +* `/layouts/*`
 +* `/themes/<CURRENT-THEME>/*`
 +* `config`
 +
 +Whenever you make changes, Hugo will simultaneously rebuild the site and continue to serve content. As soon as the build is finished, LiveReload tells the browser to silently reload the page.
 +
 +Most Hugo builds are so fast that you may not notice the change unless looking directly at the site in your browser. This means that keeping the site open on a second monitor (or another half of your current monitor) allows you to see the most up-to-date version of your website without the need to leave your text editor.
 +
 +{{% note "Closing `</body>` Tag"%}}
 +Hugo injects the LiveReload `<script>` before the closing `</body>` in your templates and will therefore not work if this tag is not present..
 +{{% /note %}}
 +
 +### Disable LiveReload
 +
 +LiveReload works by injecting JavaScript into the pages Hugo generates. The script creates a connection from the browser's web socket client to the Hugo web socket server.
 +
 +LiveReload is awesome for development. However, some Hugo users may use `hugo server` in production to instantly display updated content. The following methods make it easy to disable LiveReload:
 +
 +```
 +hugo server --watch=false
 +```
 +
 +Or...
 +
 +```
 +hugo server --disableLiveReload
 +```
 +
 +The latter flag can be omitted by adding the following key-value to  your `config.toml` or `config.yml` file, respectively:
 +
 +```
 +disableLiveReload = true
 +```
 +
 +```
 +disableLiveReload: true
 +```
 +
 +## Deploy Your Website
 +
 +After running `hugo server` for local web development, you need to do a final `hugo` run *without the `server` part of the command* to rebuild your site. You may then deploy your site by copying the `public/` directory to your production web server.
 +
 +Since Hugo generates a static website, your site can be hosted *anywhere* using any web server. See [Hosting and Deployment][hosting] for methods for hosting and automating deployments contributed by the Hugo community.
 +
 +{{% warning "Generated Files are **NOT** Removed on Site Build" %}}
 +Running `hugo` *does not* remove generated files before building. This means that you should delete your `public/` directory (or the publish directory you specified via flag or configuration file) before running the `hugo` command. If you do not remove these files, you run the risk of the wrong files (e.g., drafts or future posts) being left in the generated site.
 +{{% /warning %}}
 +
 +### Dev vs Deploy Destinations
 +
 +Hugo does not remove generated files before building. An easy workaround is to use different directories for development and production.
 +
 +To start a server that builds draft content (helpful for editing), you can specify a different destination; e.g., a `dev/` directory:
 +
 +```
 +hugo server -wDs ~/Code/hugo/docs -d dev
 +```
 +
 +When the content is ready for publishing, use the default `public/` dir:
 +
 +```
 +hugo -s ~/Code/hugo/docs
 +```
 +
 +This prevents draft content from accidentally becoming available.
 +
 +[commands]: /commands/
 +[config]: /getting-started/configuration/
 +[dirs]: /getting-started/directory-structure/
 +[front matter]: /content-management/front-matter/
 +[hosting]: /hosting-and-deployment/
 +[install]: /getting-started/installing/
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..1f1cab1f150434a3f74b793d26c435730e43ad39
new file mode 100644 (file)
Binary files differ
index 67bbce4fc8af936cda9da519460ab11ddceaf88a,0000000000000000000000000000000000000000..c3f99d3133078a8a50aee4c1283db637431b8e43
mode 100644,000000..100644
--- /dev/null
@@@ -1,66 -1,0 +1,66 @@@
- title: "0.42"
- description: "0.42"
 +
 +---
 +date: 2018-06-12
++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"]
 +---
 +
 +      Hugo `0.42` adds **Theme Components**. This is a really powerful new way of building your Hugo sites with reusable components. This is both **Theme Composition** and **Theme Inheritance**.
 +
 +>Read more about Theme Components in the [Hugo Documentation](https://gohugo.io/themes/theme-components/).
 +
 +The feature above was implemented by [@bep](https://github.com/bep), the funny Norwegian, with great design help from the Hugo community. But that implementation would not have been possible without [Afero](https://github.com/spf13/afero), [Steve Francia's](https://github.com/spf13) virtual file system. Hugo is built on top of Afero and many other fast and solid Go projects, and if you look at the combined contribution log of the Hugo project and its many open source dependencies, the total amount of contributions is staggering. A big thank you to them all!
 +
 +This release represents **27 contributions by 7 contributors** to the main Hugo code base. [@bep](https://github.com/bep) leads the Hugo development with a significant amount of contributions, but also a big shoutout to [@onedrawingperday](https://github.com/onedrawingperday), [@anthonyfok](https://github.com/anthonyfok), and [@stefanneuhaus](https://github.com/stefanneuhaus) for their ongoing contributions.
 +
 +And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) for his relentless work on keeping the themes site in pristine condition and to [@kaushalmodi](https://github.com/kaushalmodi) for his great work on the documentation site.
 +
 +Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs), 
 +which has received **8 contributions by 5 contributors**. A special thanks to [@bep](https://github.com/bep), [@LorenzCK](https://github.com/LorenzCK), [@gavinwray](https://github.com/gavinwray), and [@deyton](https://github.com/deyton) for their work on the documentation site.
 +
 +
 +Hugo now has:
 +
 +* 26286+ [stars](https://github.com/gohugoio/hugo/stargazers)
 +* 444+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
 +* 235+ [themes](http://themes.gohugo.io/)
 +
 +## Notes
 +* The `speakerdeck` shortcode is removed. It didn't work properly, so is isn't expected to be in wide use. If you use it, you will get a build error. You will either have to remove its usage or add a `speakerdeck` shortcode to your own project or theme.
 +* We have now virtualized the filesystems for project and theme files. This makes everything simpler, faster and more powerful. But it also means that template lookups on the form `{{ template “theme/partials/pagination.html” . }}` will not work anymore. That syntax has never been documented, so it's not expected to be in wide use. `{{ partial "pagination.html" . }}` will give you the most specific version of that partial.
 +
 +## Enhancements
 +
 +
 +* Always load GA script over HTTPS [2e6712e2](https://github.com/gohugoio/hugo/commit/2e6712e2814f333caa807888c1d8a9a5a3c03709) [@coliff](https://github.com/coliff) 
 +* Remove speakerdeck shortcode [65deb72d](https://github.com/gohugoio/hugo/commit/65deb72dc4c9299416cf2d9defddb96dba4101fd) [@onedrawingperday](https://github.com/onedrawingperday) [#4830](https://github.com/gohugoio/hugo/issues/4830)
 +* Add `strings.RuneCount` [019bd557](https://github.com/gohugoio/hugo/commit/019bd5576be87c9f06b6a928ede1a5e78677f7b3) [@theory](https://github.com/theory) 
 +* Add `strings.Repeat` [13435a6f](https://github.com/gohugoio/hugo/commit/13435a6f608306c5094fdcd72a1d9538727f91b2) [@theory](https://github.com/theory) 
 +* Reset Page's main output on server rebuilds [dc4226a8](https://github.com/gohugoio/hugo/commit/dc4226a8b27e03e31068fc945daab885d3819d04) [@bep](https://github.com/bep) [#4819](https://github.com/gohugoio/hugo/issues/4819)
 +* Create LICENSE rather than LICENSE.md in "new theme" [ed4a345e](https://github.com/gohugoio/hugo/commit/ed4a345efeaa19eef2c1c6360d22f75c24abc31a) [@anthonyfok](https://github.com/anthonyfok) [#4623](https://github.com/gohugoio/hugo/issues/4623)
 +* Create `_default/baseof.html` in "new theme" [9717ac7d](https://github.com/gohugoio/hugo/commit/9717ac7dce84d004afde4edb32ad81319c7dd8a7) [@anthonyfok](https://github.com/anthonyfok) [#3576](https://github.com/gohugoio/hugo/issues/3576)
 +* Add `tweet_simple`shortcode [07b96d16](https://github.com/gohugoio/hugo/commit/07b96d16e8679c40e289c9076ef4414ed6eb7f81) [@onedrawingperday](https://github.com/onedrawingperday) 
 +* Make "new theme" feedback more intuitive [692ec008](https://github.com/gohugoio/hugo/commit/692ec008726b570c9b30ac3391774cbb622730cb) [@anthonyfok](https://github.com/anthonyfok) 
 +* Move nextStepsText() to new_site.go [d3dd74fd](https://github.com/gohugoio/hugo/commit/d3dd74fd655c22f21e91e38edb1d377a1357e3be) [@anthonyfok](https://github.com/anthonyfok) 
 +* Add support for theme composition and inheritance [80230f26](https://github.com/gohugoio/hugo/commit/80230f26a3020ff33bac2bef01b2c0e314b89f86) [@bep](https://github.com/bep) [#4460](https://github.com/gohugoio/hugo/issues/4460)[#4450](https://github.com/gohugoio/hugo/issues/4450)
 +* Add vimeo_simple [8de53244](https://github.com/gohugoio/hugo/commit/8de53244799f0d2d0343056d348d810343cf7aa5) [@onedrawingperday](https://github.com/onedrawingperday) [#4749](https://github.com/gohugoio/hugo/issues/4749)
 +* Add a BlackFriday option for rel="noreferrer" on external links [20cbc2c7](https://github.com/gohugoio/hugo/commit/20cbc2c7856a9b07d45648d940276374db35e425) [@stefanneuhaus](https://github.com/stefanneuhaus) [#4722](https://github.com/gohugoio/hugo/issues/4722)
 +* Add a BlackFriday option for rel="nofollow" on external links [7a619264](https://github.com/gohugoio/hugo/commit/7a6192647a4b383cd539df2063388ea380371de6) [@stefanneuhaus](https://github.com/stefanneuhaus) [#4722](https://github.com/gohugoio/hugo/issues/4722)
 +* Update Chroma [b5b36e32](https://github.com/gohugoio/hugo/commit/b5b36e32008bc8ea779ae06bf249b537f6d5c336) [@bep](https://github.com/bep) [#4779](https://github.com/gohugoio/hugo/issues/4779)
 +* Enhance Page and Resource String() [4f0665f4](https://github.com/gohugoio/hugo/commit/4f0665f476e06e9707621c18f7422fdeb776e0d1) [@vassudanagunta](https://github.com/vassudanagunta) 
 +* Update theme documentation [c74b0f8f](https://github.com/gohugoio/hugo/commit/c74b0f8f9b30866e09efac8235cc5e0093ab3d50) [@bep](https://github.com/bep) [#4460](https://github.com/gohugoio/hugo/issues/4460)
 +
 +## Fixes
 +
 +* Make sure that `.Site.Taxonomies` is always set on rebuilds [6464981a](https://github.com/gohugoio/hugo/commit/6464981adb4d7d0f41e8e2c987342082982210a1) [@bep](https://github.com/bep) [#4838](https://github.com/gohugoio/hugo/issues/4838)
 +* Reset the "distinct error logger" on rebuilds [bf5f10fa](https://github.com/gohugoio/hugo/commit/bf5f10faa9fd445c4dd21839aa7d73cd2acbfb85) [@bep](https://github.com/bep) [#4818](https://github.com/gohugoio/hugo/issues/4818)
 +* Remove frameborder attr YT iframe + CSS fixes [ceaff7ca](https://github.com/gohugoio/hugo/commit/ceaff7cafc5357274e546984ae02a4cbdf305f81) [@onedrawingperday](https://github.com/onedrawingperday) 
 +* Fix vimeo_simple thumb scaling [b84389c5](https://github.com/gohugoio/hugo/commit/b84389c5e0e1ef15449b24d488bbbcbc41245c59) [@onedrawingperday](https://github.com/onedrawingperday) 
 +* Fix typo instagram_simple [d68367cb](https://github.com/gohugoio/hugo/commit/d68367cbe76cbc02adb5b778e8be98bed6319368) [@onedrawingperday](https://github.com/onedrawingperday) 
 +* Prevent isBaseTemplate() from matching "baseof" in dir [c3115292](https://github.com/gohugoio/hugo/commit/c3115292a7f2d2623cb45054a361e997ad9330c9) [@anthonyfok](https://github.com/anthonyfok) [#4809](https://github.com/gohugoio/hugo/issues/4809)
 +
 +
 +
 +
 +
index 581444172013c3e9f075fd8147dabe2fa6102980,0000000000000000000000000000000000000000..6b5b3c775d4737756d8c7fdc7bcb75a9b0dd3aac
mode 100644,000000..100644
--- /dev/null
@@@ -1,18 -1,0 +1,18 @@@
- title: "0.42.1"
- description: "0.42.1"
 +
 +---
 +date: 2018-06-13
++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
 +
 +---
 +
 +      
 +
 +This is a bug-fix release with two fixes:
 +
 +* Reset the global pages cache on server rebuilds [128f14ef](https://github.com/gohugoio/hugo/commit/128f14efad90886ffef37c01ac1e20436a732f97) [@bep](https://github.com/bep) [#4845](https://github.com/gohugoio/hugo/issues/4845)
 +* Do not fail server build when /static is missing [34ee27a7](https://github.com/gohugoio/hugo/commit/34ee27a78b9e2b5f475d44253ae234067b76cc6e) [@bep](https://github.com/bep) [#4846](https://github.com/gohugoio/hugo/issues/4846)
 +
index f680b560f652289e58e29c3c084cbf99ab9981cc,0000000000000000000000000000000000000000..c9bf6c46963dd10eb7680ecdca64b2390cccf6ee
mode 100644,000000..100644
--- /dev/null
@@@ -1,19 -1,0 +1,18 @@@
- title: "0.42.2"
- description: "0.42.2"
 +
 +---
 +date: 2018-06-28
-       
++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)
 +
 +
 +
 +
 +
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..4c31412fdfd2b2e6cc90d25825e550250a3ce045
new file mode 100644 (file)
Binary files differ
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..00848fcf009ee6c95e9600b97e41368de5f677bd
new file mode 100644 (file)
Binary files differ
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..0d4dfd599d3abbafe2e10d4e7baf089d851872e8
new file mode 100644 (file)
Binary files differ
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..a06d535d5630a5f4bb640549791239462c831bae
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,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.
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..db3373c0bfb39ce0d6707ac730766cf00c27f2de
new file mode 100644 (file)
Binary files differ
index 343058e2d9e9666ca6081e84e72190b14d4543b3,0000000000000000000000000000000000000000..61ce35ef25a9c696d68fb2a5622fedd9837b3759
mode 100644,000000..100644
--- /dev/null
@@@ -1,85 -1,0 +1,85 @@@
- lastmod: 2017-05-25
 +---
 +title: Hugo's Lookup Order
 +linktitle: Template Lookup Order
 +description: Hugo searches for the layout to use for a given page in a well defined order, starting from the most specific.
 +godocref:
 +date: 2017-02-01
 +publishdate: 2017-02-01
- : 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`.
++lastmod: 2017-07-05
 +categories: [templates,fundamentals]
 +keywords: [templates]
 +menu:
 +  docs:
 +    parent: "templates"
 +    weight: 15
 +  quicklinks:
 +weight: 15
 +sections_weight: 15
 +draft: false
 +aliases: [/templates/lookup/]
 +toc: true
 +---
 +
 +## Hugo Layouts Lookup Rules
 +
 +Hugo takes the parameters listed below into consideration when choosing a layout for a given page. They are listed in a priority order. This should feel natural, but look at the table below for concrete examples of the different parameter variations.
 +
 +
 +Kind
 +: The page `Kind` (the home page is one). See the example tables below per kind. This also determines if it is a **single page** (i.e. a regular content page. We then look for a template in `_default/single.html` for HTML) or a **list page** (section listings, home page, taxonomy lists, taxonomy terms. We then look for a template in `_default/list.html` for HTML).
 +
 +Output Format
 +: See [Custom Output Formats](/templates/output-formats). An output format has both a `name` (e.g. `rss`, `amp`, `html`) and a `suffix` (e.g. `xml`, `html`). We prefer matches with both (e.g. `index.amp.html`, but look for less specific templates.
 +
 +Language
++: We will consider a language code in the template name. If the site language is `fr`, `index.fr.amp.html` will win over `index.amp.html`, but `index.amp.html` will be chosen before `index.fr.html`.
 +
 +Layout
 +: Can be set in page front matter.
 +
 +Type
 +: Is value of `type` if set in front matter, else it is the name of the root section (e.g. "blog"). It will always have a value, so if not set, the value is "page". 
 +
 +Section
 +: Is relevant for `section`, `taxonomy` and `taxonomyTerm` types.
 +
 +{{% note %}}
 +**Tip:** The examples below looks long and complex. That is the flexibility talking. Most Hugo sites contain just a handful of templates:
 +
 +```bash
 +├── _default
 +│   ├── baseof.html
 +│   ├── list.html
 +│   └── single.html
 +└── index.html
 +```
 +{{% /note %}}
 +
 +
 +## Hugo Layouts Lookup Rules With Theme
 +
 +In Hugo, layouts can live in either the project's or the themes' layout folders, and the most specific layout will be chosen. Hugo will interleave the lookups listed below, finding the most specific one either in the project or themes.
 +
 +## Examples: Layout Lookup for Regular Pages
 +
 +{{< datatable-filtered "output" "layouts" "Kind == page" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
 +
 +## Examples: Layout Lookup for Home Page
 +
 +{{< datatable-filtered "output" "layouts" "Kind == home" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
 +
 +## Examples: Layout Lookup for Section Pages
 +
 +{{< datatable-filtered "output" "layouts" "Kind == section" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
 +
 +## Examples: Layout Lookup for Taxonomy List Pages
 +
 +{{< datatable-filtered "output" "layouts" "Kind == taxonomy" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
 +
 +## Examples: Layout Lookup for Taxonomy Terms Pages
 +
 +{{< datatable-filtered "output" "layouts" "Kind == taxonomyTerm" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
 +
 +
 +
 +
index 23312db31a920132dbb9f9d79c655ddb65dede22,0000000000000000000000000000000000000000..91127e740502f0b575c1a623205d0cd45d949d6b
mode 100644,000000..100644
--- /dev/null
@@@ -1,51 -1,0 +1,51 @@@
- The theme definition example above in `config.toml` creates a theme with 3 theme components with presedence from left to right.
 +---
 +title: Theme Components
 +linktitle: Theme Components
 +description: Hugo provides advanced theming support with Theme Components.
 +date: 2017-02-01
 +categories: [themes]
 +keywords: [themes, theme, source, organization, directories]
 +menu:
 +  docs:
 +    parent: "themes"
 +    weight: 20
 +weight: 20
 +sections_weight: 20
 +draft: false
 +aliases: [/themes/customize/,/themes/customizing/]
 +toc: true
 +---
 +
 +Since Hugo `0.42` a project can configure a theme as a composite of as many theme components you need:
 +
 +{{< code-toggle file="config">}}
 +theme = ["my-shortcodes", "base-theme", "hyde"]
 +{{< /code-toggle >}}
 +
 +
 +You can even nest this, and have the theme component itself include theme components in its own `config.toml` (theme inheritance).[^1]
 +
- 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`.
++The theme definition example above in `config.toml` creates a theme with 3 theme components with precedence from left to right.
 +
- * For `static`, `layouts` (templates) and `archetypes` files, these are merged on file level. So the left-most file will be chosen.
++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.
- 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.
++* 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.
 +
 +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:
 +
 +* `params` (global and per language)
 +* `menu` (global and per language)
 +* `outputformats` and `mediatypes`
 +
 +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]: Including theme components in the themes is currently not supported for themes hosted on [The Hugo Themes Site](https://themes.gohugo.io/), but can be really useful if you want to create your own theme based on a theme you find on that site.
 +
 +
 +
index 6ff73e1f9c719caa9623d484c62cdae906c9106c,0000000000000000000000000000000000000000..f44b509c2815c7aed2de2b7055c5fa7a12744cff
mode 100644,000000..100644
--- /dev/null
@@@ -1,25 -1,0 +1,25 @@@
- {{ $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"}}
 +{{ .Scratch.Set "image" ($original.Fit $options) }}
 +{{ else if eq $command "Resize"}}
 +{{ .Scratch.Set "image" ($original.Resize $options) }}
 +{{ else if eq $command "Fill"}}
 +{{ .Scratch.Set "image" ($original.Fill $options) }}
 +{{ else }}
 +{{ 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 }}
 +      {{ . }}
 +      {{ else }}
 +      .{{ $command }} "{{ $options }}"
 +      {{ end }}
 +      </small>
 +      </figcaption>
 +</figure>
index be629d1c0a2dd124507359775a0d7ccb74f3dc9d,0000000000000000000000000000000000000000..6bb2f00d1f2616adeb6647686573f83882564b62
mode 100644,000000..100644
--- /dev/null
@@@ -1,31 -1,0 +1,31 @@@
- HUGO_VERSION = "0.41"
 +[build]
 +publish = "public"
 +command = "hugo"
 +
 +[context.production.environment]
- HUGO_VERSION = "0.41"
++HUGO_VERSION = "0.42.2"
 +HUGO_ENV = "production"
 +HUGO_ENABLEGITINFO = "true"
 +
 +[context.split1]
 +command = "hugo --enableGitInfo"
 +
 +[context.split1.environment]
- command = "hugo -b $DEPLOY_PRIME_URL"
++HUGO_VERSION = "0.42.2"
 +HUGO_ENV = "production"
 +
 +[context.deploy-preview]
- HUGO_VERSION = "0.41"
++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.42.2"
 +
 +[context.next.environment]
 +HUGO_ENABLEGITINFO = "true"
 +
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..7db1012b39142e0b116633c11ddcf782dd8f7cfd
new file mode 100644 (file)
Binary files differ
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..adb5103fe23fe55c26c0b891eb4bc9672b9f3848
new file mode 100644 (file)
Binary files differ
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..9f054a3cf2db9afbb30fc1bb314e6f1982abcab8
new file mode 100644 (file)
Binary files differ
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..2adcc4c3d067d15fb6cfefd028df3de4895e0d5f
new file mode 100644 (file)
Binary files differ
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..31f5bea348c9a48dbcb03cc70f880495255aa5ec
new file mode 100644 (file)
Binary files differ
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..177d34fa95a859cef212eb0a72303655ba6088b1
new file mode 100644 (file)
Binary files differ
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..a4bf4bd92bb5ef292151dc35345017c6bf6cb620
new file mode 100644 (file)
Binary files differ