Merge commit '35febb2e2a3780c3338a2665fddea7dda28a17f4'

This commit is contained in:
Bjørn Erik Pedersen 2019-07-15 23:50:56 +02:00
commit 05d0eddd2b
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
42 changed files with 343 additions and 152 deletions

View file

@ -109,7 +109,7 @@ You can find a list of all template variables to access the profile information
As aforementioned, Hugo is able to generate links to profiles of the most popular social networks. The following social networks with their corrersponding identifiers are supported: `github`, `facebook`, `twitter`, `pinterest`, `instagram`, `youtube` and `linkedin`.
This is can be done with the `.Social.URL` function. Its only parameter is the name of the social network as they are defined in the profile (e.g. `facebook`). Custom variables like `website` remain as they are.
This is can be done with the `.Social.URL` function. Its only parameter is the name of the social network as they are defined in the profile (e.g. `facebook`, `twitter`). Custom variables like `website` remain as they are.
Most articles feature a small section with information about the author at the end. Let's create one containing the author's name, a thumbnail, a (summarized) biography and links to all social networks:

View file

@ -61,6 +61,7 @@ There are a few alternatives to commenting on static sites for those who do not
* [Tutorial on Implementing Isso with Hugo][issotutorial]
* [Utterances](https://utteranc.es/) (Open source, Github comments widget built on Github issues)
* [Remark](https://github.com/umputun/remark) (Open source, Golang, Easy to run docker)
* [Commento](https://commento.io/) (Open Source, available as a service, local install, or docker image)
<!-- I don't think this is worth including in the documentation since it seems that Steve is no longer supporting or developing this project. rdwatters - 2017-02-29.-->
<!-- * [Kaiju](https://github.com/spf13/kaiju) -->

View file

@ -49,7 +49,7 @@ linkedin = "https://linkedin.com/fr/whoever"
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). This also works for `params`, as demonstrated with `help` above: you will get the value `Aide` in French and `Help` in all the languages without this parameter set.
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). This also works for `params`, as demonstrated witgh `help` above: You will get the value `Aide` in French and `Help` in all the languages without this parameter set.
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.
@ -159,7 +159,7 @@ plaque = "plaques"
## Translate Your Content
There are two ways to manage your content translation, both ensures each page is assigned a language and linked to its translations.
There are two ways to manage your content translations. Both ensure each page is assigned a language and is linked to its counterpart translations.
### Translation by filename
@ -168,17 +168,17 @@ Considering the following example:
1. `/content/about.en.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.
The first file is assigned the English language and is linked to the second.
The second file is assigned the French language and is linked to the first.
Their language is __assigned__ according to the language code added as __suffix to the filename__.
Their language is __assigned__ according to the language code added as a __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.
If a file has no 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.
@ -190,22 +190,22 @@ languages:
weight: 10
languageName: "English"
contentDir: "content/english"
nn:
fr:
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.
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.
The first file is assigned the English language and is linked to the second.
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.
@ -213,7 +213,7 @@ By having the same **path and basename** (relative to their language content dir
### Bypassing default linking.
Any pages sharing the same `translationKey` set in front matter will be linked as translated pages regardless of basename or location.
Any pages sharing the same `translationKey` set in front matter will be linked as translated pages regardless of basename or location.
Considering the following example:
@ -231,11 +231,11 @@ By setting the `translationKey` front matter param to `about` in all three 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.
Because paths and filenames are used to handle linking, all translated pages will share the same URL (apart from the language subdirectory).
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.
For example, a French translation (`content/about.fr.md`) can have its own localized slug.
{{< code-toggle >}}
Title: A Propos
@ -243,9 +243,10 @@ slug: "a-propos"
{{< /code-toggle >}}
At render, Hugo will build both `/about/` and `fr/a-propos/` while maintaning their translation linking.
At render, Hugo will build both `/about/` and `/fr/a-propos/` while maintaining their translation linking.
{{% note %}}
If using `url`, remember to include the language part as well: `fr/compagnie/a-propos/`.
If using `url`, remember to include the language part as well: `/fr/compagnie/a-propos/`.
{{%/ note %}}
### Page Bundles
@ -254,15 +255,13 @@ To avoid the burden of having to duplicate files, each Page Bundle inherits the
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:
If, across the linked bundles, two or more files share the same basename, only one will be included and chosen as follows:
* File from current language Bundle, if present.
* 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`).
Page Bundle resources follow the same language assignment logic as content files, both by filename (`image.jpg`, `image.fr.jpg`) and by directory (`english/about/header.jpg`, `french/about/header.jpg`).
{{%/ note %}}
## Reference the Translated Content
@ -277,18 +276,18 @@ To create a list of links to translated content, use a template similar to the f
<li>
<a href="{{ .Permalink }}">{{ .Lang }}: {{ .Title }}{{ if .IsPage }} ({{ i18n "wordCount" . }}){{ end }}</a>
</li>
{{ end}}
{{ 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 can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template, whether 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:
`.AllTranslations` on a `Page` can be used to list all translations, including the page itself. On the home page it can be used to build a language navigator:
{{< code file="layouts/partials/allLanguages.html" >}}
@ -306,7 +305,7 @@ Hugo uses [go-i18n][] to support string translations. [See the project's source
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.
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
@ -341,8 +340,8 @@ An example of singular and plural form:
```
[readingTime]
one = "One minute read"
other = "{{.Count}} minutes read"
one = "One minute to read"
other = "{{.Count}} minutes to read"
```
And then in the template:
@ -352,7 +351,7 @@ And then in the template:
## 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:
At the time of this writing, Go does not yet have support for internationalized locales for dates, 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"
@ -369,10 +368,10 @@ At the time of this writing, Go does not yet have support for internationalized
12: "décembre"
~~~
... then index the non-English date names in your templates like so:
...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 }}">
<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>
~~~
@ -381,7 +380,7 @@ This technique extracts the day, month and year by specifying ``.Date.Day``, ``.
## 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:
You can define your menus for each language independently. Creating multilingual menus works just like [creating regular menus][menus], except they're defined in language-specific blocks in the configuration file:
```
defaultContentLanguage = "en"
@ -406,7 +405,7 @@ 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.
The rendering of the main navigation works as usual. `.Site.Menus` will just contain the menu in the current language. Note that `absLangURL` below will link to the correct locale of your website. Without it, menu entries in all languages would link to the English version, since it's the default content language that resides in the root directory.
```
<ul>
@ -427,7 +426,7 @@ If a string does not have a translation for the current language, Hugo will use
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.
Hugo will generate your website with these missing translation placeholders. It might not be suitable for production environments.
{{% /note %}}
For merging of content from other languages (i.e. missing content translations), see [lang.Merge](/functions/lang.merge/).
@ -444,11 +443,9 @@ i18n|MISSING_TRANSLATION|en|wordCount
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 }}`
* Be constructed with the [`relLangURL` template function][rellangurl] or the [`absLangURL` template function][abslangurl] **OR** be 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.
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/

View file

@ -60,7 +60,7 @@ Without any additional configuration, the following will just work:
## Path Breakdown in Hugo
The following demonstrates the relationships between your content organization and the output URL structure for your Hugo website when it renders. These examples assume you are [using pretty URLs][pretty], which is the default behavior for Hugo. The examples also assume a key-value of `baseurl = "https://example.com"` in your [site's configuration file][config].
The following demonstrates the relationships between your content organization and the output URL structure for your Hugo website when it renders. These examples assume you are [using pretty URLs][pretty], which is the default behavior for Hugo. The examples also assume a key-value of `baseURL = "https://example.com"` in your [site's configuration file][config].
### Index Pages: `_index.md`

View file

@ -15,12 +15,12 @@ toc: true
---
Hugo uses a set of factors to identify a page's related content based on Front Matter parameters. This can be tuned to the desired set of indices and parameters or left to Hugo's default [Related Content configuration](#configure-related-content).
Hugo uses a set of factors to identify a page's related content based on Front Matter parameters. This can be tuned to the desired set of indices and parameters or left to Hugo's default [Related Content configuration](#configure-related-content).
## List Related Content
To list up to 5 related pages (which share the same _date_ or _keyword_ parameters) is as simple as including something similar to this partial in your single page template:
To list up to 5 related pages (which share the same _date_ or _keyword_ parameters) is as simple as including something similar to this partial in your single page template:
{{< code file="layouts/partials/related.html" >}}
{{ $related := .Site.RegularPages.Related . | first 5 }}
@ -53,9 +53,9 @@ Returns a collection of pages related to a given one restricted to a list of ind
```
#### .RelatedTo KEYVALS [KEYVALS2 ...]
Returns a collection of pages related together by a set of indices and their match.
Returns a collection of pages related together by a set of indices and their match.
In order to build those set and pass them as argument, one must use the `keyVals` function where the first agrument would be the `indice` and the consective ones its potential `matches`.
In order to build those set and pass them as argument, one must use the `keyVals` function where the first argument would be the `indice` and the consective ones its potential `matches`.
```
{{ $related := .Site.RegularPages.RelatedTo ( keyVals "tags" "hugo" "rocks") ( keyVals "date" .Date ) }}
@ -104,7 +104,7 @@ toLower
### Config Options per Index
name
: The index name. This value maps directly to a page param. Hugo supports string values (`author` in the example) and lists (`tags`, `keywords` etc.) and time and date objects.
: The index name. This value maps directly to a page param. Hugo supports string values (`author` in the example) and lists (`tags`, `keywords` etc.) and time and date objects.
weight
: An integer weight that indicates _how important_ this parameter is relative to the other parameters. It can be 0, which has the effect of turning this index off, or even negative. Test with different values to see what fits your content best.
@ -117,13 +117,13 @@ toLower
## Performance Considerations
**Fast is Hugo's middle name** and we would not have released this feature had it not been blistering fast.
**Fast is Hugo's middle name** and we would not have released this feature had it not been blistering fast.
This feature has been in the back log and requested by many for a long time. The development got this recent kick start from this Twitter thread:
{{< tweet 898398437527363585 >}}
Scott S. Lowe removed the "Related Content" section built using the `intersect` template function on tags, and the build time dropped from 30 seconds to less than 2 seconds on his 1700 content page sized blog.
Scott S. Lowe removed the "Related Content" section built using the `intersect` template function on tags, and the build time dropped from 30 seconds to less than 2 seconds on his 1700 content page sized blog.
He should now be able to add an improved version of that "Related Content" section without giving up the fast live-reloads. But it's worth noting that:

View file

@ -16,7 +16,7 @@ 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.
From Hugo 0.28, the default syntax highlighter 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.

View file

@ -132,4 +132,4 @@ If you add screenshots to the README, please make use of absolute file paths ins
{{% /note %}}
[artistexample]: https://github.com/digitalcraftsman/hugo-artists-theme/tree/master/exampleSite
[themeissuenew]: https://github.com/gohugoio/hugoThemes/issues/new
[themeissuenew]: https://github.com/gohugoio/hugoThemes/issues/new?template=theme-submission.md

View file

@ -87,9 +87,11 @@ date: 2017-03-03T14:15:59-06:00
`"Mon, 02 Jan 2006 15:04:05 MST"` (RFC1123)
: **Returns**: `Fri, 03 Mar 2017 14:15:59 CST`
`"Mon, 02 Jan 2006 15:04:05 -0700"` (RFC339)
`"Mon, 02 Jan 2006 15:04:05 -0700"` (RFC1123Z)
: **Returns**: `Fri, 03 Mar 2017 14:15:59 -0600`
More examples can be found in Go's [documentation for the time package][timeconst].
### Cardinal Numbers and Ordinal Abbreviations
Spelled-out cardinal numbers (e.g. "one", "two", and "three") and ordinal abbreviations (i.e., with shorted suffixes like "1st", "2nd", and "3rd") are not currently supported:
@ -121,3 +123,4 @@ In conjunction with the [`dateFormat` function][dateFormat], you can also conver
[gdex]: https://golang.org/pkg/time/#example_Time_Format
[pagevars]: /variables/page/
[time]: https://golang.org/pkg/time/
[timeconst]: https://golang.org/pkg/time/#ANSIC

View file

@ -28,6 +28,8 @@ So, if you have a file with the name `README.txt` in the root of your project wi
If you receive a "file doesn't exist" error with a path listed, do take note that the path is the last one checked by the function, and may not accurately reflect your target. You should generally double-check your path for mistakes.
Note that there is a 1 MB file size limit.
For more information on using `readDir` and `readFile` in your templates, see [Local File Templates][local].
[local]: /templates/files/

View file

@ -24,7 +24,7 @@ deprecated: false
A template file is any file living below the `layouts` directories of either the project or any of its theme components incudling partials and shortcodes.
The function is particulary handy with dynamic path. The following example ensures the build will not break on a `.Type` missing its dedicated `header` partial.
The function is particularly handy with dynamic path. The following example ensures the build will not break on a `.Type` missing its dedicated `header` partial.
```go-html-template
{{ $partialPath := printf "headers/%s.html" .Type }}
@ -34,4 +34,4 @@ The function is particulary handy with dynamic path. The following example ensur
{{ partial "headers/default.html" . }}
{{ end }}
```
```

