Squashed 'docs/' changes from 9b494a58c..6b00298bb

6b00298bb Remove outdated "related example"
987f1e1cd Fix dead links (#601)
96287a20a Add config option "summaryLength" (#600)
ced7f2085 Adjust Over showcase
e334a6354 Add new showcase: over
10435b502 Add warning about privacy options only work with internal templates (#525)
48c6b0e4d Minor grammatical fix
684670ebc Add quote
0e9fada52 Improvements to taxonomy template examples
e06c4bf73 Add syntax highlighting; consistent 4-space indentation
c1cb3f081 Remove dead links for custom permalinks
3e3aefd04 Fix 0a671bc3751479e74a0a9d2132736c61d239707c
d65888685 fix file name in 'Add Non-content Entries to a Menu' code toggle (#547)
1a0563857 Add Solus install guide (#590)
8a0d65b0d Update Windows Installation instructions (#564)
c4348636a Fix typo
0a671bc37 Add post to menu example
af14497c6 Add notes for `os.Stat` (Hugo 0.47) (#557)
e49f65bb3 Singular to plural
cb5608dbf Update introduction.md
30b060dff Add variable re-definition example (Hugo v0.48+)
21123967e Minor edits
fac3df043 Refresh the Go Templates introduction
4a9600e92 Updating URL to how-to-guide for hosting hugo site on firebase
bfaa7779c add missing word
c2cb5d09b Tweak 'name: weight' to 'name: date' in example (#582)
5ea938ad6 Remove some Scratch
2708dcd57 Release 0.48
e375d0f05 Merge branch 'temp48'
75e36c160 releaser: Prepare repository for 0.49-DEV
a6102f253 releaser: Add release notes to /docs for release of 0.48
41fc35db4 releaser: Bump versions for release of 0.48
64b9ecc74 Spell out the npm command for installing PostCSS
19e900a17 Improved Related Content doc
fe21600e7 Merge commit '844aef544c19e9d8f529b4f8144e089d0982bb34'
844aef544 Squashed 'themes/gohugoioTheme/' changes from 66249819..68ddff44
069828db8 Update git.md
d881d1433 Make default "related" behavior more explicit
60b9160eb Add docs for displaying 404 page on CloudFront
b72ebc760 Add .gitattributes to /resources
000cf85f4 Make the pros/cons styling consistent for summaries; use desc list
ebf1da97a Add note about outputStyle compressed
e3338ee91 Triple backquote syntax fix
361962a7c Add one more Blogger to Hugo tool for Windows (.NET Framework 4.5) (#540)
066606a21 Fix wrong link about Mmark Syntax Document
faee70757 Added exitwp-for-hugo
6b4108051 Add hugo-wrapper to starter-kits
4695dfba2 Added Utterances as Comments Alternatives.
c7ba9e3e1 Correct typo
beb850d9f Release 0.47.1
1cf417c8a Merge branch 'temp471'
0843bc46c releaser: Prepare repository for 0.48-DEV
8ff5c8b70 releaser: Add release notes to /docs for release of 0.47.1
e2353434d releaser: Bump versions for release of 0.47.1
ffb1300af Update development.md
c22234ea5 netlify: Minify output
5b9191c56 Release 0.47
bfd92cf52 releaser: Prepare repository for 0.48-DEV
ac7acf730 releaser: Add release notes to /docs for release of 0.47
b0096099d releaser: Bump versions for release of 0.47
86a7ae459 docs: Regenerate CLI docs
d2c8b72bc Merge commit 'a95896878f4b4a79448b39ce93a4e0d3258b4a43'
84de7ef59 Merge commit '3a44bf182fed5f34621f450114083a6dd7e88a07'

git-subtree-dir: docs
git-subtree-split: 6b00298bb26b700281df28817b6556e7480cdd1e
This commit is contained in:
Bjørn Erik Pedersen 2018-09-14 08:34:58 +02:00
parent a95896878f
commit 13e64d7276
75 changed files with 885 additions and 502 deletions

View file

@ -69,7 +69,7 @@ twitter = "GoHugoIO"
[params]
description = "The worlds fastest framework for building websites"
## Used for views in rendered HTML (i.e., rather than using the .Hugo variable)
release = "0.46"
release = "0.48"
## Setting this to true will add a "noindex" to *EVERY* page on the site
removefromexternalsearch = false
## Gh repo for site footer (include trailing slash)

View file

@ -28,6 +28,7 @@ toc: true
Note that:
* These settings have their defaults setting set to _off_, i.e. how it worked before Hugo `0.41`. You must do your own evaluation of your site and apply the appropriate settings.
* These settings work with the [internal templates](/templates/internal/). Some theme may contain custom templates for embedding services like Google Analytics. In that case these options have no effect.
* We will continue this work and improve this further in future Hugo versions.
## All Privacy Settings

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo"
slug: hugo
url: /commands/hugo/
@ -24,43 +24,44 @@ hugo [flags]
### Options
```
-b, --baseURL string hostname (and path) to the root, e.g. http://spf13.com/
-D, --buildDrafts include content marked as draft
-E, --buildExpired include expired content
-F, --buildFuture include content with publishdate in the future
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
--canonifyURLs (deprecated) if true, all relative URLs will be canonicalized using baseURL
--cleanDestinationDir remove files from destination not found in static directories
--config string config file (default is path/config.yaml|json|toml)
-c, --contentDir string filesystem path to content directory
--debug debug output
-d, --destination string filesystem path to write files to
--disableKinds stringSlice disable different kind of pages (home, RSS etc.)
--enableGitInfo add Git revision, date and author info to the pages
--forceSyncStatic copy all files when static is changed.
--gc enable to run some cleanup tasks (remove unused cache files) after the build
-h, --help help for hugo
--i18n-warnings print missing translations
--ignoreCache ignores the cache directory
-l, --layoutDir string filesystem path to layout directory
--log enable Logging
--logFile string log File path (if set, logging enabled automatically)
--noChmod don't sync permission mode of files
--noTimes don't sync modification time of files
--pluralizeListTitles (deprecated) pluralize titles in lists using inflect (default true)
--preserveTaxonomyNames (deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
--quiet build in quiet mode
--renderToMemory render to memory (only useful for benchmark testing)
-s, --source string filesystem path to read files relative from
--stepAnalysis display memory and timing of different steps of the program
--templateMetrics display metrics about template executions
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
-t, --theme string theme to use (located in /themes/THEMENAME/)
--themesDir string filesystem path to themes directory
--uglyURLs (deprecated) if true, use /filename.html instead of /filename/
-v, --verbose verbose output
--verboseLog verbose logging
-w, --watch watch filesystem for changes and recreate as needed
-b, --baseURL string hostname (and path) to the root, e.g. http://spf13.com/
-D, --buildDrafts include content marked as draft
-E, --buildExpired include expired content
-F, --buildFuture include content with publishdate in the future
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
--canonifyURLs (deprecated) if true, all relative URLs will be canonicalized using baseURL
--cleanDestinationDir remove files from destination not found in static directories
--config string config file (default is path/config.yaml|json|toml)
-c, --contentDir string filesystem path to content directory
--debug debug output
-d, --destination string filesystem path to write files to
--disableKinds strings disable different kind of pages (home, RSS etc.)
--enableGitInfo add Git revision, date and author info to the pages
--forceSyncStatic copy all files when static is changed.
--gc enable to run some cleanup tasks (remove unused cache files) after the build
-h, --help help for hugo
--i18n-warnings print missing translations
--ignoreCache ignores the cache directory
-l, --layoutDir string filesystem path to layout directory
--log enable Logging
--logFile string log File path (if set, logging enabled automatically)
--minify minify any supported output format (HTML, XML etc.)
--noChmod don't sync permission mode of files
--noTimes don't sync modification time of files
--pluralizeListTitles (deprecated) pluralize titles in lists using inflect (default true)
--preserveTaxonomyNames (deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
--quiet build in quiet mode
--renderToMemory render to memory (only useful for benchmark testing)
-s, --source string filesystem path to read files relative from
--stepAnalysis display memory and timing of different steps of the program
--templateMetrics display metrics about template executions
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
-t, --theme string theme to use (located in /themes/THEMENAME/)
--themesDir string filesystem path to themes directory
--uglyURLs (deprecated) if true, use /filename.html instead of /filename/
-v, --verbose verbose output
--verboseLog verbose logging
-w, --watch watch filesystem for changes and recreate as needed
```
### SEE ALSO
@ -77,4 +78,4 @@ hugo [flags]
* [hugo server](/commands/hugo_server/) - A high performance webserver
* [hugo version](/commands/hugo_version/) - Print the version number of Hugo
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo benchmark"
slug: hugo_benchmark
url: /commands/hugo_benchmark/
@ -20,38 +20,38 @@ hugo benchmark [flags]
### Options
```
-b, --baseURL string hostname (and path) to the root, e.g. http://spf13.com/
-D, --buildDrafts include content marked as draft
-E, --buildExpired include expired content
-F, --buildFuture include content with publishdate in the future
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
--canonifyURLs (deprecated) if true, all relative URLs will be canonicalized using baseURL
--cleanDestinationDir remove files from destination not found in static directories
-c, --contentDir string filesystem path to content directory
-n, --count int number of times to build the site (default 13)
--cpuprofile string path/filename for the CPU profile file
-d, --destination string filesystem path to write files to
--disableKinds stringSlice disable different kind of pages (home, RSS etc.)
--enableGitInfo add Git revision, date and author info to the pages
--forceSyncStatic copy all files when static is changed.
--gc enable to run some cleanup tasks (remove unused cache files) after the build
-h, --help help for benchmark
--i18n-warnings print missing translations
--ignoreCache ignores the cache directory
-l, --layoutDir string filesystem path to layout directory
--memprofile string path/filename for the memory profile file
--noChmod don't sync permission mode of files
--noTimes don't sync modification time of files
--pluralizeListTitles (deprecated) pluralize titles in lists using inflect (default true)
--preserveTaxonomyNames (deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
--renderToMemory render to memory (only useful for benchmark testing)
-s, --source string filesystem path to read files relative from
--stepAnalysis display memory and timing of different steps of the program
--templateMetrics display metrics about template executions
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
-t, --theme string theme to use (located in /themes/THEMENAME/)
--themesDir string filesystem path to themes directory
--uglyURLs (deprecated) if true, use /filename.html instead of /filename/
-b, --baseURL string hostname (and path) to the root, e.g. http://spf13.com/
-D, --buildDrafts include content marked as draft
-E, --buildExpired include expired content
-F, --buildFuture include content with publishdate in the future
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
--canonifyURLs (deprecated) if true, all relative URLs will be canonicalized using baseURL
--cleanDestinationDir remove files from destination not found in static directories
-c, --contentDir string filesystem path to content directory
-n, --count int number of times to build the site (default 13)
--cpuprofile string path/filename for the CPU profile file
-d, --destination string filesystem path to write files to
--disableKinds strings disable different kind of pages (home, RSS etc.)
--enableGitInfo add Git revision, date and author info to the pages
--forceSyncStatic copy all files when static is changed.
--gc enable to run some cleanup tasks (remove unused cache files) after the build
-h, --help help for benchmark
--i18n-warnings print missing translations
--ignoreCache ignores the cache directory
-l, --layoutDir string filesystem path to layout directory
--memprofile string path/filename for the memory profile file
--noChmod don't sync permission mode of files
--noTimes don't sync modification time of files
--pluralizeListTitles (deprecated) pluralize titles in lists using inflect (default true)
--preserveTaxonomyNames (deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
--renderToMemory render to memory (only useful for benchmark testing)
-s, --source string filesystem path to read files relative from
--stepAnalysis display memory and timing of different steps of the program
--templateMetrics display metrics about template executions
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
-t, --theme string theme to use (located in /themes/THEMENAME/)
--themesDir string filesystem path to themes directory
--uglyURLs (deprecated) if true, use /filename.html instead of /filename/
```
### Options inherited from parent commands
@ -70,4 +70,4 @@ hugo benchmark [flags]
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo check"
slug: hugo_check
url: /commands/hugo_check/
@ -35,4 +35,4 @@ Contains some verification checks
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo check ulimit](/commands/hugo_check_ulimit/) - Check system ulimit settings
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo check ulimit"
slug: hugo_check_ulimit
url: /commands/hugo_check_ulimit/
@ -39,4 +39,4 @@ hugo check ulimit [flags]
* [hugo check](/commands/hugo_check/) - Contains some verification checks
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo config"
slug: hugo_config
url: /commands/hugo_config/
@ -39,4 +39,4 @@ hugo config [flags]
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo convert"
slug: hugo_convert
url: /commands/hugo_convert/
@ -42,4 +42,4 @@ See convert's subcommands toJSON, toTOML and toYAML for more information.
* [hugo convert toTOML](/commands/hugo_convert_totoml/) - Convert front matter to TOML
* [hugo convert toYAML](/commands/hugo_convert_toyaml/) - Convert front matter to YAML
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo convert toJSON"
slug: hugo_convert_toJSON
url: /commands/hugo_convert_tojson/
@ -42,4 +42,4 @@ hugo convert toJSON [flags]
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo convert toTOML"
slug: hugo_convert_toTOML
url: /commands/hugo_convert_totoml/
@ -42,4 +42,4 @@ hugo convert toTOML [flags]
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo convert toYAML"
slug: hugo_convert_toYAML
url: /commands/hugo_convert_toyaml/
@ -42,4 +42,4 @@ hugo convert toYAML [flags]
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo env"
slug: hugo_env
url: /commands/hugo_env/
@ -38,4 +38,4 @@ hugo env [flags]
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo gen"
slug: hugo_gen
url: /commands/hugo_gen/
@ -38,4 +38,4 @@ A collection of several useful generators.
* [hugo gen doc](/commands/hugo_gen_doc/) - Generate Markdown documentation for the Hugo CLI.
* [hugo gen man](/commands/hugo_gen_man/) - Generate man pages for the Hugo CLI
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo gen autocomplete"
slug: hugo_gen_autocomplete
url: /commands/hugo_gen_autocomplete/
@ -56,4 +56,4 @@ hugo gen autocomplete [flags]
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo gen chromastyles"
slug: hugo_gen_chromastyles
url: /commands/hugo_gen_chromastyles/
@ -43,4 +43,4 @@ hugo gen chromastyles [flags]
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo gen doc"
slug: hugo_gen_doc
url: /commands/hugo_gen_doc/
@ -45,4 +45,4 @@ hugo gen doc [flags]
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo gen man"
slug: hugo_gen_man
url: /commands/hugo_gen_man/
@ -41,4 +41,4 @@ hugo gen man [flags]
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo import"
slug: hugo_import
url: /commands/hugo_import/
@ -37,4 +37,4 @@ Import requires a subcommand, e.g. `hugo import jekyll jekyll_root_path target_p
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo import jekyll](/commands/hugo_import_jekyll/) - hugo import from Jekyll
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo import jekyll"
slug: hugo_import_jekyll
url: /commands/hugo_import_jekyll/
@ -41,4 +41,4 @@ hugo import jekyll [flags]
* [hugo import](/commands/hugo_import/) - Import your site from others.
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo list"
slug: hugo_list
url: /commands/hugo_list/
@ -40,4 +40,4 @@ List requires a subcommand, e.g. `hugo list drafts`.
* [hugo list expired](/commands/hugo_list_expired/) - List all posts already expired
* [hugo list future](/commands/hugo_list_future/) - List all posts dated in the future
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo list drafts"
slug: hugo_list_drafts
url: /commands/hugo_list_drafts/
@ -39,4 +39,4 @@ hugo list drafts [flags]
* [hugo list](/commands/hugo_list/) - Listing out various types of content
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo list expired"
slug: hugo_list_expired
url: /commands/hugo_list_expired/
@ -40,4 +40,4 @@ hugo list expired [flags]
* [hugo list](/commands/hugo_list/) - Listing out various types of content
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo list future"
slug: hugo_list_future
url: /commands/hugo_list_future/
@ -40,4 +40,4 @@ hugo list future [flags]
* [hugo list](/commands/hugo_list/) - Listing out various types of content
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo new"
slug: hugo_new
url: /commands/hugo_new/
@ -48,4 +48,4 @@ hugo new [path] [flags]
* [hugo new site](/commands/hugo_new_site/) - Create a new site (skeleton)
* [hugo new theme](/commands/hugo_new_theme/) - Create a new theme
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo new site"
slug: hugo_new_site
url: /commands/hugo_new_site/
@ -43,4 +43,4 @@ hugo new site [path] [flags]
* [hugo new](/commands/hugo_new/) - Create new content for your site
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo new theme"
slug: hugo_new_theme
url: /commands/hugo_new_theme/
@ -42,4 +42,4 @@ hugo new theme [name] [flags]
* [hugo new](/commands/hugo_new/) - Create new content for your site
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo server"
slug: hugo_server
url: /commands/hugo_server/
@ -30,46 +30,46 @@ hugo server [flags]
### Options
```
--appendPort append port to baseURL (default true)
-b, --baseURL string hostname (and path) to the root, e.g. http://spf13.com/
--bind string interface to which the server will bind (default "127.0.0.1")
-D, --buildDrafts include content marked as draft
-E, --buildExpired include expired content
-F, --buildFuture include content with publishdate in the future
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
--canonifyURLs (deprecated) if true, all relative URLs will be canonicalized using baseURL
--cleanDestinationDir remove files from destination not found in static directories
-c, --contentDir string filesystem path to content directory
-d, --destination string filesystem path to write files to
--disableFastRender enables full re-renders on changes
--disableKinds stringSlice disable different kind of pages (home, RSS etc.)
--disableLiveReload watch without enabling live browser reload on rebuild
--enableGitInfo add Git revision, date and author info to the pages
--forceSyncStatic copy all files when static is changed.
--gc enable to run some cleanup tasks (remove unused cache files) after the build
-h, --help help for server
--i18n-warnings print missing translations
--ignoreCache ignores the cache directory
-l, --layoutDir string filesystem path to layout directory
--liveReloadPort int port for live reloading (i.e. 443 in HTTPS proxy situations) (default -1)
--meminterval string interval to poll memory usage (requires --memstats), valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". (default "100ms")
--memstats string log memory usage to this file
--navigateToChanged navigate to changed content file on live browser reload
--noChmod don't sync permission mode of files
--noHTTPCache prevent HTTP caching
--noTimes don't sync modification time of files
--pluralizeListTitles (deprecated) pluralize titles in lists using inflect (default true)
-p, --port int port on which the server will listen (default 1313)
--preserveTaxonomyNames (deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
--renderToDisk render to Destination path (default is render to memory & serve from there)
-s, --source string filesystem path to read files relative from
--stepAnalysis display memory and timing of different steps of the program
--templateMetrics display metrics about template executions
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
-t, --theme string theme to use (located in /themes/THEMENAME/)
--themesDir string filesystem path to themes directory
--uglyURLs (deprecated) if true, use /filename.html instead of /filename/
-w, --watch watch filesystem for changes and recreate as needed (default true)
--appendPort append port to baseURL (default true)
-b, --baseURL string hostname (and path) to the root, e.g. http://spf13.com/
--bind string interface to which the server will bind (default "127.0.0.1")
-D, --buildDrafts include content marked as draft
-E, --buildExpired include expired content
-F, --buildFuture include content with publishdate in the future
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
--canonifyURLs (deprecated) if true, all relative URLs will be canonicalized using baseURL
--cleanDestinationDir remove files from destination not found in static directories
-c, --contentDir string filesystem path to content directory
-d, --destination string filesystem path to write files to
--disableFastRender enables full re-renders on changes
--disableKinds strings disable different kind of pages (home, RSS etc.)
--disableLiveReload watch without enabling live browser reload on rebuild
--enableGitInfo add Git revision, date and author info to the pages
--forceSyncStatic copy all files when static is changed.
--gc enable to run some cleanup tasks (remove unused cache files) after the build
-h, --help help for server
--i18n-warnings print missing translations
--ignoreCache ignores the cache directory
-l, --layoutDir string filesystem path to layout directory
--liveReloadPort int port for live reloading (i.e. 443 in HTTPS proxy situations) (default -1)
--meminterval string interval to poll memory usage (requires --memstats), valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". (default "100ms")
--memstats string log memory usage to this file
--navigateToChanged navigate to changed content file on live browser reload
--noChmod don't sync permission mode of files
--noHTTPCache prevent HTTP caching
--noTimes don't sync modification time of files
--pluralizeListTitles (deprecated) pluralize titles in lists using inflect (default true)
-p, --port int port on which the server will listen (default 1313)
--preserveTaxonomyNames (deprecated) preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu")
--renderToDisk render to Destination path (default is render to memory & serve from there)
-s, --source string filesystem path to read files relative from
--stepAnalysis display memory and timing of different steps of the program
--templateMetrics display metrics about template executions
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
-t, --theme string theme to use (located in /themes/THEMENAME/)
--themesDir string filesystem path to themes directory
--uglyURLs (deprecated) if true, use /filename.html instead of /filename/
-w, --watch watch filesystem for changes and recreate as needed (default true)
```
### Options inherited from parent commands
@ -88,4 +88,4 @@ hugo server [flags]
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -1,5 +1,5 @@
---
date: 2018-04-16
date: 2018-08-17
title: "hugo version"
slug: hugo_version
url: /commands/hugo_version/
@ -38,4 +38,4 @@ hugo version [flags]
* [hugo](/commands/hugo/) - hugo builds your site
###### Auto generated by spf13/cobra on 16-Apr-2018
###### Auto generated by spf13/cobra on 17-Aug-2018

View file

@ -35,7 +35,7 @@ The above will create a new content file in `content/posts/my-first-post.md` usi
3. `themes/my-theme/archetypes/posts.md`
4. `themes/my-theme/archetypes/default.md`
The last two list items is only applicable if you use a theme and it uses the `my-theme` theme name as an example.
The last two list items are only applicable if you use a theme and it uses the `my-theme` theme name as an example.
## Create a New Archetype Template

View file

@ -59,7 +59,7 @@ There are a few alternatives to commenting on static sites for those who do not
* [Muut](http://muut.com/)
* [isso](http://posativ.org/isso/) (Self-hosted, Python)
* [Tutorial on Implementing Isso with Hugo][issotutorial]
* [Utterances](https://utteranc.es/) (Open source, Github comments widget built on Github issues)
<!-- 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

@ -240,7 +240,7 @@ Markdown syntax is simple enough to learn in a single sitting. The following are
[mdcheatsheet]: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet
[mdguide]: https://www.markdownguide.org/
[mdtutorial]: http://www.markdowntutorial.com/
[Miek Gieben's website]: https://miek.nl/2016/March/05/mmark-syntax-document/
[Miek Gieben's website]: https://miek.nl/2016/march/05/mmark-syntax-document/
[mmark]: https://github.com/miekg/mmark
[mmarkgh]: https://github.com/miekg/mmark/wiki/Syntax
[org]: http://orgmode.org/

View file

@ -80,7 +80,7 @@ You can also add entries to menus that arent attached to a piece of content.
Heres an example snippet pulled from a configuration file:
{{< code-toggle file="config.toml" >}}
{{< code-toggle file="config" >}}
[[menu.main]]
name = "about hugo"
pre = "<i class='fa fa-heart'></i>"
@ -90,6 +90,7 @@ Heres an example snippet pulled from a configuration file:
[[menu.main]]
name = "getting started"
pre = "<i class='fa fa-road'></i>"
post = "<span class='alert'>New!</span>"
weight = -100
url = "/getting-started/"
{{< /code-toggle >}}

View file

@ -14,13 +14,13 @@ aliases: [/content/related/,/related/]
toc: true
---
{{% note %}}
We currently do not index **Page content**. We thought we would release something that will make most people happy before we start solving [Sherlock's last case](https://github.com/joearms/sherlock).
{{% /note %}}
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 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 }}
@ -34,67 +34,62 @@ To list up to 5 related pages is as simple as including something similar to thi
{{ end }}
{{< /code >}}
### Methods
Here is the list of "Related" methods available on a page collection such `.RegularPages`.
#### .Related PAGE
Returns a collection of pages related the given one.
```
{{ $related := .RegularPages.Related . }}
```
#### .RelatedIndices PAGE INDICE1 [INDICE2 ...]
Returns a collection of pages related to a given one restricted to a list of indices.
```
{{ $related := .RegularPages.RelatedIndices . "tags" "date" }}
```
#### .RelatedTo KEYVALS [KEYVALS2 ...]
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`.
```
{{ $related := .RegularPages.RelatedTo ( keyVals "tags" "hugo" "rocks") ( keyVals "date" .Date ) }}
```
{{% note %}}
Read [this blog article](https://regisphilibert.com/blog/2018/04/hugo-optmized-relashionships-with-related-content/) for a great explanation of more advanced usage of this feature.
{{% /note %}}
The full set of methods available on the page lists can be seen in this Go interface:
```go
// A PageGenealogist finds related pages in a page collection. This interface is implemented
// by Pages and PageGroup, which makes it available as `{{ .RegularPages.Related . }}` etc.
type PageGenealogist interface {
// Template example:
// {{ $related := .RegularPages.Related . }}
Related(doc related.Document) (Pages, error)
// Template example:
// {{ $related := .RegularPages.RelatedIndices . "tags" "date" }}
RelatedIndices(doc related.Document, indices ...interface{}) (Pages, error)
// Template example:
// {{ $related := .RegularPages.RelatedTo ( keyVals "tags" "hugo" "rocks") ( keyVals "date" .Date ) }}
RelatedTo(args ...types.KeyValues) (Pages, error)
}
```
## Configure Related Content
Hugo provides a sensible default configuration of Related Content, but you can fine-tune this in your configuration, on the global or language level if needed.
### Default configuration
Without any `related` configuration set on the project, Hugo's Related Content methods will use the following.
```yaml
related:
threshold: 80
includeNewer: false
toLower: false
indices:
- name: keywords
weight: 100
- name: date
weight: 10
```
Custom configuration should be set using the same syntax.
{{% note %}}
If you add a `related` config section, you need to add a complete configuration. It is not possible to just set, say, `includeNewer` and use the rest from the Hugo defaults.
{{% /note %}}
Below is a sample `config.toml` section:
```
[related]
# Only include matches with rank >= threshold. This is a normalized rank between 0 and 100.
threshold = 80
# To get stable "See also" sections we, by default, exclude newer related pages.
includeNewer = false
# Will lower case keywords in both queries and in the indexes.
toLower = false
[[related.indices]]
name = "keywords"
weight = 150
[[related.indices]]
name = "author"
toLower = true
weight = 30
[[related.indices]]
name = "tags"
weight = 100
[[related.indices]]
name = "date"
weight = 10
pattern = "2006"
```
### Top Level Config Options
threshold
@ -135,9 +130,6 @@ He should now be able to add an improved version of that "Related Content" secti
* If you don't use any of the `Related` methods, you will not use the Relate Content feature, and performance will be the same as before.
* Calling `.RegularPages.Related` etc. will create one inverted index, also sometimes named posting list, that will be reused for any lookups in that same page collection. Doing that in addition to, as an example, calling `.Pages.Related` will work as expected, but will create one additional inverted index. This should still be very fast, but worth having in mind, especially for bigger sites.
{{% note %}}
We currently do not index **Page content**. We thought we would release something that will make most people happy before we start solving [Sherlock's last case](https://github.com/joearms/sherlock).
{{% /note %}}

View file

@ -21,32 +21,40 @@ With the use of the `.Summary` [page variable][pagevariables], Hugo generates su
## Summary Splitting Options
* Hugo-defined Summary Split
* User-defined Summary Split
* Automatic Summary Split
* Manual Summary Split
It is natural to accompany the summary with links to the original content, and a common design pattern is to see this link in the form of a "Read More ..." button. See the `.RelPermalink`, `.Permalink`, and `.Truncated` [page variables][pagevariables].
### Hugo-defined: Automatic Summary Splitting
### Automatic Summary Splitting
By default, Hugo automatically takes the first 70 words of your content as its summary and stores it into the `.Summary` page variable for use in your templates. Taking the Hugo-defined approach to summaries may save time, but it has pros and cons:
* **Pros:** Automatic, no additional work on your part.
* **Cons:** All HTML tags are stripped from the summary, and the first 70 words, whether they belong to a heading or to different paragraphs, are all put into one paragraph.
By default, Hugo automatically takes the first 70 words of your content as its summary and stores it into the `.Summary` page variable for use in your templates. You may customize the summary length by setting `summaryLength` in your [site configuration](/getting-started/configuration/).
{{% note %}}
The Hugo-defined summaries are set to use word count calculated by splitting the text by one or more consecutive white space characters. If you are creating content in a `CJK` language and want to use Hugo's automatic summary splitting, set `hasCJKLanguage` to `true` in you [site configuration](/getting-started/configuration/).
You can customize how HTML tags in the summary are loaded using functions such as `plainify` and `safeHTML`.
{{% /note %}}
### User-defined: Manual Summary Splitting
{{% note %}}
The Hugo-defined summaries are set to use word count calculated by splitting the text by one or more consecutive whitespace characters. If you are creating content in a `CJK` language and want to use Hugo's automatic summary splitting, set `hasCJKLanguage` to `true` in your [site configuration](/getting-started/configuration/).
{{% /note %}}
Alternatively, you may add the <code>&#60;&#33;&#45;&#45;more&#45;&#45;&#62;</code> summary divider where you want to split the article. For [org content][org], use `# more` where you want to split the article. Content that comes before the summary divider will be used as that content's summary and stored in the `.Summary` page variable with all HTML formatting intact.
### Manual Summary Splitting
Alternatively, you may add the <code>&#60;&#33;&#45;&#45;more&#45;&#45;&#62;</code> summary divider where you want to split the article.
For [Org mode content][org], use `# more` where you want to split the article.
Content that comes before the summary divider will be used as that content's summary and stored in the `.Summary` page variable with all HTML formatting intact.
{{% note "Summary Divider"%}}
The concept of a *summary divider* is not unique to Hugo. It is also called the "more tag" or "excerpt separator" in other literature.
{{% /note %}}
* Pros: Freedom, precision, and improved rendering. All HTML tags and formatting are preserved.
* Cons: Extra work for content authors, since they need to remember to type <code>&#60;&#33;&#45;&#45;more&#45;&#45;&#62;</code> (or `# more` for [org content][org]) in each content file. This can be automated by adding the summary divider below the front matter of an [archetype](/content-management/archetypes/).
Pros
: Freedom, precision, and improved rendering. All HTML tags and formatting are preserved.
Cons
: Extra work for content authors, since they need to remember to type <code>&#60;&#33;&#45;&#45;more&#45;&#45;&#62;</code> (or `# more` for [org content][org]) in each content file. This can be automated by adding the summary divider below the front matter of an [archetype](/content-management/archetypes/).
{{% warning "Be Precise with the Summary Divider" %}}
Be careful to enter <code>&#60;&#33;&#45;&#45;more&#45;&#45;&#62;</code> exactly; i.e., all lowercase and with no whitespace.

View file

@ -15,7 +15,6 @@ menu:
weight: 10
sections_weight: 10
draft: false
aliases: [/contribute/development/]
toc: true
---

View file

@ -94,15 +94,15 @@ Code blocks are crucial for providing examples of Hugo's new features to end use
### Standard Syntax
Across all pages on the Hugo docs, the typical triple-back-tick markdown syntax is used. If you do not want to take the extra time to implement the following code block shortcodes, please use standard GitHub-flavored markdown. The Hugo docs use a version of [highlight.js](https://highlightjs.org/) with a specific set of languages.
Across many pages on the Hugo docs, the typical triple-back-tick markdown syntax (```` ``` ````) is used. If you do not want to take the extra time to implement the following code block shortcodes, please use standard GitHub-flavored markdown. The Hugo docs use a version of [highlight.js](https://highlightjs.org/) with a specific set of languages.
Your options for languages are `xml`/`html`, `go`/`golang`, `md`/`markdown`/`mkd`, `handlebars`, `apache`, `toml`, `yaml`, `json`, `css`, `asciidoc`, `ruby`, `powershell`/`ps`, `scss`, `sh`/`zsh`/`bash`/`git`, `http`/`https`, and `javascript`/`js`.
```
````
```
<h1>Hello world!</h1>
```
```
````
### Code Block Shortcode
@ -118,14 +118,13 @@ With the `code` shortcodes, *you must include triple back ticks and a language d
```
{{%/* code file="smart/file/name/with/path.html" download="download.html" copy="true" */%}}
```
A whole bunch of coding going on up in here!
```
{{%/* /code */%}}
```
The following are the arguments passed into `code`:
***`file`***
: the only *required* argument. `file` is needed for styling but also plays an important role in helping users create a mental model around Hugo's directory structure. Visually, this will be displayed as text in the top left of the code block.
@ -194,10 +193,8 @@ The `output` shortcode is almost identical to the `code` shortcode but only take
```
{{%/* output file="post/my-first-post/index.html" */%}}
```
<h1>This is my First Hugo Blog Post</h1>
<p>I am excited to be using Hugo.</p>
```
{{%/* /output */%}}
```

View file

@ -31,7 +31,7 @@ aliases: []
This method wil return `nil` when no page could be found, so the above will not print anything if the blog section is not found.
To fund a regular page in the blog section::
To find a regular page in the blog section::
```go-html-template
{{ with .Site.GetPage "/blog/my-post.md" }}{{ .Title }}{{ end }}

View file

@ -22,7 +22,7 @@ aliases: []
needsexamples: false
---
`default` checks whether a given value is set and returns a default value if it is not. *Set* in this context means different things depending on date type:
`default` checks whether a given value is set and returns a default value if it is not. *Set* in this context means different things depending on the data type:
* non-zero for numeric types and times
* non-zero length for strings, arrays, slices, and maps

View file

@ -19,27 +19,7 @@ deprecated: false
aliases: []
---
The elements supported are strings, integers, and floats (only float64).
A useful example of `intersect` functionality is a "related posts" block. `isset` allows us to create a list of links to other posts that have tags that intersect with the tags in the current post.
The following is an example of a "related posts" [partial template][partials] that could be added to a [single page template][single]:
{{< code file="layouts/partials/related-posts.html" download="related-posts.html" >}}
<ul>
{{ $page_link := .Permalink }}
{{ $tags := .Params.tags }}
{{ range .Site.Pages }}
{{ $page := . }}
{{ $has_common_tags := intersect $tags .Params.tags | len | lt 0 }}
{{ if and $has_common_tags (ne $page_link $page.Permalink) }}
<li><a href="{{ $page.Permalink }}">{{ $page.Title }}</a></li>
{{ end }}
{{ end }}
</ul>
{{< /code >}}
This is also very useful to use as `AND` filters when combined with where:
An useful example is to use it as `AND` filters when combined with where:
```
{{ $pages := where .Site.RegularPages "Type" "not in" (slice "page" "about") }}

View file

@ -0,0 +1,33 @@
---
title: os.Stat
description: Gets a file information of a given path.
godocref:
date: 2018-08-07
publishdate: 2018-08-07
lastmod: 2018-08-07
categories: [functions]
menu:
docs:
parent: "functions"
keywords: [files]
signature: ["os.Stat PATH"]
workson: []
hugoversion:
relatedfuncs: [readDir]
deprecated: false
aliases: []
---
If your current project working directory has a single file named `README.txt` (30 bytes):
```
{{ $stat := os.Stat "README.txt" }}
{{ $stat.Name }} → "README.txt"
{{ $stat.Size }} → 30
```
Function [`os.Stat`][Stat] returns [`os.FileInfo`][osfileinfo].
For further information of `os.FileInfo`, see [golang page][osfileinfo].
[Stat]: /functions/os.Stat/
[osfileinfo]: https://golang.org/pkg/os/#FileInfo

View file

@ -343,7 +343,7 @@ You'll need a place to store the Hugo executable, your [content][], and the gene
3. Find the Windows files near the bottom (they're in alphabetical order, so Windows is last) download either the 32-bit or 64-bit file depending on whether you have 32-bit or 64-bit Windows. (If you don't know, [see here](https://esupport.trendmicro.com/en-us/home/pages/technical-support/1038680.aspx).)
4. Move the ZIP file into your `C:\Hugo\bin` folder.
5. Double-click on the ZIP file and extract its contents. Be sure to extract the contents into the same `C:\Hugo\bin` folder Windows will do this by default unless you tell it to extract somewhere else.
6. You should now have three new files: hugo executable (e.g. `hugo_0.18_windows_amd64.exe`), `license.md`, and `readme.md`. (You can delete the ZIP download now.) Rename that hugo executable (`hugo_hugo-version_platform_arch.exe`) to `hugo.exe` for ease of use.
6. You should now have three new files: The hugo executable (`hugo.exe`), `LICENSE`, and `README.md`.
Now you need to add Hugo to your Windows PATH settings:
@ -472,6 +472,14 @@ For the latest version, the Hugo package maintained by [@daftaupe](https://githu
See the [related discussion in the Hugo forums][redhatforum].
### Solus
Solus includes Hugo in its package repository, it may be installed with:
```
sudo eopkg install hugo
```
## OpenBSD
OpenBSD provides a package for Hugo via `pkg_add`:

View file

@ -24,7 +24,7 @@ toc: true
## Assumptions
* You have an account with GitHub, GitLab, or Bitbucket.
* You have completed the [Quick Start][] or have Hugo website you are ready to deploy and share with the world.
* You have completed the [Quick Start][] or have a Hugo website you are ready to deploy and share with the world.
* You do not already have a Netlify account.
## Create a Netlify account
@ -59,7 +59,7 @@ Select the repo you want to use for continuous deployment. If you have a large n
Once selected, you'll be brought to a screen for basic setup. Here you can select the branch you wanted published, your [build command][], and your publish (i.e. deploy) directory. The publish directory should mirror that of what you've set in your [site configuration][config], the default of which is `public`. The following steps assume you are publishing from the `master` branch.
## Configure Hugo Version in Netlify
## Configure Hugo Version in Netlify
You can [set Hugo version](https://www.netlify.com/blog/2017/04/11/netlify-plus-hugo-0.20-and-beyond/) for your environments in `netlify.toml` file or set `HUGO_VERSION` as a build environment variable in the Netlify console.
@ -80,7 +80,7 @@ For testing:
The Netlify configuration file can be a little hard to understand and get right for the different environment, and you may get some inspiration and tips from this site's `netlify.toml`:
{{< code file="netlify.toml" nocode="true" >}}
{{< readfile file="netlify.toml" highlight="toml" >}}
{{< readfile file="netlify.toml" highlight="toml" >}}
{{< /code >}}
## Build and Deploy Site

View file

@ -27,7 +27,9 @@ The resource will be processed using the project's or theme's own `postcss.confi
```
{{% note %}}
Hugo Pipe's PostCSS requires `postcss-cli` javascript package to be installed on the environement along with any PostCSS plugin used.
Hugo Pipe's PostCSS requires the `postcss-cli` JavaScript package to be installed in the environment (`npm install -g postcss-cli`) along with any PostCSS plugin(s) used (e.g., `npm install -g autoprefixer`).
If you are using the Hugo Snap package, PostCSS and plugin(s) need to be installed locally within your Hugo site directory, e.g., `npm install postcss-cli` without the `-g` flag.
{{% /note %}}
### Options

View file

@ -43,3 +43,7 @@ includePaths [string slice]
{{ $options := (dict "targetPath" "style.css" "outputStyle" "compressed" "enableSourceMap" true "includePaths" (slice "node_modules/myscss")) }}
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }}
```
{{% note %}}
Setting `outputStyle` to `compressed` will handle SASS/SCSS files minification better than the more generic [`resources.Minify`]({{< ref "minification">}}).
{{% /note %}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

View file

@ -0,0 +1,79 @@
---
date: 2018-08-17
title: "Output Minification, Live-Reload Fixes and More"
description: "Hugo 0.47: Adds minification of rendered output, but is mostly a massive bug fix release."
categories: ["Releases"]
---
Hugo `0.47` is named **Hugo Reloaded**. It adds minification support for the final rendered output (run `hugo --minify`), but it is mostly a bug fix release. And most notably, it fixes a set of issues with live-reloading/partial rebuilds when running `hugo server`. Working with bundles should now be a more pleasant experience, to pick one example.
This release represents **35 contributions by 6 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 [@satotake](https://github.com/satotake), [@anthonyfok](https://github.com/anthonyfok), and [@coliff](https://github.com/coliff) 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),
which has received **21 contributions by 10 contributors**. A special thanks to [@bep](https://github.com/bep), [@aapeliv](https://github.com/aapeliv), [@regisphilibert](https://github.com/regisphilibert), and [@brentybh](https://github.com/brentybh) for their work on the documentation site.
Hugo now has:
* 27980+ [stars](https://github.com/gohugoio/hugo/stargazers)
* 442+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
* 251+ [themes](http://themes.gohugo.io/)
## Enhancements
### Templates
* Suppress blank lines from opengraph internal template [c09ee78f](https://github.com/gohugoio/hugo/commit/c09ee78fd235599d3fb794110cd75c024d80cfca) [@anthonyfok](https://github.com/anthonyfok)
* Add MIME type to embedded JS [755d1ffe](https://github.com/gohugoio/hugo/commit/755d1ffe7a22d8ad83485240ff78cf25d501602f) [@bep](https://github.com/bep) [#5042](https://github.com/gohugoio/hugo/issues/5042)
* Add `os.Stat` template function [d7112085](https://github.com/gohugoio/hugo/commit/d71120852a8e14d0ea4d24de269fce041ef7b666) [@satotake](https://github.com/satotake)
### Output
* Add support for minification of final output [789ef8c6](https://github.com/gohugoio/hugo/commit/789ef8c639e4621abd36da530bcb5942ac9297da) [@bep](https://github.com/bep) [#1251](https://github.com/gohugoio/hugo/issues/1251)
### Other
* Regenerate CLI docs [4a16b5f4](https://github.com/gohugoio/hugo/commit/4a16b5f4b0adbb31fee611c378de9d5526de2f86) [@bep](https://github.com/bep)
* Include theme name in version mismatch error [e5052f4e](https://github.com/gohugoio/hugo/commit/e5052f4e09b6df590cddf2f8bc2c834fd3af3082) [@bep](https://github.com/bep) [#5044](https://github.com/gohugoio/hugo/issues/5044)
* Make the JS minifier matcher less specific [c81fbf46](https://github.com/gohugoio/hugo/commit/c81fbf4625ae7cc7dd3a7a526331ddfdf5237cc6) [@bep](https://github.com/bep) [#5073](https://github.com/gohugoio/hugo/issues/5073)
* Close file when done [f6ae436c](https://github.com/gohugoio/hugo/commit/f6ae436c5878bafeafa0bb2646a2c9b32c9b4380) [@bep](https://github.com/bep) [#5062](https://github.com/gohugoio/hugo/issues/5062)
* https links to 3rd party sites [c2a67413](https://github.com/gohugoio/hugo/commit/c2a6741394bc609a663522b245d3d75f0ad17da4) [@coliff](https://github.com/coliff)
* Update alias.go [06bd0136](https://github.com/gohugoio/hugo/commit/06bd0136419ebd6727635716c7023494cc5a8257) [@coliff](https://github.com/coliff)
* Remove test debug [fb3cb05c](https://github.com/gohugoio/hugo/commit/fb3cb05cc3dfc50370449f622fb0130ba7e0ced2) [@bep](https://github.com/bep)
* Update dependencies [d07882df](https://github.com/gohugoio/hugo/commit/d07882dfb76a65cce79aaa6f27df71279cd30600) [@bep](https://github.com/bep)
* Update Chroma [7f535671](https://github.com/gohugoio/hugo/commit/7f5356717d14079432365974e1424fc4ff5987c9) [@bep](https://github.com/bep) [#5025](https://github.com/gohugoio/hugo/issues/5025)
* Remove alias of os.Stat [71931b30](https://github.com/gohugoio/hugo/commit/71931b30b1813b146aaa60f5cdab16c0f9ebebdb) [@satotake](https://github.com/satotake)
* Renmae FileStat Stat [d40116e5](https://github.com/gohugoio/hugo/commit/d40116e5f941e4734ed3bed69dce8ffe11fc76b2) [@satotake](https://github.com/satotake)
* Reduce allocation in the benchmark itself [a6b1eb1e](https://github.com/gohugoio/hugo/commit/a6b1eb1e9150aa5c1c86fe7424cc4167d6f59a5a) [@bep](https://github.com/bep)
* Simplify the 0 transformer case [27110133](https://github.com/gohugoio/hugo/commit/27110133ffca05feae2e11a9ff28a9a00f613350) [@bep](https://github.com/bep)
## Fixes
### Templates
* Fix compiling Amber templates that import other templates [37438757](https://github.com/gohugoio/hugo/commit/37438757788d279c839506d54f460b2ab37db164) [@Stebalien](https://github.com/Stebalien)
* Reimplement the ".Params tolower" template transformer [5c538491](https://github.com/gohugoio/hugo/commit/5c5384916e8f954f3ea66148ecceb3732584588e) [@bep](https://github.com/bep) [#5068](https://github.com/gohugoio/hugo/issues/5068)
### Output
* Fix Resource output in multihost setups [78f8475a](https://github.com/gohugoio/hugo/commit/78f8475a054a6277d37f13329afd240b00dc9408) [@bep](https://github.com/bep) [#5058](https://github.com/gohugoio/hugo/issues/5058)
### Core
* Force render of any changed page, even in Fast Render Mode [22475460](https://github.com/gohugoio/hugo/commit/2247546017c00201d2ce1232dd5303295451f1cc) [@bep](https://github.com/bep) [#5083](https://github.com/gohugoio/hugo/issues/5083)
* Add configFile(s) back to the watch list after REMOVE event [abc54080](https://github.com/gohugoio/hugo/commit/abc54080ec8c43e8989c081d934b59f0c9570c0b) [@anthonyfok](https://github.com/anthonyfok) [#4701](https://github.com/gohugoio/hugo/issues/4701)
* Gracefully handle typos in server config when running the server [a655e00d](https://github.com/gohugoio/hugo/commit/a655e00d702dbc20b3961b131b33ab21841b043d) [@bep](https://github.com/bep) [#5081](https://github.com/gohugoio/hugo/issues/5081)
* Fix shortcode output wrapped in p [78c99463](https://github.com/gohugoio/hugo/commit/78c99463fdd45c91af9933528d12d36a86dc6482) [@gllera](https://github.com/gllera) [#1642](https://github.com/gohugoio/hugo/issues/1642)
* Adjust tests for shortcode p-issue [baa62d0a](https://github.com/gohugoio/hugo/commit/baa62d0abbbf24a17d0aa800a4bb217f026c49ad) [@bep](https://github.com/bep) [#1642](https://github.com/gohugoio/hugo/issues/1642)
* Fix image cache-clearing for sub-languages [9d973004](https://github.com/gohugoio/hugo/commit/9d973004f5379cff2adda489566fe40683553c4c) [@bep](https://github.com/bep) [#5084](https://github.com/gohugoio/hugo/issues/5084)
* Fix error when deleting a bundle in server mode [0a88741f](https://github.com/gohugoio/hugo/commit/0a88741fe85f4f7aedc02ed748dfeb8ccc073dbf) [@bep](https://github.com/bep) [#5077](https://github.com/gohugoio/hugo/issues/5077)
* Fix Related when called from shortcode [0dd06bda](https://github.com/gohugoio/hugo/commit/0dd06bdac008aa81ec2e8f29ad8110dac0227011) [@bep](https://github.com/bep) [#5071](https://github.com/gohugoio/hugo/issues/5071)
* Use the interface value when doing Related search [a6f199f7](https://github.com/gohugoio/hugo/commit/a6f199f7a640161333608b4a843d701f7e182829) [@bep](https://github.com/bep) [#5071](https://github.com/gohugoio/hugo/issues/5071)
* Fix GitInfo when multiple content dirs [2182ecfd](https://github.com/gohugoio/hugo/commit/2182ecfd34a24521bf0e3c939627a55327eb1e19) [@bep](https://github.com/bep) [#5054](https://github.com/gohugoio/hugo/issues/5054)
* Add multiple content dirs to GitInfo test site [e85833d8](https://github.com/gohugoio/hugo/commit/e85833d868a902840c5ed1c90713256153b2548b) [@bep](https://github.com/bep) [#5054](https://github.com/gohugoio/hugo/issues/5054)
* Fix "adding a bundle" in server mode [d139a037](https://github.com/gohugoio/hugo/commit/d139a037d98e4b388687eecb7831758412247c58) [@bep](https://github.com/bep) [#5075](https://github.com/gohugoio/hugo/issues/5075)
* Fix typo [c362634b](https://github.com/gohugoio/hugo/commit/c362634b7d8802ea81b0b4341c800a9f78f7cd7c) [@satotake](https://github.com/satotake)

View file

@ -0,0 +1,30 @@
---
date: 2018-08-20
title: "Two Bug Fixes"
description: "Hugo 0.47.1: Two Bug Fixes"
categories: ["Releases"]
images:
- images/blog/hugo-bug-poster.png
---
This is a bug-fix release with two fixes.
# Fixes
* Fix .Site.Params case regression [fdff0d3a](https://github.com/gohugoio/hugo/commit/fdff0d3af4670f7079e539fef4b92af2a866d02d) [@bep](https://github.com/bep) [#5094](https://github.com/gohugoio/hugo/issues/5094)
* Do not strip IE conditional statements [5a0ee2b9](https://github.com/gohugoio/hugo/commit/5a0ee2b934e38d596da0f9742361f81c1221e3d5) [@bep](https://github.com/bep) [#5089](https://github.com/gohugoio/hugo/issues/5089)
## Updates to Linux Snap build
* Remove unused files from Git, Perl, etc. [834617f9](https://github.com/gohugoio/hugo/commit/834617f9f8d870643b2631fe607471c8e2ef2f47) [@anthonyfok](https://github.com/anthonyfok)
* Add nodejs to allow PostCSS to work [ef20ec1f](https://github.com/gohugoio/hugo/commit/ef20ec1fbaa8f5841b3fbe18978d4d8c19d8fc53) [@anthonyfok](https://github.com/anthonyfok)

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

View file

@ -0,0 +1,57 @@
---
date: 2018-08-29
title: "This One Goes to 11!"
description: "With Go 1.11, Hugo finally gets support for variable overwrites in templates!"
categories: ["Releases"]
---
Hugo `0.48` is built with the brand new Go 1.11. On the technical side this means that Hugo now uses [Go Modules](https://github.com/golang/go/wiki/Modules) for the build. The big new functional thing in Go 1.11 for Hugo is added support for [variable overwrites](https://github.com/golang/go/issues/10608). This means that you can now do this and get the expected result:
```go-html-template
{{ $var := "Hugo Page" }}
{{ if .IsHome }}
{{ $var = "Hugo Home" }}
{{ end }}
Var is {{ $var }}
```
The above may look obvious, but has not been possible until now. In Hugo we have had `.Scratch` as a workaround for this, but Go 1.11 will help clean up a lot of templates.
This release represents **23 contributions by 5 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 [@anthonyfok](https://github.com/anthonyfok), [@vsopvsop](https://github.com/vsopvsop), and [@moorereason](https://github.com/moorereason) for their ongoing contributions. And a big thanks to [@digitalcraftsman](https://github.com/digitalcraftsman) for his relentless work on keeping the themes site in pristine condition and to [@kaushalmodi](https://github.com/kaushalmodi) for his great work on the documentation site.
Many have also been busy writing and fixing the documentation in [hugoDocs](https://github.com/gohugoio/hugoDocs),
which has received **15 contributions by 12 contributors**. A special thanks to [@bep](https://github.com/bep), [@kaushalmodi](https://github.com/kaushalmodi), [@regisphilibert](https://github.com/regisphilibert), and [@anthonyfok](https://github.com/anthonyfok) for their work on the documentation site.
Hugo now has:
* 28275+ [stars](https://github.com/gohugoio/hugo/stargazers)
* 441+ [contributors](https://github.com/gohugoio/hugo/graphs/contributors)
* 252+ [themes](http://themes.gohugo.io/)
## Enhancements
* Add a test for template variable overwrite [0c8a4154](https://github.com/gohugoio/hugo/commit/0c8a4154838e32a33d34202fd4fa0187aa502190) [@bep](https://github.com/bep)
* Include language code in REF_NOT_FOUND errors [94d0e79d](https://github.com/gohugoio/hugo/commit/94d0e79d33994b9a9d26a4d020500acdcc71e58c) [@bep](https://github.com/bep) [#5110](https://github.com/gohugoio/hugo/issues/5110)
* Improve minifier MIME type resolution [ebb56e8b](https://github.com/gohugoio/hugo/commit/ebb56e8bdbfaf4f955326017e40b2805850871e9) [@bep](https://github.com/bep) [#5093](https://github.com/gohugoio/hugo/issues/5093)
* Update to Go 1.11 [6b9934a2](https://github.com/gohugoio/hugo/commit/6b9934a26615ea614b1774770532cae9762a58d3) [@bep](https://github.com/bep) [#5115](https://github.com/gohugoio/hugo/issues/5115)
* Set GO111MODULE=on for mage install [c7f05779](https://github.com/gohugoio/hugo/commit/c7f057797ca7bfc781d5a2bbf181bb52360f160f) [@bep](https://github.com/bep) [#5115](https://github.com/gohugoio/hugo/issues/5115)
* Add instruction to install PostCSS when missing [08d14113](https://github.com/gohugoio/hugo/commit/08d14113b60ff70ffe922e8098e289b099a70e0f) [@anthonyfok](https://github.com/anthonyfok) [#5111](https://github.com/gohugoio/hugo/issues/5111)
* Update snapcraft build config to Go 1.11 [94d6d678](https://github.com/gohugoio/hugo/commit/94d6d6780fac78e9ed5ed58ecdb9821ad8f0f27c) [@bep](https://github.com/bep) [#5115](https://github.com/gohugoio/hugo/issues/5115)
* Use Go 1.11 modules with Mage [45c9c45d](https://github.com/gohugoio/hugo/commit/45c9c45d1d0d99443fa6bb524a1265fa9ba95e0e) [@bep](https://github.com/bep) [#5115](https://github.com/gohugoio/hugo/issues/5115)
* Add go.mod [fce32c07](https://github.com/gohugoio/hugo/commit/fce32c07fb80e9929bc2660cf1e681e93009d24b) [@bep](https://github.com/bep) [#5115](https://github.com/gohugoio/hugo/issues/5115)
* Update Travis to Go 1.11 and Go 1.10.4 [d32ff16f](https://github.com/gohugoio/hugo/commit/d32ff16fd61f55874e81d73759afa099b8bdcb57) [@bep](https://github.com/bep) [#5115](https://github.com/gohugoio/hugo/issues/5115)
* Skip installing postcss due to failure on build server [66f688f7](https://github.com/gohugoio/hugo/commit/66f688f7120560ca787c1a23e3e7fbc3aa617956) [@anthonyfok](https://github.com/anthonyfok)
## Fixes
* Keep end tags [e6eda2a3](https://github.com/gohugoio/hugo/commit/e6eda2a370aa1184e0afaf12e95dbd6f8b63ace5) [@vsopvsop](https://github.com/vsopvsop)
* Fix permissions when creating new folders [f4675fa0](https://github.com/gohugoio/hugo/commit/f4675fa0f0fae2358adfaea49e8da824ee094495) [@bep](https://github.com/bep) [#5128](https://github.com/gohugoio/hugo/issues/5128)
* Fix handling of taxonomy terms containing slashes [fff13253](https://github.com/gohugoio/hugo/commit/fff132537b4094221f4f099e2251f3cda613060f) [@moorereason](https://github.com/moorereason) [#4090](https://github.com/gohugoio/hugo/issues/4090)
* Fix build on armv7 [8999de19](https://github.com/gohugoio/hugo/commit/8999de193c18b7aa07b44e5b7d9f443a8572e117) [@caarlos0](https://github.com/caarlos0) [#5101](https://github.com/gohugoio/hugo/issues/5101)

View file

@ -0,0 +1,5 @@
The site is built by:
* [Lauren Waller](https://twitter.com/waller_texas)
* [Wayne Ashley Berry](https://twitter.com/waynethebrain)

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

View file

@ -0,0 +1,17 @@
---
title: Over
date: 2018-09-12
description: "Showcase: \"People from all disciplines contribute to our website; Hugos single static binary makes that possible.\""
siteURL: https://madewithover.com/
---
At Over we're into creativity, and technology should not get in the way. We want it to be easy for everyone to create, and Hugo does the same for us. That's one of the reasons many of us are fond of using it.
People from all disciplines contribute to our website, be it legal documentation, layout and design, recruiting, marketing and of course… engineering. Hugo allows us to do this with as little friction as possible. A lot of this comes down to Hugo being distributed as a single static binary. Copy, paste, run... and you're up and running!
We use [Wercker](https://www.wercker.com/) for continuous integration and deployments, [GitHub](https://github.com/) for contributing to and writing markdown and [Firebase](https://firebase.google.com/docs/hosting/) for hosting.
This infrastructure takes all the pressure off our engineers, anyone can contribute to our website. Anyone else can review the changes, and of course anyone with permission can deploy those approved changes as well!
We're busy working on a few new features for our website, and Hugo continues to deliver above and beyond. We're so happy with the choice we made to use Hugo and to us it has become the de-facto static site generator.

View file

@ -50,6 +50,7 @@ Your 404.html file can be set to load automatically when a visitor enters a mist
* Apache. You can specify `ErrorDocument 404 /404.html` in an `.htaccess` file in the root of your site.
* Nginx. You might specify `error_page 404 /404.html;` in your `nginx.conf` file.
* Amazon AWS S3. When setting a bucket up for static web serving, you can specify the error file from within the S3 GUI.
* 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)
{{% note %}}

View file

@ -104,12 +104,12 @@ And here is the result as [called directly in the Hugo docs][] and rendered for
{{< readfile file="/content/en/readfiles/testing.txt" markdown="true">}}
[called directly in the Hugo docs]: https://github.com/gohugoio/hugo/blob/master/docs/content/templates/files.md
[called directly in the Hugo docs]: https://github.com/gohugoio/hugoDocs/blob/master/content/en/templates/files.md
[dirindex]: https://github.com/gohugoio/hugo/blob/master/docs/layouts/shortcodes/directoryindex.html
[osfileinfo]: https://golang.org/pkg/os/#FileInfo
[readDir]: /functions/readdir/
[readFile]: /functions/readfile/
[sc]: /content-management/shortcodes/
[sct]: /templates/shortcode-templates/
[readfilesource]: https://github.com/gohugoio/hugo/blob/master/
[testfile]: https://github.com/gohugoio/hugo/blob/master/docs/testfile
[readfilesource]: https://github.com/gohugoio/hugoDocs/blob/master/layouts/shortcodes/readfile.html
[testfile]: https://github.com/gohugoio/hugoDocs/blob/master/content/en/readfiles/testing.txt

View file

@ -20,26 +20,39 @@ toc: true
---
{{% note %}}
The following is only a primer on Go templates. For an in-depth look into Go templates, check the official [Go docs](http://golang.org/pkg/html/template/).
The following is only a primer on Go Templates. For an in-depth look into Go Templates, check the official [Go docs](http://golang.org/pkg/html/template/).
{{% /note %}}
Go templates provide an extremely simple template language that adheres to the belief that only the most basic of logic belongs in the template or view layer.
Go Templates provide an extremely simple template language that adheres to the belief that only the most basic of logic belongs in the template or view layer.
{{< youtube gnJbPO-GFIw >}}
## Basic Syntax
Go templates are HTML files with the addition of [variables][variables] and [functions][functions]. Go template variables and functions are accessible within `{{ }}`.
Go Templates are HTML files with the addition of [variables][variables] and [functions][functions]. Go Template variables and functions are accessible within `{{ }}`.
### Access a Predefined Variable
```
{{ foo }}
A _predefined variable_ could be a variable already existing in the
current scope (like the `.Title` example in the [Variables]({{< relref
"#variables" >}}) section below) or a custom variable (like the
`$address` example in that same section).
```go-html-template
{{ .Title }}
{{ $address }}
```
Parameters for functions are separated using spaces. The following example calls the `add` function with inputs of `1` and `2`:
Parameters for functions are separated using spaces. The general syntax is:
```
{{ FUNCTION ARG1 ARG2 .. }}
```
The following example calls the `add` function with inputs of `1` and `2`:
```go-html-template
{{ add 1 2 }}
```
@ -47,64 +60,88 @@ Parameters for functions are separated using spaces. The following example calls
Accessing the Page Parameter `bar` defined in a piece of content's [front matter][].
```
```go-html-template
{{ .Params.bar }}
```
#### Parentheses Can be Used to Group Items Together
```
```go-html-template
{{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }}
```
## Variables
## Variables {#variables}
Each Go template gets a data object. In Hugo, each template is passed a `Page`. See [variables][] for more information.
Each Go Template gets a data object. In Hugo, each template is passed
a `Page`. In the below example, `.Title` is one of the elements
accessible in that [`Page` variable][pagevars].
This is how you access a `Page` variable from a template:
With the `Page` being the default scope of a template, the `Title`
element in current scope (`.` -- "the **dot**") is accessible simply
by the dot-prefix (`.Title`):
```
```go-html-template
<title>{{ .Title }}</title>
```
Values can also be stored in custom variables and referenced later:
```
{{ $address := "123 Main St."}}
{{% note %}}
The custom variables need to be prefixed with `$`.
{{% /note %}}
```go-html-template
{{ $address := "123 Main St." }}
{{ $address }}
```
{{% warning %}}
Variables defined inside `if` conditionals and similar are not visible on the outside. See [https://github.com/golang/go/issues/10608](https://github.com/golang/go/issues/10608).
For Hugo v0.47 and older versions, variables defined inside `if`
conditionals and similar are not visible on the outside.
See [https://github.com/golang/go/issues/10608](https://github.com/golang/go/issues/10608).
Hugo has created a workaround for this issue in [Scratch](/functions/scratch).
{{% /warning %}}
For **Hugo v0.48** and newer, variables can be re-defined using the
new `=` operator (new in Go 1.11).
Below example will work only in these newer Hugo versions. The example
prints "Var is Hugo Home" on the home page, and "Var is Hugo Page" on
all other pages:
```go-html-template
{{ $var := "Hugo Page" }}
{{ if .IsHome }}
{{ $var = "Hugo Home" }}
{{ end }}
Var is {{ $var }}
```
## Functions
Go templates only ship with a few basic functions but also provide a mechanism for applications to extend the original set.
Go Templates only ship with a few basic functions but also provide a mechanism for applications to extend the original set.
[Hugo template functions][functions] provide additional functionality specific to building websites. Functions are called by using their name followed by the required parameters separated by spaces. Template functions cannot be added without recompiling Hugo.
### Example 1: Adding Numbers
```
```go-html-template
{{ add 1 2 }}
=> 3
<!-- prints 3 -->
```
### Example 2: Comparing Numbers
```
```go-html-template
{{ lt 1 2 }}
=> true (i.e., since 1 is less than 2)
<!-- prints true (i.e., since 1 is less than 2) -->
```
Note that both examples make use of Go template's [math functions][].
Note that both examples make use of Go Template's [math functions][].
{{% note "Additional Boolean Operators" %}}
There are more boolean operators than those listed in the Hugo docs in the [Go template documentation](http://golang.org/pkg/text/template/#hdr-Functions).
There are more boolean operators than those listed in the Hugo docs in the [Go Template documentation](http://golang.org/pkg/text/template/#hdr-Functions).
{{% /note %}}
## Includes
@ -124,116 +161,174 @@ within Hugo.
The [`partial`][partials] function is used to include *partial* templates using
the syntax `{{ partial "<PATH>/<PARTIAL>.<EXTENSION>" . }}`.
Example:
Example of including a `layouts/partials/header.html` partial:
```
```go-html-template
{{ partial "header.html" . }}
```
### Template
The `template` function was used to include *partial* templates in much older
Hugo versions. Now it is still useful for calling [*internal*
templates][internal_templates]:
The `template` function was used to include *partial* templates
in much older Hugo versions. Now it useful only for calling
[*internal* templates][internal_templates]. The syntax is `{{ template
"_internal/<TEMPLATE>.<EXTENSION>" . }}`.
```
{{% note %}}
The available **internal** templates can be found
[here](https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates).
{{% /note %}}
Example of including the internal `opengraph.html` template:
```go-html-template
{{ template "_internal/opengraph.html" . }}
```
## Logic
Go templates provide the most basic iteration and conditional logic.
Go Templates provide the most basic iteration and conditional logic.
### Iteration
Just like in Go, the Go templates make heavy use of `range` to iterate over
a map, array, or slice. The following are different examples of how to use
range.
The Go Templates make heavy use of `range` to iterate over a _map_,
_array_, or _slice_. The following are different examples of how to
use `range`.
#### Example 1: Using Context
#### Example 1: Using Context (`.`)
```
{{ range array }}
{{ . }}
```go-html-template
{{ range $array }}
{{ . }} <!-- The . represents an element in $array -->
{{ end }}
```
#### Example 2: Declaring Value => Variable name
#### Example 2: Declaring a variable name for an array element's value
```
{{range $element := array}}
{{ $element }}
```go-html-template
{{ range $elem_val := $array }}
{{ $elem_val }}
{{ end }}
```
#### Example 3: Declaring Key-Value Variable Name
#### Example 3: Declaring variable names for an array element's index _and_ value
For an array or slice, the first declared variable will map to each
element's index.
```go-html-template
{{ range $elem_index, $elem_val := $array }}
{{ $elem_index }} -- {{ $elem_val }}
{{ end }}
```
{{range $index, $element := array}}
{{ $index }}
{{ $element }}
#### Example 4: Declaring variable names for a map element's key _and_ value
For a map, the first declared variable will map to each map element's
key.
```go-html-template
{{ range $elem_key, $elem_val := $map }}
{{ $elem_key }} -- {{ $elem_val }}
{{ end }}
```
### Conditionals
`if`, `else`, `with`, `or`, and `and` provide the framework for handling conditional logic in Go Templates. Like `range`, each statement is closed with an `{{end}}`.
`if`, `else`, `with`, `or`, and `and` provide the framework for handling conditional logic in Go Templates. Like `range`, each statement is closed with an `{{ end }}`.
Go Templates treat the following values as false:
Go Templates treat the following values as **false**:
* false
* 0
* any zero-length array, slice, map, or string
- `false` (boolean)
- 0 (integer)
- any zero-length array, slice, map, or string
#### Example 1: `if`
#### Example 1: `with`
```
{{ if isset .Params "title" }}<h4>{{ index .Params "title" }}</h4>{{ end }}
```
It is common to write "if something exists, do this" kind of
statements using `with`.
#### Example 2: `if``else`
{{% note %}}
`with` rebinds the context `.` within its scope (just like in `range`).
{{% /note %}}
```
{{ if isset .Params "alt" }}
{{ index .Params "alt" }}
{{else}}
{{ index .Params "caption" }}
It skips the block if the variable is absent, or if it evaluates to
"false" as explained above.
```go-html-template
{{ with .Params.title }}
<h4>{{ . }}</h4>
{{ end }}
```
#### Example 3: `and` & `or`
#### Example 2: `with` .. `else`
```
{{ if and (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}}
```
Below snippet uses the "description" front-matter parameter's value if
set, else uses the default `.Summary` [Page variable][pagevars]:
#### Example 4: `with`
An alternative way of writing "`if`" and then referencing the same value
is to use "`with`" instead. `with` rebinds the context `.` within its scope
and skips the block if the variable is absent.
The first example above could be simplified as:
```
{{ with .Params.title }}<h4>{{ . }}</h4>{{ end }}
```
#### Example 5: `if``else if`
```
{{ if isset .Params "alt" }}
{{ index .Params "alt" }}
{{ else if isset .Params "caption" }}
{{ index .Params "caption" }}
```go-html-template
{{ with .Param "description" }}
{{ . }}
{{ else }}
{{ .Summary }}
{{ end }}
```
See the [`.Param` function][param].
#### Example 3: `if`
An alternative (and a more verbose) way of writing `with` is using
`if`. Here, the `.` does not get rebinded.
Below example is "Example 1" rewritten using `if`:
```go-html-template
{{ if isset .Params "title" }}
<h4>{{ index .Params "title" }}</h4>
{{ end }}
```
#### Example 4: `if` .. `else`
Below example is "Example 2" rewritten using `if` .. `else`, and using
[`isset` function][isset] + `.Params` variable (different from the
[`.Param` **function**][param]) instead:
```go-html-template
{{ if (isset .Params "description") }}
{{ index .Params "description" }}
{{ else }}
{{ .Summary }}
{{ end }}
```
#### Example 5: `if` .. `else if` .. `else`
Unlike `with`, `if` can contain `else if` clauses too.
```go-html-template
{{ if (isset .Params "description") }}
{{ index .Params "description" }}
{{ else if (isset .Params "summary") }}
{{ index .Params "summary" }}
{{ else }}
{{ .Summary }}
{{ end }}
```
#### Example 6: `and` & `or`
```go-html-template
{{ if (and (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")) }}
```
## Pipes
One of the most powerful components of Go templates is the ability to stack actions one after another. This is done by using pipes. Borrowed from Unix pipes, the concept is simple: each pipeline's output becomes the input of the following pipe.
One of the most powerful components of Go Templates is the ability to stack actions one after another. This is done by using pipes. Borrowed from Unix pipes, the concept is simple: each pipeline's output becomes the input of the following pipe.
Because of the very simple syntax of Go templates, the pipe is essential to being able to chain together function calls. One limitation of the pipes is that they can only work with a single value and that value becomes the last parameter of the next pipeline.
Because of the very simple syntax of Go Templates, the pipe is essential to being able to chain together function calls. One limitation of the pipes is that they can only work with a single value and that value becomes the last parameter of the next pipeline.
A few simple examples should help convey how to use the pipe.
@ -241,26 +336,26 @@ A few simple examples should help convey how to use the pipe.
The following two examples are functionally the same:
```
```go-html-template
{{ shuffle (seq 1 5) }}
```
```
```go-html-template
{{ (seq 1 5) | shuffle }}
```
### Example 2: `index`
The following accesses the page parameter called "disqus_url" and escapes the HTML. This example also uses the [`index` function][index], which is built into Go templates:
The following accesses the page parameter called "disqus_url" and escapes the HTML. This example also uses the [`index` function][index], which is built into Go Templates:
```
```go-html-template
{{ index .Params "disqus_url" | html }}
```
### Example 3: `or` with `isset`
```
```go-html-template
{{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr") }}
Stuff Here
{{ end }}
@ -268,7 +363,7 @@ Stuff Here
Could be rewritten as
```
```go-html-template
{{ if isset .Params "caption" | or isset .Params "title" | or isset .Params "attr" }}
Stuff Here
{{ end }}
@ -278,7 +373,7 @@ Stuff Here
By default, Go Templates remove HTML comments from output. This has the unfortunate side effect of removing Internet Explorer conditional comments. As a workaround, use something like this:
```
```go-html-template
{{ "<!--[if lt IE 9]>" | safeHTML }}
<script src="html5shiv.js"></script>
{{ "<![endif]-->" | safeHTML }}
@ -286,13 +381,24 @@ By default, Go Templates remove HTML comments from output. This has the unfortun
Alternatively, you can use the backtick (`` ` ``) to quote the IE conditional comments, avoiding the tedious task of escaping every double quotes (`"`) inside, as demonstrated in the [examples](http://golang.org/pkg/text/template/#hdr-Examples) in the Go text/template documentation:
```
```go-html-template
{{ `<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7"><![endif]-->` | safeHTML }}
```
## Context (aka "the dot")
## Context (aka "the dot") {#the-dot}
The most easily overlooked concept to understand about Go templates is that `{{ . }}` always refers to the current context. In the top level of your template, this will be the data set made available to it. Inside of an iteration, however, it will have the value of the current item in the loop; i.e., `{{ . }}` will no longer refer to the data available to the entire page. If you need to access page-level data (e.g., page params set in front matter) from within the loop, you will likely want to do one of the following:
The most easily overlooked concept to understand about Go Templates is
that `{{ . }}` always refers to the **current context**.
- In the top level of your template, this will be the data set made
available to it.
- Inside of an iteration, however, it will have the value of the
current item in the loop; i.e., `{{ . }}` will no longer refer to
the data available to the entire page.
If you need to access page-level data (e.g., page params set in front
matter) from within the loop, you will likely want to do one of the
following:
### 1. Define a Variable Independent of Context
@ -337,9 +443,9 @@ The built-in magic of `$` would cease to work if someone were to mischievously r
Go 1.6 includes the ability to trim the whitespace from either side of a Go tag by including a hyphen (`-`) and space immediately beside the corresponding `{{` or `}}` delimiter.
For instance, the following Go template will include the newlines and horizontal tab in its HTML output:
For instance, the following Go Template will include the newlines and horizontal tab in its HTML output:
```
```go-html-template
<div>
{{ .Title }}
</div>
@ -347,7 +453,7 @@ For instance, the following Go template will include the newlines and horizontal
Which will output:
```
```html
<div>
Hello, World!
</div>
@ -355,7 +461,7 @@ Which will output:
Leveraging the `-` in the following example will remove the extra white space surrounding the `.Title` variable and remove the newline:
```
```go-html-template
<div>
{{- .Title -}}
</div>
@ -363,11 +469,11 @@ Leveraging the `-` in the following example will remove the extra white space su
Which then outputs:
```
```html
<div>Hello, World!</div>
```
Go considers the following characters whitespace:
Go considers the following characters _whitespace_:
* <kbd>space</kbd>
* horizontal <kbd>tab</kbd>
@ -378,13 +484,13 @@ Go considers the following characters whitespace:
In order to keep your templates organized and share information throughout your team, you may want to add comments to your templates. There are two ways to do that with Hugo.
### Go templates comments
### Go Templates comments
Go templates support `{{/*` and `*/}}` to open and close a comment block. Nothing within that block will be rendered.
Go Templates support `{{/*` and `*/}}` to open and close a comment block. Nothing within that block will be rendered.
For example:
```
```go-html-template
Bonsoir, {{/* {{ add 0 + 2 }} */}}Eliott.
```
@ -394,24 +500,24 @@ Will render `Bonsoir, Eliott.`, and not care about the syntax error (`add 0 + 2`
If you need to produce HTML comments from your templates, take a look at the [Internet Explorer conditional comments](#ie-conditional-comments) example. If you need variables to construct such HTML comments, just pipe `printf` to `safeHTML`. For example:
```
```go-html-template
{{ printf "<!-- Our website is named: %s -->" .Site.Title | safeHTML }}
```
#### HTML comments containing Go templates
#### HTML comments containing Go Templates
HTML comments are by default stripped, but their content is still evaluated. That means that although the HTML comment will never render any content to the final HTML pages, code contained within the comment may fail the build process.
{{% note %}}
Do **not** try to comment out Go template code using HTML comments.
Do **not** try to comment out Go Template code using HTML comments.
{{% /note %}}
```
```go-html-template
<!-- {{ $author := "Emma Goldman" }} was a great woman. -->
{{ $author }}
```
The templating engine will strip the content within the HTML comment, but will first evaluate any Go template code if present within. So the above example will render `Emma Goldman`, as the `$author` variable got evaluated in the HTML comment. But the build would have failed if that code in the HTML comment had an error.
The templating engine will strip the content within the HTML comment, but will first evaluate any Go Template code if present within. So the above example will render `Emma Goldman`, as the `$author` variable got evaluated in the HTML comment. But the build would have failed if that code in the HTML comment had an error.
## Hugo Parameters
@ -423,7 +529,7 @@ You can provide variables to be used by templates in individual content's [front
An example of this is used in the Hugo docs. Most of the pages benefit from having the table of contents provided, but sometimes the table of contents doesn't make a lot of sense. We've defined a `notoc` variable in our front matter that will prevent a table of contents from rendering when specifically set to `true`.
Here is the example front matter:
Here is the example front matter (YAML):
```
---
@ -447,7 +553,7 @@ Here is an example of corresponding code that could be used inside a `toc.html`
{{.TableOfContents}}
</aside>
<a href="#" id="toc-toggle"></a>
{{end}}
{{ end }}
{{< /code >}}
We want the *default* behavior to be for pages to include a TOC unless otherwise specified. This template checks to make sure that the `notoc:` field in this page's front matter is not `true`.
@ -467,31 +573,33 @@ params:
Within a footer layout, you might then declare a `<footer>` that is only rendered if the `copyrighthtml` parameter is provided. If it *is* provided, you will then need to declare the string is safe to use via the [`safeHTML` function][safehtml] so that the HTML entity is not escaped again. This would let you easily update just your top-level config file each January 1st, instead of hunting through your templates.
```
{{if .Site.Params.copyrighthtml}}<footer>
<div class="text-center">{{.Site.Params.CopyrightHTML | safeHTML}}</div>
</footer>{{end}}
```go-html-template
{{ if .Site.Params.copyrighthtml }}
<footer>
<div class="text-center">{{.Site.Params.CopyrightHTML | safeHTML}}</div>
</footer>
{{ end }}
```
An alternative way of writing the "`if`" and then referencing the same value is to use [`with`][with] instead. `with` rebinds the context (`.`) within its scope and skips the block if the variable is absent:
{{< code file="layouts/partials/twitter.html" >}}
{{with .Site.Params.twitteruser}}
<div>
<a href="https://twitter.com/{{.}}" rel="author">
<img src="/images/twitter.png" width="48" height="48" title="Twitter: {{.}}" alt="Twitter"></a>
</div>
{{end}}
{{ with .Site.Params.twitteruser }}
<div>
<a href="https://twitter.com/{{.}}" rel="author">
<img src="/images/twitter.png" width="48" height="48" title="Twitter: {{.}}" alt="Twitter"></a>
</div>
{{ end }}
{{< /code >}}
Finally, you can pull "magic constants" out of your layouts as well. The following uses the [`first`][first] function, as well as the [`.RelPermalink`][relpermalink] page variable and the [`.Site.Pages`][sitevars] site variable.
```
```go-html-template
<nav>
<h1>Recent Posts</h1>
<ul>
{{- range first .Site.Params.SidebarRecentLimit .Site.Pages -}}
<li><a href="{{.RelPermalink}}">{{.Title}}</a></li>
<li><a href="{{.RelPermalink}}">{{.Title}}</a></li>
{{- end -}}
</ul>
</nav>
@ -505,16 +613,16 @@ Go allows you to do more than what's shown here. Using Hugo's [`where` function]
<h4>Upcoming Events</h4>
<ul class="upcoming-events">
{{ range where .Pages.ByDate "Section" "events" }}
{{ if ge .Date.Unix .Now.Unix }}
<li>
<!-- add span for event type -->
<span>{{ .Type | title }} —</span>
{{ .Title }} on
<!-- add span for event date -->
<span>{{ .Date.Format "2 January at 3:04pm" }}</span>
at {{ .Params.place }}
</li>
{{ end }}
{{ if ge .Date.Unix now.Unix }}
<li>
<!-- add span for event type -->
<span>{{ .Type | title }} —</span>
{{ .Title }} on
<!-- add span for event date -->
<span>{{ .Date.Format "2 January at 3:04pm" }}</span>
at {{ .Params.place }}
</li>
{{ end }}
{{ end }}
</ul>
{{< /code >}}
@ -535,7 +643,10 @@ Go allows you to do more than what's shown here. Using Hugo's [`where` function]
[relpermalink]: /variables/page/
[safehtml]: /functions/safehtml/
[sitevars]: /variables/site/
[pagevars]: /variables/page/
[variables]: /variables/ "See the full extent of page-, site-, and other variables that Hugo make available to you in your templates."
[where]: /functions/where/
[with]: /functions/with/
[godocsindex]: http://golang.org/pkg/text/template/ "Godocs page for index function"
[param]: /functions/param/
[isset]: /functions/isset/

View file

@ -66,7 +66,7 @@ A Taxonomy is a `map[string]WeightedPages`.
Since Maps are unordered, an OrderedTaxonomy is a special structure that has a defined order.
```
```go
[]struct {
Name string
WeightedPages WeightedPages
@ -91,7 +91,7 @@ Each element of the slice has:
WeightedPages is simply a slice of WeightedPage.
```
```go
type WeightedPages []WeightedPage
```
@ -103,16 +103,16 @@ type WeightedPages []WeightedPage
## Displaying custom metadata in Taxonomy Terms Templates
If you need to display custom metadata for each taxonomy term, you will need to create a page for that term at `/content/<TAXONOMY>/<TERM>/_index.md` and add your metadata in it's front matter, [as explained in the taxonomies documentation](/content-management/taxonomies/#add-custom-meta-data-to-a-taxonomy-term). Based on the Actors taxonomy example shown there, within your taxonomy terms template, you may access your custom fields by iterating through the variable `.Pages` as such:
If you need to display custom metadata for each taxonomy term, you will need to create a page for that term at `/content/<TAXONOMY>/<TERM>/_index.md` and add your metadata in its front matter, [as explained in the taxonomies documentation](/content-management/taxonomies/#add-custom-meta-data-to-a-taxonomy-term). Based on the Actors taxonomy example shown there, within your taxonomy terms template, you may access your custom fields by iterating through the variable `.Pages` as such:
```
```go-html-template
<ul>
{{ range .Pages }}
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a>
{{ .Params.wikipedia }}
</li>
{{ end }}
{{ range .Pages }}
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a>
{{ .Params.wikipedia }}
</li>
{{ end }}
</ul>
```
@ -124,34 +124,46 @@ Taxonomies can be ordered by either alphabetical key or by the number of content
### Order Alphabetically Example
```
```go-html-template
<ul>
{{ $data := .Data }}
{{ range $key, $value := .Data.Terms.Alphabetical }}
<li><a href="{{ $.Site.LanguagePrefix }}/{{ $data.Plural }}/{{ $value.Name | urlize }}"> {{ $value.Name }} </a> {{ $value.Count }} </li>
{{ end }}
{{ $type := .Type }}
{{ range $key, $value := .Data.Terms.Alphabetical }}
{{ $name := .Name }}
{{ $count := .Count }}
{{ with $.Site.GetPage (printf "/%s/%s" $type $name) }}
<li><a href="{{ .Permalink }}">{{ $name }}</a> {{ $count }}</li>
{{ end }}
{{ end }}
</ul>
```
### Order by Popularity Example
```
```go-html-template
<ul>
{{ $data := .Data }}
{{ range $key, $value := .Data.Terms.ByCount }}
<li><a href="{{ $.Site.LanguagePrefix }}/{{ $data.Plural }}/{{ $value.Name | urlize }}"> {{ $value.Name }} </a> {{ $value.Count }} </li>
{{ end }}
{{ $type := .Type }}
{{ range $key, $value := .Data.Terms.ByCount }}
{{ $name := .Name }}
{{ $count := .Count }}
{{ with $.Site.GetPage (printf "/%s/%s" $type $name) }}
<li><a href="{{ .Permalink }}">{{ $name }}</a> {{ $count }}</li>
{{ end }}
{{ end }}
</ul>
```
### Order by Least Popular Example
```
```go-html-template
<ul>
{{ $data := .Data }}
{{ range $key, $value := .Data.Terms.ByCount.Reverse }}
<li><a href="{{ $.Site.LanguagePrefix }}/{{ $data.Plural }}/{{ $value.Name | urlize }}"> {{ $value.Name }} </a> {{ $value.Count }} </li>
{{ end }}
{{ $type := .Type }}
{{ range $key, $value := .Data.Terms.ByCount.Reverse }}
{{ $name := .Name }}
{{ $count := .Count }}
{{ with $.Site.GetPage (printf "/%s/%s" $type $name) }}
<li><a href="{{ .Permalink }}">{{ $name }}</a> {{ $count }}</li>
{{ end }}
{{ end }}
</ul>
```
@ -221,11 +233,15 @@ Because we are leveraging the front matter system to define taxonomies for conte
### Example: List Tags in a Single Page Template
```
<ul id="tags">
{{ range .Params.tags }}
<li><a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a> </li>
{{ end }}
```go-html-template
{{ $taxo := "tags" }} <!-- Use the plural form here -->
<ul id="{{ $taxo }}">
{{ range .Param $taxo }}
{{ $name := . }}
{{ with $.Site.GetPage (printf "/%s/%s" $taxo $name) }}
<li><a href="{{ .Permalink }}">{{ $name }}</a></li>
{{ end }}
{{ end }}
</ul>
```
@ -235,10 +251,16 @@ To list such taxonomies, use the following:
### Example: Comma-delimit Tags in a Single Page Template
```
{{ if .Params.directors }}
<strong>Director{{ if gt (len .Params.directors) 1 }}s{{ end }}:</strong>
{{ range $index, $director := .Params.directors }}{{ if gt $index 0 }}, {{ end }}<a href="{{ "directors/" | relURL }}{{ . | urlize }}">{{ . }}</a>{{ end }}
```go-html-template
{{ $taxo := "directors" }} <!-- Use the plural form here -->
{{ with .Param $taxo }}
<strong>Director{{ if gt (len .) 1 }}s{{ end }}:</strong>
{{ range $index, $director := . }}
{{- if gt $index 0 }}, {{ end -}}
{{ with $.Site.GetPage (printf "/%s/%s" $taxo $director) -}}
<a href="{{ .Permalink }}">{{ $director }}</a>
{{- end -}}
{{- end -}}
{{ end }}
```
@ -250,11 +272,11 @@ If you are using a taxonomy for something like a series of posts, you can list i
### Example: Showing Content in Same Series
```
```go-html-template
<ul>
{{ range .Site.Taxonomies.series.golang }}
<li><a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a></li>
{{ end }}
{{ range .Site.Taxonomies.series.golang }}
<li><a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a></li>
{{ end }}
</ul>
```
@ -264,14 +286,14 @@ This would be very useful in a sidebar as “featured content”. You could even
### Example: Grouping "Featured" Content
```
```go-html-template
<section id="menu">
<ul>
{{ range $key, $taxonomy := .Site.Taxonomies.featured }}
<li> {{ $key }} </li>
<li>{{ $key }}</li>
<ul>
{{ range $taxonomy.Pages }}
<li hugo-nav="{{ .RelPermalink}}"><a href="{{ .Permalink}}"> {{ .LinkTitle }} </a> </li>
<li hugo-nav="{{ .RelPermalink}}"><a href="{{ .Permalink}}">{{ .LinkTitle }}</a></li>
{{ end }}
</ul>
{{ end }}
@ -287,13 +309,15 @@ This may take the form of a tag cloud, a menu, or simply a list.
The following example displays all terms in a site's tags taxonomy:
### Example: List All Site Tags
### Example: List All Site Tags {#example-list-all-site-tags}
```
```go-html-template
<ul id="all-tags">
{{ range $name, $taxonomy := .Site.Taxonomies.tags }}
<li><a href="{{ "/tags/" | relLangURL }}{{ $name | urlize }}">{{ $name }}</a></li>
{{ end }}
{{ range $name, $taxonomy := .Site.Taxonomies.tags }}
{{ with $.Site.GetPage (printf "/tags/%s" $name) }}
<li><a href="{{ .Permalink }}">{{ $name }}</a></li>
{{ end }}
{{ end }}
</ul>
```
@ -303,40 +327,47 @@ This example will list all taxonomies and their terms, as well as all the conten
{{< code file="layouts/partials/all-taxonomies.html" download="all-taxonomies.html" download="all-taxonomies.html" >}}
<section>
<ul id="all-taxonomies">
{{ range $taxonomyname, $taxonomy := .Site.Taxonomies }}
<li><a href="{{ "/" | relLangURL}}{{ $taxonomyname | urlize }}">{{ $taxonomyname }}</a>
<ul>
{{ range $key, $value := $taxonomy }}
<li> {{ $key }} </li>
<ul>
{{ range $value.Pages }}
<li hugo-nav="{{ .RelPermalink}}"><a href="{{ .Permalink}}"> {{ .LinkTitle }} </a> </li>
{{ end }}
</ul>
{{ end }}
</ul>
</li>
{{ end }}
</ul>
<ul id="all-taxonomies">
{{ range $taxonomy_term, $taxonomy := .Site.Taxonomies }}
{{ with $.Site.GetPage (printf "/%s" $taxonomy_term) }}
<li><a href="{{ .Permalink }}">{{ $taxonomy_term }}</a>
<ul>
{{ range $key, $value := $taxonomy }}
<li>{{ $key }}</li>
<ul>
{{ range $value.Pages }}
<li hugo-nav="{{ .RelPermalink}}">
<a href="{{ .Permalink}}">{{ .LinkTitle }}</a>
</li>
{{ end }}
</ul>
{{ end }}
</ul>
</li>
{{ end }}
{{ end }}
</ul>
</section>
{{< /code >}}
## `.Site.GetPage` for Taxonomies
Because taxonomies are lists, the [`.GetPage` function][getpage] can be used to get all the pages associated with a particular taxonomy term using a terse syntax. The following ranges over the full list of tags on your site and links to each of the individual taxonomy pages for each term without having to use the more fragile URL construction of the "List All Site Tags" example above:
Because taxonomies are lists, the [`.GetPage` function][getpage] can be used to get all the pages associated with a particular taxonomy term using a terse syntax. The following ranges over the full list of tags on your site and links to each of the individual taxonomy pages for each term without having to use the more fragile URL construction of the ["List All Site Tags" example above]({{< relref "#example-list-all-site-tags" >}}):
{{< code file="links-to-all-tags" >}}
<ul class="tags">
{{ range ($.Site.GetPage "taxonomyTerm" "tags").Pages }}
<li><a href="{{ .Permalink }}">{{ .Title}}</a></li>
{{ end }}
{{< code file="links-to-all-tags.html" >}}
{{ $taxo := "tags" }}
<ul class="{{ $taxo }}">
{{ with ($.Site.GetPage (printf "/%s" $taxo)) }}
{{ range .Pages }}
<li><a href="{{ .Permalink }}">{{ .Title}}</a></li>
{{ end }}
{{ end }}
</ul>
{{< /code >}}
<!--### `.Site.GetPage` Taxonomy List Example
<!-- TODO: ### `.Site.GetPage` Taxonomy List Example -->
### `.Site.GetPage` Taxonomy Terms Example -->
<!-- TODO: ### `.Site.GetPage` Taxonomy Terms Example -->
[delimit]: /functions/delimit/

View file

@ -47,6 +47,7 @@ Alternatively, you can use the new [Jekyll import command](/commands/hugo_import
## WordPress
- [wordpress-to-hugo-exporter](https://github.com/SchumacherFM/wordpress-to-hugo-exporter) - A one-click WordPress plugin that converts all posts, pages, taxonomies, metadata, and settings to Markdown and YAML which can be dropped into Hugo. (Note: If you have trouble using this plugin, you can [export your site for Jekyll](https://wordpress.org/plugins/jekyll-exporter/) and use Hugo's built in Jekyll converter listed above.)
- [exitwp-for-hugo](https://github.com/wooni005/exitwp-for-hugo) - A python script which works with the xml export from Wordpress and converts Wordpress pages and posts to Markdown and YAML for hugo.
- [blog2md](https://github.com/palaniraja/blog2md) - Works with [exported xml](https://en.support.wordpress.com/export/) file of your free YOUR-TLD.wordpress.com website. It also saves approved comments to `YOUR-POST-NAME-comments.md` file along with posts.
## Tumblr
@ -68,6 +69,7 @@ Alternatively, you can use the new [Jekyll import command](/commands/hugo_import
- [blogimport](https://github.com/natefinch/blogimport) - A tool to import from Blogger posts to Hugo.
- [blogger-to-hugo](https://bitbucket.org/petraszd/blogger-to-hugo) - Another tool to import Blogger posts to Hugo. It also downloads embedded images so they will be stored locally.
- [blog2md](https://github.com/palaniraja/blog2md) - Works with [exported xml](https://support.google.com/blogger/answer/41387?hl=en) file of your YOUR-TLD.blogspot.com website. It also saves comments to `YOUR-POST-NAME-comments.md` file along with posts.
- [BloggerToHugo](https://github.com/huanlin/blogger-to-hugo) - Yet another tool to import Blogger posts to Hugo. For Windows platform only, and .NET Framework 4.5 is required. See README.md before using this tool.
## Contentful

View file

@ -4,7 +4,7 @@ linktitle: Starter Kits
description: A list of community-developed projects designed to help you get up and running with Hugo.
date: 2017-02-22
publishdate: 2017-02-01
lastmod: 2017-02-22
lastmod: 2018-08-11
keywords: [starters,assets,pipeline]
menu:
docs:
@ -23,6 +23,7 @@ Know of a Hugo-related starter kit that isn't mentioned here? [Please add it to
The following starter kits are developed by active members of the Hugo community. If you find yourself having issues with any of the projects, it's best to file an issue directly with the project's maintainer(s).
{{% /note %}}
* [Hugo Wrapper][hugow]. Hugo Wrapper is a POSIX-style shell script which acts as a wrapper to download and run Hugo binary for your platform. It can be executed in variety of [Operating Systems][hugow-test] and [Command Shells][hugow-test].
* [Victor Hugo][]. Victor Hugo is a Hugo boilerplate for creating truly epic websites using Gulp + Webpack as an asset pipeline. Victor Hugo uses post-css and Babel for CSS and JavaScript, respectively, and is actively maintained.
* [GOHUGO AMP][]. GoHugo AMP is a starter theme that aims to make it easy to adopt [Google's AMP Project][amp]. The starter kit comes with 40+ shortcodes and partials plus automatic structured data. The project also includes a [separate site with extensive documentation][gohugodocs].
* [Blaupause][]. Blaupause is a developer-friendly Hugo starter kit based on Gulp tasks. It comes ES6-ready with several helpers for SVG and fonts and basic structure for HTML, SCSS, and JavaScript.
@ -35,6 +36,8 @@ The following starter kits are developed by active members of the Hugo community
[Blaupause]: https://github.com/fspoettel/blaupause
[GOHUGO AMP]: https://github.com/wildhaber/gohugo-amp
[gohugodocs]: https://gohugo-amp.gohugohq.com/
[hugow]: https://github.com/khos2ow/hugo-wrapper
[hugow-test]: https://github.com/khos2ow/hugo-wrapper#tested-on
[hugulp]: https://github.com/jbrodriguez/hugulp
[Victor Hugo]: https://github.com/netlify/victor-hugo
[Atlas]: https://github.com/indigotree/atlas

View file

@ -53,6 +53,6 @@ The `GitInfo` object contains the following fields:
## `.Lastmod`
If the `.GitInfo` feature is enabled, **and** if the `lastmod` field in the content's front matter is not set, `.Lastmod` (on `Page`) is fetched from Git i.e. `.GitInfo.AuthorDate`.
If the `.GitInfo` feature is enabled, `.Lastmod` (on `Page`) is fetched from Git i.e. `.GitInfo.AuthorDate`. This behaviour can be changed by adding your own [front matter configuration for dates](/getting-started/configuration/#configure-front-matter).
[configuration]: /getting-started/configuration/

View file

@ -84,7 +84,7 @@
[[article]]
title = "How to use Firebase to host a Hugo site"
url = "https://www.m0d3rnc0ad.com/post/static-site-firebase/"
url = "https://code.selfmadefighter.com/post/static-site-firebase/"
author = "Andrew Cuga"
date= "2017-02-04"

View file

@ -2838,6 +2838,19 @@
}
},
"os": {
"Stat": {
"Description": "Stat returns a file infomation under the given path.",
"Args": [
"i"
],
"Aliases": null,
"Examples": [
[
"{{ (os.Stat \"foo.txt\").Name }}",
"foo.txt"
]
]
},
"FileExists": {
"Description": "FileExists checks whether a file exists under the given path.",
"Args": [

View file

@ -1,3 +1,9 @@
[[quotes]]
name = "Joshua Steven"
twitter_handle = "@jscarto"
quote = "Can't overstate how much I enjoy @GoHugoIO. My site is relatively small, but *18 ms* to build the whole thing made template development and proofing a breeze."
link = "https://twitter.com/jscarto/status/1039648827815485440"
date = 2018-09-12T00:00:00Z
[[quotes]]
name = "Execute"

View file

@ -1,12 +1,12 @@
{{ $file := .Get "file" }}
{{ $.Scratch.Set "codeLang" "" }}
{{ $codeLang := "" }}
{{ $suffix := findRE "(\\.[^.]+)$" $file 1 }}
{{ with $suffix }}
{{ $.Scratch.Set "codeLang" (index . 0 | strings.TrimPrefix ".") }}
{{ $codeLang = (index . 0 | strings.TrimPrefix ".") }}
{{ end }}
{{ with .Get "codeLang" }}{{ $.Scratch.Set "codeLang" . }}{{ end }}
{{ if eq (.Scratch.Get "codeLang") "html"}}
{{ $.Scratch.Set "codeLang" "go-html-template" }}
{{ with .Get "codeLang" }}{{ $codeLang = . }}{{ end }}
{{ if eq $codeLang "html"}}
{{ $codeLang = "go-html-template" }}
{{ end }}
<div class="code relative" id="{{ $file | urlize}}">
{{- with $file -}}
@ -19,7 +19,7 @@
{{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
{{end}}
<div class="code-copy-content nt3" {{with .Get "download"}}id="{{.}}"{{end}}>
{{ if .Get "nocode" }}{{ $.Inner }}{{ else }}{{ with $.Scratch.Get "codeLang" }}{{- highlight $.Inner . "" | -}}{{ else }}<pre><code>{{- .Inner | string -}}</code></pre>{{ end }}{{ end }}
{{ if .Get "nocode" }}{{ $.Inner }}{{ else }}{{ with $codeLang }}{{- highlight $.Inner . "" | -}}{{ else }}<pre><code>{{- .Inner | string -}}</code></pre>{{ end }}{{ end }}
</div>
</div>

View file

@ -1,9 +1,9 @@
[build]
publish = "public"
command = "hugo"
command = "hugo --minify"
[context.production.environment]
HUGO_VERSION = "0.46"
HUGO_VERSION = "0.48"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"
@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true"
command = "hugo --enableGitInfo"
[context.split1.environment]
HUGO_VERSION = "0.46"
HUGO_VERSION = "0.48"
HUGO_ENV = "production"
[context.deploy-preview]
command = "hugo --buildFuture -b $DEPLOY_PRIME_URL"
[context.deploy-preview.environment]
HUGO_VERSION = "0.46"
HUGO_VERSION = "0.48"
[context.branch-deploy]
command = "hugo -b $DEPLOY_PRIME_URL"
[context.branch-deploy.environment]
HUGO_VERSION = "0.46"
HUGO_VERSION = "0.48"
[context.next.environment]
HUGO_ENABLEGITINFO = "true"

2
resources/.gitattributes generated vendored Normal file
View file

@ -0,0 +1,2 @@
*.* linguist-generated=true
*.* -diff -merge

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View file

@ -2,5 +2,5 @@
<a href="{{ .Permalink }}" class="hide-child link primary-color">
<span class="nl3 child">{{ partial "svg/link-permalink.svg" (dict "size" "14px") }}</span>
“{{ .Title }}”
</a> was last updated: {{ .Lastmod.Format "January 2, 2006" }}{{ with .GitInfo }}: <a class="hide-child link primary-color" href="{{$.Site.Params.ghrepo}}/commit/{{ .Hash }}">{{ .Subject }} ({{ .AbbreviatedHash }})</a>{{end }}
</a> was last updated: {{ .Lastmod.Format "January 2, 2006" }}{{ with .GitInfo }}: <a class="hide-child link primary-color" href="{{$.Site.Params.ghrepo}}commit/{{ .Hash }}">{{ .Subject }} ({{ .AbbreviatedHash }})</a>{{end }}
</h6>

View file

@ -1,5 +1,5 @@
{{if .Prev }}
<a href="{{ .Prev.Permalink }}" class="db-l f4 f3-ns link primary-color hover-black fw8">
<a href="{{ .Prev.Permalink }}" class="db-l f4 f3-ns link primary-color hover-black fw8 mr4">
<span class="v-mid dib">{{ partial "svg/ic_chevron_left_black_24px.svg" (dict "size" "30px") }}</span> {{ .Prev.Title }}
</a>
{{end}}
@ -13,13 +13,13 @@
<script>
document.body.onkeyup = function(e){
{{ if .Prev }}
if (!(e.ctrlKey || e.shiftKey || e.altKey || e.metaKey)) {
{{- if .Prev }}
if (e.keyCode == '37') { window.location = '{{ .Prev.Permalink }}'; }
{{ end }}
{{ if .Next }}
if (e.keyCode == '39') { window.location = '{{.Next.Permalink }}'; }
{{ end }}
{{- end }}
{{- if .Next }}
if (e.keyCode == '39') { window.location = '{{ .Next.Permalink }}'; }
{{- end }}
}
};
</script>

View file

@ -3,7 +3,7 @@
<div class="pb3 pt4 w-100 w-50-ns">
<div class="b f3 light-gray mb3 nested-links tc">
By the <a href="https://github.com/gohugoio/hugo/contributors" class="link">Hugo Authors</a><br />
By the <a href="https://github.com/gohugoio/hugo/graphs/contributors" class="link">Hugo Authors</a><br />
</div>
<div class="center w4">