Merge commit 'eb16165694f868d73e57b6aed5c26ba5e98229de'

This commit is contained in:
Bjørn Erik Pedersen 2018-12-12 09:06:42 +01:00
commit b17a61a605
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
199 changed files with 10860 additions and 22630 deletions

21
docs/.github/stale.yml vendored Normal file
View file

@ -0,0 +1,21 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 120
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 30
# Issues with these labels will never be considered stale
exemptLabels:
- Keep
- Security
# Label to use when marking an issue as stale
staleLabel: Stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If you still think this is important, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

View file

@ -37,7 +37,6 @@ JSON
### Example
{{< code-toggle >}}
+++
title = "spf13-vim 3.0 release and new website"
description = "spf13-vim is a cross platform distribution of vim plugins and resources for Vim."
tags = [ ".vimrc", "plugins", "spf13-vim", "vim" ]
@ -47,8 +46,7 @@ categories = [
"VIM"
]
slug = "spf13-vim-3-0-release-and-new-website"
+++
{{</ code-toggle >}}
{{< /code-toggle >}}
## Front Matter Variables

View file

@ -349,12 +349,6 @@ 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
@ -438,6 +432,13 @@ Hugo will generate your website with these missing translation placeholders. It
For merging of content from other languages (i.e. missing content translations), see [lang.Merge](/functions/lang.merge/).
To track down missing translation strings, run Hugo with the `--i18n-warnings` flag:
```
hugo --i18n-warnings | grep i18n
i18n|MISSING_TRANSLATION|en|wordCount
```
## 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:

View file

@ -249,7 +249,7 @@ Gets a value from the current `Page's` params set in front matter, with a fall b
{{</* param testparam */>}}
```
Since `testparam` is a param defined in front matter of this page wi the value `Hugo Rocks!`, the above will print:
Since `testparam` is a param defined in front matter of this page with the value `Hugo Rocks!`, the above will print:
{{< param testparam >}}

View file

@ -22,7 +22,7 @@ toc: true
A collection of all themes created by the Hugo community, including screenshots and demos, can be found at <https://themes.gohugo.io>. Every theme in this list will automatically be added to the theme site. Theme updates aren't scheduled but usually happen at least once a week.
## tl;dr
## Adding a theme to the list
1. Create your theme using `hugo new theme <THEMENAME>`;
2. Test your theme against <https://github.com/gohugoio/hugoBasicExample> \*

View file

@ -22,20 +22,25 @@ aliases: []
`dict` is especially useful for passing more than one value to a partial template.
## Example: `dict` with Embedded SVGs
## Example: Using `dict` to pass multiple values to a `partial`
The partial below creates a SVG and expects `fill` `height` and `width` from the caller:
The partial below creates a SVG and expects `fill`, `height` and `width` from the caller:
**Partial definition**
{{< code file="layouts/partials/svgs/external-links.svg" download="external-links.svg" >}}
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="{{ .fill }}" width="{{ .size }}" height="{{ .size }}" viewBox="0 0 32 32" aria-label="External Link">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
fill="{{ .fill }}" width="{{ .width }}" height="{{ .height }}" viewBox="0 0 32 32" aria-label="External Link">
<path d="M25.152 16.576v5.696q0 2.144-1.504 3.648t-3.648 1.504h-14.848q-2.144 0-3.648-1.504t-1.504-3.648v-14.848q0-2.112 1.504-3.616t3.648-1.536h12.576q0.224 0 0.384 0.16t0.16 0.416v1.152q0 0.256-0.16 0.416t-0.384 0.16h-12.576q-1.184 0-2.016 0.832t-0.864 2.016v14.848q0 1.184 0.864 2.016t2.016 0.864h14.848q1.184 0 2.016-0.864t0.832-2.016v-5.696q0-0.256 0.16-0.416t0.416-0.16h1.152q0.256 0 0.416 0.16t0.16 0.416zM32 1.152v9.12q0 0.48-0.352 0.8t-0.8 0.352-0.8-0.352l-3.136-3.136-11.648 11.648q-0.16 0.192-0.416 0.192t-0.384-0.192l-2.048-2.048q-0.192-0.16-0.192-0.384t0.192-0.416l11.648-11.648-3.136-3.136q-0.352-0.352-0.352-0.8t0.352-0.8 0.8-0.352h9.12q0.48 0 0.8 0.352t0.352 0.8z"></path>
</svg>
{{< /code >}}
These values can be stored in one object with `dict` and passed to the partial:
**Partial call**
The `fill`, `height` and `width` values can be stored in one object with `dict` and passed to the partial:
{{< code file="layouts/_default/list.html" >}}
{{ partial "svg/link-ext.svg" (dict "fill" "#01589B" "size" 10 "width" 20 ) }}
{{ partial "svgs/external-links.svg" (dict "fill" "#01589B" "width" 10 "height" 20 ) }}
{{< /code >}}

View file

@ -1,4 +1,5 @@
---
title: imageConfig
linktitle: imageConfig
description: Parses the image and returns the height, width, and color model.
godocref:

View file

@ -18,9 +18,10 @@ relatedfuncs: []
deprecated: false
aliases: []
---
An useful example is to use it as `AND` filters when combined with where:
## AND filter in where query
```
{{ $pages := where .Site.RegularPages "Type" "not in" (slice "page" "about") }}
{{ $pages := $pages | union (where .Site.RegularPages "Params.pinned" true) }}

