From: Bjørn Erik Pedersen Date: Thu, 19 Jul 2018 07:18:11 +0000 (+0200) Subject: Merge commit 'a3535c8486b2ce762b1a8a9c30b03985c3e02cee' X-Git-Tag: v0.45~23 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9da617912ba740cebd18789ca7aa55f25495ae6c;p=brevno-suite%2Fhugo Merge commit 'a3535c8486b2ce762b1a8a9c30b03985c3e02cee' --- 9da617912ba740cebd18789ca7aa55f25495ae6c diff --cc docs/config.toml index 12398be2,00000000..6c75f521 mode 100644,000000..100644 --- a/docs/config.toml +++ b/docs/config.toml @@@ -1,408 -1,0 +1,412 @@@ +baseURL = "https://gohugo.io/" +paginate = 100 +defaultContentLanguage = "en" +enableEmoji = true +# Set the unicode character used for the "return" link in page footnotes. +footnotereturnlinkcontents = "↩" +languageCode = "en-us" +metaDataFormat = "yaml" +title = "Hugo" +theme = "gohugoioTheme" + +googleAnalytics = "UA-7131036-4" + +pluralizeListTitles = false + +# We do redirects via Netlify's _redirects file, generated by Hugo (see "outputs" below). +disableAliases = true + +# Highlighting config (Pygments) +# It is (currently) not in use, but you can do ```go in a content file if you want to. +pygmentsCodeFences = true + +pygmentsOptions = "" +# Use the Chroma stylesheet +pygmentsUseClasses = true +pygmentsUseClassic = false + +# See https://help.farbox.com/pygments.html +pygmentsStyle = "trac" + +[outputs] +home = [ "HTML", "RSS", "REDIR", "HEADERS" ] +section = [ "HTML", "RSS"] + +[mediaTypes] +[mediaTypes."text/netlify"] +delimiter = "" + +[outputFormats] +[outputFormats.REDIR] +mediatype = "text/netlify" +baseName = "_redirects" +isPlainText = true +notAlternative = true +[outputFormats.HEADERS] +mediatype = "text/netlify" +baseName = "_headers" +isPlainText = true +notAlternative = true + +[related] + +threshold = 80 +includeNewer = true +toLower = false + +[[related.indices]] +name = "keywords" +weight = 100 +[[related.indices]] +name = "date" +weight = 10 +pattern = "2006" + +[social] +twitter = "GoHugoIO" + +#CUSTOM PARAMS +[params] + description = "The world’s fastest framework for building websites" + ## Used for views in rendered HTML (i.e., rather than using the .Hugo variable) + release = "0.45-DEV" + ## Setting this to true will add a "noindex" to *EVERY* page on the site + removefromexternalsearch = false + ## Gh repo for site footer (include trailing slash) + ghrepo = "https://github.com/gohugoio/hugoDocs/" + ## GH Repo for filing a new issue + github_repo = "https://github.com/gohugoio/hugo/issues/new" + ### Edit content repo (set to automatically enter "edit" mode; this is good for "improve this page" links) + ghdocsrepo = "https://github.com/gohugoio/hugoDocs/tree/master/docs" + ## Gitter URL + gitter = "https://gitter.im/spf13/hugo" + ## Discuss Forum URL + forum = "https://discourse.gohugo.io/" + ## Google Tag Manager + gtmid = "" + + # First one is picked as the Twitter card image if not set on page. + images = ["images/gohugoio-card.png"] + + flex_box_interior_classes = "flex-auto w-100 w-40-l mr3 mb3 bg-white ba b--moon-gray nested-copy-line-height" + + #sidebar_direction = "sidebar_left" + +# MARKDOWN +## Configuration for BlackFriday markdown parser: https://github.com/russross/blackfriday +[blackfriday] + plainIDAnchors = true + # See https://github.com/gohugoio/hugo/issues/2424 + hrefTargetBlank = false + angledQuotes = false + latexDashes = true + +[imaging] +# See https://github.com/disintegration/imaging +# CatmullRom is a sharp bicubic filter which should fit the docs site well with its many screenshots. +# Note that you can also set this per image processing. +resampleFilter = "CatmullRom" + +# Defatult JPEG quality setting. Default is 75. +quality = 75 + +anchor = "smart" + + +## As of v0.20, all content files include a default "categories" value that's the same as the section. This was a cheap future-proofing method and should/could be changed accordingly. +[taxonomies] + category = "categories" + +# High level items + +[[menu.docs]] + name = "About Hugo" + weight = 1 + identifier = "about" + url = "/about/" + +[[menu.docs]] + name = "Getting Started" + weight = 5 + identifier = "getting-started" + url = "/getting-started/" + + +[[menu.docs]] + name = "Themes" + weight = 15 + identifier = "themes" + post = "break" + url = "/themes/" + +# Core Menus + +[[menu.docs]] + name = "Content Management" + weight = 20 + identifier = "content-management" + post = "expanded" + url = "/content-management/" + +[[menu.docs]] + name = "Templates" + weight = 25 + identifier = "templates" + + url = "/templates/" + +[[menu.docs]] + name = "Functions" + weight = 30 + identifier = "functions" + url = "/functions/" + +[[menu.docs]] + name = "Variables" + weight = 35 + identifier = "variables" + url = "/variables/" - ++[[menu.docs]] ++ name = "Hugo Pipes" ++ weight = 36 ++ identifier = "pipes" ++ url = "/hugo-pipes/" +[[menu.docs]] + name = "CLI" + weight = 40 + post = "break" + identifier = "commands" + url = "/commands/" + + + +# LOW LEVEL ITEMS + + +[[menu.docs]] + name = "Troubleshooting" + weight = 60 + identifier = "troubleshooting" + url = "/troubleshooting/" + +[[menu.docs]] + name = "Tools" + weight = 70 + identifier = "tools" + url = "/tools/" + +[[menu.docs]] + name = "Hosting & Deployment" + weight = 80 + identifier = "hosting-and-deployment" + url = "/hosting-and-deployment/" + +[[menu.docs]] + name = "Contribute" + weight = 100 + post = "break" + identifier = "contribute" + url = "/contribute/" + +#[[menu.docs]] +# name = "Tags" +# weight = 120 +# identifier = "tags" +# url = "/tags/" + + +# [[menu.docs]] +# name = "Categories" +# weight = 140 +# identifier = "categories" +# url = "/categories/" + +######## QUICKLINKS + + [[menu.quicklinks]] + name = "Fundamentals" + weight = 1 + identifier = "fundamentals" + url = "/tags/fundamentals/" + + + + +######## GLOBAL ITEMS TO BE SHARED WITH THE HUGO SITES + +[[menu.global]] + name = "News" + weight = 1 + identifier = "news" + url = "/news/" + + [[menu.global]] + name = "Docs" + weight = 5 + identifier = "docs" + url = "/documentation/" + + [[menu.global]] + name = "Themes" + weight = 10 + identifier = "themes" + url = "https://themes.gohugo.io/" + + [[menu.global]] + name = "Showcase" + weight = 20 + identifier = "showcase" + url = "/showcase/" + + # Anything with a weight > 100 gets an external icon + [[menu.global]] + name = "Community" + weight = 150 + icon = true + identifier = "community" + post = "external" + url = "https://discourse.gohugo.io/" + + + [[menu.global]] + name = "GitHub" + weight = 200 + identifier = "github" + post = "external" + url = "https://github.com/gohugoio/hugo" + +### LANGUAGES ### + +[languages] + [languages.en] + contentDir = "content/en" + languageName = "English" + weight = 1 + [languages.zh] + contentDir = "content/zh" + languageName = "中文" + weight = 2 + + +### LANGUAGE-SPECIFIC MENUS ### + +# Chinese menus + +[[languages.zh.menu.docs]] + name = "关于 Hugo" + weight = 1 + identifier = "about" + url = "/zh/about/" + +[[languages.zh.menu.docs]] + name = "入门" + weight = 5 + identifier = "getting-started" + url = "/zh/getting-started/" + +[[languages.zh.menu.docs]] + name = "主题" + weight = 15 + identifier = "themes" + post = "break" + url = "/zh/themes/" + +# Core languages.zh.menus + +[[languages.zh.menu.docs]] + name = "内容管理" + weight = 20 + identifier = "content-management" + post = "expanded" + url = "/zh/content-management/" + +[[languages.zh.menu.docs]] + name = "模板" + weight = 25 + identifier = "templates" + url = "/zh/templates/" + +[[languages.zh.menu.docs]] + name = "函数" + weight = 30 + identifier = "functions" + url = "/zh/functions/" + +[[languages.zh.menu.docs]] + name = "变量" + weight = 35 + identifier = "variables" + url = "/zh/variables/" + +[[languages.zh.menu.docs]] + name = "CLI" + weight = 40 + post = "break" + identifier = "commands" + url = "/commands/" + +# LOW LEVEL ITEMS +[[languages.zh.menu.docs]] + name = "故障排除" + weight = 60 + identifier = "troubleshooting" + url = "/zh/troubleshooting/" + +[[languages.zh.menu.docs]] + name = "工具" + weight = 70 + identifier = "tools" + url = "/zh/tools/" + +[[languages.zh.menu.docs]] + name = "托管与部署" + weight = 80 + identifier = "hosting-and-deployment" + url = "/zh/hosting-and-deployment/" + +[[languages.zh.menu.docs]] + name = "贡献" + weight = 100 + post = "break" + identifier = "contribute" + url = "/zh/contribute/" + +[[languages.zh.menu.global]] + name = "新闻" + weight = 1 + identifier = "news" + url = "/zh/news/" + +[[languages.zh.menu.global]] + name = "文档" + weight = 5 + identifier = "docs" + url = "/zh/documentation/" + +[[languages.zh.menu.global]] + name = "主题" + weight = 10 + identifier = "themes" + url = "https://themes.gohugo.io/" + +[[languages.zh.menu.global]] + name = "作品展示" + weight = 20 + identifier = "showcase" + url = "/zh/showcase/" + +# Anything with a weight > 100 gets an external icon +[[languages.zh.menu.global]] + name = "社区" + weight = 150 + icon = true + identifier = "community" + post = "external" + url = "https://discourse.gohugo.io/" + +[[languages.zh.menu.global]] + name = "GitHub" + weight = 200 + identifier = "github" + post = "external" + url = "https://github.com/gohugoio/hugo" diff --cc docs/content/en/hugo-pipes/_index.md index 00000000,00000000..47411072 new file mode 100755 --- /dev/null +++ b/docs/content/en/hugo-pipes/_index.md @@@ -1,0 -1,0 +1,15 @@@ ++--- ++title: Hugo Pipes Overview ++date: 2018-07-14 ++publishdate: 2018-07-14 ++lastmod: 2018-07-14 ++categories: [asset management] ++keywords: [] ++menu: ++ docs: ++ parent: "pipes" ++ weight: 10 ++weight: 10 ++sections_weight: 10 ++draft: false ++--- diff --cc docs/content/en/hugo-pipes/bundling.md index 00000000,00000000..32f0a788 new file mode 100755 --- /dev/null +++ b/docs/content/en/hugo-pipes/bundling.md @@@ -1,0 -1,0 +1,26 @@@ ++--- ++title: Asset bundling ++description: Hugo Pipes can bundle any number of assets together. ++date: 2018-07-14 ++publishdate: 2018-07-14 ++lastmod: 2018-07-14 ++categories: [asset management] ++keywords: [] ++menu: ++ docs: ++ parent: "pipes" ++ weight: 60 ++weight: 60 ++sections_weight: 60 ++draft: false ++--- ++ ++ ++Asset files of the same MIME type can be bundled into one resource using `resources.Concat` which takes two arguments, a target path and a slice of resource objects. ++ ++ ++```go-html-template ++{{ $plugins := resources.Get "js/plugins.js" }} ++{{ $global := resources.Get "js/global.js" }} ++{{ $js := slice $plugins $global | resources.Concat "js/bundle.js" }} ++``` diff --cc docs/content/en/hugo-pipes/fingerprint.md index 00000000,00000000..96aa7f55 new file mode 100755 --- /dev/null +++ b/docs/content/en/hugo-pipes/fingerprint.md @@@ -1,0 -1,0 +1,29 @@@ ++--- ++title: Fingerprinting and SRI ++description: Hugo Pipes allows Fingerprinting and Subresource Integrity. ++date: 2018-07-14 ++publishdate: 2018-07-14 ++lastmod: 2018-07-14 ++categories: [asset management] ++keywords: [] ++menu: ++ docs: ++ parent: "pipes" ++ weight: 70 ++weight: 70 ++sections_weight: 70 ++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). ++ ++The default hash function is `sha256`. Other available functions are `sha512` and `md5`. ++ ++Any so processed asset will bear a `.Data.Integrity` property containing an integrity string, which is made up of the name of the hash function, one hyphen and the base64-encoded hash sum. ++ ++```go-html-template ++{{ $js := resources.Get "js/global.js" }} ++{{ $secureJS := $js | resources.Fingerprint "sha512" }} ++ ++``` diff --cc docs/content/en/hugo-pipes/introduction.md index 00000000,00000000..84ac4ec6 new file mode 100755 --- /dev/null +++ b/docs/content/en/hugo-pipes/introduction.md @@@ -1,0 -1,0 +1,52 @@@ ++--- ++title: Hugo Pipes Introduction ++description: Hugo Pipes is Hugo's asset processing set of functions. ++date: 2018-07-14 ++publishdate: 2018-07-14 ++lastmod: 2018-07-14 ++categories: [asset management] ++keywords: [] ++menu: ++ docs: ++ parent: "pipes" ++ weight: 20 ++weight: 01 ++sections_weight: 01 ++draft: false ++aliases: [/assets/] ++--- ++ ++### Asset directory ++ ++Asset files must be stored in the asset directory. This is `/assets` by default, but can be configured via the configuration file's `assetDir` key. ++ ++### From file to resource ++ ++In order to process an asset with Hugo Pipes, it must be retrieved as a resource using `resources.Get`, which takes one argument: the filepath of the file relative to the asset directory. ++ ++```go-html-template ++{{ $style := resources.Get "sass/main.scss" }} ++``` ++ ++### Asset publishing ++ ++Assets will only be published (to `/public`) if `.Permalink` or `.RelPermalink` is used. ++ ++### Go Pipes ++ ++For improved readability, the Hugo Pipes examples of this documentation will be written using [Go Pipes](/templates/introduction/#pipes): ++```go-html-template ++{{ $style := resources.Get "sass/main.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }} ++ ++``` ++ ++### Method aliases ++ ++Each Hugo Pipes `resources` transformation method uses a __camelCased__ alias (`toCSS` for `resources.ToCSS`). ++Non-transformation methods deprived of such aliases are `resources.Get`, `resources.FromString` and `resources.ExecuteAsTemplate`. ++ ++The example above can therefore also be written as follows: ++```go-html-template ++{{ $style := resources.Get "sass/main.scss" | toCSS | minify | fingerprint }} ++ ++``` diff --cc docs/content/en/hugo-pipes/minification.md index 00000000,00000000..ce090752 new file mode 100755 --- /dev/null +++ b/docs/content/en/hugo-pipes/minification.md @@@ -1,0 -1,0 +1,25 @@@ ++--- ++title: Asset minification ++description: Hugo Pipes allows the minification of any CSS, JS, JSON, HTML, SVG or XML resource. ++date: 2018-07-14 ++publishdate: 2018-07-14 ++lastmod: 2018-07-14 ++categories: [asset management] ++keywords: [] ++menu: ++ docs: ++ parent: "pipes" ++ weight: 50 ++weight: 50 ++sections_weight: 50 ++draft: false ++--- ++ ++ ++Any resource of the aforementioned types can be minifed using `resources.Minify` which takes for argument the resource object. ++ ++ ++```go-html-template ++{{ $css := resources.Get "css/main.css" }} ++{{ $style := $css | resources.Minify }} ++``` diff --cc docs/content/en/hugo-pipes/postcss.md index 00000000,00000000..a0ecc6d3 new file mode 100755 --- /dev/null +++ b/docs/content/en/hugo-pipes/postcss.md @@@ -1,0 -1,0 +1,56 @@@ ++--- ++title: PostCSS ++description: Hugo Pipes can process CSS files with PostCSS. ++date: 2018-07-14 ++publishdate: 2018-07-14 ++lastmod: 2018-07-14 ++categories: [asset management] ++keywords: [] ++menu: ++ docs: ++ parent: "pipes" ++ weight: 40 ++weight: 40 ++sections_weight: 40 ++draft: false ++--- ++ ++ ++Any asset file can be processed using `resources.PostCSS` which takes for argument the resource object and a slice of options listed below. ++ ++The resource will be processed using the project's or theme's own `postcss.config.js` or any file set with the `config` option. ++ ++ ++```go-html-template ++{{ $css := resources.Get "css/main.css" }} ++{{ $style := $css | resources.PostCSS }} ++``` ++ ++{{% note %}} ++Hugo Pipe's PostCSS requires `postcss-cli` javascript package to be installed on the environement along with any PostCSS plugin used. ++{{% /note %}} ++### Options ++ ++config [string] ++: Path to the PostCSS configuration file ++ ++noMap [bool] ++: Default is `true`. Disable the default inline sourcemaps ++ ++_If no configuration file is used:_ ++ ++use [string] ++: List of PostCSS plugins to use ++ ++parser [string] ++: Custom PostCSS parser ++ ++stringifier [string] ++: Custom PostCSS stringifier ++ ++syntax [string] ++: Custom postcss syntax ++ ++```go-html-template ++{{ $style := resources.Get "css/main.css" | resources.PostCSS (dict "config" "customPostCSS.js" "noMap" true) }} ++``` diff --cc docs/content/en/hugo-pipes/resource-from-string.md index 00000000,00000000..862fcd93 new file mode 100755 --- /dev/null +++ b/docs/content/en/hugo-pipes/resource-from-string.md @@@ -1,0 -1,0 +1,31 @@@ ++--- ++title: Creating a resource from a string ++linkTitle: Resource from String ++description: Hugo Pipes allows the creation of a resource from a string. ++date: 2018-07-14 ++publishdate: 2018-07-14 ++lastmod: 2018-07-14 ++categories: [asset management] ++keywords: [] ++menu: ++ docs: ++ parent: "pipes" ++ weight: 90 ++weight: 90 ++sections_weight: 90 ++draft: false ++--- ++ ++It is possible to create a resource directly from the template using `resources.FromString` which takes two arguments, the given string and the resource target path. ++ ++The following example creates a resource file containing localized variables for every project's languages. ++ ++```go-html-template ++{{ $string := (printf "var rootURL: '%s'; var apiURL: '%s';" (absURL "/") (.Param "API_URL")) }} ++{{ $targetPath := "js/vars.js" }} ++{{ $vars := $string | resources.FromString $targetPath }} ++{{ $global := resources.Get "js/global.js" | resources.Minify }} ++ ++ ++ ++``` diff --cc docs/content/en/hugo-pipes/resource-from-template.md index 00000000,00000000..317630b4 new file mode 100755 --- /dev/null +++ b/docs/content/en/hugo-pipes/resource-from-template.md @@@ -1,0 -1,0 +1,38 @@@ ++--- ++title: Creating a resource from template ++linkTitle: Resource from Template ++description: Hugo Pipes allows the creation of a resource from an asset file using Go Template. ++date: 2018-07-14 ++publishdate: 2018-07-14 ++lastmod: 2018-07-14 ++categories: [asset management] ++keywords: [] ++menu: ++ docs: ++ parent: "pipes" ++ weight: 80 ++weight: 80 ++sections_weight: 80 ++draft: false ++--- ++ ++In order to use Hugo Pipes function on an asset file containing Go Template magic the function `resources.ExecuteAsTemplate` must be used. ++ ++The function takes three arguments, the resource object, the resource target path and the template context. ++ ++```go-html-template ++// assets/sass/template.scss ++$backgroundColor: {{ .Param "backgroundColor" }}; ++$textColor: {{ .Param "textColor" }}; ++body{ ++ background-color:$backgroundColor; ++ color: $textColor; ++} ++// [...] ++``` ++ ++ ++```go-html-template ++{{ $sassTemplate := resources.Get "sass/template.scss" }} ++{{ $style := $sassTemplate | resources.ExecuteAsTemplate "main.scss" . | resources.ToCSS }} ++``` diff --cc docs/content/en/hugo-pipes/scss-sass.md index 00000000,00000000..b08d4be0 new file mode 100755 --- /dev/null +++ b/docs/content/en/hugo-pipes/scss-sass.md @@@ -1,0 -1,0 +1,42 @@@ ++--- ++title: SASS / SCSS ++description: Hugo Pipes allows the processing of SASS and SCSS files. ++date: 2018-07-14 ++publishdate: 2018-07-14 ++lastmod: 2018-07-14 ++categories: [asset management] ++keywords: [] ++menu: ++ docs: ++ parent: "pipes" ++ weight: 30 ++weight: 02 ++sections_weight: 02 ++draft: false ++--- ++ ++ ++Any SASS or SCSS file can be transformed into a CSS file using `resources.ToCSS` which takes two arguments, the resource object and a map of options listed below. ++ ++```go-html-template ++{{ $sass := resources.Get "sass/main.scss" }} ++{{ $style := $sass | resources.ToCSS }} ++``` ++ ++### Options ++targetPath [string] ++: If not set, the resource's target path will be the asset file original path with its extension replaced by `.css`. ++ ++outputStyle [string] ++: Default is `nested`. Other available output styles are `expanded`, `compact` and `compressed`. ++ ++precision [int] ++: Precision of floating point math. ++ ++enableSourceMap [bool] ++: When enabled, a source map will be generated. ++ ++```go-html-template ++{{ $options := (dict "targetPath" "style.css" "outputStyle" "compressed" "enableSourceMap" true) }} ++{{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }} ++```