View file

@ -31,3 +31,7 @@ Can be combined in pipes. In the following snippet, the link text is cleaned up
<li><a href="{{ printf "%s/%s" "categories" ($name | urlize | lower) | absURL }}">{{ $name | humanize | title }} ({{ len $items }})</a></li>
{{ end }}
```
## Configure Title Case
The default is AP Stylebook, but you can [configure it](/getting-started/configuration/#configure-title-case).

View file

@ -115,7 +115,7 @@ defaultContentLanguageInSubdir (false)
: Render the default content language in subdir, e.g. `content/en/`. The site root `/` will then redirect to `/en/`.
disableAliases (false)
: Will disable generation of alias redirects. Note that even if `disableAliases` is set, the aliases themselves are preserved on the page. The motivation with this is to be able to generate 301 redirects in an `.htacess`, a Netlify `_redirects` file or similar using a custom output format.
: Will disable generation of alias redirects. Note that even if `disableAliases` is set, the aliases themselves are preserved on the page. The motivation with this is to be able to generate 301 redirects in an `.htaccess`, a Netlify `_redirects` file or similar using a custom output format.
disableHugoGeneratorInject (false)
: Hugo will, by default, inject a generator meta tag in the HTML head on the _home page only_. You can turn it off, but we would really appreciate if you don't, as this is a good way to watch Hugo's popularity on the rise.
@ -265,6 +265,9 @@ timeout (10000)
title ("")
: Site title.
titleCaseStyle ("AP")
: See [Configure Title Case](#configure-title-case)
uglyURLs (false)
: When enabled, creates URL of the form `/filename.html` instead of `/filename/`.
@ -291,6 +294,10 @@ enableemoji: true
```
{{% /note %}}
## Configure Title Case
Set `titleCaseStyle` to specify the title style used by the [title](/functions/title/) template function and the automatic section titles in Hugo. It defaults to [AP Stylebook](https://www.apstylebook.com/) for title casing, but you can also set it to `Chicago` or `Go` (every word starts with a capital letter).
## Configuration Environment Variables
HUGO_NUMWORKERMULTIPLIER
@ -498,5 +505,5 @@ dir
[Output Formats]: /templates/output-formats/
[templates]: /templates/
[toml]: https://github.com/toml-lang/toml
[yaml]: http://yaml.org/spec/
[yaml]: https://yaml.org/spec/
[static-files]: /content-management/static-files/

View file

@ -27,8 +27,7 @@ Running the `hugo new site` generator from the command line will create a direct
```
.
├── archetypes
├── assets
├── config
├── config.toml
├── content
├── data
├── layouts
@ -46,14 +45,14 @@ The following is a high-level overview of each of the directories with links to
By default, Hugo will create new content files with at least `date`, `title` (inferred from the file name), and `draft = true`. This saves time and promotes consistency for sites using multiple content types. You can create your own [archetypes][] with custom preconfigured front matter fields as well.
[`assets`][]
: Stores all the files which need be processed by [Hugo Pipes]({{< ref "/hugo-pipes" >}}). Only the files whose `.Permalink` or `.RelPermalink` are used will be published to the `public` directory.
: Stores all the files which need be processed by [Hugo Pipes]({{< ref "/hugo-pipes" >}}). Only the files whose `.Permalink` or `.RelPermalink` are used will be published to the `public` directory. Note: assets directory is not created by default.
[`config`](/getting-started/configuration/)
: Hugo ships with a large number of [configuration directives](https://gohugo.io/getting-started/configuration/#all-variables-yaml).
The [config directory](/getting-started/configuration/#configuration-directory) is where those directives are stored as JSON, YAML, or TOML files. Every root setting object can stand as its own file and structured by environments.
Projects with minimal settings and no need for environment awareness can use a single `config.toml` file at its root.
Many sites may need little to no configuration, but Hugo ships with a large number of [configuration directives][] for more granular directions on how you want Hugo to build your website.
Many sites may need little to no configuration, but Hugo ships with a large number of [configuration directives][] for more granular directions on how you want Hugo to build your website. Note: config directory is not created by default.
[`content`][]
: All content for your website will live inside this directory. Each top-level folder in Hugo is considered a [content section][]. For example, if your site has three main sections---`blog`, `articles`, and `tutorials`---you will have three directories at `content/blog`, `content/articles`, and `content/tutorials`. Hugo uses sections to assign default [content types][].

View file

@ -54,6 +54,16 @@ brew install hugo
For more detailed explanations, read the installation guides that follow for installing on macOS and Windows.
### Linuxbrew (Linux)
If you are on Linux and using [Linuxbrew][linuxbrew], you can install Hugo with the following one-liner:
{{< code file="install-with-linuxbrew.sh" >}}
brew install hugo
{{< /code >}}
Installation guides for Linuxbrew are available on their [website][linuxbrew].
### Chocolatey (Windows)
If you are on a Windows machine and use [Chocolatey][] for package management, you can install Hugo with the following one-liner:
@ -437,7 +447,7 @@ To install the non-extended version without Sass/SCSS support:
To switch between the two, use either `snap refresh hugo --channel=extended` or `snap refresh hugo --channel=stable`.
{{% note %}}
Hugo-as-a-snap can write only inside the users `$HOME` directory---and gvfs-mounted directories owned by the user---because of Snaps confinement and security model. More information is also available [in this related GitHub issue](https://github.com/gohugoio/hugo/issues/3143). Use ```sudo snap install hugo --classic``` to disable the default security model if you want hugo to be able to have write access in other paths besides the users `$HOME` directory.
Hugo installed via Snap can write only inside the users `$HOME` directory---and gvfs-mounted directories owned by the user---because of Snaps confinement and security model. More information is also available [in this related GitHub issue](https://github.com/gohugoio/hugo/issues/3143).
{{% /note %}}
### Debian and Ubuntu
@ -507,6 +517,7 @@ Now that you've installed Hugo, read the [Quick Start guide][quickstart] and exp
[highlight shortcode]: /content-management/shortcodes/#highlight
[installgit]: http://git-scm.com/
[installgo]: https://golang.org/dl/
[linuxbrew]: https://linuxbrew.sh/
[Path Editor]: https://patheditor2.codeplex.com/
[pygments]: http://pygments.org
[quickstart]: /getting-started/quick-start/

View file

@ -83,16 +83,27 @@ echo 'theme = "ananke"' >> config.toml
{{< asciicast 7naKerRYUGVPj8kiDmdh5k5h9 >}}
## Step 4: Add Some Content
You can manually create content files (for example as `content/<CATEGORY>/<FILE>.<FORMAT>`) and provide metadata in them, however you can use `new` commend to do few things for you (like add title and date):
```
hugo new posts/my-first-post.md
```
{{< asciicast eUojYCfRTZvkEiqc52fUsJRBR >}}
Edit the newly created content file if you want, it will start with something like this:
Edit the newly created content file if you want.
```markdown
---
title: "My First Post"
date: 2019-03-26T08:47:11+01:00
draft: true
---
```
## Step 5: Start the Hugo server
@ -130,6 +141,8 @@ Press Ctrl+C to stop
**Navigate to your new site at [http://localhost:1313/](http://localhost:1313/).**
Feel free to edit or add new content and simply refresh in browser to see changes quickly (You might need to force refresh in webbrowser, something like Ctrl-R usually works).
## Step 6: Customize the Theme
@ -157,3 +170,13 @@ For theme specific configuration options, see the [theme site](https://github.co
**For further theme customization, see [Customize a Theme](/themes/customizing/).**
### Step 7: Build static pages
It is simple. Just call:
```
hugo
```
Output will be in `./public/` directory by default (`-d`/`--destination` flag to change it, or set `publishdir` in the config file).

View file

@ -4,7 +4,7 @@ linktitle: Host on GitHub
description: Deploy Hugo as a GitHub Pages project or personal/organizational site and automate the whole process with a simple shell script.
date: 2014-03-21
publishdate: 2014-03-21
lastmod: 2017-03-30
lastmod: 2018-09-22
categories: [hosting and deployment]
keywords: [github,git,deployment,hosting]
authors: [Spencer Lyon, Gunnar Morling]
@ -54,15 +54,15 @@ This is a much simpler setup as your Hugo files and generated content are publis
1. Create a `<YOUR-PROJECT>` (e.g. `blog`) repository on GitHub. This repository will contain Hugo's content and other source files.
2. Create a `<USERNAME>.github.io` GitHub repository. This is the repository that will contain the fully rendered version of your Hugo website.
3. `git clone <YOUR-PROJECT-URL> && cd <YOUR-PROJECT>`
4. Make your website work locally (`hugo server` or `hugo server -t <YOURTHEME>`) and open your browser to <http://localhost:1313>.
4. Paste your existing Hugo project into a new local `<YOUR-PROJECT>` repository. Make sure your website works locally (`hugo server` or `hugo server -t <YOURTHEME>`) and open your browser to <http://localhost:1313>.
5. Once you are happy with the results:
* Press <kbd>Ctrl</kbd>+<kbd>C</kbd> to kill the server
* `rm -rf public` to completely remove the `public` directory
6. `git submodule add -b master git@github.com:<USERNAME>/<USERNAME>.github.io.git public`. This creates a git [submodule][]. Now when you run the `hugo` command to build your site to `public`, the created `public` directory will have a different remote origin (i.e. hosted GitHub repository). You can automate some of these steps with the following script.
* Before proceeding run `rm -rf public` to completely remove the `public` directory
6. `git submodule add -b master git@github.com:<USERNAME>/<USERNAME>.github.io.git public`. This creates a git [submodule][]. Now when you run the `hugo` command to build your site to `public`, the created `public` directory will have a different remote origin (i.e. hosted GitHub repository).
### Put it Into a Script
You're almost done. You can also add a `deploy.sh` script to automate the preceding steps for you. You can also make it executable with `chmod +x deploy.sh`.
You're almost done. In order to automate next steps create a `deploy.sh` script. You can also make it executable with `chmod +x deploy.sh`.
The following are the contents of the `deploy.sh` script:
@ -193,11 +193,7 @@ To automate these steps, you can create a script with the following contents:
{{< code file="publish_to_ghpages.sh" >}}
#!/bin/sh
DIR=$(dirname "$0")
cd $DIR/..
if [[ $(git status -s) ]]
if [ "`git status -s`" ]
then
echo "The working directory is dirty. Please commit any pending changes."
exit 1;
@ -220,9 +216,12 @@ hugo
echo "Updating gh-pages branch"
cd public && git add --all && git commit -m "Publishing to gh-pages (publish.sh)"
#echo "Pushing to github"
#git push --all
{{< /code >}}
This will abort if there are pending changes in the working directory and also makes sure that all previously existing output files are removed. Adjust the script to taste, e.g. to include the final push to the remote repository if you don't need to take a look at the gh-pages branch before pushing. Or adding `echo yourdomainname.com >> CNAME` if you set up for your gh-pages to use customize domain.
This will abort if there are pending changes in the working directory and also makes sure that all previously existing output files are removed. Adjust the script to taste, e.g. to include the final push to the remote repository if you don't need to take a look at the gh-pages branch before pushing.
### Deployment of Project Pages from Your `master` Branch

View file

@ -0,0 +1,93 @@
---
title: Host on Render
linktitle: Host on Render
description: Host your Hugo site for free with Render's global CDN, fully-managed SSL and auto deploys from GitHub.
date: 2019-06-06
publishdate: 2019-06-06
lastmod: 2019-06-21
categories: [hosting and deployment]
keywords: [render,hosting,deployment]
authors: [Anurag Goel]
menu:
docs:
parent: "hosting-and-deployment"
weight: 10
weight: 10
sections_weight: 10
draft: false
aliases: []
toc: true
---
## Introduction
[Render](https://render.com) is a fully-managed cloud platform where you can host static sites, backend APIs, databases, cron jobs, and all your other apps in one place.
Static sites are **completely free** on Render and include the following:
- Continuous, automatic builds & deploys from GitHub.
- Automatic SSL certificates through [Let's Encrypt](https://letsencrypt.org).
- Instant cache invalidation with a lightning fast, global CDN.
- Unlimited collaborators.
- Unlimited [custom domains](https://render.com/docs/custom-domains).
- Automatic [Brotli compression](https://en.wikipedia.org/wiki/Brotli) for faster sites.
- Native HTTP/2 support.
- [Pull Request Previews](https://render.com/docs/pull-request-previews).
- Automatic HTTP → HTTPS redirects.
- Custom URL redirects and rewrites.
## Assumptions
* You have an account with GitHub.
* You have completed the [Quick Start][] or have a Hugo website you are ready to deploy and share with the world.
* You have a Render account. You can sign up at https://render.com/register.
## Deployment
You can set up a Hugo site on Render in two quick steps:
1. Create a new **Web Service** on Render, and give Render permission to access your GitHub repo.
2. Use the following values during creation:
Field | Value
------------------- | -------------------
**Environment** | `Static Site`
**Build Command** | `hugo --gc --minify` (or our own build command)
**Publish Directory** | `public` (or your own output directory)
That's it! Your site will be live on your Render URL (which looks like `yoursite.onrender.com`) as soon as the build is done.
## Continuous Deploys
Now that Render is connected to your repo, it will **automatically build and publish your site** any time you push to GitHub.
You can choose to disable auto deploys under the **Settings** section for your site and deploy it manually from the Render dashboard.
## CDN and Cache Invalidation
Render hosts your site on a global, lightning fast CDN which ensures the fastest possible download times for all your users across the globe.
Every deploy automatically and instantly invalidates the CDN cache, so your users can always access the latest content on your site.
## Custom Domains
Add your own domains to your site easily using Render's [custom domains](https://render.com/docs/custom-domains) guide.
## Pull Request Previews
With Pull Request (PR) previews, you can visualize changes introduced in a pull request instead of simply relying on code reviews.
Once enabled, every PR for your site will automatically generate a new static site based on the code in the PR. It will have its own URL, and it will be deleted automatically when the PR is closed.
Read more about [Pull Request Previews](https://render.com/docs/pull-request-previews) on Render.
## Hugo Themes
Render automatically downloads all Git submodules defined in your Git repo on every build. This way Hugo themes added as submodules work as expected.
## Support
Chat with Render developers at https://render.com/chat or email `support@render.com` if you need help.
[Quick Start]: /getting-started/quick-start/

View file

@ -16,7 +16,7 @@ draft: false
---
Fingerprinting and [SRI](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) can be applied to any asset file using `resources.Fingerpint` which takes two arguments, the resource object and a [hash function](https://en.wikipedia.org/wiki/Cryptographic_hash_function).
Fingerprinting and [SRI](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) can be applied to any asset file using `resources.Fingerprint` which takes two arguments, the resource object and a [hash function](https://en.wikipedia.org/wiki/Cryptographic_hash_function).
The default hash function is `sha256`. Other available functions are `sha384` (from Hugo `0.55`), `sha512` and `md5`.
@ -26,4 +26,4 @@ Any so processed asset will bear a `.Data.Integrity` property containing an inte
{{ $js := resources.Get "js/global.js" }}
{{ $secureJS := $js | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{ $secureJS.Permalink }}" integrity="{{ $secureJS.Data.Integrity }}"></script>
```
```

View file

@ -30,7 +30,7 @@ Hugo also depends on a lot of other great projects. A big thanks to all of our d
- New template functions:
- `getenv`
- The string functions `substr` and `slicestr`
*`seq`, a sequence generator very similar to its Gnu countepart
*`seq`, a sequence generator very similar to its Gnu counterpart
- `absURL` and `relURL`, both of which takes the `BaseURL` setting into account
## Improvements

View file

@ -6,13 +6,13 @@ description: "Configurable file caches, inline shortcodes, and more ..."
categories: ["Releases"]
---
The two big new items in this release is [Inline Shortcodes](https://gohugo.io//templates/shortcode-templates/#inline-shortcodes) and [Consolidated File Caches](https://gohugo.io/getting-started/configuration/#configure-file-caches). In Hugo we really care about build speed, and caching is important. With this release, you get much better control over your cache configuration, which is especially useful when building on a Continous Integration server (Netlify, CircleCI or similar). Inline Shortcodes was implemented to help the Bootstrap project [move their documentation site](https://github.com/twbs/bootstrap/issues/24475#issuecomment-441238128) to Hugo. Note that this feature is disabled by default. To enable, set `enableInlineShortcodes = true` in your site config. Worth mentioning is also the new `param` shortcode, which looks up the param in page front matter with the site's parameter as a fall back.
The two big new items in this release is [Inline Shortcodes](https://gohugo.io//templates/shortcode-templates/#inline-shortcodes) and [Consolidated File Caches](https://gohugo.io/getting-started/configuration/#configure-file-caches). In Hugo we really care about build speed, and caching is important. With this release, you get much better control over your cache configuration, which is especially useful when building on a Continuous Integration server (Netlify, CircleCI or similar). Inline Shortcodes was implemented to help the Bootstrap project [move their documentation site](https://github.com/twbs/bootstrap/issues/24475#issuecomment-441238128) to Hugo. Note that this feature is disabled by default. To enable, set `enableInlineShortcodes = true` in your site config. Worth mentioning is also the new `param` shortcode, which looks up the param in page front matter with the site's parameter as a fall back.
This release represents **33 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 [@moorereason](https://github.com/moorereason), [@emirb](https://github.com/emirb), and [@allizad](https://github.com/allizad) for their ongoing contributions.
And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) and [@onedrawingperday](https://github.com/onedrawingperday) for their 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),
Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs),
which has received **10 contributions by 4 contributors**. A special thanks to [@budparr](https://github.com/budparr), [@bep](https://github.com/bep), [@allizad](https://github.com/allizad), and [@funkydan2](https://github.com/funkydan2) for their work on the documentation site.
Hugo now has:
@ -25,8 +25,8 @@ Hugo now has:
### Templates
* Add tests [ed698e94](https://github.com/gohugoio/hugo/commit/ed698e94c12c05bfc392eaca4f0c8442eac64906) [@moorereason](https://github.com/moorereason)
* Regenerate templates [89e2716d](https://github.com/gohugoio/hugo/commit/89e2716d290708ccde0a6f65504c1650c2f41b3d) [@bep](https://github.com/bep)
* Add tests [ed698e94](https://github.com/gohugoio/hugo/commit/ed698e94c12c05bfc392eaca4f0c8442eac64906) [@moorereason](https://github.com/moorereason)
* Regenerate templates [89e2716d](https://github.com/gohugoio/hugo/commit/89e2716d290708ccde0a6f65504c1650c2f41b3d) [@bep](https://github.com/bep)
* Add "param" shortcode [f37c5a25](https://github.com/gohugoio/hugo/commit/f37c5a25676db89c0e804ccaac69bb392758192b) [@bep](https://github.com/bep) [#4010](https://github.com/gohugoio/hugo/issues/4010)
* Add float64 support to where [112461fd](https://github.com/gohugoio/hugo/commit/112461fded0d7970817ce7bf476c4763922ad314) [@moorereason](https://github.com/moorereason) [#5466](https://github.com/gohugoio/hugo/issues/5466)
@ -37,8 +37,8 @@ Hugo now has:
### Other
* Remove duplicate mapstructure depdendency [7e75aeca](https://github.com/gohugoio/hugo/commit/7e75aeca80aead50d64902d2ff47e4ad4d013352) [@bep](https://github.com/bep)
* Add dependency list to README [e14e0b19](https://github.com/gohugoio/hugo/commit/e14e0b192f39812e3c3d5202d34ee907021412bb) [@bep](https://github.com/bep)
* Remove duplicate mapstructure depdendency [7e75aeca](https://github.com/gohugoio/hugo/commit/7e75aeca80aead50d64902d2ff47e4ad4d013352) [@bep](https://github.com/bep)
* Add dependency list to README [e14e0b19](https://github.com/gohugoio/hugo/commit/e14e0b192f39812e3c3d5202d34ee907021412bb) [@bep](https://github.com/bep)
* Document inline shortcodes [aded0f25](https://github.com/gohugoio/hugo/commit/aded0f25fd23a78804b10e127aebe0e4b6fed2ac) [@bep](https://github.com/bep) [#4011](https://github.com/gohugoio/hugo/issues/4011)
* Add inline shortcode support [bc337e6a](https://github.com/gohugoio/hugo/commit/bc337e6ab5a75f1f1bfe3a83f3786d0afdb6346c) [@bep](https://github.com/bep) [#4011](https://github.com/gohugoio/hugo/issues/4011)
* Include drafts in convert command [dcfeed35](https://github.com/gohugoio/hugo/commit/dcfeed35c6e14c1ce593d23be9d2b89c66ce9bee) [@bep](https://github.com/bep) [#5457](https://github.com/gohugoio/hugo/issues/5457)
@ -47,33 +47,28 @@ Hugo now has:
* Add a comment about file mode for new files [fabf026f](https://github.com/gohugoio/hugo/commit/fabf026f4937bf6fbbb944aa7d6e721839ae4c92) [@bep](https://github.com/bep) [#5434](https://github.com/gohugoio/hugo/issues/5434)
* Add a :project placeholder [94f0f7e5](https://github.com/gohugoio/hugo/commit/94f0f7e59788e802e706a55cac0d52a9e70ff745) [@bep](https://github.com/bep) [#5439](https://github.com/gohugoio/hugo/issues/5439)
* Add a cache prune func [3c29c5af](https://github.com/gohugoio/hugo/commit/3c29c5af8ee865ef20741f576088e031e940c3d2) [@bep](https://github.com/bep) [#5439](https://github.com/gohugoio/hugo/issues/5439)
* Add a filecache root dir [33502667](https://github.com/gohugoio/hugo/commit/33502667fbacf57167ede66df8f13e308a4a9aec) [@bep](https://github.com/bep)
* Add a filecache root dir [33502667](https://github.com/gohugoio/hugo/commit/33502667fbacf57167ede66df8f13e308a4a9aec) [@bep](https://github.com/bep)
* Use time.Duration for maxAge [d3489eba](https://github.com/gohugoio/hugo/commit/d3489eba5dfc0ecdc032016d9db0746213dd5f0e) [@bep](https://github.com/bep) [#5438](https://github.com/gohugoio/hugo/issues/5438)
* Split implementation and config into separate files [17d7ecde](https://github.com/gohugoio/hugo/commit/17d7ecde2b261d2ab29049d12361b66504e3f995) [@bep](https://github.com/bep)
* Split implementation and config into separate files [17d7ecde](https://github.com/gohugoio/hugo/commit/17d7ecde2b261d2ab29049d12361b66504e3f995) [@bep](https://github.com/bep)
* Update to LibSASS 3.5.5 [e4b25728](https://github.com/gohugoio/hugo/commit/e4b2572880550a997d51dab3b198dac1fd642690) [@bep](https://github.com/bep) [#5432](https://github.com/gohugoio/hugo/issues/5432)[#5435](https://github.com/gohugoio/hugo/issues/5435)
* More spelling corrections [782dd158](https://github.com/gohugoio/hugo/commit/782dd15858128d8dfe78970c86e543b6590a004c) [@bep](https://github.com/bep)
* Spelling corrections [aff9c091](https://github.com/gohugoio/hugo/commit/aff9c091669a022b59f493c9dccf72be29511299) [@bep](https://github.com/bep)
* Remove appveyor [fdd4a768](https://github.com/gohugoio/hugo/commit/fdd4a768f053b21271d4520bf0d43baf62d516da) [@bep](https://github.com/bep)
* More spelling corrections [782dd158](https://github.com/gohugoio/hugo/commit/782dd15858128d8dfe78970c86e543b6590a004c) [@bep](https://github.com/bep)
* Spelling corrections [aff9c091](https://github.com/gohugoio/hugo/commit/aff9c091669a022b59f493c9dccf72be29511299) [@bep](https://github.com/bep)
* Remove appveyor [fdd4a768](https://github.com/gohugoio/hugo/commit/fdd4a768f053b21271d4520bf0d43baf62d516da) [@bep](https://github.com/bep)
* Document the new file cache [abeeff13](https://github.com/gohugoio/hugo/commit/abeeff1325267f8d8f1f66f0ec4ed175ffc140ad) [@bep](https://github.com/bep) [#5404](https://github.com/gohugoio/hugo/issues/5404)
* Add a consolidated file cache [f7aeaa61](https://github.com/gohugoio/hugo/commit/f7aeaa61291dd75f92901bcbeecc7fce07a28dec) [@bep](https://github.com/bep) [#5404](https://github.com/gohugoio/hugo/issues/5404)
* Add Windows build config to Travis [7d78a2af](https://github.com/gohugoio/hugo/commit/7d78a2afd3c4a6c4af77a4ddcbd2a82f15986048) [@emirb](https://github.com/emirb)
* Add Elasticsearch/bonsai.io to services doc. [c0b3a1af](https://github.com/gohugoio/hugo/commit/c0b3a1af0354e3aa9979cc00ae8630d7f0be63dc) [@allizad](https://github.com/allizad)
* Add Windows build config to Travis [7d78a2af](https://github.com/gohugoio/hugo/commit/7d78a2afd3c4a6c4af77a4ddcbd2a82f15986048) [@emirb](https://github.com/emirb)
* Add Elasticsearch/bonsai.io to services doc. [c0b3a1af](https://github.com/gohugoio/hugo/commit/c0b3a1af0354e3aa9979cc00ae8630d7f0be63dc) [@allizad](https://github.com/allizad)
## Fixes
### Templates
* Fix whitespace issue [aba2647c](https://github.com/gohugoio/hugo/commit/aba2647c152ffff927f42523b77ee6651630cd67) [@max-arnold](https://github.com/max-arnold)
* Fix test to pass with gccgo [a8cb1b07](https://github.com/gohugoio/hugo/commit/a8cb1b07b4cf7fcf0e949657cb03c1a4838f975e) [@ianlancetaylor](https://github.com/ianlancetaylor)
* Fix whitespace issue [aba2647c](https://github.com/gohugoio/hugo/commit/aba2647c152ffff927f42523b77ee6651630cd67) [@max-arnold](https://github.com/max-arnold)
* Fix test to pass with gccgo [a8cb1b07](https://github.com/gohugoio/hugo/commit/a8cb1b07b4cf7fcf0e949657cb03c1a4838f975e) [@ianlancetaylor](https://github.com/ianlancetaylor)
### Other
* Fix handling of commented out front matter [7540a628](https://github.com/gohugoio/hugo/commit/7540a62834d4465af8936967e430a9e05a1e1359) [@bep](https://github.com/bep) [#5478](https://github.com/gohugoio/hugo/issues/5478)
* Fix when only shortcode and then summary [94ab125b](https://github.com/gohugoio/hugo/commit/94ab125b27a29a65e5ea45efd99dd247084b4c37) [@bep](https://github.com/bep) [#5464](https://github.com/gohugoio/hugo/issues/5464)
* Fix ignored --config flag with 'new' command [e82b2dc8](https://github.com/gohugoio/hugo/commit/e82b2dc8c1628f2da33e5fb0bae1b03e0594ad2c) [@krisbudhram](https://github.com/krisbudhram)
* Fix ignored --config flag with 'new' command [e82b2dc8](https://github.com/gohugoio/hugo/commit/e82b2dc8c1628f2da33e5fb0bae1b03e0594ad2c) [@krisbudhram](https://github.com/krisbudhram)
* Fix Permalink for resource, baseURL with path and canonifyURLs set [5df2b79d](https://github.com/gohugoio/hugo/commit/5df2b79dd2734e9a00ed1692328f58c385676468) [@bep](https://github.com/bep) [#5226](https://github.com/gohugoio/hugo/issues/5226)

View file

@ -13,7 +13,7 @@ Swiss [Arolla campsite](http://www.camping-arolla.com/) runs the highest campsit
But they just launch a brand new offer (luxury tents with bed and fire oven), and we couldn't wait for the proper new website for having this promoted: we needed the website up and running within 24h!
So we decided to quickly launch a dedicated [independant web site](https://www.cocoon-arolla.com) using all the powefull tools included with [gohugo.io](http://gohugo.io) and some things we already knew & used:
So we decided to quickly launch a dedicated [independent web site](https://www.cocoon-arolla.com) using all the powefull tools included with [gohugo.io](http://gohugo.io) and some things we already knew & used:
- Choose a spectacular landing theme in the rich [Hugo Themes](http://themes.gohugo.io/) collection : [Airspace Theme](https://themes.gohugo.io/airspace-hugo/) by Themefisher.
- Replace the main images.
@ -27,4 +27,4 @@ So we decided to quickly launch a dedicated [independant web site](https://www.c
The first version was up in 4 hours, and the polished 2 languages version was published on Netlify the next day.
This would have been impossible to do it in such a short time without all the powerfull Hugo tools and Netlify simplicity.
This would have been impossible to do it in such a short time without all the powerful Hugo tools and Netlify simplicity.

View file

@ -0,0 +1,6 @@
Bypass Censorship find and promote tools that provide Internet access to everyone.
The site is built by:
* [Leyla Avsar](https://www.leylaavsar.com/) (designer)
* [Fredrik Jonsson](https://xdeb.net/) (dev)

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View file

@ -0,0 +1,24 @@
---
title: Bypass Censorship
date: 2019-06-16
description: "Showcase: Bypass Censorship find and promote tools that provide Internet access to everyone."
siteURL: https://www.bypasscensorship.org/
byline: "[Fredrik Jonsson](https://xdeb.net/), Web developer & Linux sysadmin"
---
The British Broadcasting Corporation (BBC) (UK), Deutsche Welle (DW) (Germany), France Médias Monde (FMM) (France), the U.S. Agency for Global Media (USAGM) (US) and the Open Technology Fund (OTF) (US) co-sponsor the Bypass Censorship website.
Websites of international news agencies are often blocked in many countries. In order to connect people to these sites, Bypass Censorship feature and recommend tools in the following languages: English, French, Spanish, Arabic, Farsi, Chinese, and Russian.
One of the tools is the Bypass Censorship Extension for Firefox and Chrome. The extension help direct people to mirrors of partners sites if they are being censored.
The first version of the site was built in Drupal 8 but it was relaunched as a static site built with Hugo in 2019.
Security, page load time and easy of hosting is the main reasons for switching to a static site. As the lead developer I had good experience with Hugo and was interested in exploring the multilingual features.
It's a simply site, basically one page in seven languages. I had no problems getting Hugo to output what I wanted. Found the multilingual support straight forward and easy to work with.
Thanks to the design by [Leyla Avsar](https://www.leylaavsar.com/) the site also looks good. I used the [Hugo Zen theme](https://github.com/frjo/hugo-theme-zen) with a few custom templates and the needed CSS.
The editors can maintain content via [Forestry.io CMS](https://forestry.io/) or directly via Git. Forestry does unfortunately not have multilingual support. All the language versions are in one pile making it harder to find the right file to edit, but it works.

View file

@ -1,4 +1,4 @@
PHARMASEAL began in 2016 with the purpose of disrupting the Clinical Trials Management market through continuos validation and intergration
PHARMASEAL began in 2016 with the purpose of disrupting the Clinical Trials Management market through continuous validation and integration
We've been using **Hugo + Webpack + Netlify** to provide a scalable, modular design for the website, complete with Forestry building blocks to quickly be able to generate engagement pages.

View file

@ -53,6 +53,7 @@ Your 404.html file can be set to load automatically when a visitor enters a mist
* Amazon CloudFont. You can specify the page in the Error Pages section in the CloudFont Console. [Details here](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-error-pages.html)
* Caddy Server. Using `errors { 404 /404.html }`. [Details here](https://caddyserver.com/docs/errors)
* Netlify. Add `/* /404.html 404` to `content/_redirects`. [Details Here](https://www.netlify.com/docs/redirects/#custom-404)
* Azure Static website. You can specify the `Error document path` in the Static website configuration page of the Azure portal. [More details are available in the Static website documentation](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website).
{{% note %}}
`hugo server` will not automatically load your custom `404.html` file, but you

View file

@ -137,7 +137,7 @@ description = "Text about this post"
date = "2006-01-02"
images = ["post-cover.png"]
audio = []
video = []
videos = []
series = []
tags = []
{{</ code-toggle >}}
@ -146,11 +146,14 @@ Hugo uses the page title and description for the title and description metadata.
The first 6 URLs from the `images` array are used for image metadata.
Various optional metadata can also be set:
- Date, published date, and last modified data are used to set the published time metadata if specified.
- `audio` and `video` are URL arrays like `images` for the audio and video metadata tags, respectively.
- `audio` and `videos` are URL arrays like `images` for the audio and video metadata tags, respectively.
- The first 6 `tags` on the page are used for the tags metadata.
- The `series` taxonomy is used to specify related "see also" pages by placing them in the same series.
If using YouTube this will produce a og:video tag like `<meta property="og:video" content="url">`. If using a YouTube link make sure this is in **https://www.youtube.com/v/NlXVWtgLNjY** not __https://www.youtube.com/watch?v=NlXVWtgLNjY__
### Use the Open Graph Template
To add Open Graph metadata, include the following line between the `<head>` tags in your templates:
@ -160,6 +163,7 @@ To add Open Graph metadata, include the following line between the `<head>` tags
```
## Twitter Cards
An internal template for [Twitter Cards](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards),
metadata used to attach rich media to Tweets linking to your site.

View file

@ -170,7 +170,7 @@ Example of including a `layouts/partials/header.html` partial:
### Template
The `template` function was used to include *partial* templates
in much older Hugo versions. Now it useful only for calling
in much older Hugo versions. Now it's useful only for calling
[*internal* templates][internal_templates]. The syntax is `{{ template
"_internal/<TEMPLATE>.<EXTENSION>" . }}`.
@ -235,7 +235,7 @@ key.
#### Example 5: Conditional on empty _map_, _array_, or _slice_.
If the _map_, _array_, or _slice_ passed into the range is zero-length then the else statment is evaluated.
If the _map_, _array_, or _slice_ passed into the range is zero-length then the else statement is evaluated.
```go-html-template
{{ range $array }}

View file

@ -35,7 +35,7 @@ For template lookup order, see [Template Lookup](/templates/lookup-order/).
The idea of a list page comes from the [hierarchical mental model of the web][mentalmodel] and is best demonstrated visually:
![Image demonstrating a hierarchical website sitemap.](/images/site-hierarchy.svg)
[![Image demonstrating a hierarchical website sitemap.](/images/site-hierarchy.svg)](/images/site-hierarchy.svg)
## List Defaults

View file

@ -65,7 +65,7 @@ The following is an example:
{{< /code >}}
{{% note "`absLangURL` and `relLangURL`" %}}
Use the [`absLangUrl`](/functions/abslangurl) or [`relLangUrl`](/functions/rellangurl) functions if your theme makes use of the [multilingual feature](/content-management/multilingual/). In contrast to `absURL` and `relURL`, these two functions add the correct language prefix to the url.
Use the [`absLangURL`](/functions/abslangurl) or [`relLangURL`](/functions/rellangurl) functions if your theme makes use of the [multilingual feature](/content-management/multilingual/). In contrast to `absURL` and `relURL`, these two functions add the correct language prefix to the url.
{{% /note %}}
## Section Menu for Lazy Bloggers

View file

@ -47,7 +47,7 @@ To add or modify a media type, define it in a `mediaTypes` section in your [site
The above example adds one new media type, `text/enriched`, and changes the suffix for the built-in `text/html` media type.
**Note:** these media types are configured for **your output formats**. If you want to redefine one of Hugo's default output formats (e.g. `HTML`), you also need to redefine the output format. So, if you want to change the suffix of the `HTML` output format from `html` (default) to `htm`:
**Note:** these media types are configured for **your output formats**. If you want to redefine one of Hugo's default output formats (e.g. `HTML`), you also need to redefine the media type. So, if you want to change the suffix of the `HTML` output format from `html` (default) to `htm`:
```toml
[mediaTypes]

View file

@ -58,6 +58,7 @@ copyright = "This work is licensed under a Creative Commons Attribution-ShareAli
This is the default RSS template that ships with Hugo. It adheres to the [RSS 2.0 Specification][RSS 2.0].
```xml
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
@ -86,13 +87,6 @@ This is the default RSS template that ships with Hugo. It adheres to the [RSS 2.
</rss>
```
{{% warning "XML Header" %}}
Hugo will automatically add the following header line to this file on render. Please do *not* include this in the template as it's not valid HTML.
```
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
```
{{% /warning %}}
## Reference your RSS Feed in `<head>`
In your `header.html` template, you can specify your RSS feed in your `<head></head>` tag using Hugo's [Output Formats][Output Formats] like this:

View file

@ -46,6 +46,7 @@ For multilingual sites, we also create a Sitemap index. You can provide a custom
This template respects the version 0.9 of the [Sitemap Protocol](http://www.sitemaps.org/protocol.html).
```xml
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .Data.Pages }}
@ -69,18 +70,12 @@ This template respects the version 0.9 of the [Sitemap Protocol](http://www.site
</urlset>
```
{{% note %}}
Hugo will automatically add the following header line to this file
on render. Please don't include this in the template as it's not valid HTML.
`<?xml version="1.0" encoding="utf-8" standalone="yes" ?>`
{{% /note %}}
## Hugo's sitemapindex.xml
This is used to create a Sitemap index in multilingual mode:
```xml
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{ range . }}
<sitemap>

View file

@ -19,6 +19,11 @@ toc: false
wip: false
---
{{% warning "Deprecated" %}}
Page's `.Hugo` is deprecated and will be removed in a future release. Use the global `hugo` function.
For example: `hugo.Generator`.
{{% /warning %}}
It contains the following fields:
.Hugo.Generator

View file

@ -84,7 +84,7 @@ entries, if any, under the current menu entry.
Menus also have the following functions available:
[.HasChildren](/functions/haschildren/)
.HasChildren
: _boolean_ <br />
Returns `true` if `.Children` is non-nil.

View file

@ -30,6 +30,9 @@ See [`.Scratch`](/functions/scratch/) for page-scoped, writable variables.
.AlternativeOutputFormats
: contains all alternative formats for a given page; this variable is especially useful `link rel` list in your site's `<head>`. (See [Output Formats](/templates/output-formats/).)
.Aliases
: aliases of this page
.Content
: the content itself, defined below the front matter.
@ -133,6 +136,9 @@ http://remarkjs.com)
.ReadingTime
: the estimated time, in minutes, it takes to read the content.
.Resources
: resources such as images and CSS that are associated with this page
.Ref
: returns the permalink for a given reference (e.g., `.Ref "sample.md"`). `.Ref` does *not* handle in-page fragments correctly. See [Cross References](/content-management/cross-references/).
@ -164,6 +170,9 @@ http://remarkjs.com)
.Translations
: a list of translated versions of the current page. See [Multilingual Mode](/content-management/multilingual/) for more information.
.TranslationKey
: the key used to map language translations of the current page. See [Multilingual Mode](/content-management/multilingual/) for more information.
.Truncated
: a boolean, `true` if the `.Summary` is truncated. Useful for showing a "Read more..." link only when necessary. See [Summaries](/content-management/summaries/) for more information.

View file

@ -12,7 +12,7 @@
{{ end }}
{{ $image := .Scratch.Get "image" }}
<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 }}">
<img style="max-width: 100%; width: auto; height: auto;" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}">
<figcaption>
<small>
{{ with .Inner }}

View file

@ -3,9 +3,9 @@
<head>
<meta charset="utf-8">
{{/* https://www.zachleat.com/web/preload/ */}}
<link rel="preload" href="{{ "files/muli-latin-200.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="{{ "files/muli-latin-400.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="{{ "files/muli-latin-800.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="{{ "fonts/muli-latin-200.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="{{ "fonts/muli-latin-400.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="{{ "fonts/muli-latin-800.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
{{/* NOTE: the Site's title, and if there is a page title, that is set too */}}