View file

@ -29,17 +29,13 @@ As an example:
Will "fill in the gaps" in the current site with, from left to right, content from the French site, and lastly the English.
A more practical example is to fill in the missing translations for the "minority languages" with content from the main language:
A more practical example is to fill in the missing translations from the other languages:
```bash
{{ $pages := .Site.RegularPages }}
{{ .Scratch.Set "pages" $pages }}
{{ $mainSite := .Sites.First }}
{{ if ne $mainSite .Site }}
{{ .Scratch.Set "pages" ($pages | lang.Merge $mainSite.RegularPages) }}
{{ end }}
{{ $pages := .Scratch.Get "pages" }}
{{ $pages := .Site.RegularPages }}
{{ range .Site.Home.Translations }}
{{ $pages = $pages | lang.Merge .Site.RegularPages }}
{{ end }}
```
{{% note %}}

View file

@ -19,7 +19,12 @@ deprecated: false
aliases: []
---
The `partialCached` template function can offer significant performance gains for complex templates that don't need to be re-rendered on every invocation. Here is the simplest usage:
The `partialCached` template function can offer significant performance gains for complex templates that don't need to be re-rendered on every invocation.
**Note:** Each Site (or language) has its own `partialCached` cache, so each site will execute a partial once.
Here is the simplest usage:
```
{{ partialCached "footer.html" . }}

View file

@ -0,0 +1,31 @@
---
title: path.Base
description: Base returns the last element of a path.
godocref:
date: 2018-11-28
publishdate: 2018-11-28
lastmod: 2018-11-28
categories: [functions]
menu:
docs:
parent: "functions"
keywords: [path, base]
signature: ["path.Base PATH"]
workson: []
hugoversion: "0.40"
relatedfuncs: [path.Dir, path.Ext, path.Split]
deprecated: false
---
`path.Base` returns the last element of `PATH`.
If `PATH` is empty, `.` is returned.
**Note:** On Windows, `PATH` is converted to slash (`/`) separators.
```
{{ path.Base "a/news.html" }} → "news.html"
{{ path.Base "news.html" }} → "news.html"
{{ path.Base "a/b/c" }} → "c"
{{ path.Base "/x/y/z/" }} → "z"
```

View file

@ -0,0 +1,32 @@
---
title: path.Dir
description: Dir returns all but the last element of a path.
godocref:
date: 2018-11-28
publishdate: 2018-11-28
lastmod: 2018-11-28
categories: [functions]
menu:
docs:
parent: "functions"
keywords: [path, dir]
signature: ["path.Dir PATH"]
workson: []
hugoversion: "0.40"
relatedfuncs: [path.Base, path.Ext, path.Split]
deprecated: false
---
`path.Dir` returns all but the last element of `PATH`, typically `PATH`'s directory.
The returned path will never end in a slash.
If `PATH` is empty, `.` is returned.
**Note:** On Windows, `PATH` is converted to slash (`/`) separators.
```
{{ path.Dir "a/news.html" }} → "a"
{{ path.Dir "news.html" }} → "."
{{ path.Dir "a/b/c" }} → "a/b"
{{ path.Dir "/x/y/z" }} → "/x/y"
```

View file

@ -0,0 +1,29 @@
---
title: path.Ext
description: Ext returns the file name extension of a path.
godocref:
date: 2018-11-28
publishdate: 2018-11-28
lastmod: 2018-11-28
categories: [functions]
menu:
docs:
parent: "functions"
keywords: [path, ext, extension]
signature: ["path.Ext PATH"]
workson: []
hugoversion: "0.40"
relatedfuncs: [path.Base, path.Dir, path.Split]
deprecated: false
---
`path.Ext` returns the file name extension `PATH`.
The extension is the suffix beginning at the final dot in the final slash-separated element `PATH`;
it is empty if there is no dot.
**Note:** On Windows, `PATH` is converted to slash (`/`) separators.
```
{{ path.Ext "a/b/c/news.html" }} → ".html"
```

View file

@ -0,0 +1,29 @@
---
title: path.Join
description: Join path elements into a single path.
godocref:
date: 2018-11-28
publishdate: 2018-11-28
lastmod: 2018-11-28
categories: [functions]
menu:
docs:
parent: "functions"
keywords: [path, join]
signature: ["path.Join ELEMENT..."]
workson: []
hugoversion: "0.39"
relatedfuncs: [path.Split]
deprecated: false
---
`path.Join` joins path elements into a single path, adding a separating slash if necessary.
All empty strings are ignored.
**Note:** All path elements on Windows are converted to slash ('/') separators.
```
{{ path.Join "partial" "news.html" }} → "partial/news.html"
{{ path.Join "partial/" "news.html" }} → "partial/news.html"
{{ path.Join "foo/baz" "bar" }} → "foo/baz/bar"
```

View file

@ -0,0 +1,31 @@
---
title: path.Split
description: Split path immediately following the final slash.
godocref:
date: 2018-11-28
publishdate: 2018-11-28
lastmod: 2018-11-28
categories: [functions]
menu:
docs:
parent: "functions"
keywords: [path, split]
signature: ["path.Split PATH"]
workson: []
hugoversion: "0.39"
relatedfuncs: [path.Split]
deprecated: false
---
`path.Split` splits `PATH` immediately following the final slash, separating it into a directory and a base component.
The returned values have the property that `PATH` = `DIR`+`BASE`.
If there is no slash in `PATH`, it returns an empty directory and the base is set to `PATH`.
**Note:** On Windows, `PATH` is converted to slash (`/`) separators.
```
{{ path.Split "a/news.html" }} → "a/", "news.html"
{{ path.Split "news.html" }} → "", "news.html"
{{ path.Split "a/b/c" }} → "a/b/", "c"
```

View file

@ -1,6 +1,5 @@
---
title: render
# linktitle: Render
title: .Render
description: Takes a view to apply when rendering content.
godocref:
date: 2017-02-01
@ -11,7 +10,7 @@ menu:
docs:
parent: "functions"
keywords: [views]
signature: ["render LAYOUT"]
signature: [".Render LAYOUT"]
workson: []
hugoversion:
relatedfuncs: []

View file

@ -0,0 +1,37 @@
---
title: templates.Exists
linktitle: ""
description: "Checks whether a template file exists under the given path relative to the `layouts` directory."
godocref: ""
date: 2018-11-01
publishdate: 2018-11-01
lastmod: 2018-11-01
categories: [functions]
tags: []
menu:
docs:
parent: "functions"
ns: ""
keywords: ["templates", "template", "layouts"]
signature: ["templates.Exists PATH"]
workson: []
hugoversion: "0.46"
aliases: []
relatedfuncs: []
toc: false
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.
```go-html-template
{{ $partialPath := printf "headers/%s.html" .Type }}
{{ if templates.Exists ( printf "partials/%s" $partialPath ) }}
{{ partial $partialPath . }}
{{ else }}
{{ partial "headers/default.html" . }}
{{ end }}
```

View file

@ -35,6 +35,7 @@ Given two arrays (or slices) A and B, this function will return a new array that
<!-- returns an error because both arrays/slices have to be of the same type -->
```
## OR filter in where query
This is also very useful to use as `OR` filters when combined with where:

View file

@ -437,15 +437,15 @@ You can override any of these cache setting in your own `config.toml`.
:cacheDir
: This is the value of the `cacheDir` config option if set (can also be set via OS env variable `HUGO_CACHEDIR`). It will fall back to `/opt/build/cache/hugo_cache/` on Netlify, or a `hugo_cache` directory below the OS temp dir for the others. This means that if you run your builds on Netlify, all caches configured with `:cacheDir` will be saved and restored on the next build. For other CI vendors, please read their documentation. For an CircleCI example, see [this configuration](https://github.com/bep/hugo-sass-test/blob/6c3960a8f4b90e8938228688bc49bdcdd6b2d99e/.circleci/config.yml).
:project
`:project`
The base directory name of the current Hugo project. This means that, in its default setting, every project will have separated file caches, which means that when you do `hugo --gc` you will not touch files related to other Hugo projects running on the same PC.
:resourceDir
`:resourceDir`
: This is the value of the `resourceDir` config option.
maxAge
: This is the duration before a cache entry will be evicted, -1 means forever and 0 effectively turns that particular cache off. Uses Go's `time.Duration`, so valid values are `"10s"` (10 seconds), `"10m"` (10 minutes) and `"10m"` (10 hours).
: This is the duration before a cache entry will be evicted, -1 means forever and 0 effectively turns that particular cache off. Uses Go's `time.Duration`, so valid values are `"10s"` (10 seconds), `"10m"` (10 minutes) and `"10h"` (10 hours).
dir
: The absolute path to where the files for this cache will be stored. Allowed starting placeholders are `:cacheDir` and `:resourceDir` (see above).

View file

@ -128,6 +128,12 @@ You can checkout a specific version as follows:
git checkout tags/<version-name>
```
You can update a theme to the latest version by executing the following command in the *root* directory of your project:
```
git submodule update --rebase --remote
```
## Next Steps
You now have a live website served over https, distributed through CDN, and configured for continuous deployment. Dig deeper into the Netlify documentation:

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

View file

@ -1,12 +1,12 @@
---
date: 2018-10-29
title: "0.50"
description: "0.50"
title: "Hugo 0.50: Errors so Good, Youll Want to Fail!"
description: "Errors with full filename and line and column number, shown in browser. And improved Fast Render Mode …"
categories: ["Releases"]
---
Hugo `0.50` brings **greatly improved error messages**, and we now also show them in the browser. Having error messages with filename, line- and column number greatly simplify troubleshooting. Many editors (like VS Code) even let you click and navigate directly to the problematic line. If your editor requires a different log format, you can set it via the `HUGO_FILE_LOG_FORMAT` OS environment variable:
Hugo `0.50` brings **greatly improved error messages**, and we now also show them in the browser. Having error messages with filename, line- and column number greatly simplify troubleshooting. Many editors (like VS Code) even let you click and navigate directly to the problematic line. If your editor requires a different log format, you can set it via the `HUGO_FILE_LOG_FORMAT` OS environment variable:
```bash

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

View file

@ -1,12 +1,12 @@
---
date: 2018-11-07
title: "0.51"
description: "0.51"
title: "Hugo 0.51: The 30K Stars Edition!"
description: "Bug fixes, new template functions and more error improvements."
categories: ["Releases"]
---
Hugo reached [30 000 stars on GitHub](https://github.com/gohugoio/hugo/stargazers) this week, which is a good occasion to do a follow-up release of the great Hugo `0.50`. This is mostly a bug fix release, but it also adds some useful new functionality, two examples are the new template funcs `complement` and `symdiff`. This release also continues the work on improving Hugo's error messages. And with `.Position` now available on shortcodes, you can also improve your own error messages inside your custom shortcodes:
Hugo reached [30 000 stars on GitHub](https://github.com/gohugoio/hugo/stargazers) this week, which is a good occasion to do a follow-up release of the great Hugo `0.50`. This is mostly a bug fix release, but it also adds some useful new functionality, two examples are the new template funcs [complement](https://gohugo.io/functions/complement/) and [symdiff](https://gohugo.io/functions/symdiff/). This release also continues the work on improving Hugo's error messages. And with `.Position` now available on shortcodes, you can also improve your own error messages inside your custom shortcodes:
```bash

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB

View file

@ -1,12 +1,12 @@
---
date: 2018-11-28
title: "0.52"
description: "0.52"
title: "And Now: Hugo 0.52"
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//templates/shortcode-templates/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](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 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.
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.

View file

@ -48,7 +48,7 @@ You can then call the shortcode as follows inside of your content's markup:
The above shortcode [is part of the code for the Hugo docs][dirindex]. Here it lists this site's CSS files:
{{< directoryindex path="/themes/gohugoioTheme/static/dist" pathURL="/css" >}}
{{< directoryindex path="/themes/gohugoioTheme/static" pathURL="/css" >}}
{{% note "Slashes are Important" %}}
The initial slash `/` in `pathURL` is important in the `directoryindex` shortcode. Otherwise, `pathURL` becomes relative to the current web page.

View file

@ -60,6 +60,10 @@ All partials are called within your templates using the following pattern:
One of the most common mistakes with new Hugo users is failing to pass a context to the partial call. In the pattern above, note how "the dot" (`.`) is required as the second argument to give the partial context. You can read more about "the dot" in the [Hugo templating introduction](/templates/introduction/).
{{% /note %}}
{{% note %}}
`<PARTIAL>` including `baseof` is reserved. ([#5373](https://github.com/gohugoio/hugo/issues/5373))
{{% /note %}}
As shown in the above example directory structure, you can nest your directories within `partials` for better source organization. You only need to call the nested partial's path relative to the `partials` directory:
```

View file

@ -19,8 +19,8 @@ toc: true
wip: true
---
{{% warning "Use Relative Links" %}}
If you're creating a theme with plans to share it with the community, use relative URLs since users of your theme may not publish from the root of their website. See [relURL](/functions/relurl) and [absURL](/functions/absurl).
{{% warning "Use Absolute Links" %}}
If you're creating a theme with plans to share it on the [Hugo Themes website](https://themes.gohugo.io/) please note that your theme's demo will be available in a sub-directory of website and for the theme's assets to load properly you will need to create absolute paths in the templates by using either the [absURL](/functions/absurl) function or `.Permalink`. Also make sure not to use a forward slash `/` in the beginning of a `PATH`, because Hugo will turn it into a relative URL and the `absURL` function will have no effect.
{{% /warning %}}
Hugo can initialize a new blank theme directory within your existing `themes` using the `hugo new` command:

View file

@ -30,3 +30,4 @@ A static website with a dynamic search function? Yes. As alternatives to embedda
## Commercial Search Services
* [Algolia](https://www.algolia.com/)'s Search API makes it easy to deliver a great search experience in your apps and websites. Algolia Search provides hosted full-text, numerical, faceted, and geolocalized search.
* [Bonsai](https://www.bonsai.io) is a fully-managed hosted Elasticsearch service that is fast, reliable, and simple to set up. Easily ingest your docs from Hugo into Elasticsearch following [this guide from the docs](https://docs.bonsai.io/docs/hugo).

View file

@ -33,9 +33,13 @@ The `.File` object contains the following fields:
.File.TranslationBaseName
: the filename without extension or optional language identifier (e.g., `foo`)
.File.ContentBaseName
: is a either TranslationBaseName or name of containing folder if file is a leaf bundle.
.File.BaseFileName
: the filename without extension (e.g., `foo.en`)
.File.Ext
: the file extension of the content file (e.g., `md`); this can also be called using `.File.Extension` as well. Note that it is *only* the extension without `.`.
@ -45,4 +49,4 @@ The `.File` object contains the following fields:
.File.Dir
: given the path `content/posts/dir1/dir2/`, the relative directory path of the content file will be returned (e.g., `posts/dir1/dir2/`)
[Multilingual]: /content-management/multilingual/
[Multilingual]: /content-management/multilingual/

View file

@ -156,6 +156,12 @@ http://remarkjs.com)
.Site
: see [Site Variables](/variables/site/).
.Sites
: returns all sites (languages). A typical use case would be to link back to the main language: `<a href="{{ .Sites.First.Home.RelPermalink }}">...</a>`.
.Sites.First
: returns the site for the first language. If this is not a multilingual setup, it will return itself.
.Summary
: a generated summary of the content for easily showing a snippet in a summary view. The breakpoint can be set manually by inserting <code>&lt;!&#x2d;&#x2d;more&#x2d;&#x2d;&gt;</code> at the appropriate place in the content page. See [Content Summaries](/content-management/summaries/) for more details.

View file

@ -1,30 +1,30 @@
[build]
publish = "public"
command = "hugo"
command = "hugo --gc --minify"
[context.production.environment]
HUGO_VERSION = "0.49.2"
HUGO_VERSION = "0.52"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"
[context.split1]
command = "hugo --enableGitInfo"
command = "hugo --gc --minify --enableGitInfo"
[context.split1.environment]
HUGO_VERSION = "0.49.2"
HUGO_VERSION = "0.52"
HUGO_ENV = "production"
[context.deploy-preview]
command = "hugo --buildFuture -b $DEPLOY_PRIME_URL"
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
[context.deploy-preview.environment]
HUGO_VERSION = "0.49.2"
HUGO_VERSION = "0.52"
[context.branch-deploy]
command = "hugo -b $DEPLOY_PRIME_URL"
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
[context.branch-deploy.environment]
HUGO_VERSION = "0.49.2"
HUGO_VERSION = "0.52"
[context.next.environment]
HUGO_ENABLEGITINFO = "true"

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"Target":"output/css/app.min.3d04cd530b6fbca129e24fb79af6692fa64cad11185196c7a800e58b4b3e2f97.css","MediaType":"text/css","Data":{"Integrity":"sha256-PQTNUwtvvKEp4k+3mvZpL6ZMrREYUZbHqADli0s+L5c="}}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"Target":"output/js/app.09ca7921ca2b6e15c2dc516eccf642c08861fe5c249cc9073fb370c0a8a9022c.js","MediaType":"application/javascript","Data":{"Integrity":"sha256-Ccp5IcorbhXC3FFuzPZCwIhh/lwknMkHP7NwwKipAiw="}}

View file

@ -4,4 +4,40 @@ Theme for gohugo.io sites:
* [https://gohugo.io/](https://gohugo.io/)
* [https://themes.gohugo.io/](https://themes.gohugo.io/)
More info to come.
## Tools
### NPM
We use [NPM](https://www.npmjs.com/) for package management The theme's `.gitignore` file should be kept intact to make sure that all files in the `node_modules` folder are not pushed to the repository.
### Webpack 4+
We use Webpack to manage our asset pipeline. Arguably, Webpack is overkill for this use-case, but we're using it here because once it's set up (which we've done for you), it's really easy to use. If you want to use an external script, just add it via Yarn, and reference it in main.js. You'll find instructions in the js/main.js file.
### PostCSS
PostCSS is just CSS. You'll find `postcss.config.js` in the Webpack.config.js file. There you'll find that we're using [`postcss-import`](https://github.com/postcss/postcss-import) which allows us import css files directly from the node_modules folder, [`postcss-cssnext`](http://cssnext.io/features/) which gives us the power to use upcoming CSS features today. If you miss Sass you can find PostCss modules for those capabilities, too.
### Tachyons
This theme uses the [Tachyons CSS Library](http://tachyons.io/). It's about 15kb gzipped, highly modular, and each class is atomic so you never have to worry about overwriting your styles. It's a great library for themes because you can make most all the style changes you need right in your layouts.
## How to Use
You'll find the commands to run in `package.json`.
For development, you'll need Node with NPM installed:
```
$ npm install
$ npm start
```
This will process both postcss, fonts, and scripts.
For production, instead of `npm start`, run `npm run build,` which will output smaller versions of your files.

View file

@ -1,15 +1,10 @@
/*Base Styles*/
@import '_tachyons';
/*type*/
@import 'font/_muli-200';
@import 'font/_muli-400';
@import 'font/_muli-800';
/* purgecss start ignore */
@import '_anchorforid';
@import '_animation';
@import '_documentation-styles';
@import '_algolia';
@import '_carousel';
@import '_code';
@ -21,7 +16,6 @@
@import '_definition-lists';
@import '_fluid-type';
@import '_font-family';
/*@import '_hljs';*/
@import '_hugo-internal-template-styling';
@import '_no-js';
@import '_social-icons';
@ -41,3 +35,4 @@
.mw-90 {
max-width:90%;
}
/* purgecss end ignore */

View file

@ -0,0 +1,16 @@
require("typeface-muli")
import styles from './css/main.css';
import './js/anchorforid.js'
import './js/clipboardjs.js'
import './js/codeblocks.js'
import './js/docsearch.js'
import './js/hljs.js'
import './js/lazysizes.js'
import './js/menutoggle.js'
import './js/scrolldir.js'
import './js/smoothscroll.js'
import './js/tabs.js'
import './js/nojs.js'

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -2,7 +2,7 @@
<main class="cf pa5 pa4-l f4 tc center measure-wide lh-copy gray">
<h1 class="f3 f2-ns">The page you're looking for doesn't exist. Perhaps you'd like to gopher something else? Sorry.</h1>
<div class="h6">
{{ partial "svg/gopher-hero.svg" . }}
<img src="/images/gopher-hero.svg" alt="" class="h5">
</div>
{{ .Content }}

View file

@ -2,11 +2,7 @@
<html class="no-js" lang="{{ with $.Site.LanguageCode }}{{ . }}{{ else }}en-us{{ end }}">
<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>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
{{/* NOTE: the Site's title, and if there is a page title, that is set too */}}
<title>{{ block "title" . }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title>
@ -25,8 +21,18 @@
{{ range .AlternativeOutputFormats -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
{{ end -}}
{{ $stylesheet := resources.Get "output/css/app.css" | minify | fingerprint }}
{{ with $stylesheet }}
<link rel="stylesheet" href="{{ .Permalink | relURL }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{ $.Scratch.Set "stylesheet" . }}
{{end}}
<link href='{{ "dist/main.css" | relURL }}' rel='stylesheet' type="text/css" />
{{ block "scripts" . }}
{{- partial "site-scripts.html" . -}}
{{ end }}
{{ partial "site-manifest.html" . }}
{{- partial "head-additions.html" . -}}
{{- template "_internal/opengraph.html" . -}}
{{- template "_internal/google_news.html" . -}}
@ -38,7 +44,7 @@
{{ end }}
</head>
<body class="ma0 sans-serif bg-primary-color-light{{ with getenv "HUGO_ENV" }} {{ . }}{{ end }}">
@ -49,7 +55,7 @@
</main>
{{ block "footer" . }}{{ partialCached "site-footer.html" . }}{{ end }}
{{ block "scripts" . }}{{- partial "site-scripts.html" . -}}{{ end }}
</body>
</html>

View file

@ -4,5 +4,25 @@
X-Content-Type-Options: nosniff
Referrer-Policy: origin-when-cross-origin
*/
Link: <{{ "dist/app.bundle.js" | relURL }}>; rel=preload; as=script
Link: <{{ "dist/main.css" | relURL }}>; rel=preload; as=style
{{ $stylesheet := resources.Get "output/css/app.css" }}
{{ $scripts := resources.Get "output/js/app.js" }}
{{ with $stylesheet -}}Link: <{{ .Permalink | relURL }}>; rel=preload; as=style nopush{{- end}}
{{ with $scripts -}}Link: <{{ .Permalink | relURL }}>; rel=preload; as=script nopush{{- end}}
{{ range (readDir "/static/fonts/") }}
Link: </fonts/{{ .Name }}>; rel=preload; as=font nopush
{{ end }}
{{ range (readDir "./themes/gohugoioTheme/static/fonts") }}
Link: </fonts/{{ .Name }}>; rel=preload; as=font nopush
{{ end }}
{{ with $stylesheet }}
{{ .Permalink | relURL }}
Cache-Control: public, max-age=31556926,immutable
{{end }}
{{ with $scripts }}
{{ .Permalink | relURL }}
Cache-Control: public, max-age=31556926,immutable
{{end}}

View file

@ -0,0 +1 @@
<!-- EMPTY -->

View file

@ -1,7 +1,7 @@
<header class="bg-primary-color-dark ph4 tc" role="banner">
<section class="center pb4 pb5-l ph4-l pt3 pt5-ns w-90 w-60-l">
<div class="center w-100 w-50-ns">
{{ partial "svg/hugo-logo-wide.svg" . }}
<img src="/images/hugo-logo-wide.svg" alt="Hugo Logo">
</div>
{{ with .Site.Params.description }}
<h2 class="f3 f1-l fw4 white-90 m0 lh-title pt2 pb3 pv0-ns">

View file

@ -12,7 +12,7 @@
<!-- RIGHT -->
<div class="w-100 w-50-ns tc">
<div class="h4">
{{ partial "svg/gopher-hero.svg" . }}
<img src="/images/gopher-hero.svg" alt="Hugo Gopher" class="h4">
</div>
<p class="f6 mid-gray m0 p0 pt3">Mac OS</p>
<div class="code f6 bg-black light-green lh-copy pv3 ph3 br2 w-100 w-50-ns center mb2 tl">

View file

@ -7,7 +7,7 @@
</div>
<div class="center w4">
{{ partialCached "svg/hugo-logo-wide.svg" . }}
<img src="/images/hugo-logo-wide.svg" alt="Hugo Logo">
</div>
<ul class="center f6 list ma0 mv3 pa0 tc">

View file

@ -17,7 +17,9 @@
{{/* using ".Post" from the menu system to determine if we should show an icon for external links */}}
{{ $post_status := printf "%s" .Post }}
{{ if eq $post_status "external" }}
{{ partial "svg/link-ext.svg" (dict "size" "10") }}
<span class="pl1">
{{ partial "svg/link-ext.svg" (dict "size" "10") }}
</span>
{{ end }}
</a>
</li>

View file

@ -1,3 +1,10 @@
<script src="{{ "dist/app.bundle.js" | relURL }}"></script>
<!-- scripts -->
{{ $scripts := resources.Get "output/js/app.js" | fingerprint }}
{{ with $scripts }}
<script type="text/javascript" src="{{ .Permalink | relURL }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous" defer></script>
{{ $.Scratch.Set "scripts" . }}
{{end}}
<!-- Place this tag in your head or just before your close body tag. -->
<script async defer src="https://buttons.github.io/buttons.js"></script>

View file

@ -1,6 +1,6 @@
<form id="site-search-form" action="" role="search">
<fieldset class="bn ma0 pa0">
<label class="clip" for="search-input">Search</label>
<input type="search" id="search-input" class="needs-js bg-left bg-transparent bn f5 input-reset lh-solid mt3 mt0-ns pl4 pv2 w5 white" placeholder="Search the Docs" type="text" name="search-input" value="" style="background-image:url('/images/icon-search.png');background-size:16px 16px;">
<input type="search" id="search-input" class="needs-js bn f5 input-reset lh-solid mt3 mt0-ns pl4 pv2 w5 white" placeholder="Search the Docs" type="text" name="search-input" value="" style="background: transparent url('/images/icon-search.png') no-repeat left center;background-size:16px 16px;">
</fieldset>
</form>

View file

@ -35,9 +35,16 @@ Showcase: {{ .Title }}
{{define "sc-main-column"}}
{{ $img := (.Resources.ByType "image").GetMatch "*featured*" }}
{{ with $img }}
{{ $big := .Fill "1024x512 top" }}
{{ $small := $big.Resize "512x" }}
<img srcset="{{ $small.RelPermalink }} 1x, {{ $big.RelPermalink }} 2x" alt="{{ $img.Title }}" width="{{ $big.Width }}" class="mw-100 b--light-gray ba">
{{ $big := .Fill "1024x512 top" }}
{{ $small := $big.Resize "512x" }}
<img
alt="{{ $img.Title }}"
src="{{ $big.RelPermalink }}"
srcset="{{ $small.RelPermalink }} 512w, {{ $big.RelPermalink }} 1024w"
sizes="(min-width: 1570px) 822px, (max-width: 1569px) and (min-width: 960px) 50vw, 93vw"
width="{{ $big.Width }}"
class="mw-100 b--light-gray ba"
>
{{ end }}
<div class="mid-gray nested-copy-line-height nested-img nested-links">
{{with .Params.byline }}

7647
docs/themes/gohugoioTheme/package-lock.json generated vendored Normal file

File diff suppressed because it is too large Load diff

36
docs/themes/gohugoioTheme/package.json vendored Normal file
View file

@ -0,0 +1,36 @@
{
"name": "gohugo-default-styles",
"version": "1.1.0",
"description": "Default Theme for Hugo Sites",
"main": "index.js",
"repository": "",
"author": "budparr",
"license": "MIT",
"scripts": {
"build": "NODE_ENV=production webpack",
"build-dev": "NODE_ENV=development webpack --progress --watch",
"start": "npm run build-dev"
},
"devDependencies": {
"clean-webpack-plugin": "^1.0.0",
"clipboard": "^2.0.4",
"css-loader": "^1.0.1",
"docsearch.js": "^2.6.1",
"file-loader": "^2.0.0",
"glob-all": "^3.1.0",
"highlight.js": "^9.13.1",
"lazysizes": "^4.1.4",
"mini-css-extract-plugin": "^0.4.4",
"postcss": "^7.0.5",
"postcss-cssnext": "^3.1.0",
"postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0",
"purgecss-webpack-plugin": "^1.3.1",
"scrolldir": "^1.4.0",
"tachyons": "^4.7.0",
"typeface-muli": "0.0.54",
"webpack": "^4.25.1",
"webpack-command": "^0.4.2"
},
"dependencies": {}
}

View file

@ -1,29 +0,0 @@
/* muli-200normal - latin */
@font-face {
font-family: 'Muli';
font-style: normal;
font-weight: 200;
src: url('/files/muli-latin-200.eot'); /* IE9 Compat Modes */
src:
local('Muli Extra Light '),
local('Muli-Extra Light'),
url('/files/muli-latin-200.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/files/muli-latin-200.woff2') format('woff2'), /* Super Modern Browsers */
url('/files/muli-latin-200.woff') format('woff'), /* Modern Browsers */
url('/files/muli-latin-200.svg#muli') format('svg'); /* Legacy iOS */
}
/* muli-200italic - latin */
@font-face {
font-family: 'Muli';
font-style: italic;
font-weight: 200;
src: url('/files/muli-latin-200italic.eot'); /* IE9 Compat Modes */
src:
local('Muli Extra Light italic'),
local('Muli-Extra Lightitalic'),
url('/files/muli-latin-200italic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/files/muli-latin-200italic.woff2') format('woff2'), /* Super Modern Browsers */
url('/files/muli-latin-200italic.woff') format('woff'), /* Modern Browsers */
url('/files/muli-latin-200italic.svg#muli') format('svg'); /* Legacy iOS */
}

View file

@ -1,30 +0,0 @@
/* muli-300normal - latin */
@font-face {
font-family: 'Muli';
font-style: normal;
font-weight: 300;
src: url('/files/muli-latin-300.eot'); /* IE9 Compat Modes */
src:
local('Muli Light '),
local('Muli-Light'),
url('/files/muli-latin-300.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/files/muli-latin-300.woff2') format('woff2'), /* Super Modern Browsers */
url('/files/muli-latin-300.woff') format('woff'), /* Modern Browsers */
url('/files/muli-latin-300.svg#muli') format('svg'); /* Legacy iOS */
}
/* muli-300italic - latin */
@font-face {
font-family: 'Muli';
font-style: italic;
font-weight: 300;
src: url('/files/muli-latin-300italic.eot'); /* IE9 Compat Modes */
src:
local('Muli Light italic'),
local('Muli-Lightitalic'),
url('/files/muli-latin-300italic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/files/muli-latin-300italic.woff2') format('woff2'), /* Super Modern Browsers */
url('/files/muli-latin-300italic.woff') format('woff'), /* Modern Browsers */
url('/files/muli-latin-300italic.svg#muli') format('svg'); /* Legacy iOS */
}

Some files were not shown because too many files have changed in this diff Show more