View file

@ -431,7 +431,7 @@
},
"util": {
"version": "0.10.3",
"resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
"integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=",
"dev": true,
"requires": {
@ -516,7 +516,7 @@
},
"chalk": {
"version": "1.1.3",
"resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": {
@ -529,7 +529,7 @@
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"requires": {
@ -1119,7 +1119,7 @@
},
"color": {
"version": "0.11.4",
"resolved": "http://registry.npmjs.org/color/-/color-0.11.4.tgz",
"resolved": "https://registry.npmjs.org/color/-/color-0.11.4.tgz",
"integrity": "sha1-bXtcdPtl6EHNSHkq0e1eB7kE12Q=",
"dev": true,
"requires": {
@ -2236,7 +2236,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@ -2257,12 +2258,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -2277,17 +2280,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@ -2404,7 +2410,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@ -2416,6 +2423,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -2430,6 +2438,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -2437,12 +2446,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
@ -2461,6 +2472,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -2541,7 +2553,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
@ -2553,6 +2566,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -2638,7 +2652,8 @@
"safe-buffer": {
"version": "5.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@ -2674,6 +2689,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -2693,6 +2709,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -2736,12 +2753,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
@ -3502,9 +3521,9 @@
"dev": true
},
"js-yaml": {
"version": "3.12.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz",
"integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==",
"version": "3.13.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
"integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
"dev": true,
"requires": {
"argparse": "^1.0.7",
@ -3665,12 +3684,12 @@
"dev": true
},
"lodash.template": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz",
"integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=",
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.5.0.tgz",
"integrity": "sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==",
"dev": true,
"requires": {
"lodash._reinterpolate": "~3.0.0",
"lodash._reinterpolate": "^3.0.0",
"lodash.templatesettings": "^4.0.0"
}
},
@ -4846,7 +4865,7 @@
"dependencies": {
"color": {
"version": "1.0.3",
"resolved": "http://registry.npmjs.org/color/-/color-1.0.3.tgz",
"resolved": "https://registry.npmjs.org/color/-/color-1.0.3.tgz",
"integrity": "sha1-5I6DLYXxTvaU+0aIEcLVz+cptV0=",
"dev": true,
"requires": {
@ -4927,7 +4946,7 @@
"dependencies": {
"color": {
"version": "1.0.3",
"resolved": "http://registry.npmjs.org/color/-/color-1.0.3.tgz",
"resolved": "https://registry.npmjs.org/color/-/color-1.0.3.tgz",
"integrity": "sha1-5I6DLYXxTvaU+0aIEcLVz+cptV0=",
"dev": true,
"requires": {
@ -6038,7 +6057,7 @@
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
}
@ -6112,7 +6131,7 @@
},
"reduce-css-calc": {
"version": "1.3.0",
"resolved": "http://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz",
"resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-1.3.0.tgz",
"integrity": "sha1-dHyRTgSWFKTJz7umKYca0dKSdxY=",
"dev": true,
"requires": {
@ -7547,7 +7566,7 @@
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"requires": {
@ -7605,7 +7624,7 @@
},
"yargs": {
"version": "1.2.6",
"resolved": "http://registry.npmjs.org/yargs/-/yargs-1.2.6.tgz",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-1.2.6.tgz",
"integrity": "sha1-nHtKgv1dWVsr8Xq23MQxNUMv40s=",
"dev": true,
"requires": {