diff -Nru hugo-0.25.1/appveyor.yml hugo-0.26/appveyor.yml --- hugo-0.25.1/appveyor.yml 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/appveyor.yml 2017-08-07 07:09:19.000000000 +0000 @@ -8,6 +8,7 @@ clone_folder: C:\GOPATH\src\github.com\gohugoio\hugo install: + - git submodule update --init --recursive - gem install asciidoctor - pip install docutils diff -Nru hugo-0.25.1/bench.sh hugo-0.26/bench.sh --- hugo-0.25.1/bench.sh 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/bench.sh 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,7 @@ #!/usr/bin/env bash +# allow user to override go executable by running as GOEXE=xxx make ... +GOEXE="${GOEXE-go}" # Convenience script to # - For a given branch @@ -26,10 +28,10 @@ PACKAGE=$2 git checkout $BRANCH -go test -test.run=NONE -bench="$benchFilter" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-$BRANCH.txt +"${GOEXE}" test -test.run=NONE -bench="$benchFilter" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-$BRANCH.txt git checkout master -go test -test.run=NONE -bench="$benchFilter" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-master.txt +"${GOEXE}" test -test.run=NONE -bench="$benchFilter" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-master.txt -benchcmp /tmp/bench-$PACKAGE-master.txt /tmp/bench-$PACKAGE-$BRANCH.txt \ No newline at end of file +benchcmp /tmp/bench-$PACKAGE-master.txt /tmp/bench-$PACKAGE-$BRANCH.txt diff -Nru hugo-0.25.1/benchSite.sh hugo-0.26/benchSite.sh --- hugo-0.25.1/benchSite.sh 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/benchSite.sh 2017-08-07 07:09:19.000000000 +0000 @@ -1,9 +1,12 @@ #!/bin/bash +# allow user to override go executable by running as GOEXE=xxx make ... +GOEXE="${GOEXE-go}" + # Send in a regexp mathing the benchmarks you want to run, i.e. './benchSite.sh "YAML"'. # Note the quotes, which will be needed for more complex expressions. # The above will run all variations, but only for front matter YAML. echo "Running with BenchmarkSiteBuilding/${1}" -go test -run="NONE" -bench="BenchmarkSiteBuilding/${1}$" -test.benchmem=true ./hugolib -memprofile mem.prof -cpuprofile cpu.prof \ No newline at end of file +"${GOEXE}" test -run="NONE" -bench="BenchmarkSiteBuilding/${1}$" -test.benchmem=true ./hugolib -memprofile mem.prof -cpuprofile cpu.prof diff -Nru hugo-0.25.1/CODEOWNERS hugo-0.26/CODEOWNERS --- hugo-0.25.1/CODEOWNERS 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/CODEOWNERS 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -# See https://github.com/blog/2392-introducing-code-owners - -# These owners will be the default owners for everything in the repo. -* @bep - -tpl/* @moorereason @bep -docs/* @digitalcraftsman -snapcraft.yaml @anthonyfok -Dockerfile @anthonyfok -i18n/* @bogem \ No newline at end of file diff -Nru hugo-0.25.1/commands/hugo.go hugo-0.26/commands/hugo.go --- hugo-0.25.1/commands/hugo.go 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/commands/hugo.go 2017-08-07 07:09:19.000000000 +0000 @@ -143,6 +143,7 @@ renderToMemory bool // for benchmark testing verbose bool verboseLog bool + debug bool quiet bool ) @@ -263,6 +264,7 @@ // init initializes flags. func init() { HugoCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose output") + HugoCmd.PersistentFlags().BoolVarP(&debug, "debug", "", false, "debug output") HugoCmd.PersistentFlags().BoolVar(&logging, "log", false, "enable Logging") HugoCmd.PersistentFlags().StringVar(&logFile, "logFile", "", "log File path (if set, logging enabled automatically)") HugoCmd.PersistentFlags().BoolVar(&verboseLog, "verboseLog", false, "verbose logging") @@ -432,8 +434,15 @@ stdoutThreshold = jww.LevelInfo } + if cfg.GetBool("debug") { + stdoutThreshold = jww.LevelDebug + } + if verboseLog { logThreshold = jww.LevelInfo + if cfg.GetBool("debug") { + logThreshold = jww.LevelDebug + } } // The global logger is used in some few cases. @@ -446,7 +455,7 @@ } func (c *commandeer) initializeFlags(cmd *cobra.Command) { - persFlagKeys := []string{"verbose", "logFile"} + persFlagKeys := []string{"debug", "verbose", "logFile"} flagKeys := []string{ "cleanDestinationDir", "buildDrafts", diff -Nru hugo-0.25.1/commands/new.go hugo-0.26/commands/new.go --- hugo-0.25.1/commands/new.go 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/commands/new.go 2017-08-07 07:09:19.000000000 +0000 @@ -347,7 +347,7 @@ homepage = "http://example.com/" tags = [] features = [] -min_version = "0.25.1" +min_version = "0.26" [author] name = "" diff -Nru hugo-0.25.1/CONTRIBUTING.md hugo-0.26/CONTRIBUTING.md --- hugo-0.25.1/CONTRIBUTING.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/CONTRIBUTING.md 2017-08-07 07:09:19.000000000 +0000 @@ -7,6 +7,10 @@ The Hugo community and maintainers are [very active](https://github.com/gohugoio/hugo/pulse/monthly) and helpful, and the project benefits greatly from this activity. We created a [step by step guide](https://gohugo.io/tutorials/how-to-contribute-to-hugo/) if you're unfamiliar with GitHub or contributing to open source projects in general. +*Note that this repository only contains the actual source code of Hugo. For **only** documentation-related pull requests / issues please refer to the [hugoDocs](https://github.com/gohugoio/hugoDocs) repository.* + +*Pull requests that contain changes on the code base **and** related documentation, e.g. for a new feature, shall remain a single, atomic one.* + ## Table of Contents * [Asking Support Questions](#asking-support-questions) @@ -93,7 +97,7 @@ ### Fetch the Sources From GitHub ``` -go get github.com/kardianos/govendor +go get -u github.com/kardianos/govendor govendor get github.com/gohugoio/hugo ``` diff -Nru hugo-0.25.1/create/content_template_handler.go hugo-0.26/create/content_template_handler.go --- hugo-0.25.1/create/content_template_handler.go 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/create/content_template_handler.go 2017-08-07 07:09:19.000000000 +0000 @@ -49,6 +49,7 @@ } const ( + // ArchetypeTemplateTemplate is used as inital template when adding an archetype template. ArchetypeTemplateTemplate = `--- title: "{{ replace .TranslationBaseName "-" " " | title }}" date: {{ .Date }} @@ -123,7 +124,7 @@ if !bytes.Contains(archetypeContent, []byte("date")) || !bytes.Contains(archetypeContent, []byte("title")) { // TODO(bep) remove some time in the future. - s.Log.FEEDBACK.Println(fmt.Sprintf(`WARNING: date and/or title missing from archetype file %q. + s.Log.FEEDBACK.Println(fmt.Sprintf(`WARNING: date and/or title missing from archetype file %q. From Hugo 0.24 this must be provided in the archetype file itself, if needed. Example: %s `, archetypeFilename, ArchetypeTemplateTemplate)) diff -Nru hugo-0.25.1/debian/changelog hugo-0.26/debian/changelog --- hugo-0.25.1/debian/changelog 2017-08-03 08:06:42.000000000 +0000 +++ hugo-0.26/debian/changelog 2017-11-13 18:45:19.000000000 +0000 @@ -1,3 +1,24 @@ +hugo (0.26-1) unstable; urgency=medium + + * New upstream version 0.26 + * Update dependencies: + - Replace golang-github-bep-inflect-dev with + golang-github-markbates-inflect-dev + - Add golang-github-jdkato-prose-dev + * Update Files listing in debian/copyright + * Upgrade debian/watch to version 4 format + * Reformat debian/control with "cme fix dpkg", and bump Standards-Version + to 4.1.1: Change -dev package priority from extra to optional + * Refresh 002-do-not-use-git-information-in-docs.patch + * Delete 003-accommodate-gccgo-in-TestMethodToName.patch which has been + accepted upstream, see https://github.com/gohugoio/hugo/pull/3747 + * Delete 001-disable-google-analytics-in-docs.patch + which cannot be applied to Hugo's revamped documentation + * Disable "hugo -s docs" run because Git submodule + docs/themes/gohugoioTheme is not checked out + + -- Anthony Fok Mon, 13 Nov 2017 11:45:19 -0700 + hugo (0.25.1-2) unstable; urgency=medium * Add 003-accommodate-gccgo-in-TestMethodToName.patch diff -Nru hugo-0.25.1/debian/control hugo-0.26/debian/control --- hugo-0.25.1/debian/control 2017-07-24 21:36:30.000000000 +0000 +++ hugo-0.26/debian/control 2017-11-13 18:45:19.000000000 +0000 @@ -1,15 +1,15 @@ Source: hugo -Section: web -Priority: optional Maintainer: Debian Go Packaging Team Uploaders: Anthony Fok , Dr. Tobias Quathamer +Section: web +Testsuite: autopkgtest-pkg-go +Priority: optional Build-Depends: debhelper (>= 10), bash-completion, dh-golang, golang-any, golang-github-bep-gitmap-dev, - golang-github-bep-inflect-dev, golang-github-burntsushi-toml-dev, golang-github-chaseadamsio-goorgeous-dev, golang-github-dchest-cssmin-dev, @@ -18,13 +18,15 @@ golang-github-fsnotify-fsnotify-dev, golang-github-gorilla-websocket-dev, golang-github-hashicorp-go-immutable-radix-dev, + golang-github-jdkato-prose-dev, golang-github-kardianos-osext-dev, golang-github-kyokomi-emoji-dev, + golang-github-markbates-inflect-dev, golang-github-miekg-mmark-dev, golang-github-mitchellh-mapstructure-dev, golang-github-nicksnyder-go-i18n-dev, golang-github-puerkitobio-purell-dev, - golang-github-russross-blackfriday-dev, + golang-github-russross-blackfriday-dev (>= 1.4+git20170728.51.4048872-1~), golang-github-spf13-afero-dev, golang-github-spf13-cast-dev, golang-github-spf13-cobra-dev, @@ -38,12 +40,11 @@ golang-golang-x-image-dev, golang-golang-x-text-dev, golang-gopkg-yaml.v2-dev -Standards-Version: 4.0.0 -Homepage: https://gohugo.io/ +Standards-Version: 4.1.1 Vcs-Browser: https://anonscm.debian.org/cgit/pkg-go/packages/hugo.git Vcs-Git: https://anonscm.debian.org/git/pkg-go/packages/hugo.git +Homepage: https://gohugo.io/ XS-Go-Import-Path: github.com/gohugoio/hugo -Testsuite: autopkgtest-pkg-go Package: hugo Architecture: any @@ -69,15 +70,11 @@ Complete documentation is available at https://gohugo.io/ Package: golang-github-gohugoio-hugo-dev -Section: devel -Priority: extra Architecture: all -Replaces: golang-github-spf13-hugo-dev (<< 0.25.1-1~) -Breaks: golang-github-spf13-hugo-dev (<< 0.25.1-1~) +Section: devel Depends: ${shlibs:Depends}, ${misc:Depends}, golang-github-bep-gitmap-dev, - golang-github-bep-inflect-dev, golang-github-burntsushi-toml-dev, golang-github-chaseadamsio-goorgeous-dev, golang-github-dchest-cssmin-dev, @@ -86,8 +83,10 @@ golang-github-fsnotify-fsnotify-dev, golang-github-gorilla-websocket-dev, golang-github-hashicorp-go-immutable-radix-dev, + golang-github-jdkato-prose-dev, golang-github-kardianos-osext-dev, golang-github-kyokomi-emoji-dev, + golang-github-markbates-inflect-dev, golang-github-miekg-mmark-dev, golang-github-mitchellh-mapstructure-dev, golang-github-nicksnyder-go-i18n-dev, @@ -106,6 +105,8 @@ golang-golang-x-image-dev, golang-golang-x-text-dev, golang-gopkg-yaml.v2-dev +Breaks: golang-github-spf13-hugo-dev (<< 0.25.1-1~) +Replaces: golang-github-spf13-hugo-dev (<< 0.25.1-1~) Description: Go source code and library of Hugo the static website generator Hugo is a static site generator written in Go. It is optimized for speed, ease of use, and configurability. Hugo takes a directory with content and diff -Nru hugo-0.25.1/debian/copyright hugo-0.26/debian/copyright --- hugo-0.25.1/debian/copyright 2017-07-24 22:38:31.000000000 +0000 +++ hugo-0.26/debian/copyright 2017-11-13 05:56:40.000000000 +0000 @@ -6,11 +6,11 @@ docshelper/* helpers/* hugofs/* hugolib/* i18n/* livereload/* media/* output/* parser/* releaser/* source/* tpl/* transform/* utils/* watcher/* vendor/vendor.json - CODEOWNERS CONTRIBUTING.md LICENSE.md README.md requirements.txt + CONTRIBUTING.md LICENSE.md README.md requirements.txt appveyor.yml bench.sh benchSite.sh Dockerfile goreleaser.yml Makefile snapcraft.yaml .travis.yml .gitignore .goxc.json .mailmap docs/archetypes/* docs/content/* docs/data/* docs/layouts/* - docs/config.toml docs/README.md docs/static/_headers + docs/config.toml docs/README.md docs/static/css/content-style.css docs/static/css/home-page-style-responsive.css docs/static/css/home-page-style.css @@ -19,8 +19,21 @@ docs/static/js/scripts.js docs/static/share/* docs/static/js/owl.carousel-custom.js docs/static/apple-touch-icon.png docs/static/favicon.ico - docs/.gitignore docs/temp/* + docs/.gitignore examples/* temp/* + .gitmodules + docs/.gitmodules + docs/LICENSE.md + docs/netlify.toml + docs/requirements.txt + docs/static/contribute/development/* + docs/static/hosting-and-deployment/deployment-with-wercker/* + docs/static/hosting-and-deployment/hosting-on-bitbucket/* + docs/static/hosting-and-deployment/hosting-on-bitbucket/* + docs/static/hosting-and-deployment/hosting-on-netlify/* + docs/static/images/* + docs/static/quickstart/* + pull-docs.sh Copyright: 2013–2016 Steve Francia 2015–2017 The Hugo Authors License: Apache-2.0 diff -Nru hugo-0.25.1/debian/patches/001-disable-google-analytics-in-docs.patch hugo-0.26/debian/patches/001-disable-google-analytics-in-docs.patch --- hugo-0.25.1/debian/patches/001-disable-google-analytics-in-docs.patch 2017-07-22 07:52:41.000000000 +0000 +++ hugo-0.26/debian/patches/001-disable-google-analytics-in-docs.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -Description: Strip Google Analytics from documentation, even in example - This avoids triggering the Lintian "privacy-breach-google-adsense" error. -Author: Anthony Fok -Origin: vendor -Forwarded: not-needed -Last-Update: 2016-04-30 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ ---- a/docs/content/templates/partials.md -+++ b/docs/content/templates/partials.md -@@ -81,21 +81,6 @@ -

- - -- - - - ---- a/docs/layouts/index.html -+++ b/docs/layouts/index.html -@@ -313,7 +313,5 @@ - }); - - --{{ "" | safeHTML }} --{{ template "partials/analytics.html" . }} - - ---- a/docs/layouts/partials/footer.html -+++ b/docs/layouts/partials/footer.html -@@ -48,7 +48,5 @@ - } - }); - -- -- {{ template "partials/analytics.html" . }} - - diff -Nru hugo-0.25.1/debian/patches/002-do-not-use-git-information-in-docs.patch hugo-0.26/debian/patches/002-do-not-use-git-information-in-docs.patch --- hugo-0.25.1/debian/patches/002-do-not-use-git-information-in-docs.patch 2017-07-22 07:52:41.000000000 +0000 +++ hugo-0.26/debian/patches/002-do-not-use-git-information-in-docs.patch 2017-11-13 05:56:23.000000000 +0000 @@ -5,17 +5,17 @@ Origin: Debian Forwarded: not-needed Reviewed-by: Anthony Fok -Last-Update: 2017-07-21 +Last-Update: 2017-11-12 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/docs/config.toml +++ b/docs/config.toml -@@ -4,6 +4,8 @@ - pluralizeListTitles = false +@@ -15,6 +15,8 @@ + # We do redirects via Netlify's _redirects file, generated by Hugo (see "outputs" below). disableAliases = true +# Do not use git revision information during a Debian package build +enableGitInfo = false - [blackfriday] - plainIDAnchors = true + + # Highlighting config (Pygments) diff -Nru hugo-0.25.1/debian/patches/003-accommodate-gccgo-in-TestMethodToName.patch hugo-0.26/debian/patches/003-accommodate-gccgo-in-TestMethodToName.patch --- hugo-0.25.1/debian/patches/003-accommodate-gccgo-in-TestMethodToName.patch 2017-07-29 05:57:04.000000000 +0000 +++ hugo-0.26/debian/patches/003-accommodate-gccgo-in-TestMethodToName.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -commit 555a9bc80653597a5c5c82fe84222813dfe5aff8 -Author: Anthony Fok -Date: Thu Jul 27 23:28:43 2017 -0600 - - tpl: Accommodate gccgo in TestMethodToName - - Fixes #3744 - -diff --git a/tpl/internal/templatefuncRegistry_test.go b/tpl/internal/templatefuncRegistry_test.go -index dfc4ba09..c2194807 100644 ---- a/tpl/internal/templatefuncRegistry_test.go -+++ b/tpl/internal/templatefuncRegistry_test.go -@@ -14,6 +14,7 @@ - package internal - - import ( -+ "runtime" - "testing" - - "github.com/stretchr/testify/require" -@@ -29,5 +30,9 @@ func (t *Test) MyTestMethod() string { - func TestMethodToName(t *testing.T) { - test := &Test{} - -- require.Equal(t, "MyTestMethod", methodToName(test.MyTestMethod)) -+ if runtime.Compiler == "gccgo" { -+ require.Equal(t, "$thunk0", methodToName(test.MyTestMethod)) -+ } else { -+ require.Equal(t, "MyTestMethod", methodToName(test.MyTestMethod)) -+ } - } diff -Nru hugo-0.25.1/debian/patches/series hugo-0.26/debian/patches/series --- hugo-0.25.1/debian/patches/series 2017-07-29 05:57:26.000000000 +0000 +++ hugo-0.26/debian/patches/series 2017-11-13 05:56:23.000000000 +0000 @@ -1,3 +1 @@ -001-disable-google-analytics-in-docs.patch 002-do-not-use-git-information-in-docs.patch -003-accommodate-gccgo-in-TestMethodToName.patch diff -Nru hugo-0.25.1/debian/rules hugo-0.26/debian/rules --- hugo-0.25.1/debian/rules 2017-08-03 08:06:15.000000000 +0000 +++ hugo-0.26/debian/rules 2017-11-13 05:56:40.000000000 +0000 @@ -26,8 +26,8 @@ endif $(HUGO) gen autocomplete --completionfile=debian/hugo.bash-completion $(HUGO) gen man --dir=debian/man - # TODO: Add "hugo-docs" package in the future - $(HUGO) -s docs -d public/html --uglyURLs + # TODO: Add "hugo-docs" package in the future? + #$(HUGO) -s docs -d public/html --uglyURLs # Disable network access during testing by using -test.short flag, # and skip Git tests which upstream has also disabled for Travis CI. diff -Nru hugo-0.25.1/debian/watch hugo-0.26/debian/watch --- hugo-0.25.1/debian/watch 2017-07-22 07:56:44.000000000 +0000 +++ hugo-0.26/debian/watch 2017-11-13 05:56:40.000000000 +0000 @@ -1,3 +1,4 @@ -version=3 -opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/hugo-$1\.tar\.gz/ \ - https://github.com/gohugoio/hugo/tags .*/v?(\d\S*)\.tar\.gz +version=4 +opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%hugo-$1.tar.gz%" \ + https://github.com/gohugoio/hugo/releases \ + (?:.*?/)?v?(\d[\d.]*)\.tar\.gz diff -Nru hugo-0.25.1/deps/deps.go hugo-0.26/deps/deps.go --- hugo-0.25.1/deps/deps.go 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/deps/deps.go 2017-08-07 07:09:19.000000000 +0000 @@ -14,7 +14,7 @@ ) // Deps holds dependencies used by many. -// There will be normally be only one instance of deps in play +// There will be normally only one instance of deps in play // at a given time, i.e. one per Site built. type Deps struct { // The logger to use. @@ -55,10 +55,12 @@ Clone(deps *Deps) error } +// TemplateHandler returns the used tpl.TemplateFinder as tpl.TemplateHandler. func (d *Deps) TemplateHandler() tpl.TemplateHandler { return d.Tmpl.(tpl.TemplateHandler) } +// LoadResources loads translations and templates. func (d *Deps) LoadResources() error { // Note that the translations need to be loaded before the templates. if err := d.translationProvider.Update(d); err != nil { @@ -76,6 +78,9 @@ return nil } +// New initializes a Dep struct. +// Defaults are set for nil values, +// but TemplateProvider, TranslationProvider and Language are always required. func New(cfg DepsCfg) (*Deps, error) { var ( logger = cfg.Logger diff -Nru hugo-0.25.1/Dockerfile hugo-0.26/Dockerfile --- hugo-0.25.1/Dockerfile 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/Dockerfile 2017-08-07 07:09:19.000000000 +0000 @@ -1,27 +1,34 @@ -FROM golang:alpine3.6 +FROM alpine:3.6 ENV GOPATH /go +ENV PATH $GOPATH/bin:$PATH RUN \ adduser -h /site -s /sbin/nologin -u 1000 -D hugo && \ - apk add --no-cache dumb-init && \ + apk add --no-cache \ + dumb-init && \ apk add --no-cache --virtual .build-deps \ - git \ - make && \ + gcc \ + musl-dev \ + go \ + git && \ + mkdir -p \ + ${GOPATH}/bin \ + ${GOPATH}/pkg \ + ${GOPATH}/src && \ go get github.com/kardianos/govendor && \ govendor get github.com/gohugoio/hugo && \ cd $GOPATH/src/github.com/gohugoio/hugo && \ - make install test && \ - rm -rf $GOPATH/src/* && \ + rm -f $GOPATH/bin/hugo && \ + go install -ldflags '-s -w' && \ + cd $GOPATH && \ + rm -rf pkg src .cache bin/govendor && \ apk del .build-deps -USER hugo - +USER hugo WORKDIR /site - -EXPOSE 1313 +VOLUME /site +EXPOSE 1313 ENTRYPOINT ["/usr/bin/dumb-init", "--", "hugo"] - CMD [ "--help" ] - diff -Nru hugo-0.25.1/docs/archetypes/default.md hugo-0.26/docs/archetypes/default.md --- hugo-0.25.1/docs/archetypes/default.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/archetypes/default.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,6 +1,11 @@ -+++ -weight = 5 -[menu] - [menu.main] - parent = "x" -+++ +--- +title: "{{ replace .TranslationBaseName "-" " " | title }}" +date: {{ .Date }} +description: "" +categories: [] +#tags: [] +slug: "" +aliases: [] +toc: false +draft: true +--- diff -Nru hugo-0.25.1/docs/archetypes/showcase.md hugo-0.26/docs/archetypes/showcase.md --- hugo-0.25.1/docs/archetypes/showcase.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/archetypes/showcase.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ ---- -date: 2013-07-01T07:32:00Z -description: "" -license: "" -licenseLink: "" -sitelink: http://spf13.com/ -sourceLink: https://github.com/spf13/spf13.com -tags: -- personal -- blog -thumbnail: /img/spf13-tn.jpg -title: spf13.com ---- - diff -Nru hugo-0.25.1/docs/config.toml hugo-0.26/docs/config.toml --- hugo-0.25.1/docs/config.toml 2017-07-14 13:00:49.000000000 +0000 +++ hugo-0.26/docs/config.toml 2017-08-07 07:09:19.000000000 +0000 @@ -1,15 +1,32 @@ -title = "Hugo: A Fast and Flexible Website Generator" -baseurl = "http://gohugo.io/" -MetaDataFormat = "yaml" +baseURL = "https://gohugo.io/" +paginate = 100 +defaultContentLanguage = "en" +enableEmoji = true +# Set the unicode character used for the "return" link in page footnotes. +footnotereturnlinkcontents = "↩" +languageCode = "en-us" +metaDataFormat = "yaml" +title = "Hugo" +theme = "gohugoioTheme" + +googleAnalytics = "UA-7131036-4" + pluralizeListTitles = false + # We do redirects via Netlify's _redirects file, generated by Hugo (see "outputs" below). disableAliases = true -[blackfriday] - plainIDAnchors = true + +# Highlighting config (Pygments) +# It is (currently) not in use, but you can do ```go in a content file if you want to. +pygmentsCodeFences = true + +# See https://help.farbox.com/pygments.html +pygmentsStyle = "friendly" [outputs] -home = [ "HTML", "RSS", "REDIR" ] +home = [ "HTML", "RSS", "REDIR", "HEADERS" ] +section = [ "HTML", "RSS"] [mediaTypes] [mediaTypes."text/netlify"] @@ -22,114 +39,198 @@ baseName = "_redirects" isPlainText = true notAlternative = true +[outputFormats.HEADERS] +mediatype = "text/netlify" +baseName = "_headers" +isPlainText = true +notAlternative = true +[social] +twitter = "GoHugoIO" + +#CUSTOM PARAMS [params] - description = "Documentation of Hugo, a fast and flexible static site generator built with love by spf13, bep and friends in Go" - author = "Steve Francia (spf13) and friends" - release = "0.25.1" + description = "The world’s fastest framework for building websites" + ## Used for views in rendered HTML (i.e., rather than using the .Hugo variable) + release = "0.26" + ## Setting this to true will add a "noindex" to *EVERY* page on the site + removefromexternalsearch = false + ## Gh repo for site footer (include trailing slash) + ghrepo = "https://github.com/gohugoio/hugoDocs/" + ## GH Repo for filing a new issue + github_repo = "https://github.com/gohugoio/hugo/issues/new" + ### Edit content repo (set to automatically enter "edit" mode; this is good for "improve this page" links) + ghdocsrepo = "https://github.com/gohugoio/hugoDocs/tree/master/docs" + ## Gitter URL + gitter = "https://gitter.im/spf13/hugo" + ## Discuss Forum URL + forum = "https://discourse.gohugo.io/" + ## Google Tag Manager + gtmid = "" + + # First one is picked as the Twitter card image if not set on page. + images = ["images/gohugoio-card.png"] + + flex_box_interior_classes = "flex-auto w-100 w-40-l mr3 mb3 bg-white ba b--moon-gray nested-copy-line-height" + #sidebar_direction = "sidebar_left" + +# MARKDOWN +## Configuration for BlackFriday markdown parser: https://github.com/russross/blackfriday +[blackfriday] + plainIDAnchors = true + hrefTargetBlank = true + angledQuotes = false + latexDashes = true + +## As of v0.20, all content files include a default "categories" value that's the same as the section. This was a cheap future-proofing method and should/could be changed accordingly. [taxonomies] - tag = "tags" - group = "groups" + category = "categories" -[[menu.main]] - name = "Download Hugo" - pre = "" - url = "https://github.com/gohugoio/hugo/releases" - weight = -200 -[[menu.main]] - name = "Site Showcase" - pre = "" - url = "/showcase/" - weight = -180 -[[menu.main]] - name = "Theme Showcase" - pre = "" - url = "http://themes.gohugo.io" - weight = -170 -[[menu.main]] - name = "Press & Articles" - pre = "" - url = "/community/press/" - weight = -160 -[[menu.main]] - name = "Discuss Hugo" - pre = "" - url = "https://discourse.gohugo.io/" - weight = -150 -[[menu.main]] - name = "About Hugo" - identifier = "about" - pre = "" - weight = -110 -[[menu.main]] - name = "Release Notes" - url = "/release-notes/" - pre = "" - weight = -111 -[[menu.main]] - name = "Getting Started" - identifier = "getting started" - pre = "" - weight = -100 -[[menu.main]] - name = "Content" - identifier = "content" - pre = "" - weight = -90 -[[menu.main]] +# High level items + +[[menu.docs]] + name = "About Hugo" + weight = 1 + identifier = "about" + url = "/about/" + +[[menu.docs]] + name = "Getting Started" + weight = 5 + identifier = "getting-started" + url = "/getting-started/" + + +[[menu.docs]] + name = "Themes" + weight = 15 + identifier = "themes" + post = "break" + url = "/themes/" + +# Core Menus + +[[menu.docs]] + name = "Content Management" + weight = 20 + identifier = "content-management" + post = "expanded" + url = "/content-management/" + +[[menu.docs]] + name = "Templates" + weight = 25 + identifier = "templates" + + url = "/templates/" + +[[menu.docs]] + name = "Functions" + weight = 30 + identifier = "functions" + url = "/functions/" + +[[menu.docs]] + name = "Variables" + weight = 35 + identifier = "variables" + url = "/variables/" + +[[menu.docs]] + name = "CLI" + weight = 40 + post = "break" + identifier = "commands" + url = "/commands/" + + + +# LOW LEVEL ITEMS + + +[[menu.docs]] + name = "Troubleshooting" + weight = 60 + identifier = "troubleshooting" + url = "/troubleshooting/" + +[[menu.docs]] + name = "Tools" + weight = 70 + identifier = "tools" + url = "/tools/" + +[[menu.docs]] + name = "Hosting & Deployment" + weight = 80 + identifier = "hosting-and-deployment" + url = "/hosting-and-deployment/" + +[[menu.docs]] + name = "Contribute" + weight = 100 + post = "break" + identifier = "contribute" + url = "/contribute/" + +#[[menu.docs]] +# name = "Tags" +# weight = 120 +# identifier = "tags" +# url = "/tags/" + + +# [[menu.docs]] +# name = "Categories" +# weight = 140 +# identifier = "categories" +# url = "/categories/" + +######## QUICKLINKS + + [[menu.quicklinks]] + name = "Fundamentals" + weight = 1 + identifier = "fundamentals" + url = "/tags/fundamentals/" + + + + +######## GLOBAL ITEMS TO BE SHARED WITH THE HUGO SITES + +[[menu.global]] + name = "News" + weight = 1 + identifier = "news" + url = "/news/" + + [[menu.global]] + name = "Docs" + weight = 5 + identifier = "docs" + url = "/documentation/" + + [[menu.global]] name = "Themes" + weight = 10 identifier = "themes" - pre = "" - weight = -85 -[[menu.main]] - parent = "themes" - name = "Theme Showcase" - url = "http://themes.gohugo.io" - weight = -170 -[[menu.main]] - name = "Templates" - identifier = "layout" - pre = "" - weight = -80 -[[menu.main]] - name = "Taxonomies" - identifier = "taxonomy" - pre = "" - weight = -70 -[[menu.main]] - name = "Extras" - identifier = "extras" - pre = "" - weight = -60 -[[menu.main]] + url = "https://themes.gohugo.io/" + + # Anything with a weight > 100 gets an external icon + [[menu.global]] name = "Community" + weight = 150 + icon = true identifier = "community" - pre = "" - weight = -50 -[[menu.main]] - parent = "community" - name = "Discussion Forum" + post = "external" url = "https://discourse.gohugo.io/" - weight = 150 -[[menu.main]] - name = "Tutorials" - identifier = "tutorials" - pre = "" - weight = -40 -[[menu.main]] - name = "Troubleshooting" - identifier = "troubleshooting" - pre = "" - weight = -30 -[[menu.main]] - name = "Tools" - url = "/tools/" - pre = "" - weight = -25 -[[menu.main]] - name = "Hugo Cmd Reference" - identifier = "commands" - pre = "" - weight = -20 - url = "/commands/" + + + [[menu.global]] + name = "GitHub" + weight = 200 + identifier = "github" + post = "external" + url = "https://github.com/gohugoio/hugo" diff -Nru hugo-0.25.1/docs/content/about/benefits.md hugo-0.26/docs/content/about/benefits.md --- hugo-0.25.1/docs/content/about/benefits.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/about/benefits.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,43 @@ +--- +title: The Benefits of Static Site Generators +linktitle: The Benefits of Static +description: Improved performance, security and ease of use are just a few of the reasons static site generators are so appealing. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +#tags: [ssg,static,performance,security] +menu: + docs: + parent: "about" + weight: 30 +weight: 30 +sections_weight: 30 +draft: false +aliases: [] +toc: false +--- + +The purpose of website generators is to render content into HTML files. Most are "dynamic site generators." That means the HTTP server---i.e., the program that sends files to the browser to be viewed---runs the generator to create a new HTML file every time an end user requests a page. + +Over time, dynamic site generators were programmed to cache their HTML files to prevent unnecessary delays in delivering pages to end users. A cached page is a static version of a web page. + +Hugo takes caching a step further and all HTML files are rendered on your computer. You can review the files locally before copying them to the computer hosting the HTTP server. Since the HTML files aren't generated dynamically, we say that Hugo is a *static site generator*. + +This has many benefits. The most noticeable is performance. HTTP servers are *very* good at sending files---so good, in fact, that you can effectively serve the same number of pages with a fraction of the memory and CPU needed for a dynamic site. + +## More on Static Site Generators + +* ["An Introduction to Static Site Generators", David Walsh][] +* ["Hugo vs. Wordpress page load speed comparison: Hugo leaves WordPress in its dust", GettingThingsTech][hugovwordpress] +* ["Static Site Generators", O-Reilly][] +* [StaticGen: Top Open-Source Static Site Generators (GitHub Stars)][] +* ["Top 10 Static Website Generators", Netlify blog][] +* ["The Resurgence of Static", dotCMS][dotcms] + + +["An Introduction to Static Site Generators", David Walsh]: https://davidwalsh.name/introduction-static-site-generators +["Static Site Generators", O-Reilly]: /documents/oreilly-static-site-generators.pdf +["Top 10 Static Website Generators", Netlify blog]: https://www.netlify.com/blog/2016/05/02/top-ten-static-website-generators/ +[hugovwordpress]: https://gettingthingstech.com/hugo-vs.-wordpress-page-load-speed-comparison-hugo-leaves-wordpress-in-its-dust/ +[StaticGen: Top Open-Source Static Site Generators (GitHub Stars)]: https://www.staticgen.com/ +[dotcms]: https://dotcms.com/blog/post/the-resurgence-of-static diff -Nru hugo-0.25.1/docs/content/about/features.md hugo-0.26/docs/content/about/features.md --- hugo-0.25.1/docs/content/about/features.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/about/features.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,90 @@ +--- +title: Hugo Features +linktitle: Hugo Features +description: Hugo boasts blistering speed, robust content management, and a powerful templating language making it a great fit for all kinds of static websites. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +menu: + docs: + parent: "about" + weight: 20 +weight: 20 +sections_weight: 20 +draft: false +aliases: [/about/features] +toc: true +--- + +## General + +* [Extremely fast][] build times (< 1 ms per page) +* Completely cross platform, with [easy installation][install] on macOS, Linux, Windows, and more +* Renders changes on the fly with [LiveReload][] as you develop +* [Powerful theming][] +* [Host your site anywhere][hostanywhere] + +## Organization + +* Straightforward [organization for your projects][], including website sections +* Customizable [URLs][] +* Support for configurable [taxonomies][], including categories and tags +* [Sort content][] as you desire through powerful template [functions][] +* Automatic [table of contents][] generation +* [Dynamic menu][] creation +* [Pretty URLs][] support +* [Permalink][] pattern support +* Redirects via [aliases][] + +## Content + +* Native Markdown and Emacs Org-Mode support, as well as other languages via *external helpers* (see [supported formats][]) +* TOML, YAML, and JSON metadata support in [front matter][] +* Customizable [homepage][] +* Multiple [content types][] +* Automatic and user defined [content summaries][] +* [Shortcodes][] to enable rich content inside of Markdown +* ["Minutes to Read"][pagevars] functionality +* ["Wordcount"][pagevars] functionality + +## Additional Features + +* Integrated [Disqus][] comment support +* Integrated [Google Analytics][] support +* Automatic [RSS][] creation +* Support for [Go][], [Amber], and [Ace][] HTML templates +* [Syntax highlighting][] powered by [Pygments][] + +See what's coming next in the [Hugo roadmap][]. + +[Ace]: /templates/alternatives/ +[aliases]: /content-management/urls/#aliases +[Amber]: https://github.com/eknkc/amber +[content summaries]: /content-management/summaries/ +[content types]: /content-management/types/ +[Disqus]: https://disqus.com/ +[Dynamic menu]: /templates/menus/ +[Extremely fast]: https://github.com/bep/hugo-benchmark +[front matter]: /content-management/front-matter/ +[functions]: /functions/ +[Go]: http://golang.org/pkg/html/template/ +[Google Analytics]: https://google-analytics.com/ +[homepage]: /templates/homepage/ +[hostanywhere]: /hosting-and-deployment/ +[Hugo roadmap]: /about/roadmap +[install]: /getting-started/installing/ +[LiveReload]: /getting-started/usage/ +[organization for your projects]: /getting-started/directory-structure/ +[pagevars]: /variables/page/ +[Permalink]: /content-management/urls/#permalinks +[Powerful theming]: /themes/ +[Pretty URLs]: /content-management/urls/ +[Pygments]: http://pygments.org/ +[RSS]: /templates/rss/ +[Shortcodes]: /content-management/shortcodes/ +[sort content]: /templates/ +[supported formats]: /content-management/formats/ +[Syntax highlighting]: /tools/syntax-highlighting/ +[table of contents]: /content-management/toc/ +[taxonomies]: /content-management/taxonomies/ +[URLs]: /content-management/urls/ diff -Nru hugo-0.25.1/docs/content/about/_index.md hugo-0.26/docs/content/about/_index.md --- hugo-0.25.1/docs/content/about/_index.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/about/_index.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,20 @@ +--- +title: About Hugo +linktitle: Overview +description: Hugo's features, roadmap, license, and motivation. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [] +#tags: [] +menu: + docs: + parent: "about" + weight: 1 +weight: 1 +draft: false +aliases: [/about-hugo/,/docs/] +toc: false +--- + +Hugo is not your average static site generator. diff -Nru hugo-0.25.1/docs/content/about/license.md hugo-0.26/docs/content/about/license.md --- hugo-0.25.1/docs/content/about/license.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/about/license.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,165 @@ +--- +title: Apache License +linktitle: License +description: Hugo v0.15 and later are released under the Apache 2.0 license. +date: 2016-02-01 +publishdate: 2016-02-01 +lastmod: 2016-03-02 +categories: ["about hugo"] +#tags: ["License","apache"] +menu: + docs: + parent: "about" + weight: 60 +weight: 60 +sections_weight: 60 +aliases: [/meta/license] +toc: true +--- + +{{% note %}} +Hugo v0.15 and later are released under the Apache 2.0 license. +Earlier versions of Hugo were released under the [Simple Public License](https://opensource.org/licenses/Simple-2.0). +{{% /note %}} + +_Version 2.0, January 2004_
+ + +*Terms and Conditions for use, reproduction, and distribution* + +## 1. Definitions + +“License” shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +“Licensor” shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +“Legal Entity” shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, “control” means **(i)** the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the +outstanding shares, or **(iii)** beneficial ownership of such entity. + +“You” (or “Your”) shall mean an individual or Legal Entity exercising +permissions granted by this License. + +“Source” form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +“Object” form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +“Work” shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +“Derivative Works” shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +“Contribution” shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +“submitted” means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as “Not a Contribution.” + +“Contributor” shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +## 2. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +## 3. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby +grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have +made, use, offer to sell, sell, import, and otherwise transfer the Work, where +such license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by combination +of their Contribution(s) with the Work to which such Contribution(s) was +submitted. If You institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work or a +Contribution incorporated within the Work constitutes direct or contributory +patent infringement, then any patent licenses granted to You under this License +for that Work shall terminate as of the date such litigation is filed. + +## 4. Redistribution + +You may reproduce and distribute copies of the Work or Derivative Works thereof +in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +* **(a)** You must give any other recipients of the Work or Derivative Works a copy of +this License; and +* **(b)** You must cause any modified files to carry prominent notices stating that You +changed the files; and +* **\(c)** You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +## 5. Submission of Contributions + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +## 6. Trademarks + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +## 7. Disclaimer of Warranty + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +## 8. Limitation of Liability + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +## 9. Accepting Warranty or Additional Liability + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +_END OF TERMS AND CONDITIONS_ + +## APPENDIX: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets `[]` replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same “printed page” as the copyright notice for easier identification within third-party archives. + +{{< code file="apache-notice.txt" download="apache-notice.txt" >}} +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +{{< /code >}} diff -Nru hugo-0.25.1/docs/content/about/roadmap.md hugo-0.26/docs/content/about/roadmap.md --- hugo-0.25.1/docs/content/about/roadmap.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/about/roadmap.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,51 @@ +--- +title: Roadmap +linktitle: Roadmap +description: Take a look at what's in the pipeline for future versions of the Hugo project. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [about hugo] +#tags: [about,contribute,roadmap] +menu: + docs: + parent: "about" + weight: 50 +weight: 50 +sections_weight: 50 +draft: false +aliases: [/meta/roadmap] +toc: false +--- + +To track Hugo's progress, see our [GitHub Milestones][milestones]. + +In no particular order, here are some other features currently being worked on: + +* Even easier deployment to S3, SSH, GitHub, rsync. Give the [hosting and deployment][] section a shot. +* Import from other website systems. There are already [existing migration tools][migrate], but they don’t cover all major platforms. +* An interactive web-based editor (See the [related forum thread][]) +* Additional [themes][], which are always ongoing and [contributions are welcome][themescontrib]! +* Dynamic image resizing via shortcodes ({{< gh 1014 >}}) +* Native support for additional content formats (AsciiDoc {{< gh 1435>}}, reST {{< gh 1436 >}}) +* And, last but not least, [***your*** best ideas!][] + +## Contributions Welcome + +Feel free to [contribute to Hugo's development][devcontribute], [improve Hugo's documentation][doccontribute], or [open a new issue][newissue] if you have an idea for a new feature. + +[#98]: https://github.com/gohugoio/hugo/issues/98 +[#1014]: https://github.com/gohugoio/hugo/issues/1014 +[#1435]: https://github.com/gohugoio/hugo/issues/1435 +[#1436]: https://github.com/gohugoio/hugo/issues/1436 +[devcontribute]: /contribute/development/ +[doccontribute]: /contribute/documentation/ +[hosting and deployment]: /hosting-and-deployment/ +[migrate]: /tools/migrations/ +[milestones]: https://github.com/gohugoio/hugo/milestone/14 +[newissue]: https://github.com/gohugoio/hugo/issues/ +[related forum thread]: https://discourse.gohugo.io/t/web-based-editor/155 +[themes]: /themes/ +[themescontrib]: /contribute/themes/ +[tutorials]: /tutorials +[***your*** best ideas!]: /contribute/ diff -Nru hugo-0.25.1/docs/content/about/what-is-hugo.md hugo-0.26/docs/content/about/what-is-hugo.md --- hugo-0.25.1/docs/content/about/what-is-hugo.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/about/what-is-hugo.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,69 @@ +--- +title: What is Hugo +linktitle: What is Hugo +description: Hugo is a fast and modern static site generator written in Go, and designed to make website creation fun again. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +layout: single +menu: + main: + parent: "about" + weight: 10 +weight: 10 +sections_weight: 10 +draft: false +aliases: [/overview/introduction/,/about/why-i-built-hugo/] +toc: true +--- + +Hugo is a general-purpose website framework. Technically speaking, Hugo is a [static site generator][]. Unlike systems that dynamically build a page with each visitor request, Hugo builds pages when you create or update your content. Since websites are viewed far more often than they are edited, Hugo is designed to provide an optimal viewing experience for your website's end users and an ideal writing experience for website authors. + +Websites built with Hugo are extremely fast and secure. Hugo sites can be hosted anywhere, including [Netlify][], [Heroku][], [GoDaddy][], [DreamHost][], [GitHub Pages][], [Surge][], [Aerobatic][], [Firebase][], [Google Cloud Storage][], [Amazon S3][], [Rackspace][], [Azure][], and [CloudFront][] and work well with CDNs. Hugo sites run without the need for a database or dependencies on expensive runtimes like Ruby, Python, or PHP. + +We think of Hugo as the ideal website creation tool with nearly instant build times, able to rebuild whenever a change is made. + +## How Fast is Hugo? + +{{< youtube "CdiDYZ51a2o" >}} + +## What Does Hugo Do? + +In technical terms, Hugo takes a source directory of files and templates and uses these as input to create a complete website. + +## Who Should Use Hugo? + +Hugo is for people that prefer writing in a text editor over a browser. + +Hugo is for people who want to hand code their own website without worrying about setting up complicated runtimes, dependencies and databases. + +Hugo is for people building a blog, a company site, a portfolio site, documentation, a single landing page, or a website with thousands of pages. + + + +[@spf13]: https://twitter.com/@spf13 +[Aerobatic]: https://www.aerobatic.com/ +[Amazon S3]: http://aws.amazon.com/s3/ +[Azure]: https://blogs.msdn.microsoft.com/acoat/2016/01/28/publish-a-static-web-site-using-azure-web-apps/ +[CloudFront]: http://aws.amazon.com/cloudfront/ "Amazon CloudFront" +[contributing to it]: https://github.com/gohugoio/hugo +[DreamHost]: http://www.dreamhost.com/ +[Firebase]: https://firebase.google.com/docs/hosting/ "Firebase static hosting" +[GitHub Pages]: https://pages.github.com/ +[GitLab]: https://about.gitlab.com +[Go language]: https://golang.org/ +[GoDaddy]: https://www.godaddy.com/ "Godaddy.com Hosting" +[Google Cloud Storage]: http://cloud.google.com/storage/ +[Heroku]: https://www.heroku.com/ +[Jekyll]: http://jekyllrb.com/ +[Jekyll]: https://jekyllrb.com/ +[Middleman]: https://middlemanapp.com/ +[Middleman]: https://middlemanapp.com/ +[Nanoc]: http://nanoc.ws/ +[Nanoc]: https://nanoc.ws/ +[Netlify]: https://netlify.com +[rackspace]: https://www.rackspace.com/cloud/files +[static site generator]: /about/benefits/ +[Rackspace]: https://www.rackspace.com/cloud/files +[static site generator]: /about/benefits/ +[Surge]: https://surge.sh diff -Nru hugo-0.25.1/docs/content/commands/hugo_benchmark.md hugo-0.26/docs/content/commands/hugo_benchmark.md --- hugo-0.25.1/docs/content/commands/hugo_benchmark.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_benchmark.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo benchmark" slug: hugo_benchmark url: /commands/hugo_benchmark/ @@ -69,4 +69,4 @@ ### SEE ALSO * [hugo](/commands/hugo/) - hugo builds your site -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_check.md hugo-0.26/docs/content/commands/hugo_check.md --- hugo-0.25.1/docs/content/commands/hugo_check.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_check.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo check" slug: hugo_check url: /commands/hugo_check/ @@ -34,4 +34,4 @@ * [hugo](/commands/hugo/) - hugo builds your site * [hugo check ulimit](/commands/hugo_check_ulimit/) - Check system ulimit settings -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_check_ulimit.md hugo-0.26/docs/content/commands/hugo_check_ulimit.md --- hugo-0.25.1/docs/content/commands/hugo_check_ulimit.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_check_ulimit.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo check ulimit" slug: hugo_check_ulimit url: /commands/hugo_check_ulimit/ @@ -38,4 +38,4 @@ ### SEE ALSO * [hugo check](/commands/hugo_check/) - Contains some verification checks -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_config.md hugo-0.26/docs/content/commands/hugo_config.md --- hugo-0.25.1/docs/content/commands/hugo_config.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_config.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo config" slug: hugo_config url: /commands/hugo_config/ @@ -37,4 +37,4 @@ ### SEE ALSO * [hugo](/commands/hugo/) - hugo builds your site -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_convert.md hugo-0.26/docs/content/commands/hugo_convert.md --- hugo-0.25.1/docs/content/commands/hugo_convert.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_convert.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo convert" slug: hugo_convert url: /commands/hugo_convert/ @@ -41,4 +41,4 @@ * [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 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_convert_toJSON.md hugo-0.26/docs/content/commands/hugo_convert_toJSON.md --- hugo-0.25.1/docs/content/commands/hugo_convert_toJSON.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_convert_toJSON.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo convert toJSON" slug: hugo_convert_toJSON url: /commands/hugo_convert_tojson/ @@ -41,4 +41,4 @@ ### SEE ALSO * [hugo convert](/commands/hugo_convert/) - Convert your content to different formats -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_convert_toTOML.md hugo-0.26/docs/content/commands/hugo_convert_toTOML.md --- hugo-0.25.1/docs/content/commands/hugo_convert_toTOML.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_convert_toTOML.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo convert toTOML" slug: hugo_convert_toTOML url: /commands/hugo_convert_totoml/ @@ -41,4 +41,4 @@ ### SEE ALSO * [hugo convert](/commands/hugo_convert/) - Convert your content to different formats -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_convert_toYAML.md hugo-0.26/docs/content/commands/hugo_convert_toYAML.md --- hugo-0.25.1/docs/content/commands/hugo_convert_toYAML.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_convert_toYAML.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo convert toYAML" slug: hugo_convert_toYAML url: /commands/hugo_convert_toyaml/ @@ -41,4 +41,4 @@ ### SEE ALSO * [hugo convert](/commands/hugo_convert/) - Convert your content to different formats -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_env.md hugo-0.26/docs/content/commands/hugo_env.md --- hugo-0.25.1/docs/content/commands/hugo_env.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_env.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo env" slug: hugo_env url: /commands/hugo_env/ @@ -37,4 +37,4 @@ ### SEE ALSO * [hugo](/commands/hugo/) - hugo builds your site -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_gen_autocomplete.md hugo-0.26/docs/content/commands/hugo_gen_autocomplete.md --- hugo-0.25.1/docs/content/commands/hugo_gen_autocomplete.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_gen_autocomplete.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo gen autocomplete" slug: hugo_gen_autocomplete url: /commands/hugo_gen_autocomplete/ @@ -55,4 +55,4 @@ ### SEE ALSO * [hugo gen](/commands/hugo_gen/) - A collection of several useful generators. -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_gen_doc.md hugo-0.26/docs/content/commands/hugo_gen_doc.md --- hugo-0.25.1/docs/content/commands/hugo_gen_doc.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_gen_doc.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo gen doc" slug: hugo_gen_doc url: /commands/hugo_gen_doc/ @@ -44,4 +44,4 @@ ### SEE ALSO * [hugo gen](/commands/hugo_gen/) - A collection of several useful generators. -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_gen_man.md hugo-0.26/docs/content/commands/hugo_gen_man.md --- hugo-0.25.1/docs/content/commands/hugo_gen_man.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_gen_man.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo gen man" slug: hugo_gen_man url: /commands/hugo_gen_man/ @@ -40,4 +40,4 @@ ### SEE ALSO * [hugo gen](/commands/hugo_gen/) - A collection of several useful generators. -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_gen.md hugo-0.26/docs/content/commands/hugo_gen.md --- hugo-0.25.1/docs/content/commands/hugo_gen.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_gen.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo gen" slug: hugo_gen url: /commands/hugo_gen/ @@ -36,4 +36,4 @@ * [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 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_import_jekyll.md hugo-0.26/docs/content/commands/hugo_import_jekyll.md --- hugo-0.25.1/docs/content/commands/hugo_import_jekyll.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_import_jekyll.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo import jekyll" slug: hugo_import_jekyll url: /commands/hugo_import_jekyll/ @@ -40,4 +40,4 @@ ### SEE ALSO * [hugo import](/commands/hugo_import/) - Import your site from others. -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_import.md hugo-0.26/docs/content/commands/hugo_import.md --- hugo-0.25.1/docs/content/commands/hugo_import.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_import.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo import" slug: hugo_import url: /commands/hugo_import/ @@ -36,4 +36,4 @@ * [hugo](/commands/hugo/) - hugo builds your site * [hugo import jekyll](/commands/hugo_import_jekyll/) - hugo import from Jekyll -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_list_drafts.md hugo-0.26/docs/content/commands/hugo_list_drafts.md --- hugo-0.25.1/docs/content/commands/hugo_list_drafts.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_list_drafts.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo list drafts" slug: hugo_list_drafts url: /commands/hugo_list_drafts/ @@ -38,4 +38,4 @@ ### SEE ALSO * [hugo list](/commands/hugo_list/) - Listing out various types of content -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_list_expired.md hugo-0.26/docs/content/commands/hugo_list_expired.md --- hugo-0.25.1/docs/content/commands/hugo_list_expired.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_list_expired.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo list expired" slug: hugo_list_expired url: /commands/hugo_list_expired/ @@ -39,4 +39,4 @@ ### SEE ALSO * [hugo list](/commands/hugo_list/) - Listing out various types of content -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_list_future.md hugo-0.26/docs/content/commands/hugo_list_future.md --- hugo-0.25.1/docs/content/commands/hugo_list_future.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_list_future.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo list future" slug: hugo_list_future url: /commands/hugo_list_future/ @@ -39,4 +39,4 @@ ### SEE ALSO * [hugo list](/commands/hugo_list/) - Listing out various types of content -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_list.md hugo-0.26/docs/content/commands/hugo_list.md --- hugo-0.25.1/docs/content/commands/hugo_list.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_list.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo list" slug: hugo_list url: /commands/hugo_list/ @@ -39,4 +39,4 @@ * [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 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo.md hugo-0.26/docs/content/commands/hugo.md --- hugo-0.25.1/docs/content/commands/hugo.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo" slug: hugo url: /commands/hugo/ @@ -77,4 +77,4 @@ * [hugo undraft](/commands/hugo_undraft/) - Undraft resets the content's draft status * [hugo version](/commands/hugo_version/) - Print the version number of Hugo -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_new.md hugo-0.26/docs/content/commands/hugo_new.md --- hugo-0.25.1/docs/content/commands/hugo_new.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_new.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo new" slug: hugo_new url: /commands/hugo_new/ @@ -47,4 +47,4 @@ * [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 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_new_site.md hugo-0.26/docs/content/commands/hugo_new_site.md --- hugo-0.25.1/docs/content/commands/hugo_new_site.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_new_site.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo new site" slug: hugo_new_site url: /commands/hugo_new_site/ @@ -42,4 +42,4 @@ ### SEE ALSO * [hugo new](/commands/hugo_new/) - Create new content for your site -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_new_theme.md hugo-0.26/docs/content/commands/hugo_new_theme.md --- hugo-0.25.1/docs/content/commands/hugo_new_theme.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_new_theme.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo new theme" slug: hugo_new_theme url: /commands/hugo_new_theme/ @@ -41,4 +41,4 @@ ### SEE ALSO * [hugo new](/commands/hugo_new/) - Create new content for your site -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_server.md hugo-0.26/docs/content/commands/hugo_server.md --- hugo-0.25.1/docs/content/commands/hugo_server.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_server.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo server" slug: hugo_server url: /commands/hugo_server/ @@ -84,4 +84,4 @@ ### SEE ALSO * [hugo](/commands/hugo/) - hugo builds your site -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_undraft.md hugo-0.26/docs/content/commands/hugo_undraft.md --- hugo-0.25.1/docs/content/commands/hugo_undraft.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_undraft.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo undraft" slug: hugo_undraft url: /commands/hugo_undraft/ @@ -39,4 +39,4 @@ ### SEE ALSO * [hugo](/commands/hugo/) - hugo builds your site -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/hugo_version.md hugo-0.26/docs/content/commands/hugo_version.md --- hugo-0.25.1/docs/content/commands/hugo_version.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/commands/hugo_version.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,5 +1,5 @@ --- -date: 2017-07-06T10:34:39+02:00 +date: 2017-07-16T23:23:14+02:00 title: "hugo version" slug: hugo_version url: /commands/hugo_version/ @@ -37,4 +37,4 @@ ### SEE ALSO * [hugo](/commands/hugo/) - hugo builds your site -###### Auto generated by spf13/cobra on 6-Jul-2017 +###### Auto generated by spf13/cobra on 16-Jul-2017 diff -Nru hugo-0.25.1/docs/content/commands/_index.md hugo-0.26/docs/content/commands/_index.md --- hugo-0.25.1/docs/content/commands/_index.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/commands/_index.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,22 @@ +--- +title: Command Line Reference +linktitle: CLI Overview +description: Comprehensive list of Hugo templating functions, including basic and advanced usage examples. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [commands] +#tags: [cli,command line] +menu: + docs: + parent: "commands" + weight: 1 +weight: 01 #rem +draft: false +aliases: [/cli/] +--- + +The following list contains auto-generated and up-to-date (thanks to [Cobra][]) documentation for all the CLI commands in Hugo. + + +[Cobra]: https://github.com/spf13/cobra diff -Nru hugo-0.25.1/docs/content/community/contributing.md hugo-0.26/docs/content/community/contributing.md --- hugo-0.25.1/docs/content/community/contributing.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/community/contributing.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ ---- -aliases: -- /doc/contributing/ -- /meta/contributing/ -lastmod: 2015-02-12 -date: 2013-07-01 -menu: - main: - parent: community -next: /tutorials/automated-deployments -prev: /community/mailing-list -title: Contributing to Hugo -weight: 30 ---- - -All contributions to Hugo are welcome. Whether you want to scratch an itch or simply contribute to the project, feel free to pick something from the [roadmap]({{< relref "meta/roadmap.md" >}}) or contact the dev team via the [Forums](https://discourse.gohugo.io/) or [Gitter](https://gitter.im/gohugoio/hugo) about what may make sense to do next. - -You should fork the project and make your changes. *We encourage pull requests to discuss code changes.* - - -When you're ready to create a pull request, be sure to: - - * Have test cases for the new code. If you have questions about how to do it, please ask in your pull request. - * Run `go fmt`. - * Squash your commits into a single commit. `git rebase -i`. It's okay to force update your pull request. - * Run `make check` and ensure it succeeds. [Travis CI](https://travis-ci.org/gohugoio/hugo) and [Appveyor](https://ci.appveyor.com/project/gohugoio/hugo) will runs these checks and fail the build if `make check` fails. - -## Contribution Overview - -We wrote a [detailed guide]({{< relref "tutorials/how-to-contribute-to-hugo.md" >}}) for newcomers that guides you step by step to your first contribution. If you are more experienced, follow the guide below. - - -# Building from source - -## Vendored Dependencies - -Hugo uses [govendor][] to vendor dependencies, but we don't commit the vendored packages themselves to the Hugo git repository. -Therefore, a simple `go get` is not supported since `go get` is not vendor-aware. -You **must use govendor** to fetch Hugo's dependencies. - -## Fetch the Sources - - go get github.com/kardianos/govendor - govendor get github.com/gohugoio/hugo - -## Running Hugo - - cd $HOME/go/src/github.com/gohugoio/hugo - go run main.go - -## Building Hugo - - cd $HOME/go/src/github.com/gohugoio/hugo - make build - # or to install to $HOME/go/bin: - make install - - -# Showcase additions - -You got your new website running and it's powered by Hugo? Great. You can add your website with a few steps to the [showcase](/showcase/). - -First, make sure that you created a [fork](https://help.github.com/articles/fork-a-repo/) of the [`hugoDocs`](https://github.com/gohugoio/hugodocs) repository on GitHub and cloned your fork on your local computer. **Next, create a separate branch for your additions**: - -``` -# You can choose a different descriptive branch name if you like -git checkout -b showcase-addition -``` - -Let's create a new document that contains some metadata of your homepage. Replace `example` in the following examples with something unique like the name of your website. Inside the terminal enter the following commands: - -``` -cd docs -hugo new showcase/example.md -``` - -You should find the new file at `content/showcase/example.md`. Open it in an editor. The file should contain a frontmatter with predefined variables like below: - -``` ---- -date: 2016-02-12T21:01:18+01:00 -description: "" -license: "" -licenseLink: "" -sitelink: http://spf13.com/ -sourceLink: https://github.com/spf13/spf13.com -tags: -- personal -- blog -thumbnail: /img/spf13-tn.jpg -title: example ---- -``` - -Add at least values for `sitelink`, `title`, `description` and a path for `thumbnail`. - -Furthermore, we need to create the thumbnail of your website. **It's important that the thumbnail has the required dimensions of 600px by 400px.** Give your thumbnail a name like `example-tn.png`. Save it under `static/img/`. - -Check a last time that everything works as expected. Start Hugo's built-in server in order to inspect your local copy of the showcase in the browser: - - hugo server - -If everything looks fine, we are ready to commit your additions. For the sake of best practices, please make sure that your commit follows our [code contribution guideline](https://github.com/gohugoio/hugo#code-contribution-guideline). - - git commit -m"Add example.com to the showcase" - -Last but not least, we're ready to create a [pull request](https://github.com/gohugoio/hugoDocs/compare). - -Don't forget to accept the contributor license agreement. Click on the yellow badge in the automatically added comment in the pull request. - -[govendor]: https://github.com/kardianos/govendor diff -Nru hugo-0.25.1/docs/content/community/mailing-list.md hugo-0.26/docs/content/community/mailing-list.md --- hugo-0.25.1/docs/content/community/mailing-list.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/community/mailing-list.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ ---- -lastmod: 2015-05-25 -date: 2013-07-01 -menu: - main: - parent: community -next: /community/contributing -prev: /extras/urls -title: Mailing List -weight: 10 ---- - -## Discussion Forum - -Hugo has its own [discussion forum](https://discourse.gohugo.io/) powered by [Discourse](http://www.discourse.org/). - -Please use this for all discussions, questions, etc. - -### Twitter - -Get the latest bite-sized news and themes from the Hugo community on Twitter by following [@gohugoio](http://twitter.com/gohugoio). - -## Mailing List - -Hugo has two mailing lists: - -### Announcements -Very low traffic. Only releases will be emailed here. - -https://groups.google.com/forum/#!forum/hugo-announce - -### Discussion (Archive) - -**This has been replaced with the [Hugo discussion forum](https://discourse.gohugo.io/).** - -It is available for archival purposes. - -https://groups.google.com/forum/#!forum/hugo-discuss - - -## Other Resources - -### GoNuts - -For general Go questions or discussion please refer to the Go mailing list. - -https://groups.google.com/forum/#!forum/golang-nuts - -### GitHub Issues - -https://github.com/gohugoio/hugo/issues diff -Nru hugo-0.25.1/docs/content/community/press.md hugo-0.26/docs/content/community/press.md --- hugo-0.25.1/docs/content/community/press.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/community/press.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,141 +0,0 @@ ---- -lastmod: 2017-03-02 -date: 2014-03-24T20:00:00Z -linktitle: Press -notoc: true -title: Press, Blogs and Media Coverage -weight: 20 ---- - -### Help keep this list up to date - -Know of a post, article or tutorial on Hugo? [Add it to this list](https://github.com/gohugoio/hugo/edit/master/docs/content/community/press.md). - -## Press and Articles - -Hugo has been featured in the following Blog Posts, Press and Media. - - -| Title | Author | Date | -| ------ | ------ | -----: | -| [Build, Test, And Deploy Statically Generated Websites With Hugo & CircleCI](https://circleci.com/blog/build-test-deploy-hugo-sites/)| Ricardo N Feliciano | 2017-05-31 | -| [Hugo Easy Gallery - Automagical PhotoSwipe image gallery with a one-line shortcode](https://www.liwen.id.au/heg/)| Li-Wen Yip | 2017-03-25 | -| [Hugo Tutorial: How to Build & Host a (Very Fast) Static E-Commerce Site](https://snipcart.com/blog/hugo-tutorial-static-site-ecommerce) | Snipcart | 2017-03-12 | -| [Automagical image gallery in Hugo with PhotoSwipe and jQuery](https://www.liwen.id.au/photoswipe/)| Li-Wen Yip | 2017-03-04 | -| [Adding Isso Comments to Hugo](https://stiobhart.net/2017-02-24-isso-comments/) | Stíobhart Matulevicz | 2017-02-24 | -| [Zero to HTTP/2 with AWS and Hugo](https://habd.as/zero-to-http-2-aws-hugo/) | Josh Habdas | 2017-02-16 | -| [How to Password Protect a Hugo Site](https://www.aerobatic.com/blog/password-protect-a-hugo-site/) | Aerobatic | 2017-02-19 | -| [Switching from Wordpress to Hugo](http://schnuddelhuddel.de/switching-from-wordpress-to-hugo/) | Mario Martelli | 2017-02-19 | ] -| [Deploy a Hugo site to Aerobatic with CircleCI ](https://www.aerobatic.com/blog/hugo-github-circleci/) | Aerobatic | 2017-02-14 | -| [NPM scripts for building and deploying Hugo site](https://www.aerobatic.com/blog/hugo-npm-buildtool-setup/) | Aerobatic | 2017-02-12 | -| [Getting started with Hugo and the plain-blog theme, on NearlyFreeSpeech.Net](https://www.penwatch.net/cms/get_started_plain_blog/) | Li-aung “Lewis” Yip | 2017-02-12 | -| [Build a Hugo site using Cloud9 IDE and host on App Engine](https://loyall.ch/lab/2017/01/build-a-static-website-with-cloud9-hugo-and-app-engine/)| Pascal Aubort | 2017-02-05 | -| [Hugo Continuous Deployment with Bitbucket Pipelines and Aerobatic](https://www.aerobatic.com/blog/hugo-bitbucket-pipelines/) | Aerobatic | 2017-02-04 | -| [How to use Firebase to host a Hugo site](https://www.m0d3rnc0ad.com/post/static-site-firebase/) | Andrew Cuga | 2017-02-04 | -| [A publishing workflow for teams using static site generators](https://www.keybits.net/post/publishing-workflow-for-teams-using-static-site-generators/) | Tom Atkins | 2017-01-02 | -| [How To Dynamically Use Google Fonts In A Hugo Website](https://stoned.io/web-development/hugo/How-To-Dynamically-Use-Google-Fonts-In-A-Hugo-Website/) | Hash Borgir | 2016-10-27 | -| [Embedding Facebook In A Hugo Template](https://stoned.io/web-development/hugo/Embedding-Facebook-In-A-Hugo-Template/) | Hash Borgir | 2016-10-22 | -| [通过 Gitlab-cl 将 Hugo blog 自动部署至 GitHub](https://zetaoyang.github.io/post/2016/10/17/gitlab-cl.html) (Chinese, Continious integration) | Zetao Yang | 2016-10-17 | -| [A Step-by-Step Guide: Hugo on Netlify](https://www.netlify.com/blog/2016/09/21/a-step-by-step-guide-hugo-on-netlify/) | Eli Williamson | 2016-09-21 | -| [Building our site: From Django & Wordpress to a static generator (Part I)](https://tryolabs.com/blog/2016/09/20/building-our-site-django-wordpress-to-static-part-i/) | Alan Descoins | 2016-09-20 | -| [Webseitenmaschine - Statische Websites mit Hugo erzeugen](http://www.heise.de/ct/ausgabe/2016-12-Statische-Websites-mit-Hugo-erzeugen-3211704.html) (German, $) | Christian Helmbold | 2016-05-27 | -| [Cómo hacer sitios web estáticos con Hugo y Go - Platzi](https://www.youtube.com/watch?v=qaXXpdiCHXE) (Video tutorial) | Verónica López | 2016-04-06 | -| [CDNOverview: A CDN comparison site made with Hugo](https://www.cloakfusion.com/cdnoverview-cdn-comparison-site-made-hugo/) | Thijs de Zoete | 2016-02-23 | -| [Hugo: A Modern WebSite Engine That Just Works](https://github.com/shekhargulati/52-technologies-in-2016/blob/master/07-hugo/README.md) | Shekhar Gulati | 2016-02-14 | -| [Minify Hugo Generated HTML](http://ratson.name/blog/minify-hugo-generated-html/) | Ratson | 2016-02-02 | -| [HugoのデプロイをWerckerからCircle CIに変更した - log](http://log.deprode.net/logs/2016-01-17/) | Deprode | 2016-01-17 | -| [Static site generators: el futuro de las webs estáticas
(Hugo, Jekyll, Flask y otros)](http://sitelabs.es/static-site-generators-futuro-las-webs-estaticas/) | Eneko Sarasola | 2016-01-09 | -| [Writing a Lambda Function for Hugo](https://blog.jolexa.net/post/writing-a-lambda-function-for-hugo/) | Jeremy Olexa | 2016-01-01 | -| [Ein Blog mit Hugo erstellen - Tutorial](http://privat.albicker.org/tags/hugo.html) (Deutsch/German) | Bernhard Albicker | 2015-12-30 | -| [How to host Hugo static website generator on AWS Lambda](http://bezdelev.com/post/hugo-aws-lambda-static-website/) | Ilya Bezdelev | 2015-12-15 | -| [Migrating from Pelican to Hugo](http://www.softinio.com/post/migrating-from-pelican-to-hugo/) | Salar Rahmanian | 2015-11-29 | -| [Static Website Generators Reviewed: Jekyll, Middleman, Roots, Hugo](http://www.smashingmagazine.com/2015/11/static-website-generators-jekyll-middleman-roots-hugo-review/) | Mathias Biilmann Christensen | 2015-11-16 | -| [How To Deploy a Hugo Site to Production with Git Hooks on Ubuntu 14.04](https://www.digitalocean.com/community/tutorials/how-to-deploy-a-hugo-site-to-production-with-git-hooks-on-ubuntu-14-04) | Justin Ellingwood | 2015-11-12 | -| [How To Install and Use Hugo, a Static Site Generator, on Ubuntu 14.04](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-hugo-a-static-site-generator-on-ubuntu-14-04) | Justin Ellingwood | 2015-11-09 | -| [Switching from Wordpress to Hugo](http://justinfx.com/2015/11/08/switching-from-wordpress-to-hugo/) | Justin Israel | 2015-11-08 | -| [Hands-on Experience with Hugo as a Static Site Generator](http://usersnap.com/blog/hands-on-experience-with-hugo-static-site-generator/) | Thomas Peham | 2015 -10-15 | -| [Statische Webseites mit Hugo erstellen/Vortrag mit Foliensatz (deutsch)](http://sfd.koelnerlinuxtreffen.de/2015/HaraldWeidner/) | Harald Weidner | 2015-09-19 | -| [Moving from WordPress to Hugo](http://abhipandey.com/2015/09/moving-to-hugo/) | Abhishek Pandey | 2015-09-15 | -| [通过webhook将Hugo自动部署至GitHub Pages和GitCafe Pages (Automated deployment)](http://blog.coderzh.com/2015/09/13/use-webhook-automated-deploy-hugo/) | CoderZh | 2015-09-13 | -| [使用hugo搭建个人博客站点 (Using Hugo to build a personal blog site)](http://blog.coderzh.com/2015/08/29/hugo/) | CoderZh | 2015-08-29 | -| [Good-Bye Wordpress, Hello Hugo!](http://blog.arminhanisch.de/2015/08/blog-migration-zu-hugo/) (German) | Armin Hanisch | 2015-08-18 | -| [Générer votre site web statique avec Hugo (Generate your static site with Hugo)](http://www.linux-pratique.com/?p=191) | Benoît Benedetti | 2015-06-26 | -| [Hugo向けの新しいテーマを作った (I created a new theme for Hugo)](https://yet.unresolved.xyz/blog/2016/10/03/how-to-make-of-hugo-theme/) | Daisuke Tsuji | 2015-06-20 | -| [Hugo - Gerando um site com conteúdo estático. (Portuguese Brazil)](http://blog.ffrizzo.com/posts/hugo/) | Fabiano Frizzo | 2015-06-02 | -| [An Introduction to Static Site Generators](http://davidwalsh.name/introduction-static-site-generators) | Eduardo Bouças | 2015-05-20 | -| [Hugo Still Rules](http://cheekycoder.com/2015/05/hugo-still-rules/) | Cheeky Coder | 2015-05-18 | -| [hugo - Static Site Generator](http://gscacco.github.io/post/hugo/) | G Scaccoio | 2015-05-04 | -| [WindowsでHugoを使う](http://ureta.net/2015/05/hugo-on-windows/) | うれ太郎 | 2015-05-01 | -| [Hugoのshortcodesを用いてサイトにスライドなどを埋め込む](http://blog.yucchiy.com/2015/04/29/hugo-shortcode/) | Yucchiy | 2015-04-29 | -| [HugoとCircleCIでGitHub PagesにBlogを公開してみたら超簡単だった](http://hori-ryota.github.io/blog/create-blog-with-hugo-and-circleci/) | Hori Ryota | 2015-04-17 | -| [10 Best Static Site Generators](http://beebom.com/2015/04/best-static-site-generators) | Aniruddha Mysore | 2015-04-06 | -| [Goodbye WordPress; Hello Hugo](http://willwarren.com/2015/04/05/goodbye-wordpress-hello-hugo/) | Will Warren | 2015-04-05 | -| [Static Websites with Hugo on Google Cloud Storage](http://www.moxie.io/post/static-websites-with-hugo-on-google-cloud-storage/) | Moxie Input/Output | 2015-04-02 | -| [De nuevo iniciando un blog](https://alvarolizama.net/) | Alvaro Lizama | 2015-03-29 | -| [We moved our blog from Posthaven to Hugo after only three posts. Why?](http://blog.hypriot.com/post/moved-from-posthaven-to-hugo/) | Hypriot | 2015-03-27 | -| [Top Static Site Generators in 2015](http://superdevresources.com/static-site-generators-2015/) | Kanishk Kunal | 2015-03-12 | -| [Moving to Hugo](http://abiosoft.com/moving-to-hugo/) | Abiola Ibrahim | 2015-03-08 | -| [Migrating a blog (yes, this one!) from Wordpress to Hugo](http://justindunham.net/migrating-from-wordpress-to-hugo/) | Justin Dunham | 2015-02-13 | -| [blogをoctopressからHugoに乗り換えたメモ](http://blog.jigyakkuma.org/2015/02/11/hugo/) | jigyakkuma | 2015-02-11 | -| [Hugoでブログをつくった](http://porgy13.github.io/post/new-hugo-blog/) | porgy13 | 2015-02-07 | -| [Hugoにブログを移行した](http://keichi.net/post/first/) | Keichi Takahashi | 2015-02-04 | -| [Hugo静态网站生成器中文教程](http://nanshu.wang/post/2015-01-31/) | Nanshu Wang | 2015-01-31 | -| [Hugo + GitHub Pages + Wercker CI = ¥0(無料)
でコマンド 1 発(自動化)でサイト
・ブログを公開・運営・分析・収益化
](http://qiita.com/yoheimuta/items/8a619cac356bed89a4c9) | Yohei Yoshimuta | 2015-01-31 | -| [Running Hugo websites on anynines](http://blog.anynines.com/running-hugo-websites-on-anynines/) | Julian Weber | 2015-01-30 | -| [MiddlemanからHugoへ移行した](http://re-dzine.net/2015/01/hugo/) | Haruki Konishi | 2015-01-21 | -| [WordPress から Hugo に乗り換えました](http://rakuishi.com/archives/wordpress-to-hugo/) | rakuishi | 2015-01-20 | -| [HUGOを使ってサイトを立ち上げる方法](http://qiita.com/syui/items/869538099551f24acbbf) | Syui | 2015-01-17 | -| [Jekyllが許されるのは小学生までだよね](http://t32k.me/mol/log/hugo/) | Ishimoto Koji | 2015-01-16 | -| [Getting started with Hugo](http://anthonyfok.org/post/getting-started-with-hugo/) | Anthony Fok | 2015-01-12 | -| [把这个博客静态化了 (Migrate to Hugo)](http://lich-eng.com/2015/01/03/migrate-to-hugo/)| Li Cheng | 2015-01-03 | -| [Porting my blog with Hugo](http://blog.srackham.com/posts/porting-my-blog-with-hugo/) | Stuart Rackham | 2014-12-30 | -| [Hugoを使ってみたときのメモ](http://machortz.github.io/posts/usinghugo/) | Machortz | 2014-12-29 | -| [OctopressからHugoへ移行した](http://deeeet.com/writing/2014/12/25/hugo/) | Taichi Nakashima | 2014-12-25 | -| [Migrating to Hugo From Octopress](http://nathanleclaire.com/blog/2014/12/22/migrating-to-hugo-from-octopress/) | Nathan LeClaire | 2014-12-22 | -| [Dynamic Pages with GoHugo.io](http://cyrillschumacher.com/2014/12/21/dynamic-pages-with-gohugo.io/) | Cyrill Schumacher | 2014-12-21 | -| [6 Static Blog Generators That Aren’t Jekyll](http://www.sitepoint.com/6-static-blog-generators-arent-jekyll/) | David Turnbull | 2014-12-08 | -| [Travel Blogging Setup](http://www.stou.dk/2014/11/travel-blogging-setup/) | Rasmus Stougaard | 2014-11-23 | -| [Hosting A Hugo Website Behind Nginx](http://www.bigbeeconsultants.co.uk/blog/hosting-hugo-website-behind-nginx) | Rick Beton | 2014-11-20 | -| [使用Hugo搭建免费个人Blog (How to use Hugo)](http://ulricqin.com/post/how-to-use-hugo/) | Ulric Qin 秦晓辉 | 2014-11-11 | -| [Built in Speed and Built for Speed by Hugo](http://cheekycoder.com/2014/10/built-for-speed-by-hugo/) | Cheeky Coder | 2014-10-30 | -| [Hugo para crear sitios web estáticos](http://www.webbizarro.com/noticias/1076/hugo-para-crear-sitios-web-estaticos/) | Web Bizarro | 2014-08-19 | -| [Going with hugo](http://www.markuseliasson.se/article/going-with-hugo/) | Markus Eliasson | 2014-08-18 | -| [Benchmarking Jekyll, Hugo and Wintersmith](http://fredrikloch.me/post/2014-08-12-Jekyll-and-its-alternatives-from-a-site-generation-point-of-view/) | Fredrik Loch | 2014-08-12 | -| [Goodbye Octopress, Hello Hugo!](http://andreimihu.com/blog/2014/08/11/goodbye-octopress-hello-hugo/) | Andrei Mihu | 2014-08-11 | -| [Beautiful sites for Open Source projects](http://beautifulopen.com/2014/08/09/hugo/) | Beautiful Open | 2014-08-09 | -| [Hugo: Beyond the Defaults](http://npf.io/2014/08/hugo-beyond-the-defaults/) | Nate Finch | 2014-08-08 | -| [First Impressions of Hugo](https://peteraba.com/blog/first-impressions-of-hugo/) | Peter Aba | 2014-06-06 | -| [New Site Workflow](http://vurt.co.uk/post/new_website/) | Giles Paterson | 2014-08-05 | -| [How I Learned to Stop Worrying and Love the (Static) Web](http://cognition.ca/post/about-hugo/) | Joshua McKenty | 2014-08-04 | -| [Hugo - Static Site Generator](http://kenwoo.io/blog/hugo---static-site-generator/) | Kenny Woo | 2014-08-03 | -| [Hugo Is Friggin' Awesome](http://npf.io/2014/08/hugo-is-awesome/) | Nate Finch | 2014-08-01 | -| [再次搬家 (Move from WordPress to Hugo)](http://www.chingli.com/misc/move-from-wordpress-to-hugo/) | 青砾 (chingli) | 2014-07-12 | -| [Embedding Gists in Hugo](http://danmux.com/posts/embedded_gists/) | Dan Mull | 2014-07-05 | -| [An Introduction To Hugo](http://www.cirrushosting.com/web-hosting-blog/an-introduction-to-hugo/) | Dan Silber | 2014-07-01 | -| [Moving to Hugo](http://danmux.com/posts/hugo_based_blog/) | Dan Mull | 2014-05-29 | -| [开源之静态站点生成器排行榜
(Leaderboard of open-source static website generators)](http://code.csdn.net/news/2819909) | CSDN.net | 2014-05-23 | -| [Finally, a satisfying and effective blog setup](http://michaelwhatcott.com/now-powered-by-hugo/) | Michael Whatcott | 2014-05-20 | -| [Hugo from scratch](http://zackofalltrades.com/notes/2014/05/hugo-from-scratch/) | Zack Williams | 2014-05-18 | -| [Why I switched away from Jekyll](http://www.jakejanuzelli.com/why-I-switched-away-from-jekyll/) | Jake Januzelli | 2014-05-10 | -| [Welcome our new blog](http://blog.ninya.io/posts/welcome-our-new-blog/) | Ninya.io | 2014-04-11 | -| [Mission Not Accomplished](http://johnsto.co.uk/blog/mission-not-accomplished/) | Dave Johnston | 2014-04-03 | -| [Hugo - A Static Site Builder in Go](http://deepfriedcode.com/post/hugo/) | Deep Fried Code | 2014-03-30 | -| [Adventures in Angular Podcast](http://devchat.tv/adventures-in-angular/003-aia-gdes) | Matias Niemela | 2014-03-28 | -| [Hugo](http://bra.am/post/hugo/) | bra.am | 2014-03-23 | -| [Converting Blogger To Markdown](http://trishagee.github.io/project/atom-to-hugo/) | Trisha Gee | 2014-03-20 | -| [Moving to Hugo Static Web Pages](http://tepid.org/tech/hugo-web/) | Tobias Weingartner | 2014-03-16 | -| [New Blog Engine: Hugo](https://blog.afoolishmanifesto.com/posts/hugo/) | fREW Schmidt | 2014-03-15 | -| [Hugo + gulp.js = Huggle](http://ktmud.github.io/huggle/en/intro/) ([English](http://ktmud.github.io/huggle/en/intro/), [中文](http://ktmud.github.io/huggle/zh/intro/)) | Jesse Yang 杨建超 | 2014-03-08 | -| [Powered by Hugo](http://kieranhealy.org/blog/archives/2014/02/24/powered-by-hugo/) | Kieran Healy | 2014-02-24 | -| [静的サイトを素早く構築するために
GoLangで作られたジェネレータHugo
](http://hamasyou.com/blog/2014/02/21/hugo/)|
Shogo Hamada
濱田章吾
| 2014-02-21 | -| [Latest Roundup of Useful Tools For Developers](http://codegeekz.com/latest-roundup-of-useful-tools-for-developers/) | CodeGeekz | 2014-02-13 | -| [Hugo: Static Site Generator written in Go](http://www.braveterry.com/2014/02/06/hugo-static-site-generator-written-in-go/) | Brave Terry | 2014-02-06 | -| [10 Useful HTML5 Tools for Web Designers and Developers](http://designdizzy.com/10-useful-html5-tools-for-web-designers-and-developers/) | Design Dizzy | 2014-02-04 | -| [Hugo – Fast, Flexible Static Site Generator](http://cube3x.com/hugo-fast-flexible-static-site-generator/) | Joby Joseph | 2014-01-18 | -| [Hugo: A new way to build static website](http://www.w3update.com/opensource/hugo-a-new-way-to-build-static-website.html) | w3update | 2014-01-17 | -| [Xaprb now uses Hugo](http://xaprb.com/blog/2014/01/15/using-hugo/) | Baron Schwartz | 2014-01-15 | -| [New jQuery Plugins And Resources That Web Designers Need](http://www.designyourway.net/blog/resources/new-jquery-plugins-and-resources-that-web-designers-need/) | Design Your Way | 2014-01-01 | -| [On Blog Construction](http://alexla.sh/post/on-blog-construction/) | Alexander Lash | 2013-12-27 | -| [Hugo](http://onethingwell.org/post/69070926608/hugo) | One Thing Well | 2013-12-05 | -| [In Praise Of Hugo](http://sound-guru.com/blog/post/hello-world/) | sound-guru.com | 2013-10-19 | -| [Hosting a blog on S3 and Cloudfront](http://www.danesparza.net/2013/07/hosting-a-blog-on-s3-and-cloudfront/) | Dan Esparza | 2013-07-24 | diff -Nru hugo-0.25.1/docs/content/content/archetypes.md hugo-0.26/docs/content/content/archetypes.md --- hugo-0.25.1/docs/content/content/archetypes.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/content/archetypes.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,330 +0,0 @@ ---- -lastmod: 2016-10-01 -date: 2014-05-14T02:13:50Z -menu: - main: - parent: content -next: /content/ordering -prev: /content/types -title: Archetypes -weight: 50 -toc: true ---- - -Typically, each piece of content you create within a Hugo project will have [front matter](/content/front-matter/) that follows a consistent structure. If you write blog posts, for instance, you might use the following front matter for the vast majority of those posts: - -```toml -+++ -title = "" -date = "" -slug = "" -tags = [ - "" -] -categories = [ - "" -] -draft = true -+++ -``` - -You can always add non-typical front matter to any piece of content, but since it takes extra work to develop a theme that handles unique metadata, consistency is simpler. - -With this in mind, Hugo has a convenient feature known as *archetypes* that allows users to define default front matter for new pieces of content. - -By using archetypes, we can: - -1. **Save time**. Stop writing the same front matter over and over again. -2. **Avoid errors**. Reduce the odds of typos, improperly formatted syntax, and other simple mistakes. -3. **Focus on more important things**. Avoid having to remember all of the fields that need to be associated with each piece of content. (This is particularly important for larger projects with complex front matter and a variety of content types.) - -Let's explore how they work. - -## Built-in Archetypes - -If you've been using Hugo for a while, there's a decent chance you've come across archetypes without even realizing it. This is because Hugo includes a basic, built-in archetype that is used by default whenever it generates a content file. - -To see this in action, open the command line, navigate into your project's directory, and run the following command: - -```bash -hugo new hello-world.md -``` - -This `hugo new` command creates a new content file inside the project's `content` directory — in this case, a file named `hello-world.md` — and if you open this file, you'll notice it contains the following front matter: - -```toml -+++ -date = "2017-05-31T15:18:11+10:00" -draft = true -title = "hello world" -+++ -``` - -Here, we can see that three fields have been added to the document: a `title` field that is based on the file name we defined, a `draft` field that ensures this content won't be published by default, and a `date` field that is auto-populated with the current date and time in the [RFC 3339](https://stackoverflow.com/questions/522251/whats-the-difference-between-iso-8601-and-rfc-3339-date-formats) format. - -This, in its most basic form, is an example of an archetype. To understand how useful they can be though, it's best if we create our own. - -## Creating Archetypes - -In this section, we're going to create an archetype that will override the built-in archetype, allowing us to define custom front matter that will be included in any content files that we generate with the `hugo new` command. - -To achieve this, create a file named `default.md` inside the `archetypes` folder of a Hugo project. (If the folder doesn't exist, create it.) - -Then, inside this file, define the following front matter: - -```toml -+++ -slug = "" -tags = [] -categories = [] -draft = true -+++ -``` - -You'll notice that we haven't defined a `title` or `date` field. This is because Hugo will automatically add these fields to the beginning of the front matter. We do, however, need to define the `draft` field if we want it to exist in our front matter. - -You'll also notice that we're writing the front matter in the TOML format. It's possible to define archetype front matter in other formats, but a setting needs to be changed in the configuration file for this to be possible. See the "[Archetype Formats](#archetype-formats)" section of this article for more details. - -Next, run the following command: - -```bash -hugo new my-archetype-example.md -``` - -This command will generate a file named `my-archetype-example.md` inside the `content` directory, and this file will contain the following output: - -```toml -+++ -categories = [] -date = "2017-05-31T15:21:13+10:00" -draft = true -slug = "" -tags = [] -title = "my archetype example" -+++ -``` - -As we can see, the file contains the `title` and `date` property that Hugo created for us, along with the front matter that we defined in the `archetypes/default.md` file. - -You'll also notice that the fields have been sorted into alphabetical order. This is an unintentional side-effect that stems from the underlying code libraries that Hugo relies upon. It is, however, [a known issue that is actively being discussed](https://github.com/gohugoio/hugo/issues/452). - -## Section Archetypes - -By creating the `archetypes/default.md` file, we've created a default archetype that is more useful than the built-in archetype, but since Hugo encourages us to [organize our content into sections](/content/sections/), each of which will likely have different front matter requirements, a "one-size-fits-all" archetype isn't necessarily the best approach. - -To accommodate for this, Hugo allows us to create archetypes for each section of our project. This means, whenever we generate content for a certain section, the appropriate front matter for that section will be automatically included in the generated file. - -To see this in action, create a "photo" section by creating a directory named "photo" inside the `content` directory. - -Then create a file named `photo.md` inside the `archetypes` directory and include the following front matter inside this file: - -```toml -+++ -image_url = "" -camera = "" -lens = "" -aperture = "" -iso = "" -draft = true -+++ -``` - -Here, the critical detail is that the `photo.md` file in the `archetypes` directory is named after the `photo` section that we just created. By sharing a name, Hugo can understand that there's a relationship between them. - -Next, run the following command: - -```bash -hugo new photo/my-pretty-cat.md -``` - -This command will generate a file named `my-pretty-cat.md` inside the `content/photo` directory, and this file will contain the following output: - -```toml -+++ -aperture = "" -camera = "" -date = "2017-05-31T15:25:18+10:00" -draft = true -image_url = "" -iso = "" -lens = "" -title = "my pretty cat" -+++ -``` - -As we can see, the `title` and `date` fields are still included by Hugo, but the rest of the front matter is being generated from the `photo.md` archetype instead of the `default.md` archetype. - -### Tip: Default Values - -To make archetypes more useful, define default values for any fields that will always be set to a range of limited options. In the case of the `photo.md` archetype, for instance, you could include lists of the various cameras and lenses that you own: - -```toml -+++ -image_url = "" -camera = [ - "Sony RX100 Mark IV", - "Canon 5D Mark III", - "iPhone 6S" -] -lens = [ - "Canon EF 50mm f/1.8", - "Rokinon 14mm f/2.8" -] -aperture = "" -iso = "" -draft = true -+++ -``` - -Then, after generating a content file, simply remove the values that aren't relevant. This saves you from typing out the same options over and over again while ensuring consistency in how they're written. - -## Scaffolding Content - -Archetypes aren't limited to defining default front matter. They can also be used to define a default structure for the body of Markdown documents. - -For example, imagine creating a `review.md` archetype for the purpose of writing camera reviews. This is what the front matter for such an archetype might look like: - -```toml -+++ -manufacturer = "" -model = "" -price = "" -releaseDate = "" -rating = "" -+++ -``` - -But reviews tend to follow strict formats and need to answer specific questions, and it's with these expectations of precise structure that archetypes can prove to be even more useful. - -For the sake of writing reviews, for instance, we could define the structure of a review beneath the front matter of the `review.md` file: - -```markdown -+++ -manufacturer = "" -model = "" -price = "" -releaseDate = "" -rating = "" -+++ - -## Introduction - -## Sample Photos - -## Conclusion -``` - -Then, whenever we use the `hugo new` command to create a new review, not only will the default front matter be copied into the newly created Markdown document, but the body of the `review.md` archetype will also be copied. - -To take this further though — and to ensure authors on multi-author websites are on the same page about how content should be written — we could include notes and reminders within the archetype: - -```markdown -+++ -manufacturer = "" -model = "" -price = "" -releaseDate = "" -rating = "" -+++ - -## Introduction - - - -## Sample Photos - - - -## Conclusion - - - -``` - -That way, each time we generate a new content file, we have a series of handy notes to push us closer to a piece of writing that's suitable for publishing. - -(If you're wondering why the notes are wrapped in the HTML comment syntax, it's to ensure they won't appear inside the preview window of whatever Markdown editor the author happens to be using. They're not strictly necessary though.) - -This is still a fairly simple example, but if your content usually contains a variety of components — headings, bullet-points, images, [short-codes](/extras/shortcodes/), etc — it's not hard to see the time-saving benefits of placing these components in the body of an archetype file. - -## Theme Archetypes - -Whenever you generate a content file with the `hugo new` command, Hugo will start by searching for archetypes in the `archetypes` directory, initially looking for an archetype that matches the content's section and falling-back on the `default.md` archetype (if one is present). If no archetypes are found in this directory, Hugo will continue its search in the `archetypes` directory of the currently active theme. In other words, it's possible for themes to come packaged with their own archetypes, ensuring that users of that theme format their content files with correctly structured front matter. - -To allow Hugo to use archetypes from a theme, [that theme must be activated via the project's configuration file](/themes/usage/): - -```toml -theme = "ThemeNameGoesHere" -``` - -If an archetype doesn't exist in the `archetypes` directory at the top-level of a project or inside the `archetypes` directory of an active theme, the built-in archetype will be used. - -{{< figure src="/img/content/archetypes/archetype-hierarchy.png" alt="How Hugo Decides Which Archetype To Use" >}} - -## Archetype Formats - -By default, the `hugo new` command will generate front matter in the TOML format. This means, even if we define the front matter in our archetype files as YAML or JSON, it will be converted to the TOML format before it ends up in our content files. - -Fortunately, this functionality can be overwritten. - -Inside the project's configuration file, simply define a `metaDataFormat` property: - -```toml -metaDataFormat = "" -``` - -Then set this property to any of the following values: - -* toml -* yaml -* json - -By defining this option, any front matter will be generated in your preferred format. - -It's worth noting, however, that when generating front matter in the TOML format, you might encounter the following error: - -```bash -Error: cannot convert type to TomlTree -``` - -This is because, to generate TOML, all of the fields in the front matter need to have a default value, even if that default value is just an empty string. - -For example, this YAML would *not* successfully compile into the TOML format: - -```yaml ---- -slug: -tags: -categories: -draft: ---- -``` - -But this YAML *would* successfully compile: - -```yaml ---- -slug: "" -tags: - - -categories: - - -draft: true ---- -``` - -It's a subtle yet important detail to remember. - -## Notes - -* Prior to Hugo v0.13, some users received [an "EOF" error when using archetypes](https://github.com/gohugoio/hugo/issues/776), related to what text editor they used to create the archetype. As of Hugo v0.13, this error has been [resolved](https://github.com/gohugoio/hugo/pull/785). diff -Nru hugo-0.25.1/docs/content/content/example.md hugo-0.26/docs/content/content/example.md --- hugo-0.25.1/docs/content/content/example.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/content/example.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ ---- -aliases: -- /doc/example/ -lastmod: 2015-12-23 -date: 2013-07-01 -linktitle: Example -menu: - main: - parent: content -prev: /content/multilingual -next: /content/using-index-md -notoc: true -title: Example Content File -weight: 70 ---- - -Some things are better shown than explained. The following is a very basic example of a content file written in [Markdown](https://help.github.com/articles/github-flavored-markdown/): - -**mysite/content/project/nitro.md → http://mysite.com/project/nitro.html** - -With TOML front matter: - -
+++
-date        = "2013-06-21T11:27:27-04:00"
-title       = "Nitro: A quick and simple profiler for Go"
-description = "Nitro is a simple profiler for your Golang applications"
-tags        = [ "Development", "Go", "profiling" ]
-topics      = [ "Development", "Go" ]
-slug        = "nitro"
-project_url = "https://github.com/spf13/nitro"
-+++
-# Nitro
-
-Quick and easy performance analyzer library for [Go](http://golang.org/).
-
-## Overview
-
-Nitro is a quick and easy performance analyzer library for Go.
-It is useful for comparing A/B against different drafts of functions
-or different functions.
-
-## Implementing Nitro
-
-Using Nitro is simple. First, use `go get` to install the latest version
-of the library.
-
-    $ go get github.com/spf13/nitro
-
-Next, include nitro in your application.
-
- -You may also use the equivalent YAML front matter: - -```yaml ---- -lastmod: 2015-12-23 -date: "2013-06-21T11:27:27-04:00" -title: "Nitro: A quick and simple profiler for Go" -description: "Nitro is a simple profiler for your Go lang applications" -tags: [ "Development", "Go", "profiling" ] -topics: [ "Development", "Go" ] -slug: "nitro" -project_url: "https://github.com/spf13/nitro" ---- -``` - -`nitro.md` would be rendered as follows: - -> # Nitro -> -> Quick and easy performance analyzer library for [Go](http://golang.org/). -> -> ## Overview -> -> Nitro is a quick and easy performance analyzer library for Go. -> It is useful for comparing A/B against different drafts of functions -> or different functions. -> -> ## Implementing Nitro -> -> Using Nitro is simple. First, use `go get` to install the latest version -> of the library. -> -> $ go get github.com/spf13/nitro -> -> Next, include nitro in your application. - -The source `nitro.md` file is converted to HTML by the excellent -[Blackfriday](https://github.com/russross/blackfriday) Markdown processor, -which supports extended features found in the popular -[GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown/). diff -Nru hugo-0.25.1/docs/content/content/front-matter.md hugo-0.26/docs/content/content/front-matter.md --- hugo-0.25.1/docs/content/content/front-matter.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/content/front-matter.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ ---- -aliases: -- /doc/front-matter/ -lastmod: 2015-12-23 -date: 2013-07-01 -menu: - main: - parent: content -next: /content/sections -prev: /content/organization -title: Front Matter -weight: 20 -toc: true ---- - -The **front matter** is one of the features that gives Hugo its strength. It enables -you to include the meta data of the content right with it. Hugo supports a few -different formats, each with their own identifying tokens. - -Supported formats: - - * **[TOML][]**, identified by '`+++`'. - * **[YAML][]**, identified by '`---`'. - * **[JSON][]**, a single JSON object which is surrounded by '`{`' and '`}`', followed by a newline. - -[TOML]: https://github.com/toml-lang/toml "Tom's Obvious, Minimal Language" -[YAML]: http://www.yaml.org/ "YAML Ain't Markup Language" -[JSON]: http://www.json.org/ "JavaScript Object Notation" - -## TOML Example - -
+++
-title = "spf13-vim 3.0 release and new website"
-description = "spf13-vim is a cross platform distribution of vim plugins and resources for Vim."
-tags = [ ".vimrc", "plugins", "spf13-vim", "vim" ]
-date = "2012-04-06"
-categories = [
-  "Development",
-  "VIM"
-]
-slug = "spf13-vim-3-0-release-and-new-website"
-+++
-Content of the file goes Here
-
- -## YAML Example - -```yaml ---- -title: "spf13-vim 3.0 release and new website" -description: "spf13-vim is a cross platform distribution of vim plugins and resources for Vim." -tags: [ ".vimrc", "plugins", "spf13-vim", "vim" ] -lastmod: 2015-12-23 -date: "2012-04-06" -categories: - - "Development" - - "VIM" -slug: "spf13-vim-3-0-release-and-new-website" ---- - -Content of the file goes Here -``` - -## JSON Example - -```json -{ - "title": "spf13-vim 3.0 release and new website", - "description": "spf13-vim is a cross platform distribution of vim plugins and resources for Vim.", - "tags": [ ".vimrc", "plugins", "spf13-vim", "vim" ], - "date": "2012-04-06", - "categories": [ - "Development", - "VIM" - ], - "slug": "spf13-vim-3-0-release-and-new-website" -} - -Content of the file goes Here -``` - -## Variables - -There are a few predefined variables that Hugo is aware of and utilizes. The user can also create -any variable they want. These will be placed into the `.Params` variable available to the templates. -Field names are always normalized to lowercase (e.g. `camelCase: true` is available as `.Params.camelcase`). - -### Required variables - -* **title** The title for the content -* **description** The description for the content -* **date** The date the content will be sorted by -* **taxonomies** These will use the field name of the plural form of the index (see tags and categories above) - -### Optional variables - -* **aliases** An array of one or more aliases - (e.g. old published path of a renamed content) - that would be created to redirect to this content. - See [Aliases]({{< relref "extras/aliases.md" >}}) for details. -* **draft** If true, the content will not be rendered unless `hugo` is called with `--buildDrafts` -* **publishdate** If in the future, content will not be rendered unless `hugo` is called with `--buildFuture` -* **expirydate** Content already expired will not be rendered unless `hugo` is called with `--buildExpired` -* **type** The type of the content (will be derived from the directory automatically if unset) -* **isCJKLanguage** If true, explicitly treat the content as CJKLanguage (`.Summary` and `.WordCount` can work properly in CJKLanguage) -* **weight** Used for sorting -* **markup** *(Experimental)* Specify `"rst"` for reStructuredText (requires - `rst2html`) or `"md"` (default) for Markdown -* **slug** appears as tail of the url. It can be used to change the part of the url that is based on the filename. -* **url** The full path to the content from the web root. It makes no assumptions about the path of the content file. It also ignores any language prefixes of the multilingual feature. - -*If neither `slug` or `url` is present, the filename will be used.* - -## Configure Blackfriday rendering - -It's possible to set some options for Markdown rendering in the page's front matter as an override to the site wide configuration. - -See [Configuration]({{< ref "overview/configuration.md#configure-blackfriday-rendering" >}}) for more. - diff -Nru hugo-0.25.1/docs/content/content/markdown-extras.md hugo-0.26/docs/content/content/markdown-extras.md --- hugo-0.25.1/docs/content/content/markdown-extras.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/content/markdown-extras.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ ---- -aliases: -- /doc/supported-formats/ -lastmod: 2016-07-22 -date: 2016-07-22 -menu: - main: - parent: content -prev: /content/summaries -next: /content/multilingual -title: Markdown Extras -weight: 66 -toc: false ---- - -Hugo provides some convenient markdown extensions. - -## Task lists - -Hugo supports GitHub styled task lists (TODO lists) for the Blackfriday renderer (md-files). See [Blackfriday config](/overview/configuration/#configure-blackfriday-rendering) for how to turn it off. - -Example: - -```markdown -- [ ] a task list item -- [ ] list syntax required -- [ ] incomplete -- [x] completed -``` - -Renders as: - -- [ ] a task list item -- [ ] list syntax required -- [ ] incomplete -- [x] completed - - -And produces this HTML: - -```html - -
    -
  • a task list item
  • -
  • list syntax required
  • -
  • incomplete
  • -
  • completed
  • -
-``` diff -Nru hugo-0.25.1/docs/content/content/multilingual.md hugo-0.26/docs/content/content/multilingual.md --- hugo-0.25.1/docs/content/content/multilingual.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/content/multilingual.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,232 +0,0 @@ ---- -date: 2016-01-02T21:21:00Z -menu: - main: - parent: content -prev: /content/markdown-extras -next: /content/example -title: Multilingual Mode -weight: 68 -toc: true ---- -Hugo supports multiple languages side-by-side (added in `Hugo 0.17`). Define the available languages in a `Languages` section in your top-level `config.toml` (or equivalent). - -Example: - -``` -DefaultContentLanguage = "en" -copyright = "Everything is mine" - -[params.navigation] -help = "Help" - -[Languages] -[Languages.en] -title = "My blog" -weight = 1 -[Languages.en.params] -linkedin = "english-link" - -[Languages.fr] -copyright = "Tout est à moi" -title = "Mon blog" -weight = 2 -[Languages.fr.params] -linkedin = "lien-francais" -[Languages.fr.navigation] -help = "Aide" - -``` - -Anything not defined in a `[Languages]` block will fall back to the global -value for that key (like `copyright` for the English (`en`) language in this example). - -With the config above, all content, sitemap, RSS feeds, paginations -and taxonomy pages will be rendered below `/` in English (your default content language), and below `/fr` in French. - -When working with params in frontmatter pages, omit the `params` in the key for the translation. - -If you want all of the languages to be put below their respective language code, enable `defaultContentLanguageInSubdir: true` in your configuration. - -Only the obvious non-global options can be overridden per language. Examples of global options are `BaseURL`, `BuildDrafts`, etc. - -Taxonomies and Blackfriday configuration can also be set per language, example: - -``` -[Taxonomies] -tag = "tags" - -[blackfriday] -angledQuotes = true -hrefTargetBlank = true - -[Languages] -[Languages.en] -weight = 1 -title = "English" -[Languages.en.blackfriday] -angledQuotes = false - -[Languages.fr] -weight = 2 -title = "Français" -[Languages.fr.Taxonomies] -plaque = "plaques" -``` - - -### Translating your content - -Translated articles are identified by the name of the content file. - -Example of translated articles: - -1. `/content/about.en.md` -2. `/content/about.fr.md` - -You can also have: - -1. `/content/about.md` -2. `/content/about.fr.md` - -In which case the config variable `defaultContentLanguage` will be used to affect the default language `about.md`. This way, you can -slowly start to translate your current content without having to rename everything. - -If left unspecified, the value for `defaultContentLanguage` defaults to `en`. - -By having the same _base file name_, the content pieces are linked together as translated pieces. - -If you need distinct URLs per language you can set the slug in the non-default language file. Just define the custom slug for the french translation in your `/content/about.fr.md` file: - -``` ---- -slug: "a-propos" ---- -``` - -You will get both `/about/` and `/a-propos/` URLs in your build, properly linked as translated pieces. - -### Link to translated content - -To create a list of links to translated content, use a template similar to this: - -``` -{{ if .IsTranslated }} -

{{ i18n "translations" }}

- -{{ end }} -``` -The above can be put in a `partial` and included in any template, be it for a content page or the home page. It will not print anything if there are no translations for a given page, or if it is -- in the case of the home page, section listing etc. -- a site with only one language. - -The above also uses the `i18n` func, see [Translation of strings](#translation-of-strings). - -### Translation of strings - -Hugo uses [go-i18n](https://github.com/nicksnyder/go-i18n) to support string translations. Follow the link to find tools to manage your translation workflows. - -Translations are collected from the `themes/[name]/i18n/` folder (built into the theme), as well as translations present in `i18n/` at the root of your project. In the `i18n`, the translations will be merged and take precedence over what is in the theme folder. Language files should be named according to RFC 5646 with names such as `en-US.toml`, `fr.toml`, etc. - -From within your templates, use the `i18n` function like this: - -``` -{{ i18n "home" }} -``` - -This uses a definition like this one in `i18n/en-US.toml`: - -``` -[home] -other = "Home" -``` - -Often you will want to use to the page variables in the translations strings. To do that, pass on the "." context when calling `i18n`: - -``` -{{ i18n "wordCount" . }} -``` - -This uses a definition like this one in `i18n/en-US.toml`: - -``` -[wordCount] -other = "This article has {{ .WordCount }} words." -``` -An example of singular and plural form: - -``` -[readingTime] -one = "One minute read" -other = "{{.Count}} minutes read" -``` -And then in the template: - -``` -{{ i18n "readingTime" .ReadingTime }} -``` -To track down missing translation strings, run Hugo with the `--i18n-warnings` flag: - -```bash - hugo --i18n-warnings | grep i18n -i18n|MISSING_TRANSLATION|en|wordCount -``` - -### Menus - -You can define your menus for each language independently. The [creation of a menu]({{< relref "extras/menus.md" >}}) works analogous to earlier versions of Hugo, except that they have to be defined in their language-specific block in the configuration file: - -```toml -defaultContentLanguage = "en" - -[languages.en] -weight = 0 -languageName = "English" - -[[languages.en.menu.main]] -url = "/" -name = "Home" -weight = 0 - - -[languages.de] -weight = 10 -languageName = "Deutsch" - -[[languages.de.menu.main]] -url = "/" -name = "Startseite" -weight = 0 -``` - -The rendering of the main navigation works as usual. `.Site.Menus` will just contain the menu of the current language. Pay attention to the generation of the menu links. `absLangURL` takes care that you link to the correct locale of your website. Otherwise, both menu entries would link to the English version because it's the default content language that resides in the root directory. - -```html -
    - {{- $currentPage := . -}} - {{ range .Site.Menus.main -}} -
  • - {{ .Name }} -
  • - {{- end }} -
- -``` - -### Missing translations - -If a string does not have a translation for the current language, Hugo will use the value from the default language. If no default value is set, an empty string will be shown. - -While translating a Hugo site, it can be handy to have a visual indicator of missing translations. The `EnableMissingTranslationPlaceholders` config option will flag all untranslated strings with the placeholder `[i18n] identifier`, where `identifier` is the id of the missing translation. - -**Remember: Hugo will generate your website with these placeholders. It might not be suited for production environments.** - -### Multilingual Themes support - -To support Multilingual mode in your themes, some considerations must be taken for the URLs in the templates. If there are more than one language, URLs must either come from the built-in `.Permalink` or `.URL`, be constructed with `relLangURL` or `absLangURL` template funcs -- or prefixed with `{{.LanguagePrefix }}`. - -If there are more than one language defined, the`LanguagePrefix` variable will equal `"/en"` (or whatever your `CurrentLanguage` is). If not enabled, it will be an empty string, so it is harmless for single-language sites. diff -Nru hugo-0.25.1/docs/content/content/ordering.md hugo-0.26/docs/content/content/ordering.md --- hugo-0.25.1/docs/content/content/ordering.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/content/ordering.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ ---- -lastmod: 2015-12-23 -date: 2014-03-06 -linktitle: Ordering -menu: - main: - parent: content -next: /content/summaries -prev: /content/archetypes -title: Ordering Content -weight: 60 ---- - -Hugo provides you with all the flexibility you need to organize how your content is ordered. - -By default, content is ordered by weight, then by date with the most -recent date first, but alternative sorting (by `title` and `linktitle`) is -also available. The order the content would appear is specified in -the [list template](/templates/list/). - -_Both the `date` and `weight` fields are optional._ - -Unweighted pages appear at the end of the list. If no weights are provided (or -if weights are the same), `date` will be used to sort. If neither is provided, -content will be ordered based on how it's read off the disk, and no order is -guaranteed. - -## Assigning weight to content - -```toml -+++ -weight = 4 -title = "Three" -date = "2012-04-06" -+++ -Front Matter with Ordered Pages 3 -``` - -## Ordering Content Within Taxonomies - -Please see the [Taxonomy Ordering Documentation](/taxonomies/ordering/). diff -Nru hugo-0.25.1/docs/content/content/organization.md hugo-0.26/docs/content/content/organization.md --- hugo-0.25.1/docs/content/content/organization.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/content/organization.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,175 +0,0 @@ ---- -aliases: -- /doc/organization/ -lastmod: 2015-09-27 -date: 2013-07-01 -linktitle: Organization -menu: - main: - parent: content -next: /content/supported-formats -prev: /overview/source-directory -title: Content Organization -weight: 10 -toc: true ---- - -Hugo uses files (see [supported formats](/content/supported-formats/)) with headers commonly called the *front matter*. Hugo -respects the organization that you provide for your content to minimize any -extra configuration, though this can be overridden by additional configuration -in the front matter. - -## Organization - -In Hugo, the content should be arranged in the same way they are intended for -the rendered website. Without any additional configuration, the following will -just work. Hugo supports content nested at any level. The top level is special -in Hugo and is used as the [section](/content/sections/). - - . - └── content - └── about - | └── _index.md // <- http://1.com/about/ - ├── post - | ├── firstpost.md // <- http://1.com/post/firstpost/ - | ├── happy - | | └── ness.md // <- http://1.com/post/happy/ness/ - | └── secondpost.md // <- http://1.com/post/secondpost/ - └── quote - ├── first.md // <- http://1.com/quote/first/ - └── second.md // <- http://1.com/quote/second/ - -**Here's the same organization run with `hugo --uglyURLs`** - - . - └── content - └── about - | └── _index.md // <- http://1.com/about/ - ├── post - | ├── firstpost.md // <- http://1.com/post/firstpost.html - | ├── happy - | | └── ness.md // <- http://1.com/post/happy/ness.html - | └── secondpost.md // <- http://1.com/post/secondpost.html - └── quote - ├── first.md // <- http://1.com/quote/first.html - └── second.md // <- http://1.com/quote/second.html - -## Destinations - -Hugo believes that you organize your content with a purpose. The same structure -that works to organize your source content is used to organize the rendered -site. As displayed above, the organization of the source content will be -mirrored in the destination. - -Notice that the first level `about/` page URL was created using a directory -named "about" with a single `_index.md` file inside. Find out more about `_index.md` specifically in [content for the homepage and other list pages](https://gohugo.io/overview/source-directory#content-for-home-page-and-other-list-pages). - -There are times when one would need more control over their content. In these -cases, there are a variety of things that can be specified in the front matter -to determine the destination of a specific piece of content. - -The following items are defined in order; latter items in the list will override -earlier settings. - -### filename -This isn't in the front matter, but is the actual name of the file minus the -extension. This will be the name of the file in the destination. - -### slug -Defined in the front matter, the `slug` can take the place of the filename for the -destination. - -### filepath -The actual path to the file on disk. Destination will create the destination -with the same path. Includes [section](/content/sections/). - -### section -`section` is determined by its location on disk and *cannot* be specified in the front matter. See [section](/content/sections/). - -### type -`type` is also determined by its location on disk but, unlike `section`, it *can* be specified in the front matter. See [type](/content/types/). - -### path -`path` can be provided in the front matter. This will replace the actual -path to the file on disk. Destination will create the destination with the same -path. Includes [section](/content/sections/). - -### url -A complete URL can be provided. This will override all the above as it pertains -to the end destination. This must be the path from the baseURL (starting with a "/"). -When a `url` is provided, it will be used exactly. Using `url` will ignore the -`--uglyURLs` setting. - - -## Path breakdown in Hugo - -### Content - - . path slug - . ⊢-------^----⊣ ⊢------^-------⊣ - content/extras/indexes/category-example/index.html - - - . section slug - . ⊢--^--⊣ ⊢------^-------⊣ - content/extras/indexes/category-example/index.html - - - . section slug - . ⊢--^--⊣⊢--^--⊣ - content/extras/indexes/index.html - -### Destination - - - permalink - ⊢--------------^-------------⊣ - http://spf13.com/projects/hugo - - - baseURL section slug - ⊢-----^--------⊣ ⊢--^---⊣ ⊢-^⊣ - http://spf13.com/projects/hugo - - - baseURL section slug - ⊢-----^--------⊣ ⊢--^--⊣ ⊢--^--⊣ - http://spf13.com/extras/indexes/example - - - baseURL path slug - ⊢-----^--------⊣ ⊢------^-----⊣ ⊢--^--⊣ - http://spf13.com/extras/indexes/example - - - baseURL url - ⊢-----^--------⊣ ⊢-----^-----⊣ - http://spf13.com/projects/hugo - - - baseURL url - ⊢-----^--------⊣ ⊢--------^-----------⊣ - http://spf13.com/extras/indexes/example - - - -**section** = which type the content is by default - -* based on content location -* front matter overrides - -**slug** = name.ext or name/ - -* based on content-name.md -* front matter overrides - -**path** = section + path to file excluding slug - -* based on path to content location - - -**url** = relative URL - -* defined in front matter -* overrides all the above - diff -Nru hugo-0.25.1/docs/content/content/sections.md hugo-0.26/docs/content/content/sections.md --- hugo-0.25.1/docs/content/content/sections.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/content/sections.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ ---- -lastmod: 2015-12-23 -date: 2013-07-01 -menu: - main: - parent: content -next: /content/types -notoc: true -prev: /content/front-matter -title: Sections -weight: 30 ---- - -Hugo believes that you organize your content with a purpose. The same structure -that works to organize your source content is used to organize the rendered -site (see [Organization](/content/organization/)). Following this pattern Hugo -uses the top level of your content organization as **the Section**. - -The following example site uses two sections, "post" and "quote". - -{{< nohighlight >}}. -└── content - ├── post - | ├── firstpost.md // <- http://1.com/post/firstpost/ - | ├── happy - | | └── ness.md // <- http://1.com/post/happy/ness/ - | └── secondpost.md // <- http://1.com/post/secondpost/ - └── quote - ├── first.md // <- http://1.com/quote/first/ - └── second.md // <- http://1.com/quote/second/ -{{< /nohighlight >}} - -## Section Lists - -Hugo will automatically create pages for each section root that list all -of the content in that section. See [List Templates](/templates/list/) -for details on customizing the way they appear. - -Section pages can also have a content file and frontmatter, see [Source Organization]({{< relref "overview/source-directory.md#content-for-home-page-and-other-list-pages" >}}). - -## Sections and Types - -By default everything created within a section will use the content type -that matches the section name. - -Section defined in the front matter have the same impact. - -To change the type of a given piece of content, simply define the type -in the front matter. - -If a layout for a given type hasn't been provided, a default type template will -be used instead provided it exists. - - diff -Nru hugo-0.25.1/docs/content/content/summaries.md hugo-0.26/docs/content/content/summaries.md --- hugo-0.25.1/docs/content/content/summaries.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/content/summaries.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ ---- -lastmod: 2015-01-27 -date: 2013-07-01 -menu: - main: - parent: content -notoc: true -prev: /content/ordering -next: /content/markdown-extras -title: Summaries -weight: 65 ---- - -With the use of the `.Summary` [page variable](/templates/variables/), Hugo can generate summaries of content to show snippets in summary views. The summary view snippets are automatically generated by Hugo. Where a piece of content is split for the content summary depends on whether the split is Hugo-defined or user-defined. - -Content summaries may also provide links to the original content, usually in the form of a "Read More..." link, with the help of the `.RelPermalink` or `.Permalink` variable, as well as the `.Truncated` boolean variable to determine whether such "Read More..." link is necessary. - -## Hugo-defined: automatic summary split - -By default, Hugo automatically takes the first 70 words of your content as its summary and stores it into the `.Summary` variable, which you may use in your templates. - -* 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 lumped into one paragraph. Some people like it, but some people don't. - -## User-defined: manual summary split: - -Alternatively, you may add the <!--more--> summary divider[^1] (for org content, use # more) where you want to split the article. Content prior to the summary divider will be used as that content's summary, and stored into the `.Summary` variable with all HTML formatting intact. - -[^1]: The **summary divider** is also called "more tag", "excerpt separator", etc. in other literature. - -* Pros: Freedom, precision, and improved rendering. All formatting is preserved. -* Cons: Need to remember to type <!--more--> (or # more for org content) in your content file. :-) - -Be careful to enter <!--more--> (or # more for org content) exactly, i.e. all lowercase with no whitespace, otherwise it would be treated as regular comment and ignored. - -If there is nothing but spaces and newlines after the summary divider then `.Truncated` will be false. - -## Showing Summaries - -You can show content summaries with the following code. You could do this, for example, on a [list](/templates/list/) page. - - {{ range first 10 .Data.Pages }} -
-

{{ .Title }}

- {{ .Summary }} -
- {{ if .Truncated }} - - {{ end }} - {{ end }} - -Note how the `.Truncated` boolean valuable may be used to hide the "Read More..." link when the content is not truncated, i.e. when the summary contains the entire article. diff -Nru hugo-0.25.1/docs/content/content/supported-formats.md hugo-0.26/docs/content/content/supported-formats.md --- hugo-0.25.1/docs/content/content/supported-formats.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/content/supported-formats.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ ---- -aliases: -- /doc/supported-formats/ -lastmod: 2015-08-01 -date: 2015-08-01 -menu: - main: - parent: content -next: /content/front-matter -prev: /content/organization -title: Supported Formats -weight: 15 -toc: true ---- - - Since 0.14, Hugo has defined a new concept called _external helpers_. It means that you can write your content using Asciidoc[tor], reStructuredText or Org-Mode. If you have files with associated extensions ([details](https://github.com/gohugoio/hugo/blob/77c60a3440806067109347d04eb5368b65ea0fe8/helpers/general.go#L65)), then Hugo will call external commands to generate the content (the exception being Org-Mode content, which is parsed natively). - - This means that you will have to install the associated tool on your machine to be able to use those formats. - - For example, for Asciidoc files, Hugo will try to call __asciidoctor__ or __asciidoc__ command. - - To use those formats, just use the standard extension and the front matter exactly as you would do with natively supported _.md_ files. - - Notes: - - * as these are external commands, generation performance for that content will heavily depend on the performance of those external tools. - * this feature is still in early stage, hence feedback is even more welcome. diff -Nru hugo-0.25.1/docs/content/content/types.md hugo-0.26/docs/content/content/types.md --- hugo-0.25.1/docs/content/content/types.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/content/types.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ ---- -lastmod: 2015-09-28 -date: 2013-07-01 -linktitle: Types -menu: - main: - parent: content -next: /content/archetypes -prev: /content/sections -title: Content Types -weight: 40 -toc: true ---- - -Hugo has full support for different types of content. A content type can have a -unique set of meta data, template and can be automatically created by the `hugo new` -command through using content [archetypes](/content/archetypes/). - -A good example of when multiple types are needed is to look at [Tumblr](https://www.tumblr.com/). A piece -of content could be a photo, quote or post, each with different meta data and -rendered differently. - -## Assigning a content type - -Hugo assumes that your site will be organized into [sections](/content/sections/) -and each section will use the corresponding type. If you are taking advantage of -this, then each new piece of content you place into a section will automatically -inherit the type. - -Alternatively, you can set the type in the meta data under the key "`type`". - - -## Creating new content of a specific type - -Hugo has the ability to create a new content file and populate the front matter -with the data set corresponding to that type. Hugo does this by utilizing -[archetypes](/content/archetypes/). - -To create a new piece of content, use: - - hugo new relative/path/to/content.md - -For example, if I wanted to create a new post inside the post section, I would type: - - hugo new post/my-newest-post.md - - -## Defining a content type - -Creating a new content type is easy in Hugo. You simply provide the templates and archetype -that the new type will use. You only need to define the templates, archetypes and/or views -unique to that content type. Hugo will fall back to using the general templates and default archetype -whenever a specific file is not present. - -*Remember, all of the following are optional:* - -### Create Type Directory -Create a directory with the name of the type in `/layouts`. Type is always singular. *E.g. `/layouts/post`*. - -### Create single template -Create a file called `single.html` inside your directory. *E.g. `/layouts/post/single.html`*. - -### Create list template -Create a file called `post.html` inside the section lists template directory, `/layouts/section`. *E.g. `/layouts/section/post.html`*. - -### Create views -Many sites support rendering content in a few different ways, for -instance, a single page view and a summary view to be used when -displaying a [list of contents on a single page](/templates/list). -Hugo makes no assumptions here about how you want to display your -content, and will support as many different views of a content type -as your site requires. All that is required for these additional -views is that a template exists in each `/layouts/TYPE` directory -with the same name. - -### Create a corresponding archetype - -Create a file called type.md in the `/archetypes` directory. *E.g. `/archetypes/post.md`*. - -More details about archetypes can be found at the [archetypes docs](/content/archetypes/). diff -Nru hugo-0.25.1/docs/content/content/using-index-md.md hugo-0.26/docs/content/content/using-index-md.md --- hugo-0.25.1/docs/content/content/using-index-md.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/content/using-index-md.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,118 +0,0 @@ ---- -aliases: -- /doc/using-index-md/ -lastmod: 2017-02-22 -date: 2017-02-22 -linktitle: Using _index.md -menu: - main: - parent: content -prev: /content/example -next: /themes/overview -notoc: true -title: Using _index.md -weight: 70 ---- -# \_index.md and 'Everything is a Page' - -As of version v0.18 Hugo now treats '[everything as a page](http://bepsays.com/en/2016/12/19/hugo-018/)'. This allows you to add content and frontmatter to any page - including List pages like [Sections](/content/sections/), [Taxonomies](/taxonomies/overview/), [Taxonomy Terms pages](/templates/terms/) and even to potential 'special case' pages like the [Home page](/templates/homepage/). - -In order to take advantage of this behaviour you need to do a few things. - -1. Create an \_index.md file that contains the frontmatter and content you would like to apply. - -2. Place the \_index.md file in the correct place in the directory structure. - -3. Ensure that the respective template is configured to display `{{ .Content }}` if you wish for the content of the \_index.md file to be rendered on the respective page. - -## How \_index.md pages work - -Before continuing it's important to know that this page must reference certain templates to describe how the \_index.md page will be rendered. Hugo has a multitude of possible templates that can be used and placed in various places (think theme templates for instance). For simplicity/brevity the default/top level template location will be used to refer to the entire range of places the template can be placed. - -If this is confusing or you are unfamiliar with Hugo's template hierarchy, visit the various template pages listed below. You may need to find the 'active' template responsible for any particular page on your own site by going through the template hierarchy and matching it to your particular setup/theme you are using. - -- [Home page template](/templates/homepage/) -- [Content List templates](/templates/list/) -- [Single Content templates](/templates/content/) -- [Taxonomy Terms templates](/templates/terms/) - -Now that you've got a handle on templates lets recap some Hugo basics to understand how to use an \_index.md file with a List page. - -1. Sections and Taxonomies are 'List' pages, NOT single pages. -2. List pages are rendered using the template hierarchy found in the [Content - List Template](/templates/list/) docs. -3. The Home page, though technically a List page, can have [its own template](/templates/homepage/) at layouts/index.html rather than \_default/list.html. Many themes exploit this behaviour so you are likely to encounter this specific use case. -4. Taxonomy terms pages are 'lists of metadata' not lists of content, so [have their own templates](/templates/terms/). - -Let's put all this information together: - -> **\_index.md files used in List pages, Terms pages or the Home page are NOT rendered as single pages or with Single Content templates.** - -> **All pages, including List pages, can have frontmatter and frontmatter can have markdown content - meaning \_index.md files are the way to _provide_ frontmatter and content to the respective List/Terms/Home page.** - -Here are a couple of examples to make it clearer... - -| \_index.md location | Page affected | Rendered by | -| ------------------- | ------------ | ----------- | -| /content/post/\_index.md | site.com/post/ | /layouts/section/post.html | -| /content/categories/hugo/\_index.md | site.com/categories/hugo/ | /layouts/taxonomy/hugo.html | - -## Why \_index.md files are used - -With a Single page such as a post it's possible to add the frontmatter and content directly into the .md page itself. With List/Terms/Home pages this is not possible so \_index.md files can be used to provide that frontmatter/content to them. - -## How to display content from \_index.md files - -From the information above it should follow that content within an \_index.md file won't be rendered in its own Single Page, instead it'll be made available to the respective List/Terms/Home page. - -To **_actually render that content_** you need to ensure that the relevant template responsible for rendering the List/Terms/Home page contains (at least) `{{ .Content }}`. - -This is the way to actually display the content within the \_index.md file on the List/Terms/Home page. - -A very simple/naive example of this would be: - -```html -{{ partial "header.html" . }} -
- {{ .Content }} - {{ range .Paginator.Pages }} - {{ partial "summary.html" . }} - {{ end }} - {{ partial "pagination.html" . }} -
-{{ partial "sidebar.html" . }} -{{ partial "footer.html" . }} -``` - -You can see `{{ .Content }}` just after the `
` element. For this particular example, the content of the \_index.md file will show before the main list of summaries. - -## Where to organise an \_index.md file - -To add content and frontmatter to the home page, a section, a taxonomy or a taxonomy terms listing, add a markdown file with the base name \_index on the relevant place on the file system. - -```bash -└── content - ├── _index.md - ├── categories - │   ├── _index.md - │   └── photo - │   └── _index.md - ├── post - │   ├── _index.md - │   └── firstpost.md - └── tags - ├── _index.md - └── hugo - └── _index.md -``` - -In the above example \_index.md pages have been added to each section/taxonomy. - -An \_index.md file has also been added in the top level 'content' directory. - -### Where to place \_index.md for the Home page - -Hugo themes are designed to use the 'content' directory as the root of the website, so adding an \_index.md file here (like has been done in the example above) is how you would add frontmatter/content to the home page. - - - - diff -Nru hugo-0.25.1/docs/content/content-management/archetypes.md hugo-0.26/docs/content/content-management/archetypes.md --- hugo-0.25.1/docs/content/content-management/archetypes.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/content-management/archetypes.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,192 @@ +--- +title: Archetypes +linktitle: Archetypes +description: Archetypes allow you to create new instances of content types and set default parameters from the command line. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +#tags: [archetypes,generators,metadata,front matter] +categories: ["content management"] +menu: + docs: + parent: "content-management" + weight: 70 + quicklinks: +weight: 70 #rem +draft: false +aliases: [/content/archetypes/] +toc: true +--- + +{{% note %}} +This section is outdated, see https://github.com/gohugoio/hugoDocs/issues/11 +{{% /note %}} +{{% todo %}} +See above +{{% /todo %}} + +## What are Archetypes? + +**Archetypes** are content files in the [archetypes directory][] of your project that contain preconfigured [front matter][] for your website's [content types][]. Archetypes facilitate consistent metadata across your website content and allow content authors to quickly generate instances of a content type via the `hugo new` command. + +{{< youtube S3Tj3UcTFz8 >}} + +The `hugo new` generator for archetypes assumes your working directory is the content folder at the root of your project. Hugo is able to infer the appropriate archetype by assuming the content type from the content section passed to the CLI command: + +``` +hugo new / +``` + +We can use this pattern to create a new `.md` file in the `posts` section: + +{{< code file="archetype-example.sh" >}} +hugo new posts/my-first-post.md +{{< /code >}} + +{{% note "Override Content Type in a New File" %}} +To override the content type Hugo infers from `[content-section]`, add the `--kind` flag to the end of the `hugo new` command. +{{% /note %}} + +Running this command in a new site that does not have default or custom archetypes will create the following file: + +{{< output file="content/posts/my-first-post.md" >}} ++++ +date = "2017-02-01T19:20:04-07:00" +title = "my first post" +draft = true ++++ +{{< /output >}} + +{{% note %}} +In this example, if you do not already have a `content/posts` directory, Hugo will create both `content/posts/` and `content/posts/my-first-post.md` for you. +{{% /note %}} + +The auto-populated fields are worth examining: + +* `title` is generated from the new content's filename (i.e. in this case, `my-first-post` becomes `"my first post"`) +* `date` and `title` are the variables that ship with Hugo and are therefore included in *all* content files created with the Hugo CLI. `date` is generated in [RFC 3339 format][] by way of Go's [`now()`][] function, which returns the current time. +* The third variable, `draft = true`, is *not* inherited by your default or custom archetypes but is included in Hugo's automatically scaffolded `default.md` archetype for convenience. + +Three variables per content file are often not enough for effective content management of larger websites. Luckily, Hugo provides a simple mechanism for extending the number of variables through custom archetypes, as well as default archetypes to keep content creation DRY. + +## Lookup Order for Archetypes + +Similar to the [lookup order for templates][lookup] in your `layouts` directory, Hugo looks for a section- or type-specific archetype, then a default archetype, and finally an internal archetype that ships with Hugo. For example, Hugo will look for an archetype for `content/posts/my-first-post.md` in the following order: + +1. `archetypes/posts.md` +2. `archetypes/default.md` +3. `themes//archetypes/posts.md` +4. `themes//archetypes/default.md` (Auto-generated with `hugo new site`) + +{{% note "Using a Theme Archetype" %}} +If you wish to use archetypes that ship with a theme, the `theme` field must be specified in your [configuration file](/getting-started/configuration/). +{{% /note %}} + +## Choose Your Archetype's Front Matter Format + +By default, `hugo new` content files include front matter in the TOML format regardless of the format used in `archetypes/*.md`. + +You can specify a different default format in your site [configuration file][] file using the `metaDataFormat` directive. Possible values are `toml`, `yaml`, and `json`. + +## Default Archetypes + +Default archetypes are convenient if your content's front matter stays consistent across multiple [content sections][sections]. + +### Create the Default Archetype + +When you create a new Hugo project using `hugo new site`, you'll notice that Hugo has already scaffolded a file at `archetypes/default.md`. + +The following examples are from a site that's using `tags` and `categories` as [taxonomies][]. If we assume that all content files will require these two key-values, we can create a `default.md` archetype that *extends* Hugo's base archetype. In this example, we are including "golang" and "hugo" as tags and "web development" as a category. + +{{< code file="archetypes/default.md" >}} ++++ +tags = ["golang", "hugo"] +categories = ["web development"] ++++ +{{< /code >}} + +{{% warning "EOL Characters in Text Editors"%}} +If you get an `EOF error` when using `hugo new`, add a carriage return after the closing `+++` or `---` for your TOML or YAML front matter, respectively. (See the [troubleshooting article on EOF errors](/troubleshooting/eof-error/) for more information.) +{{% /warning %}} + +### Use the Default Archetype + +With an `archetypes/default.md` in place, we can use the CLI to create a new post in the `posts` content section: + +{{< code file="new-post-from-default.sh" >}} +$ hugo new posts/my-new-post.md +{{< /code >}} + +Hugo then creates a new markdown file with the following front matter: + +{{< output file="content/posts/my-new-post.md" >}} ++++ +categories = ["web development"] +date = "2017-02-01T19:20:04-07:00" +tags = ["golang", "hugo"] +title = "my new post" ++++ +{{< /output >}} + +We see that the `title` and `date` key-values have been added in addition to the `tags` and `categories` key-values from `archetypes/default.md`. + +{{% note "Ordering of Front Matter" %}} +You may notice that content files created with `hugo new` do not respect the order of the key-values specified in your archetype files. This is a [known issue](https://github.com/gohugoio/hugo/issues/452). +{{% /note %}} + +## Custom Archetypes + +Suppose your site's `posts` section requires more sophisticated front matter than what has been specified in `archetypes/default.md`. You can create a custom archetype for your posts at `archetypes/posts.md` that includes the full set of front matter to be added to the two default archetypes fields. + +### Create a Custom Archetype + +{{< code file="archetypes/posts.md">}} ++++ +description = "" +tags = "" +categories = "" ++++ +{{< /code >}} + +### Use a Custom Archetype + +With an `archetypes/posts.md` in place, you can use the Hugo CLI to create a new post with your preconfigured front matter in the `posts` content section: + +{{< code file="new-post-from-custom.sh" >}} +$ hugo new posts/post-from-custom.md +{{< /code >}} + +This time, Hugo recognizes our custom `archetypes/posts.md` archetype and uses it instead of `archetypes/default.md`. The generated file will now include the full list of front matter parameters, as well as the base archetype's `title` and `date`: + +{{< output file="content/posts/post-from-custom-archetype.md" >}} ++++ +categories = "" +date = 2017-02-13T17:24:43-08:00 +description = "" +tags = "" +title = "post from custom archetype" ++++ +{{< /output >}} + +### Hugo Docs Custom Archetype + +As an example of archetypes in practice, the following is the `functions` archetype from the Hugo docs: + +{{< code file="archetypes/functions.md" >}} +{{< readfile file="/themes/gohugoioTheme/archetypes/functions.md" >}} +{{< /code >}} + +{{% note %}} +The preceding archetype is kept up to date with every Hugo build by using Hugo's [`readFile` function](/functions/readfile/). For similar examples, see [Local File Templates](/templates/files/). +{{% /note %}} + +[archetypes directory]: /getting-started/directory-structure/ +[`now()`]: http://golang.org/pkg/time/#Now +[configuration file]: /getting-started/configuration/ +[sections]: /content-management/sections/ +[content types]: /content-management/types/ +[front matter]: /content-management/front-matter/ +[RFC 3339 format]: https://www.ietf.org/rfc/rfc3339.txt +[taxonomies]: /content-management/taxonomies/ +[lookup]: /templates/lookup/ +[templates]: /templates/ diff -Nru hugo-0.25.1/docs/content/content-management/authors.md hugo-0.26/docs/content/content-management/authors.md --- hugo-0.25.1/docs/content/content-management/authors.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/content-management/authors.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,185 @@ +--- +title: Authors +linktitle: Authors +description: +date: 2016-08-22 +publishdate: 2017-03-12 +lastmod: 2017-03-12 +#tags: [authors] +categories: ["content management"] +menu: + docs: + parent: "content-management" + weight: 55 +weight: 55 #rem +draft: true +aliases: [/content/archetypes/] +toc: true +comments: Before this page is published, need to also update both site- and page-level variables documentation. +--- + + + +Larger sites often have multiple content authors. Hugo provides standardized author profiles to organize relationships between content and content creators for sites operating under a distributed authorship model. + +## Author Profiles + +You can create a profile containing metadata for each author on your website. These profiles have to be saved under `data/_authors/`. The filename of the profile will later be used as an identifier. This way Hugo can associate content with one or multiple authors. An author's profile can be defined in the JSON, YAML, or TOML format. + +### Example: Author Profile + +Let's suppose Alice Allison is a blogger. A simple unique identifier would be `alice`. Now, we have to create a file called `alice.toml` in the `data/_authors/` directory. The following example is the standardized template written in TOML: + +{{< code file="data/_authors/alice.toml" >}} +givenName = "Alice" # or firstName as alias +familyName = "Allison" # or lastName as alias +displayName = "Alice Allison" +thumbnail = "static/authors/alice-thumb.jpg" +image = "static/authors/alice-full.jpg" +shortBio = "My name is Alice and I'm a blogger." +bio = "My name is Alice and I'm a blogger... some other stuff" +email = "alice.allison@email.com" +weight = 10 + +[social] + facebook = "alice.allison" + twitter = "alice" + googleplus = "aliceallison1" + website = "www.example.com" + +[params] + random = "whatever you want" +{{< /code >}} + +All variables are optional but it's advised to fill all important ones (e.g. names and biography) because themes can vary in their usage. + +You can store files for the `thumbnail` and `image` attributes in the `static` folder. Then add the path to the photos relative to `static`; e.g., `/static/path/to/thumbnail.jpg`. + +`weight` allows you to define the order of an author in an `.Authors` list and can be accessed on list or via the `.Site.Authors` variable. + +The `social` section contains all the links to the social network accounts of an author. Hugo is able to generate the account links for the most popular social networks automatically. This way, you only have to enter your username. You can find a list of all supported social networks [here](#linking-social-network-accounts-automatically). All other variables, like `website` in the example above remain untouched. + +The `params` section can contain arbitrary data much like the same-named section in the config file. What it contains is up to you. + +## Associate Content Through Identifiers + +Earlier it was mentioned that content can be associated with an author through their corresponding identifier. In our case, blogger Alice has the identifier `alice`. In the front matter of a content file, you can create a list of identifiers and assign it to the `authors` variable. Here are examples for `alice` using YAML and TOML, respectively. + +``` +--- +title: Why Hugo is so Awesome +date: 2016-08-22T14:27:502:00 +authors: ["alice"] +--- + +Nothing to read here. Move along... +``` + +``` ++++ +title = Why Hugo is so Awesome +date = "2016-08-22T14:27:502:00" +authors: ["alice"] ++++ + +Nothing to read here. Move along... +``` + +Future authors who might work on this blog post can append their identifiers to the `authors` array in the front matter as well. + +## Work with Templates + +After a successful setup it's time to give some credit to the authors by showing them on the website. Within the templates Hugo provides a list of the author's profiles if they are listed in the `authors` variable within the front matter. + +The list is accessible via the `.Authors` template variable. Printing all authors of a the blog post is straight forward: + +``` +{{ range .Authors }} + {{ .DisplayName }} +{{ end }} +=> Alice Allison +``` + +Even if there are co-authors you may only want to show the main author. For this case you can use the `.Author` template variable **(note the singular form)**. The template variable contains the profile of the author that is first listed with his identifier in the front matter. + +{{% note %}} +You can find a list of all template variables to access the profile information in [Author Variables](/variables/authors/). +{{% /note %}} + +### Link Social Network Accounts + +As aforementioned, Hugo is able to generate links to profiles of the most popular social networks. The following social networks with their corrersponding identifiers are supported: `github`, `facebook`, `twitter`, `googleplus`, `pinterest`, `instagram`, `youtube` and `linkedin`. + +This is can be done with the `.Social.URL` function. Its only parameter is the name of the social network as they are defined in the profile (e.g. `facebook`, `googleplus`). Custom variables like `website` remain as they are. + +Most articles feature a small section with information about the author at the end. Let's create one containing the author's name, a thumbnail, a (summarized) biography and links to all social networks: + +{{< code file="layouts/partials/author-info.html" download="author-info.html" >}} +{{ with .Author }} +

{{ .DisplayName }}

+ {{ .DisplayName }} +

{{ .ShortBio }}

+
    + {{ range $network, $username := .Social }} +
  • {{ $network }}
  • + {{ end }} +
+{{ end }} +{{< /code >}} + +## Who Published What? + +That question can be answered with a list of all authors and another list containing all articles that they each have written. Now we have to translate this idea into templates. The [taxonomy][] feature allows us to logically group content based on information that they have in common; e.g. a tag or a category. Well, many articles share the same author, so this should sound familiar, right? + +In order to let Hugo know that we want to group content based on their author, we have to create a new taxonomy called `author` (the name corresponds to the variable in the front matter). Here is the snippet in a `config.yaml` and `config.toml`, respectively: + +``` +taxonomies: + author: authors +``` + +``` +[taxonomies] + author = "authors" +``` + + +### List All Authors + +In the next step we can create a template to list all authors of your website. Later, the list can be accessed at `www.example.com/authors/`. Create a new template in the `layouts/taxonomy/` directory called `authors.term.html`. This template will be exclusively used for this taxonomy. + +{{< code file="layouts/taxonomy/author.term.html" download="author.term.html" >}} + +{{< /code >}} + +`.Data.Terms` contains the identifiers of all authors and we can range over it to create a list with all author names. The `$profile` variable gives us access to the profile of the current author. This allows you to generate a nice info box with a thumbnail, a biography and social media links, like at the [end of a blog post](#linking-social-network-accounts-automatically). + +### List Each Author's Publications + +Last but not least, we have to create the second list that contains all publications of an author. Each list will be shown in its own page and can be accessed at `www.example.com/authors/`. Replace `` with a valid author identifier like `alice`. + +The layout for this page can be defined in the template `layouts/taxonomy/author.html`. + +{{< code file="layouts/taxonomy/author.html" download="author.html" >}} +{{ range .Data.Pages }} +

{{ .Title }}

+ written by {{ .Author.DisplayName }} + {{ .Summary }} +{{ end }} +{{< /code >}} + +The example above generates a simple list of all posts written by a single author. Inside the loop you've access to the complete set of [page variables][pagevars]. Therefore, you can add additional information about the current posts like the publishing date or the tags. + +With a lot of content this list can quickly become very long. Consider to use the [pagination][] feature. It splits the list into smaller chunks and spreads them over multiple pages. + +[pagevars]: /variables/page/ +[pagination]: /templates/pagination/ diff -Nru hugo-0.25.1/docs/content/content-management/comments.md hugo-0.26/docs/content/content-management/comments.md --- hugo-0.25.1/docs/content/content-management/comments.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/content-management/comments.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,84 @@ +--- +title: Comments +linktitle: Comments +description: Hugo ships with an internal Disqus template, but this isn't the only commenting system that will work with your new Hugo website. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-03-09 +#tags: [sections,content,organization] +categories: [project organization, fundamentals] +menu: + docs: + parent: "content-management" + weight: 140 +weight: 140 #rem +draft: false +aliases: [/extras/comments/] +toc: true +--- + +Hugo ships with support for [Disqus](https://disqus.com/), a third-party service that provides comment and community capabilities to websites via JavaScript. + +Your theme may already support Disqus, but if not, it is easy to add to your templates via [Hugo's built-in Disqus partial][disquspartial]. + +## Add Disqus + +Hugo comes with all the code you need to load Disqus into your templates. Before adding Disqus to your site, you'll need to [set up an account][disqussetup]. + +### Configure Disqus + +Disqus comments require you set a single value in your [site's configuration file][configuration]. The following show the configuration variable in a `config.toml` and `config.yml`, respectively: + +``` +disqusShortname = "yourdiscussshortname" +``` + +``` +disqusShortname: "yourdiscussshortname" +``` + +For many websites, this is enough configuration. However, you also have the option to set the following in the [front matter][] of a single content file: + +* `disqus_identifier` +* `disqus_title` +* `disqus_url` + +### Render Hugo's Built-in Disqus Partial Template + +See [Partial Templates][partials] to learn how to add the Disqus partial to your Hugo website's templates. + +## Comments Alternatives + +There are a few alternatives to commenting on static sites for those who do not want to use Disqus: + +* [Static Man](https://staticman.net/) +* [txtpen](https://txtpen.com) +* [IntenseDebate](http://intensedebate.com/) +* [Graph Comment][] +* [Muut](http://muut.com/) +* [isso](http://posativ.org/isso/) (Self-hosted, Python) + * [Tutorial on Implementing Isso with Hugo][issotutorial] + + + + + + + +[configuration]: /getting-started/configuration/ +[disquspartial]: /templates/partials/#disqus +[disqussetup]: https://disqus.com/profile/signup/ +[forum]: https://discourse.gohugo.io +[front matter]: /content-management/front-matter/ +[Graph Comment]: https://graphcomment.com/ +[kaijuissue]: https://github.com/spf13/kaiju/issues/new +[issotutorial]: https://stiobhart.net/2017-02-24-isso-comments/ +[partials]: /templates/partials/ +[MongoDB]: https://www.mongodb.com/ +[tweet]: https://twitter.com/spf13 diff -Nru hugo-0.25.1/docs/content/content-management/cross-references.md hugo-0.26/docs/content/content-management/cross-references.md --- hugo-0.25.1/docs/content/content-management/cross-references.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/content-management/cross-references.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,123 @@ +--- +title: Cross References +description: Hugo makes it easy to link documents together. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-03-31 +categories: [content management] +#tags: ["cross references","references", "anchors", "urls"] +menu: + docs: + parent: "content-management" + weight: 100 +weight: 100 #rem +aliases: [/extras/crossreferences/] +toc: true +--- + + + The `ref` and `relref` shortcodes link documents together, both of which are [built-in Hugo shortcodes][]. These shortcodes are also used to provide links to headings inside of your content, whether across documents or within a document. The only difference between `ref` and `relref` is whether the resulting URL is absolute (`http://1.com/about/`) or relative (`/about/`), respectively. + +## Use `ref` and `relref` + +``` +{{}} +{{}} +{{}} +{{}} +{{}} +{{}} +``` + +The single parameter to `ref` is a string with a content `documentname` (e.g., `about.md`) with or without an appended in-document `anchor` (`#who`) without spaces. + +### Document Names + +The `documentname` is the name of a document, including the format extension; this may be just the filename, or the relative path from the `content/` directory. With a document `content/blog/post.md`, either format will produce the same result: + +``` +{{}} => `/blog/post/` +{{}} => `/blog/post/` +``` + +If you have the same filename used across multiple sections, you should only use the relative path format; otherwise, the behavior will be `undefined`. This is best illustrated with an example `content` directory: + +``` +. +└── content + ├── events + │   └── my-birthday.md + ├── galleries + │   └── my-birthday.md + ├── meta + │   └── my-article.md + └── posts + └── my-birthday.md +``` + +To be sure to get the correct reference in this case, use the full path: + +{{< code file="content/meta/my-article.md" copy="false" >}} +{{}} => /events/my-birthday/ +{{< /code >}} + +{{< todo >}}Remove this warning when https://github.com/gohugoio/hugo/issues/3703 is released.{{< /todo >}} + +A relative document name must *not* begin with a slash (`/`). +``` +{{}} => "" +``` + +### With Multiple Output Formats + +If the page exists in multiple [output formats][], `ref` or `relref` can be used with a output format name: + +``` + [Neat]({{}}) +``` + +### Anchors + +When an `anchor` is provided by itself, the current page’s unique identifier will be appended; when an `anchor` is provided appended to `documentname`, the found page's unique identifier will be appended: + +``` +{{}} => #anchors:9decaf7 +{{}} => /blog/post/#who:badcafe +``` + +The above examples render as follows for this very page as well as a reference to the "Content" heading in the Hugo docs features pageyoursite + +``` +{{}} => #who:9decaf7 +{{}} => /blog/post/#who:badcafe +``` + +More information about document unique identifiers and headings can be found [below]({{< ref "#hugo-heading-anchors" >}}). + +### Examples + +* `{{}}` => `https://example.com/blog/post/` +* `{{}}` => `https://example.com/blog/post/#tldr:caffebad` +* `{{}}` => `/blog/post/` +* `{{}}` => `/blog/post/#tldr:caffebad` +* `{{}}` => `#tldr:badcaffe` +* `{{}}` => `#tldr:badcaffe` + +## Hugo Heading Anchors + +When using Markdown document types, Hugo generates heading anchors automatically. The generated anchor for this section is `hugo-heading-anchors`. Because the heading anchors are generated automatically, Hugo takes some effort to ensure that heading anchors are unique both inside a document and across the entire site. + +Ensuring heading uniqueness across the site is accomplished with a unique identifier for each document based on its path. Unless a document is renamed or moved between sections *in the filesystem*, the unique identifier for the document will not change: `blog/post.md` will always have a unique identifier of `81df004c333b392d34a49fd3a91ba720`. + +`ref` and `relref` were added so you can make these reference links without having to know the document’s unique identifier. (The links in document tables of contents are automatically up-to-date with this value.) + +``` +{{}} +/content-management/cross-references/#hugo-heading-anchors:77cd9ea530577debf4ce0f28c8dca242 +``` + + +[built-in Hugo shortcodes]: /content-management/shortcodes/#using-the-built-in-shortcodes +[lists]: /templates/lists/ +[output formats]: /templates/output-formats/ +[shortcode]: /content-management/shortcodes/ \ No newline at end of file diff -Nru hugo-0.25.1/docs/content/content-management/formats.md hugo-0.26/docs/content/content-management/formats.md --- hugo-0.25.1/docs/content/content-management/formats.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/content-management/formats.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,241 @@ +--- +title: Supported Content Formats +linktitle: Supported Content Formats +description: Markdown and Emacs Org-Mode have native support, and additional formats (e.g. Asciidoc) come via external helpers. +date: 2017-01-10 +publishdate: 2017-01-10 +lastmod: 2017-04-06 +categories: [content management] +#tags: [markdown,asciidoc,mmark,content format] +menu: + docs: + parent: "content-management" + weight: 20 +weight: 20 #rem +draft: false +aliases: [/content/markdown-extras/,/content/supported-formats/,/doc/supported-formats/,/tutorials/mathjax/] +toc: true +--- + +**Markdown is the main content format** and comes in two flavours: The excellent [Blackfriday project][blackfriday] (name your files `*.md` or set `markup = "markdown"` in front matter) or its fork [Mmark][mmark] (name your files `*.mmark` or set `markup = "mmark"` in front matter), both very fast markdown engines written in Go. + +For Emacs users, [goorgeous](https://github.com/chaseadamsio/goorgeous) provides built-in native support for Org-mode (name your files `*.org` or set `markup = "org"` in front matter) + +{{% note "Deeply Nested Lists" %}} +Before you begin writing your content in markdown, Blackfriday has a known issue [(#329)](https://github.com/russross/blackfriday/issues/329) with handling deeply nested lists. Luckily, there is an easy workaround. Use 4-spaces (i.e., tab) rather than 2-space indentations. +{{% /note %}} + +## Configure BlackFriday Markdown Rendering + +You can configure multiple aspects of Blackfriday as show in the following list. See the docs on [Configuration][config] for the full list of explicit directions you can give to Hugo when rendering your site. + +{{< readfile file="/content/readfiles/bfconfig.md" markdown="true" >}} + +## Extend Markdown + +Hugo provides some convenient methods for extending markdown. + +### Task Lists + +Hugo supports [GitHub-styled task lists (i.e., TODO lists)][gfmtasks] for the Blackfriday markdown renderer. If you do not want to use this feature, you can disable it in your configuration. + +#### Example Task List Input + +{{< code file="content/my-to-do-list.md" >}} +- [ ] a task list item +- [ ] list syntax required +- [ ] incomplete +- [x] completed +{{< /code >}} + +#### Example Task List Output + +The preceding markdown produces the following HTML in your rendered website: + +``` +
    +
  • a task list item
  • +
  • list syntax required
  • +
  • incomplete
  • +
  • completed
  • +
+``` + +#### Example Task List Display + +The following shows how the example task list will look to the end users of your website. Note that visual styling of lists is up to you. This list has been styled according to [the Hugo Docs stylesheet][hugocss]. + +- [ ] a task list item +- [ ] list syntax required +- [ ] incomplete +- [x] completed + +### Emojis + +To add emojis directly to content, set `enableEmoji` to `true` in your [site configuration][config]. To use emojis in templates or shortcodes, see [`emojify` function][]. + +For a full list of emojis, see the [Emoji cheat sheet][emojis]. + +### Shortcodes + +If you write in Markdown and find yourself frequently embedding your content with raw HTML, Hugo provides built-in shortcodes functionality. This is one of the most powerful features in Hugo and allows you to create your own Markdown extensions very quickly. + +See [Shortcodes][sc] for usage, particularly for the built-in shortcodes that ship with Hugo, and [Shortcode Templating][sct] to learn how to build your own. + +### Code Blocks + +Hugo supports GitHub-flavored markdown's use of triple back ticks, as well as provides a special [`highlight` nested shortcode][hlsc] to render syntax highlighting via [Pygments][]. For usage examples and a complete explanation, see the [syntax highlighting documentation][hl] in [developer tools][]. + +## Mmark + +Mmark is a [fork of BlackFriday][mmark] and markdown superset that is well suited for writing [IETF documentation][ietf]. You can see examples of the syntax in the [Mmark GitHub repository][mmarkgh] or the full syntax on [Miek Gieben's website][]. + +### Use Mmark + +As Hugo ships with Mmark, using the syntax is as easy as changing the extension of your content files from `.md` to `.mmark`. + +In the event that you want to only use Mmark in specific files, you can also define the Mmark syntax in your content's front matter: + +``` +--- +title: My Post +date: 2017-04-01 +markup: mmark +--- +``` + +{{% warning %}} +Thare are some features not available in Mmark; one example being that shortcodes are not translated when used in an included `.mmark` file ([#3131](https://github.com/gohugoio/hugo/issues/3137)), and `EXTENSION_ABBREVIATION` ([#1970](https://github.com/gohugoio/hugo/issues/1970)) and the aforementioned GFM todo lists ([#2270](https://github.com/gohugoio/hugo/issues/2270)) are not fully supported. Contributions are welcome. +{{% /warning %}} + +## MathJax with Hugo + +[MathJax](http://www.mathjax.org/) is a JavaScript library that allows the display of mathematical expressions described via a LaTeX-style syntax in the HTML (or Markdown) source of a web page. As it is a pure a JavaScript library, getting it to work within Hugo is fairly straightforward, but does have some oddities that will be discussed here. + +This is not an introduction into actually using MathJax to render typeset mathematics on your website. Instead, this page is a collection of tips and hints for one way to get MathJax working on a website built with Hugo. + +### Enable MathJax + +The first step is to enable MathJax on pages that you would like to have typeset math. There are multiple ways to do this (adventurous readers can consult the [Loading and Configuring](http://docs.mathjax.org/en/latest/configuration.html) section of the MathJax documentation for additional methods of including MathJax), but the easiest way is to use the secure MathJax CDN by include a ` +{{< /code >}} + +One way to ensure that this code is included in all pages is to put it in one of the templates that live in the `layouts/partials/` directory. For example, I have included this in the bottom of my template `footer.html` because I know that the footer will be included in every page of my website. + +### Options and Features + +MathJax is a stable open-source library with many features. I encourage the interested reader to view the [MathJax Documentation](http://docs.mathjax.org/en/latest/index.html), specifically the sections on [Basic Usage](http://docs.mathjax.org/en/latest/index.html#basic-usage) and [MathJax Configuration Options](http://docs.mathjax.org/en/latest/index.html#mathjax-configuration-options). + +### Issues with Markdown + +{{% note %}} +The following issues with Markdown assume you are using `.md` for content and BlackFriday for parsing. Using [Mmark](#mmark) as your content format will obviate the need for the following workarounds. + +When using Mmark with MathJax, use `displayMath: [['$$','$$'], ['\\[','\\]']]`. See the [Mmark `README.md`](https://github.com/miekg/mmark/wiki/Syntax#math-blocks) for more information. In addition to MathJax, Mmark has been shown to work well with [KaTeX](https://github.com/Khan/KaTeX). See this [related blog post from a Hugo user](http://nosubstance.me/post/a-great-toolset-for-static-blogging/). +{{% /note %}} + +After enabling MathJax, any math entered between proper markers (see the [MathJax documentation][mathjaxdocs]) will be processed and typeset in the web page. One issue that comes up, however, with Markdown is that the underscore character (`_`) is interpreted by Markdown as a way to wrap text in `emph` blocks while LaTeX (MathJax) interprets the underscore as a way to create a subscript. This "double speak" of the underscore can result in some unexpected and unwanted behavior. + +### Solution + +There are multiple ways to remedy this problem. One solution is to simply escape each underscore in your math code by entering `\_` instead of `_`. This can become quite tedious if the equations you are entering are full of subscripts. + +Another option is to tell Markdown to treat the MathJax code as verbatim code and not process it. One way to do this is to wrap the math expression inside a `
` `
` block. Markdown would ignore these sections and they would get passed directly on to MathJax and processed correctly. This works great for display style mathematics, but for inline math expressions the line break induced by the `
` is not acceptable. The syntax for instructing Markdown to treat inline text as verbatim is by wrapping it in backticks (`` ` ``). You might have noticed, however, that the text included in between backticks is rendered differently than standard text (on this site these are items highlighted in red). To get around this problem, we could create a new CSS entry that would apply standard styling to all inline verbatim text that includes MathJax code. Below I will show the HTML and CSS source that would accomplish this (note this solution was adapted from [this blog post](http://doswa.com/2011/07/20/mathjax-in-markdown.html)---all credit goes to the original author). + +{{< code file="mathjax-markdown-solution.html" >}} + + + +{{< /code >}} + + + +As before, this content should be included in the HTML source of each page that will be using MathJax. The next code snippet contains the CSS that is used to have verbatim MathJax blocks render with the same font style as the body of the page. + +{{< code file="mathjax-style.css" >}} +code.has-jax { + font: inherit; + font-size: 100%; + background: inherit; + border: inherit; + color: #515151; +} +{{< /code >}} + +In the CSS snippet, notice the line `color: #515151;`. `#515151` is the value assigned to the `color` attribute of the `body` class in my CSS. In order for the equations to fit in with the body of a web page, this value should be the same as the color of the body. + +### Usage + +With this setup, everything is in place for a natural usage of MathJax on pages generated using Hugo. In order to include inline mathematics, just put LaTeX code in between `` `$ TeX Code $` `` or `` `\( TeX Code \)` ``. To include display style mathematics, just put LaTeX code in between `
$$TeX Code$$
`. All the math will be properly typeset and displayed within your Hugo generated web page! + +## Additional Formats Through External Helpers + +Hugo has new concept called _external helpers_. It means that you can write your content using [Asciidoc][ascii], [reStructuredText][rest]. If you have files with associated extensions, Hugo will call external commands to generate the content. ([See the Hugo source code for external helpers][helperssource].) + +For example, for Asciidoc files, Hugo will try to call the `asciidoctor` or `asciidoc` command. This means that you will have to install the associated tool on your machine to be able to use these formats. ([See the Asciidoctor docs for installation instructions](http://asciidoctor.org/docs/install-toolchain/)). + +To use these formats, just use the standard extension and the front matter exactly as you would do with natively supported `.md` files. + +{{% warning "Performance of External Helpers" %}} +Because additional formats are external commands generation performance will rely heavily on the performance of the external tool you are using. As this feature is still in its infancy, feedback is welcome. +{{% /warning %}} + +## Learn Markdown + +Markdown syntax is simple enough to learn in a single sitting. The following are excellent resources to get you up and running: + +* [Daring Fireball: Markdown, John Gruber (Creator of Markdown)][fireball] +* [Markdown Cheatsheet, Adam Pritchard][mdcheatsheet] +* [Markdown Tutorial (Interactive), Garen Torikian][mdtutorial] + +[`emojify` function]: /functions/emojify/ +[ascii]: http://asciidoc.org/ +[bfconfig]: /getting-started/configuration/#configuring-blackfriday-rendering +[blackfriday]: https://github.com/russross/blackfriday +[mmark]: https://github.com/miekg/mmark +[config]: /getting-started/configuration/ +[developer tools]: /tools/ +[emojis]: https://www.webpagefx.com/tools/emoji-cheat-sheet/ +[fireball]: https://daringfireball.net/projects/markdown/ +[gfmtasks]: https://guides.github.com/features/mastering-markdown/#syntax +[helperssource]: https://github.com/gohugoio/hugo/blob/77c60a3440806067109347d04eb5368b65ea0fe8/helpers/general.go#L65 +[hl]: /tools/syntax-highlighting/ +[hlsc]: /content-management/shortcodes/#highlight +[hugocss]: /css/style.css +[ietf]: https://tools.ietf.org/html/ +[mathjaxdocs]: https://docs.mathjax.org/en/latest/ +[mdcheatsheet]: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet +[mdtutorial]: http://www.markdowntutorial.com/ +[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/ +[Pygments]: http://pygments.org/ +[rest]: http://docutils.sourceforge.net/rst.html +[sc]: /content-management/shortcodes/ +[sct]: /templates/shortcode-templates/ diff -Nru hugo-0.25.1/docs/content/content-management/front-matter.md hugo-0.26/docs/content/content-management/front-matter.md --- hugo-0.25.1/docs/content/content-management/front-matter.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/content-management/front-matter.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,198 @@ +--- +title: Front Matter +linktitle: +description: Hugo allows you to add front matter in yaml, toml, or json to your content files. +date: 2017-01-09 +publishdate: 2017-01-09 +lastmod: 2017-02-24 +categories: [content management] +#tags: ["front matter", "yaml", "toml", "json", "metadata", "archetypes"] +menu: + docs: + parent: "content-management" + weight: 30 +weight: 30 #rem +draft: false +aliases: [/content/front-matter/] +toc: true +--- + +**Front matter** allows you to keep metadata attached to an instance of a [content type][]---i.e., embedded inside a content file---and is one of the many features that gives Hugo its strength. + +## Front Matter Formats + +Hugo supports three formats for front matter, each with their own identifying tokens. + +TOML +: identified by opening and closing `+++`. + +YAML +: identified by opening and closing `---`. + +JSON +: a single JSON object surrounded by '`{`' and '`}`', followed by a new line. + +### TOML Example + +``` ++++ +title = "spf13-vim 3.0 release and new website" +description = "spf13-vim is a cross platform distribution of vim plugins and resources for Vim." +tags = [ ".vimrc", "plugins", "spf13-vim", "vim" ] +date = "2012-04-06" +categories = [ + "Development", + "VIM" +] +slug = "spf13-vim-3-0-release-and-new-website" ++++ +``` + +### YAML Example + +``` +--- +title: "spf13-vim 3.0 release and new website" +description: "spf13-vim is a cross platform distribution of vim plugins and resources for Vim." +tags: [ ".vimrc", "plugins", "spf13-vim", "vim" ] +lastmod: 2015-12-23 +date: "2012-04-06" +categories: + - "Development" + - "VIM" +slug: "spf13-vim-3-0-release-and-new-website" +--- +``` + +### JSON Example + +``` +{ + "title": "spf13-vim 3.0 release and new website", + "description": "spf13-vim is a cross platform distribution of vim plugins and resources for Vim.", + "tags": [ ".vimrc", "plugins", "spf13-vim", "vim" ], + "date": "2012-04-06", + "categories": [ + "Development", + "VIM" + ], + "slug": "spf13-vim-3-0-release-and-new-website" +} +``` + +## Front Matter Variables + +### Predefined + +There are a few predefined variables that Hugo is aware of. See [Page Variables][pagevars] for how to call many of these predefined variables in your templates. + +`aliases` +: an array of one or more aliases (e.g., old published paths of renamed content) that will be created in the output directory structure . See [Aliases][aliases] for details. + +`date` +: the datetime at which the content was created; note this value is auto-populated according to Hugo's built-in [archetype][]. + +`description` +: the description for the content. + +`draft` +: if `true`, the content will not be rendered unless the `--buildDrafts` flag is passed to the `hugo` command. + +`expiryDate` +: the datetime at which the content should no longer be published by Hugo; expired content will not be rendered unless the `--buildExpired` flag is passed to the `hugo` command. + +`isCJKLanguage` +: if `true`, Hugo will explicitly treat the content as a CJK language; both `.Summary` and `.WordCount` work properly in CJK languages. + +`keywords` +: the meta keywords for the content. + +`layout` +: the layout Hugo should select from the [lookup order][lookup] when rendering the content. If a `type` is not specified in the front matter, Hugo will look for the layout of the same name in the layout directory that corresponds with a content's section. See ["Defining a Content Type"][definetype] + +`lastmod` +: the datetime at which the content was last modified. + +`linkTitle` +: used for creating links to content; if set, Hugo defaults to using the `linktitle` before the `title`. Hugo can also [order lists of content by `linktitle`][bylinktitle]. + +`markup` +: **experimental**; specify `"rst"` for reStructuredText (requires`rst2html`) or `"md"` (default) for Markdown. + +`outputs` +: allows you to specify output formats specific to the content. See [output formats][outputs]. + +`publishDate` +: if in the future, content will not be rendered unless the `--buildFuture` flag is passed to `hugo`. + +`slug` +: appears as the tail of the output URL. A value specified in front matter will override the segment of the URL based on the filename. + +`taxonomies` +: these will use the field name of the plural form of the index; see the `tags` and `categories` in the above front matter examples. + +`title` +: the title for the content. + +`type` +: the type of the content; this value will be automatically derived from the directory (i.e., the [section][]) if not specified in front matter. + +`url` +: the full path to the content from the web root. It makes no assumptions about the path of the content file. It also ignores any language prefixes of +the multilingual feature. + +`weight` +: used for [ordering your content in lists][ordering]. + +{{% note "Hugo's Default URL Destinations" %}} +If neither `slug` nor `url` is present and [permalinks are not configured otherwise in your site `config` file](/content-management/urls/#permalinks), Hugo will use the filename of your content to create the output URL. See [Content Organization](/content-management/organization) for an explanation of paths in Hugo and [URL Management](/content-management/urls/) for ways to customize Hugo's default behaviors. +{{% /note %}} + +### User-Defined + +You can add fields to your front matter arbitrarily to meet your needs. These user-defined key-values are placed into a single `.Params` variable for use in your templates. + +The following fields can be accessed via `.Params.include_toc` and `.Params.show_comments`, respectively. The [Variables][] section provides more information on using Hugo's page- and site-level variables in your templates. + +``` +include_toc: true +show_comments: false +``` + +These two user-defined fields can then be accessed via `.Params.include_toc` and `.Params.show_comments`, respectively. The [Variables][variables] section provides more information on using Hugo's page- and site-level variables in your templates. + + +## Order Content Through Front Matter + +You can assign content-specific `weight` in the front matter of your content. These values are especially useful for [ordering][ordering] in list views. You can use `weight` for ordering of content and the convention of [`_weight`][taxweight] for ordering content within a taxonomy. See [Ordering and Grouping Hugo Lists][lists] to see how `weight` can be used to organize your content in list views. + +## Override Global Markdown Configuration + +It's possible to set some options for Markdown rendering in a content's front matter as an override to the [BlackFriday rendering options set in your project configuration][config]. + +## Front Matter Format Specs + +* [TOML Spec][toml] +* [YAML Spec][yaml] +* [JSON Spec][json] + +[variables]: /variables/ +[aliases]: /content-management/urls/#aliases/ +[archetype]: /content-management/archetypes/ +[bylinktitle]: /templates/lists/#by-link-title +[config]: /getting-started/configuration/ "Hugo documentation for site configuration" +[content type]: /content-management/types/ +[contentorg]: /content-management/organization/ +[definetype]: /content-management/types/#defining-a-content-type "Learn how to specify a type and a layout in a content's front matter" +[json]: /documents/ecma-404-json-spec.pdf "Specification for JSON, JavaScript Object Notation" +[lists]: /templates/lists/#ordering-content "See how to order content in list pages; for example, templates that look to specific _index.md for content and front matter." +[lookup]: /templates/lookup-order/ "Hugo traverses your templates in a specific order when rendering content to allow for DRYer templating." +[ordering]: /templates/lists/ "Hugo provides multiple ways to sort and order your content in list templates" +[outputs]: /templates/output-formats/ "With the release of v22, you can output your content to any text format using Hugo's familiar templating" +[pagevars]: /variables/page/ +[section]: /content-management/sections/ +[taxweight]: /content-management/taxonomies/ +[toml]: https://github.com/toml-lang/toml "Specification for TOML, Tom's Obvious Minimal Language" +[urls]: /content-management/urls/ +[variables]: /variables/ +[yaml]: http://yaml.org/spec/ "Specification for YAML, YAML Ain't Markup Language" diff -Nru hugo-0.25.1/docs/content/content-management/_index.md hugo-0.26/docs/content/content-management/_index.md --- hugo-0.25.1/docs/content/content-management/_index.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/content-management/_index.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,20 @@ +--- +title: Content Management +linktitle: Content Management Overview +description: Hugo makes managing large static sites easy with support for archetypes, content types, menus, cross references, summaries, and more. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +menu: + docs: + parent: "content-management" + weight: 1 +#tags: [source, organization] +categories: [content management] +weight: 01 #rem +draft: false +aliases: [/content/,/content/organization] +toc: false +--- + +A static site generator needs to extend beyond front matter and a couple templates to be both scalable and *manageable*. Hugo was designed with not only developers in mind, but also content managers and authors. diff -Nru hugo-0.25.1/docs/content/content-management/menus.md hugo-0.26/docs/content/content-management/menus.md --- hugo-0.25.1/docs/content/content-management/menus.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/content-management/menus.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,179 @@ +--- +title: Menus +linktitle: Menus +description: Hugo has a simple yet powerful menu system. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-03-31 +categories: [content management] +#tags: [menus] +draft: false +menu: + docs: + parent: "content-management" + weight: 120 +weight: 120 #rem +aliases: [/extras/menus/] +toc: true +--- + +{{% note "Lazy Blogger"%}} +If all you want is a simple menu for your sections, see the ["Section Menu for Lazy Bloggers" in Menu Templates](/templates/menu-templates/#section-menu-for-lazy-blogger). +{{% /note %}} + +You can do this: + +* Place content in one or many menus +* Handle nested menus with unlimited depth +* Create menu entries without being attached to any content +* Distinguish active element (and active branch) + +## What is a Menu in Hugo? + +A **menu** is a named array of menu entries accessible by name via the [`.Site.Menus` site variable][sitevars]. For example, you can access your site's `main` menu via `.Site.Menus.main`. + +{{% note "Menus on Multilingual Sites" %}} +If you make use of the [multilingual feature](/content-management/multilingual/), you can define language-independent menus. +{{% /note %}} + +A menu entry has the following properties (i.e., variables) available to it: + +`.URL` +: string + +`.Name` +: string + +`.Menu` +: string + +`.Identifier` +: string + +`.Pre` +: template.HTML + +`.Post` +: template.HTML + +`.Weight` +: int + +`.Parent` +: string + +`.Children` +: Menu + +Note that menus also have the following functions available as well: + +`.HasChildren` +: boolean + +Additionally, there are some relevant functions available to menus on a page: + +`.IsMenuCurrent` +: (menu string, menuEntry *MenuEntry ) boolean + +`.HasMenuCurrent` +: (menu string, menuEntry *MenuEntry) boolean + +## Add content to menus + +Hugo allows you to add content to a menu via the content's [front matter](/content-management/front-matter/). + +### Simple + +If all you need to do is add an entry to a menu, the simple form works well. + +#### A Single Menu + +``` +--- +menu: "main" +--- +``` + +#### Multiple Menus + +``` +--- +menu: ["main", "footer"] +--- +``` + +#### Advanced + + +``` +--- +menu: + docs: + parent: 'extras' + weight: 20 +--- +``` + +## Add Non-content Entries to a Menu + +You can also add entries to menus that aren’t attached to a piece of content. This takes place in your Hugo project's [`config` file][config]. + +Here’s an example snippet pulled from a `config.toml`: + +{{< code file="config.toml" >}} +[[menu.main]] + name = "about hugo" + pre = "" + weight = -110 + identifier = "about" + url = "/about/" +[[menu.main]] + name = "getting started" + pre = "" + weight = -100 + url = "/getting-started/" +{{< /code >}} + +Here's the equivalent snippet in a `config.yaml`: + +{{< code file="config.yml" >}} +--- +menu: + docs: + - Name: "about hugo" + Pre: "" + Weight: -110 + Identifier: "about" + URL: "/about/" + - Name: "getting started" + Pre: "" + Weight: -100 + URL: "/getting-started/" +--- +{{< /code >}} + +{{% note %}} +The URLs must be relative to the context root. If the `baseURL` is `https://example.com/mysite/`, then the URLs in the menu must not include the context root `mysite`. Using an absolute URL will overide the baseURL. If the value used for `URL` in the above example is `https://subdomain.example.com/`, the output will be `https://subdomain.example.com`. +{{% /note %}} + +## Nesting + +All nesting of content is done via the `parent` field. + +The parent of an entry should be the identifier of another entry. The identifier should be unique (within a menu). + +The following order is used to determine an Identifier: + +`.Name > .LinkTitle > .Title` + +This means that `.Title` will be used unless `.LinkTitle` is present, etc. In practice, `.Name` and `.Identifier` are only used to structure relationships and therefore never displayed. + +In this example, the top level of the menu is defined in your [site `config` file][config]). All content entries are attached to one of these entries via the `.Parent` field. + +## Render Menus + +See [Menu Templates](/templates/menu-templates/) for information on how to render your site menus within your templates. + +[config]: /getting-started/configuration/ +[multilingual]: /content-management/multilingual/ +[sitevars]: /variables/ diff -Nru hugo-0.25.1/docs/content/content-management/multilingual.md hugo-0.26/docs/content/content-management/multilingual.md --- hugo-0.25.1/docs/content/content-management/multilingual.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/content-management/multilingual.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,294 @@ +--- +title: Multilingual Mode +linktitle: Multilingual and i18n +description: Hugo supports the creation of websites with multiple languages side by side. +date: 2017-01-10 +publishdate: 2017-01-10 +lastmod: 2017-01-10 +categories: [content management] +#tags: [multilingual,i18n, internationalization] +menu: + docs: + parent: "content-management" + weight: 150 +weight: 150 #rem +draft: false +aliases: [/content/multilingual/,/content-management/multilingual/] +toc: true +--- + +You should define the available languages in a `Languages` section in your site configuration. + +## Configure Languages + +The following is an example of a TOML site configuration for a multilingual Hugo project: + +{{< code file="config.toml" download="config.toml" >}} +DefaultContentLanguage = "en" +copyright = "Everything is mine" + +[params.navigation] +help = "Help" + +[Languages] +[Languages.en] +title = "My blog" +weight = 1 +[Languages.en.params] +linkedin = "english-link" + +[Languages.fr] +copyright = "Tout est à moi" +title = "Mon blog" +weight = 2 +[Languages.fr.params] +linkedin = "lien-francais" +[Languages.fr.navigation] +help = "Aide" +{{< /code >}} + +Anything not defined in a `[Languages]` block will fall back to the global +value for that key (e.g., `copyright` for the English [`en`] language). + +With the configuration above, all content, sitemap, RSS feeds, paginations, +and taxonomy pages will be rendered below `/` in English (your default content language) and then below `/fr` in French. + +When working with front matter `Params` in [single page templates][singles], omit the `params` in the key for the translation. + +If you want all of the languages to be put below their respective language code, enable `defaultContentLanguageInSubdir: true`. + +Only the obvious non-global options can be overridden per language. Examples of global options are `baseURL`, `buildDrafts`, etc. + +## Taxonomies and Blackfriday + +Taxonomies and [Blackfriday configuration][config] can also be set per language: + + +{{< code file="bf-config.toml" >}} +[Taxonomies] +tag = "tags" + +[blackfriday] +angledQuotes = true +hrefTargetBlank = true + +[Languages] +[Languages.en] +weight = 1 +title = "English" +[Languages.en.blackfriday] +angledQuotes = false + +[Languages.fr] +weight = 2 +title = "Français" +[Languages.fr.Taxonomies] +plaque = "plaques" +{{< /code >}} + +## Translate Your Content + +Translated articles are identified by the name of the content file. + +### Examples of Translated Articles + +1. `/content/about.en.md` +2. `/content/about.fr.md` + +In this example, the `about.md` will be assigned the configured `defaultContentLanguage`. + +1. `/content/about.md` +2. `/content/about.fr.md` + +This way, you can slowly start to translate your current content without having to rename everything. If left unspecified, the default value for `defaultContentLanguage` is `en`. + +By having the same *base filename*, the content pieces are linked together as translated pieces. + +If you need distinct URLs per language, you can set the slug in the non-default language file. For example, you can define a custom slug for a French translation in the front matter of `content/about.fr.md` as follows: + +``` +slug: "a-propos" + +``` + +At render, Hugo will build both `/about/` and `/a-propos/` as properly linked translated pages. + +{{%note %}} +Hugo currently uses the base filename as the translation key, which can be an issue with identical filenames in different sections. +We will fix this in https://github.com/gohugoio/hugo/issues/2699 +{{% /note %}} +{{< todo >}}Rewrite/remove the above one issue is fixed.{{< /todo >}} + +## Link to Translated Content + +To create a list of links to translated content, use a template similar to the following: + +{{< code file="layouts/partials/i18nlist.html" >}} +{{ if .IsTranslated }} +

{{ i18n "translations" }}

+ +{{ end }} +{{< /code >}} + +The above can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template, be it for a [single content page][contenttemplate] or the [homepage][]. It will not print anything if there are no translations for a given page, or if there are translations---in the case of the homepage, section listing, etc.---a site with only render one language. + +The above also uses the [`i18n` function][i18func] described in the next section. + +## Translation of Strings + +Hugo uses [go-i18n][] to support string translations. [See the project's source repository][go-i18n-source] to find tools that will help you manage your translation workflows. + +Translations are collected from the `themes//i18n/` folder (built into the theme), as well as translations present in `i18n/` at the root of your project. In the `i18n`, the translations will be merged and take precedence over what is in the theme folder. Language files should be named according to [RFC 5646][] with names such as `en-US.toml`, `fr.toml`, etc. + +From within your templates, use the `i18n` function like this: + +``` +{{ i18n "home" }} +``` + +This uses a definition like this one in `i18n/en-US.toml`: + +``` +[home] +other = "Home" +``` + +Often you will want to use to the page variables in the translations strings. To do that, pass on the "." context when calling `i18n`: + +``` +{{ i18n "wordCount" . }} +``` + +This uses a definition like this one in `i18n/en-US.toml`: + +``` +[wordCount] +other = "This article has {{ .WordCount }} words." +``` +An example of singular and plural form: + +``` +[readingTime] +one = "One minute read" +other = "{{.Count}} minutes read" +``` +And then in the template: + +``` +{{ i18n "readingTime" .ReadingTime }} +``` +To track down missing translation strings, run Hugo with the `--i18n-warnings` flag: + +``` + hugo --i18n-warnings | grep i18n +i18n|MISSING_TRANSLATION|en|wordCount +``` + +## Customize Dates + +At the time of this writing, Golang does not yet have support for internationalized locales, but if you do some work, you can simulate it. For example, if you want to use French month names, you can add a data file like ``data/mois.yaml`` with this content: + +~~~yaml +1: "janvier" +2: "février" +3: "mars" +4: "avril" +5: "mai" +6: "juin" +7: "juillet" +8: "août" +9: "septembre" +10: "octobre" +11: "novembre" +12: "décembre" +~~~ + +... then index the non-English date names in your templates like so: + +~~~html + +~~~ + +This technique extracts the day, month and year by specifying ``.Date.Day``, ``.Date.Month``, and ``.Date.Year``, and uses the month number as a key, when indexing the month name data file. + +## Menus + +You can define your menus for each language independently. The [creation of a menu][menus] works analogous to earlier versions of Hugo, except that they have to be defined in their language-specific block in the configuration file: + +``` +defaultContentLanguage = "en" + +[languages.en] +weight = 0 +languageName = "English" + +[[languages.en.menu.main]] +url = "/" +name = "Home" +weight = 0 + + +[languages.de] +weight = 10 +languageName = "Deutsch" + +[[languages.de.menu.main]] +url = "/" +name = "Startseite" +weight = 0 +``` + +The rendering of the main navigation works as usual. `.Site.Menus` will just contain the menu of the current language. Pay attention to the generation of the menu links. `absLangURL` takes care that you link to the correct locale of your website. Otherwise, both menu entries would link to the English version as the default content language that resides in the root directory. + +``` +
    + {{- $currentPage := . -}} + {{ range .Site.Menus.main -}} +
  • + {{ .Name }} +
  • + {{- end }} +
+ +``` + +## Missing translations + +If a string does not have a translation for the current language, Hugo will use the value from the default language. If no default value is set, an empty string will be shown. + +While translating a Hugo website, it can be handy to have a visual indicator of missing translations. The [`enableMissingTranslationPlaceholders` configuration option][config] will flag all untranslated strings with the placeholder `[i18n] identifier`, where `identifier` is the id of the missing translation. + +{{% note %}} +Hugo will generate your website with these missing translation placeholders. It might not be suited for production environments. +{{% /note %}} + +## Multilingual Themes support + +To support Multilingual mode in your themes, some considerations must be taken for the URLs in the templates. If there is more than one language, URLs must meet the following criteria: + +* Come from the built-in `.Permalink` or `.URL` +* Be constructed with + * The [`relLangURL` template function][rellangurl] or the [`absLangURL` template function][abslangurl] **OR** + * Prefixed with `{{ .LanguagePrefix }}` + +If there is more than one language defined, the `LanguagePrefix` variable will equal `/en` (or whatever your `CurrentLanguage` is). If not enabled, it will be an empty string and is therefore harmless for single-language Hugo websites. + +[abslangurl]: /functions/abslangurl +[config]: /getting-started/configuration/ +[contenttemplate]: /templates/single-page-templates/ +[go-i18n-source]: https://github.com/nicksnyder/go-i18n +[go-i18n]: https://github.com/nicksnyder/go-i18n +[homepage]: /templates/homepage/ +[i18func]: /functions/i18n/ +[menus]: /content-management/menus/ +[rellangurl]: /functions/rellangurl +[RFC 5646]: https://tools.ietf.org/html/rfc5646 +[singles]: /templates/single-page-templates/ diff -Nru hugo-0.25.1/docs/content/content-management/organization.md hugo-0.26/docs/content/content-management/organization.md --- hugo-0.25.1/docs/content/content-management/organization.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/content-management/organization.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,241 @@ +--- +title: Content Organization +linktitle: Organization +description: Hugo assumes that the same structure that works to organize your source content is used to organize the rendered site. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [content management,fundamentals] +#tags: [sections,content,organization] +menu: + docs: + parent: "content-management" + weight: 10 +weight: 10 #rem +draft: false +aliases: [/content/sections/] +toc: true +--- + +{{% note %}} +This section is not updated with the new nested sections support in Hugo 0.24, see https://github.com/gohugoio/hugoDocs/issues/36 +{{% /note %}} +{{% todo %}} +See above +{{% /todo %}} + +## Organization of Content Source + +In Hugo, your content should be organized in a manner that reflects the rendered website. + +While Hugo supports content nested at any level, the top levels (i.e. `content/`) are special in Hugo and are considered the content [sections][]. Without any additional configuration, the following will just work: + +``` +. +└── content + └── about + | └── _index.md // <- https://example.com/about/ + ├── post + | ├── firstpost.md // <- https://example.com/post/firstpost/ + | ├── happy + | | └── ness.md // <- https://example.com/post/happy/ness/ + | └── secondpost.md // <- https://example.com/post/secondpost/ + └── quote + ├── first.md // <- https://example.com/quote/first/ + └── second.md // <- https://example.com/quote/second/ +``` + +## Path Breakdown in Hugo + +The following demonstrates the relationships between your content organization and the output URL structure for your Hugo website when it renders. These examples assume you are [using pretty URLs][pretty], which is the default behavior for Hugo. The examples also assume a key-value of `baseurl = "https://example.com"` in your [site's configuration file][config]. + +### Index Pages: `_index.md` + +`_index.md` has a special role in Hugo. It allows you to add front matter and content to your [list templates][lists] as of v0.18. These templates include those for [section templates][], [taxonomy templates][], [taxonomy terms templates][], and your [homepage template][]. In your templates, you can grab information from `_index.md` using the [`.Site.GetPage` function][getpage]. + +You can keep one `_index.md` for your homepage and one in each of your content sections, taxonomies, and taxonomy terms. The following shows typical placement of an `_index.md` that would contain content and front matter for a `posts` section list page on a Hugo website: + + +``` +. url +. ⊢--^-⊣ +. path slug +. ⊢--^-⊣⊢---^---⊣ +. filepath +. ⊢------^------⊣ +content/posts/_index.md +``` + +At build, this will output to the following destination with the associated values: + +``` + + url ("/posts/") + ⊢-^-⊣ + baseurl section ("posts") +⊢--------^---------⊣⊢-^-⊣ + permalink +⊢----------^-------------⊣ +https://example.com/posts/index.html +``` + +### Single Pages in Sections + +Single content files in each of your sections are going to be rendered as [single page templates][singles]. Here is an example of a single `post` within `posts`: + + +``` + path ("posts/my-first-hugo-post.md") +. ⊢-----------^------------⊣ +. section slug +. ⊢-^-⊣⊢--------^----------⊣ +content/posts/my-first-hugo-post.md +``` + +At the time Hugo builds your site, the content will be output to the following destination: + +``` + + url ("/posts/my-first-hugo-post/") + ⊢------------^----------⊣ + baseurl section slug +⊢--------^--------⊣⊢-^--⊣⊢-------^---------⊣ + permalink +⊢--------------------^---------------------⊣ +https://example.com/posts/my-first-hugo-post/index.html +``` + +### Section with Nested Directories + +To continue the example, the following demonstrates destination paths for a file located at `content/events/chicago/lollapalooza.md` in the same site: + + +``` + section + ⊢--^--⊣ + url + ⊢-------------^------------⊣ + + baseURL path slug +⊢--------^--------⊣ ⊢------^-----⊣⊢----^------⊣ + permalink +⊢----------------------^-----------------------⊣ +https://example.com/events/chicago/lollapalooza/ +``` + +{{% note %}} +As of v0.20, Hugo does not recognize nested sections. While you can nest as many content *directories* as you'd like, any child directory of a section will still be considered the same section as that of its parents. Therefore, in the above example, `{{.Section}}` for `lollapalooza.md` is `events` and *not* `chicago`. See the [related issue on GitHub](https://github.com/gohugoio/hugo/issues/465). +{{% /note %}} + +## Paths Explained + +The following concepts will provide more insight into the relationship between your project's organization and the default behaviors of Hugo when building the output website. + +### `section` + +A default content type is determined by a piece of content's section. `section` is determined by the location within the project's `content` directory. `section` *cannot* be specified or overridden in front matter. + +### `slug` + +A content's `slug` is either `name.extension` or `name/`. The value for `slug` is determined by + +* the name of the content file (e.g., `lollapalooza.md`) OR +* front matter overrides + +### `path` + +A content's `path` is determined by the section's path to the file. The file `path` + +* is based on the path to the content's location AND +* does not include the slug + +### `url` + +The `url` is the relative URL for the piece of content. The `url` + +* is based on the content's location within the directory structure OR +* is defined in front matter and *overrides all the above* + +## Override Destination Paths via Front Matter + +Hugo believes that you organize your content with a purpose. The same structure that works to organize your source content is used to organize the rendered site. As displayed above, the organization of the source content will be mirrored in the destination. + +There are times where you may need more control over your content. In these cases, there are fields that can be specified in the front matter to determine the destination of a specific piece of content. + +The following items are defined in this order for a specific reason: items explained further down in the list will override earlier items, and not all of these items can be defined in front matter: + +### `filename` + +This isn't in the front matter, but is the actual name of the file minus the extension. This will be the name of the file in the destination (e.g., `content/posts/my-post.md` becomes `example.com/posts/my-post/`). + +### `slug` + +When defined in the front matter, the `slug` can take the place of the filename for the destination. + +{{< code file="content/posts/old-post.md" >}} +--- +title: New Post +slug: "new-post" +--- +{{< /code >}} + +This will render to the following destination according to Hugo's default behavior: + +``` +example.com/posts/new-post/ +``` + +### `section` + +`section` is determined by a content's location on disk and *cannot* be specified in the front matter. See [sections][] for more information. + +### `type` + +A content's `type` is also determined by its location on disk but, unlike `section`, it *can* be specified in the front matter. See [types][]. This can come in especially handy when you want a piece of content to render using a different layout. In the following example, you can create a layout at `layouts/new/mylayout.html` that Hugo will use to render this piece of content, even in the midst of many other posts. + +{{< code file="content/posts/my-post.md" >}} +--- +title: My Post +type: new +layout: mylayout +--- +{{< /code >}} + + + + + +### `url` + +A complete URL can be provided. This will override all the above as it pertains to the end destination. This must be the path from the baseURL (starting with a `/`). `url` will be used exactly as it provided in the front matter and will ignore the `--uglyURLs` setting in your site configuration: + +{{< code file="content/posts/old-url.md" >}} +--- +title: Old URL +url: /blog/new-url/ +--- +{{< /code >}} + +Assuming your `baseURL` is [configured][config] to `https://example.com`, the addition of `url` to the front matter will make `old-url.md` render to the following destination: + +``` +https://example.com/blog/new-url/ +``` + +You can see more information on how to control output paths in [URL Management][urls]. + +[config]: /getting-started/configuration/ +[formats]: /content-management/formats/ +[front matter]: /content-management/front-matter/ +[getpage]: /functions/getpage/ +[homepage template]: /templates/homepage/ +[homepage]: /templates/homepage/ +[lists]: /templates/lists/ +[pretty]: /content-management/urls/#pretty-urls +[section templates]: /templates/section-templates/ +[sections]: /content-management/sections/ +[singles]: /templates/single-page-templates/ +[taxonomy templates]: /templates/taxonomy-templates/ +[taxonomy terms templates]: /templates/taxonomy-templates/ +[types]: /content-management/types/ +[urls]: /content-management/urls/ diff -Nru hugo-0.25.1/docs/content/content-management/sections.md hugo-0.26/docs/content/content-management/sections.md --- hugo-0.25.1/docs/content/content-management/sections.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/content-management/sections.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,73 @@ +--- +title: Content Sections +linktitle: Sections +description: Hugo supports content sections, which according to Hugo's default behavior, will reflect the structure of the rendered website. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [content management] +#tags: [lists,sections,content types,organization] +menu: + docs: + parent: "content-management" + weight: 50 +weight: 50 #rem +draft: false +aliases: [/content/sections/] +toc: true +--- + +{{% note %}} +This section is not updated with the new nested sections support in Hugo 0.24, see https://github.com/gohugoio/hugoDocs/issues/36 +{{% /note %}} +{{% todo %}} +See above +{{% /todo %}} + +Hugo believes that you organize your content with a purpose. The same structure that works to organize your source content is used to organize the rendered site (see [directory structure][]). + +Following this pattern, Hugo uses the top level of your content organization as the content **section**. + +The following example shows a content directory structure for a website that has three sections: "authors," "events," and "posts": + +``` +. +└── content + ├── authors + | ├── _index.md // <- example.com/authors/ + | ├── john-doe.md // <- example.com/authors/john-doe/ + | └── jane-doe.md // <- example.com/authors/jane-doe/ + └── events + | ├── _index.md // <- example.com/events/ + | ├── event-1.md // <- example.com/events/event-1/ + | ├── event-2.md // <- example.com/events/event-2/ + | └── event-3.md // <- example.com/events/event-3/ + └── posts + | ├── _index.md // <- example.com/posts/ + | ├── event-1.md // <- example.com/posts/event-1/ + | ├── event-2.md // <- example.com/posts/event-2/ + | ├── event-3.md // <- example.com/posts/event-3/ + | ├── event-4.md // <- example.com/posts/event-4/ + | └── event-5.md // <- example.com/posts/event-5/ +``` + +## Content Section Lists + +Hugo will automatically create pages for each section root that list all of the content in that section. See the documentation on [section templates][] for details on customizing the way these pages are rendered. + +As of Hugo v0.18, section pages can also have a content file and front matter. These section content files must be placed in their corresponding section folder and named `_index.md` in order for Hugo to correctly render the front matter and content. + +{{% warning "`index.md` vs `_index.md`" %}} +Hugo themes developed before v0.18 often used an `index.md`(i.e., without the leading underscore [`_`]) in a content section as a hack to emulate the behavior of `_index.md`. The hack may work...*sometimes*; however, the order of page rendering can be unpredictable in Hugo. What works now may fail to render appropriately as your site grows. It is **strongly advised** to use `_index.md` as content for your section index pages. **Note:** `_index.md`'s layout, as representative of a section, is a [list page template](/templates/section-templates/) and *not* a [single page template](/templates/single-page-templates/). If you want to alter the new default behavior for `_index.md`, configure `disableKinds` accordingly in your [site's configuration](/getting-started/configuration/). +{{% /warning %}} + +## Content *Section* vs Content *Type* + +By default, everything created within a section will use the [content type][] that matches the section name. For example, Hugo will assume that `posts/post-1.md` has a `posts` content type. If you are using an [archetype][] for your posts section, Hugo will generate front matter according to what it finds in `archetypes/posts.md`. + +[archetype]: /content-management/archetypes/ +[content type]: /content-management/types/ +[directory structure]: /getting-started/directory-structure/ +[section templates]: /templates/section-templates/ + + diff -Nru hugo-0.25.1/docs/content/content-management/shortcodes.md hugo-0.26/docs/content/content-management/shortcodes.md --- hugo-0.25.1/docs/content/content-management/shortcodes.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/content-management/shortcodes.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,395 @@ +--- +title: Shortcodes +linktitle: +description: Shortcodes are simple snippets inside your content files calling built-in or custom templates. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-03-31 +menu: + docs: + parent: "content-management" + weight: 35 +weight: 35 #rem +categories: [content management] +#tags: [markdown,content,shortcodes] +draft: false +aliases: [/extras/shortcodes/] +toc: true +--- + +## What a Shortcode is + +Hugo loves Markdown because of its simple content format, but there are times when Markdown falls short. Often, content authors are forced to add raw HTML (e.g., video ``) to Markdown content. We think this contradicts the beautiful simplicity of Markdown's syntax. + +Hugo created **shortcodes** to circumvent these limitations. + +A shortcode is a simple snippet inside a content file that Hugo will render using a predefined template. Note that shortcodes will not work in template files. If you need the type of drop-in functionality that shortcodes provide but in a template, you most likely want a [partial template][partials] instead. + +In addition to cleaner Markdown, shortcodes can be updated any time to reflect new classes, techniques, or standards. At the point of site generation, Hugo shortcodes will easily merge in your changes. You avoid a possibly complicated search and replace operation. + +## Use Shortcodes + +In your content files, a shortcode can be called by calling `{{%/* shortcodename parameters */%}}`. Shortcode parameters are space delimited, and parameters with internal spaces can be quoted. + +The first word in the shortcode declaration is always the name of the shortcode. Parameters follow the name. Depending upon how the shortcode is defined, the parameters may be named, positional, or both, although you can't mix parameter types in a single call. The format for named parameters models that of HTML with the format `name="value"`. + +Some shortcodes use or require closing shortcodes. Again like HTML, the opening and closing shortcodes match (name only) with the closing declaration, which is prepended with a slash. + +Here are two examples of paired shortcodes: + +``` +{{%/* mdshortcode */%}}Stuff to `process` in the *center*.{{%/* /mdshortcode */%}} +``` + +``` +{{}} A bunch of code here {{}} +``` + +The examples above use two different delimiters, the difference being the `%` character in the first and the `<>` characters in the second. + +### Shortcodes with Markdown + +The `%` character indicates that the shortcode's inner content---called in the [shortcode template][sctemps] with the [`.Inner` variable][scvars]---needs further processing by the page's rendering processor (i.e. markdown via Blackfriday). In the following example, Blackfriday would convert `**World**` to `World`: + +``` +{{%/* myshortcode */%}}Hello **World!**{{%/* /myshortcode */%}} +``` + +### Shortcodes Without Markdown + +The `<` character indicates that the shortcode's inner content does *not* need further rendering. Often shortcodes without markdown include internal HTML: + +``` +{{}}

Hello World!

{{}} +``` + +### Nested Shortcodes + +You can call shortcodes within other shortcodes by creating your own templates that leverage the `.Parent` variable. `.Parent` allows you to check the context in which the shortcode is being called. See [Shortcode templates][sctemps]. + +## Use Hugo's Built-in Shortcodes + +Hugo ships with a set of predefined shortcodes that represent very common usage. These shortcodes are provided for author convenience and to keep your markdown content clean. + +### `figure` + +`figure` is an extension of the image syntax in markdown, which does not provide a shorthand for the more semantic [HTML5 `
` element][figureelement]. + +The `figure` shortcode can use the following named parameters: + +* `src` +* `link` +* `title` +* `caption` +* `class` +* `attr` (i.e., attribution) +* `attrlink` +* `alt` + +#### Example `figure` Input + +{{< code file="figure-input-example.md" >}} +{{}} +{{< /code >}} + +#### Example `figure` Output + +{{< output file="figure-output-example.html" >}} +
+ +
+

Steve Francia

+
+
+{{< /output >}} + +### `gist` + +Bloggers often want to include GitHub gists when writing posts. Let's suppose we want to use the [gist at the following url][examplegist]: + +``` +https://gist.github.com/spf13/7896402 +``` + +We can embed the gist in our content via username and gist ID pulled from the URL: + +``` +{{}} +``` + +#### Example `gist` Input + +If the gist contains several files and you want to quote just one of them, you can pass the filename (quoted) as an optional third argument: + +{{< code file="gist-input.md" >}} +{{}} +{{< /code >}} + +#### Example `gist` Output + +{{< output file="gist-output.html" >}} +{{< gist spf13 7896402 >}} +{{< /output >}} + +#### Example `gist` Display + +To demonstrate the remarkably efficiency of Hugo's shortcode feature, we have embedded the `spf13` `gist` example in this page. The following simulates the experience for visitors to your website. Naturally, the final display will be contingent on your stylesheets and surrounding markup. + +{{< gist spf13 7896402 >}} + +### `highlight` + +This shortcode will convert the source code provided into syntax-highlighted HTML. Read more on [highlighting](/tools/syntax-highlighting/). `highlight` takes exactly one required `language` parameter and requires a closing shortcode. + +#### Example `highlight` Input + +{{< code file="content/tutorials/learn-html.md" >}} +{{}} +
+
+

{{ .Title }}

+ {{ range .Data.Pages }} + {{ .Render "summary"}} + {{ end }} +
+
+{{}} +{{< /code >}} + +#### Example `highlight` Output + +The `highlight` shortcode example above would produce the following HTML when the site is rendered: + +{{< output file="tutorials/learn-html/index.html" >}} +<section id="main"> + <div> + <h1 id="title">{{ .Title }}</h1> + {{ range .Data.Pages }} + {{ .Render "summary"}} + {{ end }} + </div> +</section> +{{< /output >}} + +{{% note "More on Syntax Highlighting" %}} +To see even more options for adding syntax-highlighted code blocks to your website, see [Syntax Highlighting in Developer Tools](/tools/syntax-highlighting/). +{{% /note %}} + +### `instagram` + +If you'd like to embed a photo from [Instagram][], you only need the photo's ID. You can discern an Instagram photo ID from the URL: + +``` +https://www.instagram.com/p/BWNjjyYFxVx/ +``` + +#### Example `instagram` Input + +{{< code file="instagram-input.md" >}} +{{}} +{{< /code >}} + +You also have the option to hide the caption: + +{{< code file="instagram-input-hide-caption.md" >}} +{{}} +{{< /code >}} + +#### Example `instagram` Output + +By adding the preceding `hidecaption` example, the following HTML will be added to your rendered website's markup: + +{{< output file="instagram-hide-caption-output.html" >}} +{{< instagram BWNjjyYFxVx hidecaption >}} +{{< /output >}} + +#### Example `instagram` Display + +Using the preceding `instagram` with hidecaption` example above, the following simulates the displayed experience for visitors to your website. Naturally, the final display will be contingent on your stylesheets and surrounding markup. + +{{< instagram BWNjjyYFxVx hidecaption >}} + + +### `ref` and `relref` + +These shortcodes will look up the pages by their relative path (e.g., `blog/post.md`) or their logical name (`post.md`) and return the permalink (`ref`) or relative permalink (`relref`) for the found page. + +`ref` and `relref` also make it possible to make fragmentary links that work for the header links generated by Hugo. + +{{% note "More on Cross References" %}} +Read a more extensive description of `ref` and `relref` in the [cross references](/content-management/cross-references/) documentation. +{{% /note %}} + +`ref` and `relref` take exactly one required parameter of _reference_, quoted and in position `0`. + +#### Example `ref` and `relref` Input + +``` +[Neat]({{}}) +[Who]({{}}) +``` + +#### Example `ref` and `relref` Output + +Assuming that standard Hugo pretty URLs are turned on. + +``` +Neat +Who +``` + +### `speakerdeck` + +To embed slides from [Speaker Deck][], click on "< /> Embed" (under Share right next to the template on Speaker Deck) and copy the URL: + +``` + +``` + +#### `speakerdeck` Example Input + +Extract the value from the field `data-id` and pass it to the shortcode: + +{{< code file="speakerdeck-example-input.md" >}} +{{}} +{{< /code >}} + +#### `speakerdeck` Example Output + +{{< output file="speakerdeck-example-input.md" >}} +{{< speakerdeck 4e8126e72d853c0060001f97 >}} +{{< /output >}} + +#### `speakerdeck` Example Display + +For the preceding `speakerdeck` example, the following simulates the displayed experience for visitors to your website. Naturally, the final display will be contingent on your stylesheets and surrounding markup. + +{{< speakerdeck 4e8126e72d853c0060001f97 >}} + +### `tweet` + +You want to include a single tweet into your blog post? Everything you need is the URL of the tweet: + +``` +https://twitter.com/spf13/status/877500564405444608 +``` + +#### Example `tweet` Input + +Pass the tweet's ID from the URL as a parameter to the `tweet` shortcode: + +{{< code file="example-tweet-input.md" >}} +{{}} +{{< /code >}} + +#### Example `tweet` Output + +Using the preceding `tweet` example, the following HTML will be added to your rendered website's markup: + +{{< output file="example-tweet-output.html" >}} +{{< tweet 877500564405444608 >}} +{{< /output >}} + +#### Example `tweet` Display + +Using the preceding `tweet` example, the following simulates the displayed experience for visitors to your website. Naturally, the final display will be contingent on your stylesheets and surrounding markup. + +{{< tweet 877500564405444608 >}} + +### `vimeo` + +Adding a video from [Vimeo][] is equivalent to the YouTube shortcode above. + +``` +https://vimeo.com/channels/staffpicks/146022717 +``` + +#### Example `vimeo` Input + +Extract the ID from the video's URL and pass it to the `vimeo` shortcode: + +{{< code file="example-vimeo-input.md" >}} +{{}} +{{< /code >}} + +#### Example `vimeo` Output + +Using the preceding `vimeo` example, the following HTML will be added to your rendered website's markup: + +{{< output file="example-vimeo-output.html" >}} +{{< vimeo 146022717 >}} +{{< /output >}} + +{{% tip %}} +If you want to further customize the visual styling of the YouTube or Vimeo output, add a `class` named parameter when calling the shortcode. The new `class` will be added to the `
` that wraps the ` -
- -This would be rendered as: - -
- -
- -## Single Named Example: image with caption - - {{}} - -Would load the template /layouts/shortcodes/img.html - - -
- {{ with .Get "link"}}{{ end }} - - {{ if .Get "link"}}{{ end }} - {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}} -
{{ if isset .Params "title" }} -

{{ .Get "title" }}

{{ end }} - {{ if or (.Get "caption") (.Get "attr")}}

- {{ .Get "caption" }} - {{ with .Get "attrlink"}} {{ end }} - {{ .Get "attr" }} - {{ if .Get "attrlink"}} {{ end }} -

{{ end }} -
- {{ end }} -
- - -Would be rendered as: - -
- -
-

Steve Francia

-
-
- -## Single Flexible Example: vimeo with defaults - - {{}} - {{}} - -Would load the template /layouts/shortcodes/vimeo.html - - {{ if .IsNamedParams }} -
- -
- {{ else }} -
- -
- {{ end }} - -Would be rendered as: - -
- -
-
- -
- -## Paired Example: Highlight -*Hugo already ships with the `highlight` shortcode* - - {{}} - - This HTML - - {{}} - -The template for this utilizes the following code (already included in Hugo) - - {{ .Get 0 | highlight .Inner }} - -And will be rendered as: - -
<html>
-        <body> This HTML </body>
-    </html>
-    
- -Please notice that this template makes use of a Hugo-specific template function -called `highlight` which uses Pygments to add the highlighting code. - -## Simple Single-word Example: Year - -Let's assume you would like to have a shortcode to be replaced by the current year in your Markdown content files, for a license or copyright statement. Calling a shortcode like this: - - {{}} - -... would load your one-line template ``/layouts/shortcodes/year.html``, which contains: - - {{ .Page.Now.Year }} - -More shortcode examples can be found at [spf13.com](https://github.com/spf13/spf13.com/tree/master/layouts/shortcodes). diff -Nru hugo-0.25.1/docs/content/extras/toc.md hugo-0.26/docs/content/extras/toc.md --- hugo-0.25.1/docs/content/extras/toc.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/extras/toc.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ ---- -lastmod: 2015-01-27 -date: 2013-07-09 -menu: - main: - parent: extras -next: /extras/localfiles -prev: /extras/highlighting -title: Table of Contents ---- - -Hugo will automatically parse the Markdown for your content and create -a Table of Contents you can use to guide readers to the sections within -your content. - -## Usage - -Simply create content like you normally would with the appropriate -headers. - -Hugo will take this Markdown and create a table of contents stored in the -[content variable](/layout/variables/) `.TableOfContents` - - -## Template Example - -This is example code of a [single.html template](/layout/content/). - - {{ partial "header.html" . }} -
- {{ .TableOfContents }} -
-

{{ .Title }}

- {{ .Content }} - {{ partial "footer.html" . }} - - diff -Nru hugo-0.25.1/docs/content/extras/urls.md hugo-0.26/docs/content/extras/urls.md --- hugo-0.25.1/docs/content/extras/urls.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/extras/urls.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ ---- -aliases: -- /doc/urls/ -lastmod: 2016-05-07 -date: 2014-01-03 -menu: - main: - parent: extras -next: /community/mailing-list -notoc: true -prev: /extras/localfiles -title: URLs ---- - -## Pretty URLs - -By default, Hugo creates content with 'pretty' URLs. For example, -content created at `/content/extras/urls.md` will be rendered at -`/public/extras/urls/index.html`, thus accessible from the browser -at http://example.com/extras/urls/. No non-standard server-side -configuration is required for these pretty URLs to work. - -If you would like to have what we call "ugly URLs", -e.g. http://example.com/extras/urls.html, you are in luck. -Hugo supports the ability to create your entire site with ugly URLs. -Simply add `uglyurls = true` to your site-wide `config.toml`, -or use the `--uglyURLs=true` flag on the command line. - -If you want a specific piece of content to have an exact URL, you can -specify this in the front matter under the `url` key. See [Content -Organization](/content/organization/) for more details. - -## Canonicalization - -By default, all relative URLs encountered in the input are left unmodified, -e.g. `/css/foo.css` would stay as `/css/foo.css`, -i.e. `canonifyURLs` defaults to `false`. - -By setting `canonifyURLs` to `true`, all relative URLs would instead -be *canonicalized* using `baseURL`. For example, assuming you have -`baseURL = http://yoursite.example.com/` defined in the site-wide -`config.toml`, the relative URL `/css/foo.css` would be turned into -the absolute URL `http://yoursite.example.com/css/foo.css`. - -Benefits of canonicalization include fixing all URLs to be absolute, which may -aid with some parsing tasks. Note though that all real browsers handle this -client-side without issues. - -Benefits of non-canonicalization include being able to have resource inclusion -be scheme-relative, so that http vs https can be decided based on how this -page was retrieved. - -> Note: In the May 2014 release of Hugo v0.11, the default value of `canonifyURLs` was switched from `true` to `false`, which we think is the better default and should continue to be the case going forward. So, please verify and adjust your website accordingly if you are upgrading from v0.10 or older versions. - -To find out the current value of `canonifyURLs` for your website, you may use the handy `hugo config` command added in v0.13: - - hugo config | grep -i canon - -Or, if you are on Windows and do not have `grep` installed: - - hugo config | FINDSTR /I canon - -## Relative URLs - -By default, all relative URLs are left unchanged by Hugo, -which can be problematic when you want to make your site browsable from a local file system. - -Setting `relativeURLs` to `true` in the site configuration will cause Hugo to rewrite all relative URLs to be relative to the current content. - -For example, if the `/post/first/` page contained a link with a relative URL of `/about/`, Hugo would rewrite that URL to `../../about/`. diff -Nru hugo-0.25.1/docs/content/functions/abslangurl.md hugo-0.26/docs/content/functions/abslangurl.md --- hugo-0.25.1/docs/content/functions/abslangurl.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/abslangurl.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,28 @@ +--- +title: absLangURL +description: Adds the absolute URL with correct language prefix according to site configuration for multilingual. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [multilingual,i18n,urls] +signature: ["absLangURL INPUT"] +workson: [] +hugoversion: +relatedfuncs: [relLangURL] +deprecated: false +aliases: [] +--- + +Both `absLangURL` and [`relLangURL`](/functions/rellangurl/) are similar to their [`absURL`](/functions/absurl/) and [`relURL`](/functions/relurl) relatives but will add the correct language prefix when the site is configured with more than one language. + +So for a site `baseURL` set to `https://example.com/hugo/` and the current language is `en`: + +``` +{{ "blog/" | absLangURL }} → "https://example.com/hugo/en/blog/" +{{ "blog/" | relLangURL }} → "/hugo/en/blog/" +``` diff -Nru hugo-0.25.1/docs/content/functions/absurl.md hugo-0.26/docs/content/functions/absurl.md --- hugo-0.25.1/docs/content/functions/absurl.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/absurl.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,51 @@ +--- +title: absURL +description: Creates an absolute URL based on the configured baseURL. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [urls] +signature: ["absURL INPUT"] +workson: [] +hugoversion: +relatedfuncs: [relURL] +deprecated: false +aliases: [] +--- + +Both `absURL` and `relURL` consider the configured value of `baseURL` in your site's [`config` file][configuration]. Given a `baseURL` set to `https://example.com/hugo/`: + +``` +{{ "mystyle.css" | absURL }} → "https://example.com/hugo/mystyle.css" +{{ "mystyle.css" | relURL }} → "/hugo/mystyle.css" +{{ "http://gohugo.io/" | relURL }} → "http://gohugo.io/" +{{ "http://gohugo.io/" | absURL }} → "http://gohugo.io/" +``` + +The last two examples may look strange but can be very useful. For example, the following shows how to use `absURL` in [JSON-LD structured data (SEO)][jsonld], where some of your images for a piece of content may or may not be hosted locally: + +{{< code file="layouts/partials/schemaorg-metadata.html" download="schemaorg-metadata.html" >}} + +{{< /code >}} + +The above uses the [apply function][] and also exposes how the Go template parser JSON-encodes objects inside ` +{{< /code >}} + +The above uses the [apply function][] and also exposes how the Go template parser JSON-encodes objects inside `` → `` +* `` → `` + diff -Nru hugo-0.25.1/docs/content/functions/safeURL.md hugo-0.26/docs/content/functions/safeURL.md --- hugo-0.25.1/docs/content/functions/safeURL.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/safeURL.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,72 @@ +--- +title: safeURL +description: Declares the provided string as a safe URL or URL substring. +godocref: https://golang.org/pkg/html/template/#HTMLEscape +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +#tags: [strings,urls] +categories: [functions] +menu: + docs: + parent: "functions" +signature: ["safeURL INPUT"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +aliases: [] +--- + +`safeURL` declares the provided string as a "safe" URL or URL substring (see [RFC 3986][]). A URL like `javascript:checkThatFormNotEditedBeforeLeavingPage()` from a trusted source should go in the page, but by default dynamic `javascript:` URLs are filtered out since they are a frequently exploited injection vector. + +Without `safeURL`, only the URI schemes `http:`, `https:` and `mailto:` are considered safe by Go templates. If any other URI schemes (e.g., `irc:` and `javascript:`) are detected, the whole URL will be replaced with `#ZgotmplZ`. This is to "defang" any potential attack in the URL by rendering it useless. + +The following examples use a [site `config.toml`][configuration] with the following [menu entry][menus]: + +{{< code file="config.toml" copy="false" >}} +[[menu.main]] + name = "IRC: #golang at freenode" + url = "irc://irc.freenode.net/#golang" +{{< /code >}} + +The following is an example of a sidebar partial that may be used in conjunction with the preceding front matter example: + +{{< code file="layouts/partials/bad-url-sidebar-menu.html" copy="false" >}} + +
    + {{ range .Site.Menus.main }} +
  • {{ .Name }}
  • + {{ end }} +
+{{< /code >}} + +This partial would produce the following HTML output: + +{{< output file="bad-url-sidebar-menu-output.html" >}} + + +{{< /output >}} + +The odd output can be remedied by adding ` | safeURL` to our `.Title` page variable: + +{{< code file="layouts/partials/correct-url-sidebar-menu.html" copy="false" >}} + + +{{< /code >}} + +With the `.URL` page variable piped through `safeURL`, we get the desired output: + +{{< output file="correct-url-sidebar-menu-output.html" >}} + +{{< /output >}} + +[configuration]: /getting-started/configuration/ +[menus]: /content-management/menus/ +[RFC 3986]: http://tools.ietf.org/html/rfc3986 diff -Nru hugo-0.25.1/docs/content/functions/scratch.md hugo-0.26/docs/content/functions/scratch.md --- hugo-0.25.1/docs/content/functions/scratch.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/scratch.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,75 @@ +--- +title: .Scratch +description: Acts as a "scratchpad" to allow for writable page- or shortcode-scoped variables. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +#tags: [iteration] +categories: [functions] +menu: + docs: + parent: "functions" +toc: +signature: [] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +draft: false +aliases: [/extras/scratch/,/doc/scratch/] +--- + +In most cases you can do well without `Scratch`, but there are some use cases that aren't solvable with Go's templates without `Scratch`'s help, due to scoping issues. + +`Scratch` is added to both `Page` and `Shortcode` -- with following methods: + +* `Set` and `Add` takes a `key` and the `value` to add. +* `Get` returns the `value` for the `key` given. +* `SetInMap` takes a `key`, `mapKey` and `value` +* `GetSortedMapValues` returns array of values from `key` sorted by `mapKey` + +`Set` and `SetInMap` can store values of any type. + +For single values, `Add` accepts values that support Go's `+` operator. If the first `Add` for a key is an array or slice, the following adds will be appended to that list. + +The scope of the backing data is global for the given `Page` or `Shortcode`, and spans partial and shortcode includes. + +Note that `.Scratch` from a shortcode will return the shortcode's `Scratch`, which in most cases is what you want. If you want to store it in the page scroped Scratch, then use `.Page.Scratch`. + +## Sample usage + +The usage is best illustrated with some samples: + +``` +{{ $.Scratch.Add "a1" 12 }} +{{ $.Scratch.Get "a1" }} {{/* => 12 */}} +{{ $.Scratch.Add "a1" 1 }} +{{ $.Scratch.Get "a1" }} // {{/* => 13 */}} + +{{ $.Scratch.Add "a2" "AB" }} +{{ $.Scratch.Get "a2" }} {{/* => AB */}} +{{ $.Scratch.Add "a2" "CD" }} +{{ $.Scratch.Get "a2" }} {{/* => ABCD */}} + +{{ $.Scratch.Add "l1" (slice "A" "B") }} +{{ $.Scratch.Get "l1" }} {{/* => [A B] */}} +{{ $.Scratch.Add "l1" (slice "C" "D") }} +{{ $.Scratch.Get "l1" }} {{/* => [A B C D] */}} + +{{ $.Scratch.Set "v1" 123 }} +{{ $.Scratch.Get "v1" }} {{/* => 123 */}} + +{{ $.Scratch.SetInMap "a3" "b" "XX" }} +{{ $.Scratch.SetInMap "a3" "a" "AA" }} +{{ $.Scratch.SetInMap "a3" "c" "CC" }} +{{ $.Scratch.SetInMap "a3" "b" "BB" }} +{{ $.Scratch.GetSortedMapValues "a3" }} {{/* => []interface {}{"AA", "BB", "CC"} */}} +``` + +{{% note %}} +The examples above uses the special `$` variable, which refers to the top-level node. This is the behavior you most likely want, and will help remove some confusion when using `Scratch` inside page range loops -- and you start inadvertently calling the wrong `Scratch`. But there may be use cases for `{{ .Scratch.Add "key" "some value" }}`. +{{% /note %}} + + +[pagevars]: /variables/page/ diff -Nru hugo-0.25.1/docs/content/functions/seq.md hugo-0.26/docs/content/functions/seq.md --- hugo-0.25.1/docs/content/functions/seq.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/seq.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,51 @@ +--- +title: seq +# linktitle: +description: Creates a sequence of integers. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [] +signature: ["seq LAST", "seq FIRST LAST", "seq FIRST INCREMENT LAST"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +draft: false +aliases: [] +--- + +It's named and used in the model of [GNU's seq][]. + +``` +3 → 1, 2, 3 +1 2 4 → 1, 3 +-3 → -1, -2, -3 +1 4 → 1, 2, 3, 4 +1 -2 → 1, 0, -1, -2 +``` + +## Example: `seq` with `range` and `after` + +You can use `seq` in combination with `range` and `after`. The following will return 19 elements: + +``` +{{ range after 1 (seq 20)}} +{{ end }} +``` + +However, when ranging with an index, the following may be less confusing in that `$indexStartingAt1` and `$num` will return `1,2,3 ... 20`: + +``` +{{ range $index, $num := (seq 20) }} +$indexStartingAt1 := (add $index 1) +{{ end }} +``` + + +[GNU's seq]: http://www.gnu.org/software/coreutils/manual/html_node/seq-invocation.html#seq-invocation diff -Nru hugo-0.25.1/docs/content/functions/sha.md hugo-0.26/docs/content/functions/sha.md --- hugo-0.25.1/docs/content/functions/sha.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/sha.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,34 @@ +--- +title: sha +# linktitle: sha +description: Hashes the given input and returns either an SHA1 or SHA256 checksum. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [sha,checksum] +signature: ["sha1 INPUT", "sha256 INPUT"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +aliases: [] +--- + +`sha1` hashes the given input and returns its SHA1 checksum. + +``` +{{ sha1 "Hello world, gophers!" }} + +``` + +`sha256` hashes the given input and returns its SHA256 checksum. + +``` +{{ sha256 "Hello world, gophers!" }} + +``` diff -Nru hugo-0.25.1/docs/content/functions/shuffle.md hugo-0.26/docs/content/functions/shuffle.md --- hugo-0.25.1/docs/content/functions/shuffle.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/shuffle.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,39 @@ +--- +title: shuffle +# linktitle: +description: Returns a random permutation of a given array or slice. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-04-30 +#tags: [ordering] +categories: [functions] +menu: + docs: + parent: "functions" +signature: ["shuffle COLLECTION"] +workson: [] +hugoversion: +relatedfuncs: [seq] +deprecated: false +draft: false +aliases: [] +--- + +{{< code file="shuffle-input.html" >}} + +
{{ shuffle (seq 1 5) }}
+ +
{{ shuffle (slice "foo" "bar" "buzz") }}
+{{< /code >}} + +This example would return the following: + +{{< output file="shuffle-output.html" >}} + +
2 5 3 1 4
+ +
buzz foo bar
+{{< /output >}} + +This example also makes use of the [slice](/functions/slice/) and [seq](/functions/seq/) functions. diff -Nru hugo-0.25.1/docs/content/functions/singularize.md hugo-0.26/docs/content/functions/singularize.md --- hugo-0.25.1/docs/content/functions/singularize.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/singularize.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,25 @@ +--- +title: singularize +# linktitle: singularize +description: Converts a word according to a set of common English singularization rules. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [strings,singular] +signature: ["singularize INPUT"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +aliases: [] +--- + +`{{ "cats" | singularize }}` → "cat" + +See also the `.Data.Singular` [taxonomy variable](/variables/taxonomy/) for singularizing taxonomy names. + diff -Nru hugo-0.25.1/docs/content/functions/slice.md hugo-0.26/docs/content/functions/slice.md --- hugo-0.25.1/docs/content/functions/slice.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/slice.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,32 @@ +--- +title: slice +# linktitle: slice +description: Creates a slice (array) of all passed arguments. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [slice, array, interface] +signature: ["slice ITEM..."] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +draft: false +aliases: [] +toc: false +--- + +One use case is the concatenation of elements in combination with the [`delimit` function][]: + +{{< code file="slice.html" >}} +{{ delimit (slice "foo" "bar" "buzz") ", " }} + +{{< /code >}} + + +[`delimit` function]: /functions/delimit/ diff -Nru hugo-0.25.1/docs/content/functions/slicestr.md hugo-0.26/docs/content/functions/slicestr.md --- hugo-0.25.1/docs/content/functions/slicestr.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/slicestr.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,27 @@ +--- +title: slicestr +# linktitle: +description: Creates a slice of a half-open range, including start and end indices. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [strings] +signature: ["slicestr STRING START [END]"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +aliases: [] +--- + +For example, 1 and 4 creates a slice including elements 1 through 3. +The `end` index can be omitted; it defaults to the string's length. + +* `{{slicestr "BatMan" 3}}` → "Man" +* `{{slicestr "BatMan" 0 3}}` → "Bat" + diff -Nru hugo-0.25.1/docs/content/functions/sort.md hugo-0.26/docs/content/functions/sort.md --- hugo-0.25.1/docs/content/functions/sort.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/sort.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,65 @@ +--- +title: sort +# linktitle: sort +description: Sorts maps, arrays, and slices and returns a sorted slice. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [ordering,sorting,lists] +signature: [] +workson: [lists,taxonomies,terms,groups] +hugoversion: +relatedfuncs: [] +deprecated: false +aliases: [] +--- + +A sorted array of map values will be returned with the keys eliminated. There are two optional arguments: `sortByField` and `sortAsc`. If left blank, sort will sort by keys (for maps) in ascending order as its default behavior. + +``` ++++ +#tags: [ "tag3", "tag1", "tag2" ] ++++ + +// Site config ++++ +[params.authors] + [params.authors.Derek] + "firstName" = "Derek" + "lastName" = "Perkins" + [params.authors.Joe] + "firstName" = "Joe" + "lastName" = "Bergevin" + [params.authors.Tanner] + "firstName" = "Tanner" + "lastName" = "Linsley" ++++ +``` + +``` +// Use default sort options - sort by key / ascending +Tags: {{ range sort .Params.tags }}{{ . }} {{ end }} + +→ Outputs Tags: tag1 tag2 tag3 + +// Sort by value / descending +Tags: {{ range sort .Params.tags "value" "desc" }}{{ . }} {{ end }} + +→ Outputs Tags: tag3 tag2 tag1 + +// Use default sort options - sort by value / descending +Authors: {{ range sort .Site.Params.authors }}{{ .firstName }} {{ end }} + +→ Outputs Authors: Derek Joe Tanner + +// Use default sort options - sort by value / descending +Authors: {{ range sort .Site.Params.authors "lastName" "desc" }}{{ .lastName }} {{ end }} + +→ Outputs Authors: Perkins Linsley Bergevin +``` + diff -Nru hugo-0.25.1/docs/content/functions/split.md hugo-0.26/docs/content/functions/split.md --- hugo-0.25.1/docs/content/functions/split.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/split.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,24 @@ +--- +title: split +# linktitle: split +description: splits a string into substrings separated by a delimiter +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [strings] +signature: ["split STRING DELIM"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +aliases: [] +--- + +* `{{split "tag1,tag2,tag3" "," }}` → ["tag1" "tag2" "tag3"] + + diff -Nru hugo-0.25.1/docs/content/functions/string.md hugo-0.26/docs/content/functions/string.md --- hugo-0.25.1/docs/content/functions/string.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/string.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,23 @@ +--- +title: string +# linktitle: string +description: Creates a string from the argument passed to the function +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [strings] +signature: ["string INPUT"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +aliases: [] +--- + +* `{{string "BatMan"}}` → "BatMan" + diff -Nru hugo-0.25.1/docs/content/functions/substr.md hugo-0.26/docs/content/functions/substr.md --- hugo-0.25.1/docs/content/functions/substr.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/substr.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,31 @@ +--- +title: substr +# linktitle: +description: Extracts parts of a string from a specified character's position and returns the specified number of characters. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [strings] +aliases: [] +signature: ["substr STRING START [LENGTH]"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +--- + +It normally takes two parameters: `start` and `length`. It can also take one parameter: `start`, i.e. `length` is omitted, in which case the substring starting from start until the end of the string will be returned. + +To extract characters from the end of the string, use a negative start number. + +In addition, borrowing from the extended behavior described at http://php.net substr, if `length` is given and is negative, that number of characters will be omitted from the end of string. + +``` +{{substr "BatMan" 0 -3}} → "Bat" +{{substr "BatMan" 3 3}} → "Man" +``` diff -Nru hugo-0.25.1/docs/content/functions/time.md hugo-0.26/docs/content/functions/time.md --- hugo-0.25.1/docs/content/functions/time.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/time.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,48 @@ +--- +title: time +linktitle: +description: Converts a timestamp string into a `time.Time` structure. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [dates,time] +signature: ["time INPUT"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +aliases: [] +--- + +`time` converts a timestamp string into a [`time.Time`](https://godoc.org/time#Time) structure so you can access its fields: + +``` +{{ time "2016-05-28" }} → "2016-05-28T00:00:00Z" +{{ (time "2016-05-28").YearDay }} → 149 +{{ mul 1000 (time "2016-05-28T10:30:00.00+10:00").Unix }} → 1464395400000, or Unix time in milliseconds +``` + +## Example: Using `time` to get Month Index + +The following example takes a UNIX timestamp---set as `utimestamp: "1489276800"` in a content's front matter---converts the timestamp (string) to an integer using the [`int` function][int], and then uses [`printf`][] to convert the `Month` property of `time` into an index. + +The following example may be useful when setting up [multilingual sites][multilingual]: + +{{< code file="unix-to-month-integer.html" >}} +{{$time := time (int .Params.addDate)}} +=> $time = 1489276800 +{{$time.Month}} +=> "March" +{{$monthindex := printf "%d" $time.Month }} +=> $monthindex = 3 +{{< /code >}} + + +[int]: /functions/int/ +[multilingual]: /content-management/multilingual/ +[`printf`]: /functions/printf/ diff -Nru hugo-0.25.1/docs/content/functions/title.md hugo-0.26/docs/content/functions/title.md --- hugo-0.25.1/docs/content/functions/title.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/title.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,33 @@ +--- +title: title +# linktitle: +description: Converts all characters in the provided string to title case. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions,fundamentals] +menu: + docs: + parent: "functions" +#tags: [strings] +signature: ["title INPUT"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +aliases: [] +--- + + +``` +{{title "BatMan"}}` → "Batman" +``` + +Can be combined in pipes. In the following snippet, the link text is cleaned up using `humanize` to remove dashes and `title` to convert the value of `$name` to Intial Caps. + +``` +{{ range $name, $items := .Site.Taxonomies.categories }} +
  • {{ $name | humanize | title }} ({{ len $items }})
  • +{{ end }} +``` diff -Nru hugo-0.25.1/docs/content/functions/trim.md hugo-0.26/docs/content/functions/trim.md --- hugo-0.25.1/docs/content/functions/trim.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/trim.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,42 @@ +--- +title: trim +# linktitle: +description: Returns a slice of a passed string with all leading and trailing characters from cutset removed. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [strings] +signature: ["trim INPUT CUTSET"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +--- + +``` +{{ trim "++Batman--" "+-" }} → "Batman" +``` + +`trim` *requires* the second argument, which tells the function specifically what to remove from the first argument. There is no default value for the second argument, so **the following usage will not work**: + +``` +{{ trim .Inner}} +``` + +Instead, the following example tells `trim` to remove extra new lines from the content contained in the [shortcode `.Inner` variable][shortcodevars]: + +``` +{{ trim .Inner "\n" }} +``` + +{{% note %}} +Go templates also provide a simple [method for trimming whitespace](/templates/introduction/#whitespace) from either side of a Go tag by including a hyphen (`-`). +{{% /note %}} + + +[shortcodevars]: /variables/shortcodes/ diff -Nru hugo-0.25.1/docs/content/functions/truncate.md hugo-0.26/docs/content/functions/truncate.md --- hugo-0.25.1/docs/content/functions/truncate.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/truncate.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,29 @@ +--- +title: truncate +# linktitle: truncate +description: Truncates a text to a max length without cutting words or leaving unclosed HTML tags. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [strings] +signature: ["truncate SIZE INPUT", "truncate SIZE ELLIPSIS INPUT"] +workson: [] +hugoversion: 19 +relatedfuncs: [] +deprecated: false +--- + +Since Go templates are HTML-aware, `truncate` will intelligently handle normal strings vs HTML strings: + +``` +{{ "Keep my HTML" | safeHTML | truncate 10 }}` → Keep my …` +``` + +{{% note %}} +If you have a raw string that contains HTML tags you want to remain treated as HTML, you will need to convert the string to HTML using the [`safeHTML` template function](/functions/safehtml) before sending the value to truncate. Otherwise, the HTML tags will be escaped when passed through the `truncate` function. +{{% /note %}} diff -Nru hugo-0.25.1/docs/content/functions/union.md hugo-0.26/docs/content/functions/union.md --- hugo-0.25.1/docs/content/functions/union.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/union.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,49 @@ +--- +title: union +# linktitle: union +description: Given two arrays or slices, returns a new array that contains the elements or objects that belong to either or both arrays/slices. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-03-12 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [filtering,lists] +signature: ["union SET1 SET2"] +workson: [] +hugoversion: 0.20 +relatedfuncs: [intersect,where] +deprecated: false +aliases: [] +--- + +Given two arrays (or slices) A and B, this function will return a new array that contains the elements or objects that belong to either A or to B or to both. The elements supported are strings, integers, and floats (only float64). + +``` +{{ union (slice 1 2 3) (slice 3 4 5) }} + + +{{ union (slice 1 2 3) nil }} + + +{{ union nil (slice 1 2 3) }} + + +{{ union nil nil }} + +``` + + +This is also very useful to use as `OR` filters when combined with where: + +``` +{{ $pages := where .Site.RegularPages "Type" "not in" (slice "page" "about") }} +{{ $pages := $pages | union (where .Site.RegularPages "Params.pinned" true) }} +{{ $pages := $pages | intersect (where .Site.RegularPages "Params.images" "!=" nil) }} +``` + +The above fetches regular pages not of `page` or `about` type unless they are pinned. And finally, we exclude all pages with no `images` set in Page params. + +See [intersect](/functions/intersect) for `AND`. diff -Nru hugo-0.25.1/docs/content/functions/uniq.md hugo-0.26/docs/content/functions/uniq.md --- hugo-0.25.1/docs/content/functions/uniq.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/uniq.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,31 @@ +--- +title: uniq +linktitle: uniq +description: Takes in a slice or array and returns a slice with subsequent duplicate elements removed. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [multilingual,i18n,urls] +signature: ["uniq SET"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +aliases: [] +needsexamples: false +--- + +``` +{{ uniq (slice 1 2 3 2) }} +{{ slice 1 2 3 2 | uniq }} + +``` + + + + diff -Nru hugo-0.25.1/docs/content/functions/unix.md hugo-0.26/docs/content/functions/unix.md --- hugo-0.25.1/docs/content/functions/unix.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/unix.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,38 @@ +--- +title: .Unix +draft: false +description: .Unix returns the local Time corresponding to the given Unix time, sec seconds and nsec nanoseconds since January 1, 1970 UTC. +godocref: https://golang.org/search?q=Unix#Functions +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +#tags: [dates,time] +categories: [functions] +menu: + docs: + parent: "functions" +signature: [".Unix"] +workson: [times] +hugoversion: +relatedfuncs: [Format,dateFormat,now,time] +deprecated: false +aliases: [] +--- + +## Example: Time Passed Since Last Modification + +This very simple one-liner uses `now.Unix` to calculate the amount of time that has passed between the `.LastMod` for the current page and the last build of the current page. + +{{< code file="time-passed.html" >}} +{{ div (sub now.Unix .Lastmod.Unix) 86400 }} +{{< /code >}} + +Since both values are integers, they can be subtracted and then divided by the number of seconds in a day (i.e., `60 * 60 * 24 == 86400`). + +{{% note %}} +Hugo's output is *static*. For the example above to be realistic, the site needs to be built every day. + {{% /note %}} + + + +[partial template]: /templates/partials/ diff -Nru hugo-0.25.1/docs/content/functions/upper.md hugo-0.26/docs/content/functions/upper.md --- hugo-0.25.1/docs/content/functions/upper.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/upper.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,30 @@ +--- +title: upper +# linktitle: upper +description: Converts all characters in a string to uppercase +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +#tags: [] +categories: [functions] +menu: + docs: + parent: "functions" +toc: +signature: ["upper INPUT"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +draft: false +aliases: [] +--- + +Note that `upper` can be applied in your templates in more than one way: + +``` +{{ upper "BatMan" }} → "BATMAN" +{{ "BatMan" | upper }} → "BATMAN" +``` + diff -Nru hugo-0.25.1/docs/content/functions/urlize.md hugo-0.26/docs/content/functions/urlize.md --- hugo-0.25.1/docs/content/functions/urlize.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/urlize.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,73 @@ +--- +title: urlize +# linktitle: urlize +description: Takes a string, sanitizes it for usage in URLs, and converts spaces to hyphens. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [urls,strings] +godocref: +signature: ["urlize INPUT"] +hugoversion: +deprecated: false +workson: [] +relatedfuncs: [] +--- + +The following examples pull from a content file with the following front matter: + +{{< code file="content/blog/greatest-city.md" copy="false">}} ++++ +title = "The World's Greatest City" +location = "Chicago IL" +tags = ["pizza","beer","hot dogs"] ++++ +{{< /code >}} + +The following might be used as a partial within a [single page template][singletemplate]: + +{{< code file="layouts/partials/content-header.html" download="content-header.html" >}} +
    +

    {{.Title}}

    + {{ with .Params.location }} + + {{ end }} + + {{ with .Params.tags }} +
      + {{range .}} +
    • + {{ . }} +
    • + {{end}} +
    + {{ end }} +
    +{{< /code >}} + +The preceding partial would then output to the rendered page as follows, assuming the page is being built with Hugo's default pretty URLs. + +{{< output file="/blog/greatest-city/index.html" >}} +
    +

    The World's Greatest City

    + + +
    +{{< /output >}} + + +[singletemplate]: /templates/single-page-templates/ diff -Nru hugo-0.25.1/docs/content/functions/where.md hugo-0.26/docs/content/functions/where.md --- hugo-0.25.1/docs/content/functions/where.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/where.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,137 @@ +--- +title: where +# linktitle: where +description: Filters an array to only the elements containing a matching value for a given field. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +#tags: [filtering] +signature: ["where COLLECTION KEY [OPERATOR] MATCH"] +workson: [lists,taxonomies,terms,groups] +hugoversion: +relatedfuncs: [intersect,first,after,last] +deprecated: false +toc: true +needsexample: true +--- + +`where` filters an array to only the elements containing a matching value for a given field. + +``` +{{ range where .Data.Pages "Section" "post" }} + {{ .Content }} +{{ end }} +``` + +It can be used by dot-chaining the second argument to refer to a nested element of a value. + +``` ++++ +series: golang ++++ +``` + +``` +{{ range where .Site.Pages "Params.series" "golang" }} + {{ .Content }} +{{ end }} +``` + +It can also be used with the logical operators `!=`, `>=`, `in`, etc. Without an operator, `where` compares a given field with a matching value equivalent to `=`. + +``` +{{ range where .Data.Pages "Section" "!=" "post" }} + {{ .Content }} +{{ end }} +``` + +The following logical operators are vailable with `where`: + +`=`, `==`, `eq` +: `true` if a given field value equals a matching value + +`!=`, `<>`, `ne` +: `true` if a given field value doesn't equal a matching value + +`>=`, `ge` +: `true` if a given field value is greater than or equal to a matching value + +`>`, `gt` +: `true` if a given field value is greater than a matching value + +`<=`, `le` +: `true` if a given field value is lesser than or equal to a matching value + +`<`, `lt` +: `true` if a given field value is lesser than a matching value + +`in` +: `true` if a given field value is included in a matching value; a matching value must be an array or a slice + +`not in` +: `true` if a given field value isn't included in a matching value; a matching value must be an array or a slice + +`intersect` +: `true` if a given field value that is a slice/array of strings or integers contains elements in common with the matching value; it follows the same rules as the [`intersect` function][intersect]. + +## Use `where` with `intersect` + +``` +{{ range where .Site.Pages ".Params.tags" "intersect" .Params.tags }} + {{ if ne .Permalink $.Permalink }} + {{ .Render "summary" }} + {{ end }} +{{ end }} +``` + +You can also put the returned value of the `where` clauses into a variable: + +{{< code file="where-intersect-variables.html" >}} +{{ $v1 := where .Site.Pages "Params.a" "v1" }} +{{ $v2 := where .Site.Pages "Params.b" "v2" }} +{{ $filtered := $v1 | intersect $v2 }} +{{ range $filtered }} +{{ end }} +{{< /code >}} + +## Use `where` with `first` + +The following grabs the first five content files in `post` using the [default ordering](/templates/lists/) for lists (i.e., `weight => date`): + +{{< code file="where-with-first.html" >}} +{{ range first 5 (where .Data.Pages "Section" "post") }} + {{ .Content }} +{{ end }} +{{< /code >}} + +## Nest `where` Clauses + +You can also nest `where` clauses to drill down on lists of content by more than one parameter. The following first grabs all pages in the "blog" section and then ranges through the result of the first `where` clause and finds all pages that are *not* featured: + +``` +{{ range where (where .Data.Pages "Section" "blog" ) ".Params.featured" "!=" "true" }} +``` + +## Unset Fields + +Filtering only works for set fields. To check whether a field is set or exists, you can use the operand `nil`. + +This can be useful to filter a small amount of pages from a large pool. Instead of set field on all pages, you can set field on required pages only. + +Only the following operators are available for `nil` + +* `=`, `==`, `eq`: True if the given field is not set. +* `!=`, `<>`, `ne`: True if the given field is set. + +``` +{{ range where .Data.Pages ".Params.specialpost" "!=" nil }} + {{ .Content }} +{{ end }} +``` + +[intersect]: /functions/intersect/ diff -Nru hugo-0.25.1/docs/content/functions/with.md hugo-0.26/docs/content/functions/with.md --- hugo-0.25.1/docs/content/functions/with.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/functions/with.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,31 @@ +--- +title: with +# linktitle: with +description: Rebinds the context (`.`) within its scope and skips the block if the variable is absent. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-03-12 +categories: [functions,fundamentals] +menu: + docs: + parent: "functions" +#tags: [conditionals] +signature: ["with INPUT"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +--- + +An alternative way of writing an `if` statement 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 or unset. + +The following example checks for a [user-defined site variable](/variables/site/) called `twitteruser`. If the key-value is not set, the following will render nothing: + +{{< code file="layouts/partials/twitter.html" >}} +{{with .Site.Params.twitteruser}}{{end}} +{{< /code >}} diff -Nru hugo-0.25.1/docs/content/getting-started/configuration.md hugo-0.26/docs/content/getting-started/configuration.md --- hugo-0.25.1/docs/content/getting-started/configuration.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/getting-started/configuration.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,395 @@ +--- +title: Configure Hugo +linktitle: Configuration +description: Often the default settings are good enough, but the config file can provide highly granular control over how your site is rendered. +date: 2013-07-01 +publishdate: 2017-01-02 +lastmod: 2017-03-05 +categories: [getting started,fundamentals] +#tags: [configuration,toml,yaml,json] +menu: + docs: + parent: "getting-started" + weight: 60 +weight: 60 +sections_weight: 60 +draft: false +aliases: [/overview/source-directory/,/overview/configuration/] +toc: true +--- + +The [directory structure][] of a Hugo website—or more precisely, the source organization of files containing the website's content and templates—provides most of the configuration information that Hugo needs in order to generate a finished website. + +Because of Hugo's sensible defaults, many websites may not need a configuration file. Hugo is designed to recognize certain typical usage patterns. + +## Configuration Lookup Order + +Similar to the template [lookup order][], Hugo has a default set of rules for searching for a configuration file in the root of your website's source directory as a default behavior: + +1. `./config.toml` +2. `./config.yaml` +3. `./config.json` + +In your `config` file, you can direct Hugo as to how you want your website rendered, control your website's menus, and arbitrarily define site-wide parameters specific to your project. + +## YAML Configuration + +The following is a typical example of a YAML configuration file. Note the document opens with 3 hyphens and closes with 3 periods. The values nested under `params:` will populate the [`.Site.Params`][] variable for use in [templates][]: + +{{< code file="config.yml">}} +--- +baseURL: "https://yoursite.example.com/" +title: "My Hugo Site" +footnoteReturnLinkContents: "↩" +permalinks: + post: /:year/:month/:title/ +params: + Subtitle: "Hugo is Absurdly Fast!" + AuthorName: "Jon Doe" + GitHubUser: "spf13" + ListOfFoo: + - "foo1" + - "foo2" + SidebarRecentLimit: 5 +... +{{< /code >}} + +### All Variables, YAML + +The following is the full list of Hugo-defined variables in an example YAML file. The values provided in this example represent the default values used by Hugo. + +{{< code file="config.yml" download="config.yml" >}} +--- +archetypeDir: "archetypes" +# hostname (and path) to the root, e.g. http://spf13.com/ +baseURL: "" +# include content marked as draft +buildDrafts: false +# include content with publishdate in the future +buildFuture: false +# include content already expired +buildExpired: false +# enable this to make all relative URLs relative to content root. Note that this does not affect absolute URLs. See the "URL Management" page +relativeURLs: false +canonifyURLs: false +# config file (default is path/config.yaml|json|toml) +config: "config.toml" +contentDir: "content" +dataDir: "data" +defaultExtension: "html" +defaultLayout: "post" +# Missing translations will default to this content language +defaultContentLanguage: "en" +# Renders the default content language in subdir, e.g. /en/. The root directory / will redirect to /en/ +defaultContentLanguageInSubdir: false +disableLiveReload: false +# Do not build RSS files +disableRSS: false +# Do not build Sitemap file +disableSitemap: false +# Enable GitInfo feature +enableGitInfo: false +# Build robots.txt file +enableRobotsTXT: false +# Do not render 404 page +disable404: false +# Do not inject generator meta tag on homepage +disableHugoGeneratorInject: false +# Allows you to disable all page types and will render nothing related to 'kind'; +# values = "page", "home", "section", "taxonomy", "taxonomyTerm", "RSS", "sitemap", "robotsTXT", "404" +disableKinds: [] +# Do not make the url/path to lowercase +disablePathToLower: false "" +# Enable Emoji emoticons support for page content; see emoji-cheat-sheet.com +enableEmoji: false +# Show a placeholder instead of the default value or an empty string if a translation is missing +enableMissingTranslationPlaceholders: false +footnoteAnchorPrefix: "" +footnoteReturnLinkContents: "" +# google analytics tracking id +googleAnalytics: "" +# if true, auto-detect Chinese/Japanese/Korean Languages in the content. (.Summary and .WordCount can work properly in CJKLanguage) +hasCJKLanguage: false +languageCode: "" +layoutDir: "layouts" +# Enable Logging +log: false +# Log File path (if set, logging enabled automatically) +logFile: "" +# "toml","yaml", or "json" +metaDataFormat: "toml" +newContentEditor: "" +# Don't sync permission mode of files +noChmod: false +# Don't sync modification time of files +noTimes: false +# Pagination +paginate: 10 +paginatePath: "page" +# See "content-management/permalinks" +permalinks: +# Pluralize titles in lists using inflect +pluralizeListTitles: true +# Preserve special characters in taxonomy names ("Gérard Depardieu" vs "Gerard Depardieu") +preserveTaxonomyNames: false +# filesystem path to write files to +publishDir: "public" +# enables syntax guessing for code fences without specified language +pygmentsCodeFencesGuessSyntax: false +# color-codes for highlighting derived from this style +pygmentsStyle: "monokai" +# true use pygments-css or false will color code directly +pygmentsUseClasses: false +# maximum number of items in the RSS feed +rssLimit: 15 +# see "Section Menu for Lazy Bloggers", /templates/menu-templates for more info +SectionPagesMenu: "" +# default sitemap configuration map +sitemap: +# filesystem path to read files relative from +source: "" +staticDir: "static" +# display memory and timing of different steps of the program +stepAnalysis: false +# theme to use (located by default in /themes/THEMENAME/) +themesDir: "themes" +theme: "" +title: "" +# if true, use /filename.html instead of /filename/ +# Title Case style guide for the title func and other automatic title casing in Hugo. +// Valid values are "AP" (default), "Chicago" and "Go" (which was what you had in Hugo <= 0.25.1). +// See https://www.apstylebook.com/ and http://www.chicagomanualofstyle.org/home.html +titleCaseStyle: "AP" +uglyURLs: false +# verbose output +verbose: false +# verbose logging +verboseLog: false +# watch filesystem for changes and recreate as needed +watch: true +taxonomies: + - category: "categories" + - tag: "tags" +--- +{{< /code >}} + +## TOML Configuration + +The following is an example of a TOML configuration file. The values under `[params]` will populate the `.Site.Params` variable for use in [templates][]: + +``` +contentDir = "content" +layoutDir = "layouts" +publishDir = "public" +buildDrafts = false +baseURL = "https://yoursite.example.com/" +canonifyURLs = true +title = "My Hugo Site" + +[taxonomies] + category = "categories" + tag = "tags" + +[params] + subtitle = "Hugo is Absurdly Fast!" + author = "John Doe" +``` + +### All Variables, TOML + +The following is the full list of Hugo-defined variables in an example TOML file. The values provided in this example represent the default values used by Hugo. + +{{< code file="config.toml" download="config.toml">}} ++++ +archetypeDir = "archetypes" +# hostname (and path) to the root, e.g. http://spf13.com/ +baseURL = "" +# include content marked as draft +buildDrafts = false +# include content with publishdate in the future +buildFuture = false +# include content already expired +buildExpired = false +# enable this to make all relative URLs relative to content root. Note that this does not affect absolute URLs. +relativeURLs = false +canonifyURLs = false +# config file (default is path/config.yaml|json|toml) +config = "config.toml" +contentDir = "content" +dataDir = "data" +defaultExtension = "html" +defaultLayout = "post" +# Missing translations will default to this content language +defaultContentLanguage = "en" +# Renders the default content language in subdir, e.g. /en/. The root directory / will redirect to /en/ +defaultContentLanguageInSubdir = false +disableLiveReload = false +# Do not build RSS files +disableRSS = false +# Do not build Sitemap file +disableSitemap = false +# Enable GitInfo feature +enableGitInfo = false +# Build robots.txt file +enableRobotsTXT = false +# Do not render 404 page +disable404 = false +# Do not inject generator meta tag on homepage +disableHugoGeneratorInject = false +# Allows you to disable all page types and will render nothing related to 'kind'; +# values = "page", "home", "section", "taxonomy", "taxonomyTerm", "RSS", "sitemap", "robotsTXT", "404" +disableKinds = [] +# Do not make the url/path to lowercase +disablePathToLower = false +# Enable Emoji emoticons support for page content; see emoji-cheat-sheet.com +enableEmoji = false +# Show a placeholder instead of the default value or an empty string if a translation is missing +enableMissingTranslationPlaceholders = false +footnoteAnchorPrefix = "" +footnoteReturnLinkContents = "" +# google analytics tracking id +googleAnalytics = "" +# if true, auto-detect Chinese/Japanese/Korean Languages in the content. (.Summary and .WordCount can work properly in CJKLanguage) +hasCJKLanguage = false +languageCode = "" +layoutDir = "layouts" +# Enable Logging +log = false +# Log File path (if set, logging enabled automatically) +logFile = +# maximum number of items in the RSS feed +rssLimit = 15 +# "toml","yaml", or "json" +metaDataFormat = "toml" +newContentEditor = "" +# Don't sync permission mode of files +noChmod = false +# Don't sync modification time of files +noTimes = false +# Pagination +paginate = 10 +paginatePath = "page" +# See "content-management/permalinks" +permalinks = +# Pluralize titles in lists using inflect +pluralizeListTitles = true +# Preserve special characters in taxonomy names ("Gérard Depardieu" vs "Gerard Depardieu") +preserveTaxonomyNames = false +# filesystem path to write files to +publishDir = "public" +# enables syntax guessing for code fences without specified language +pygmentsCodeFencesGuessSyntax = false +# color-codes for highlighting derived from this style +pygmentsStyle = "monokai" +# true: use pygments-css or false: color-codes directly +pygmentsUseClasses = false +# see "Section Menu for Lazy Bloggers", /templates/menu-templates for more info +SectionPagesMenu = +# default sitemap configuration map +sitemap = +# filesystem path to read files relative from +source = "" +staticDir = "static" +# display memory and timing of different steps of the program +stepAnalysis = false +# theme to use (located by default in /themes/THEMENAME/) +themesDir = "themes" +theme = "" +title = "" +# if true, use /filename.html instead of /filename/ +uglyURLs = false +# verbose output +verbose = false +# verbose logging +verboseLog = false +# watch filesystem for changes and recreate as needed +watch = true +[taxonomies] + category = "categories" + tag = "tags" ++++ +{{< /code >}} + +{{% note %}} +If you are developing your site on a \*nix machine, here is a handy shortcut for finding a configuration option from the command line: +``` +~/sites/yourhugosite +hugo config | grep emoji +enableemoji: true +``` +{{% /note %}} + +## Environmental Variables + +In addition to the 3 config options already mentioned, configuration key-values can be defined through operating system environment variables. + +For example, the following command will effectively set a website's title on Unix-like systems: + +``` +$ env HUGO_TITLE="Some Title" hugo +``` + +{{% note "Setting Environment Variables" %}} +Names must be prefixed with `HUGO_` and the configuration key must be set in uppercase when setting operating system environment variables. +{{% /note %}} + +## Ignore Files When Rendering + +The following statement inside `./config.toml` will cause Hugo to ignore files ending with `.foo` and `.boo` when rendering: + +``` +ignoreFiles = [ "\\.foo$", "\\.boo$" ] +``` + +The above is a list of regular expressions. Note that the backslash (`\`) character is escaped in this example to keep TOML happy. + +## Configure Blackfriday + +[Blackfriday](https://github.com/russross/blackfriday) is Hugo's built-in Markdown rendering engine. + +Hugo typically configures Blackfriday with sane default values that should fit most use cases reasonably well. + +However, if you have specific needs with respect to Markdown, Hugo exposes some of its Blackfriday behavior options for you to alter. The following table lists these Hugo options, paired with the corresponding flags from Blackfriday's source code ( [html.go](https://github.com/russross/blackfriday/blob/master/html.go) and [markdown.go](https://github.com/russross/blackfriday/blob/master/markdown.go)). + +{{< readfile file="/content/readfiles/bfconfig.md" markdown="true" >}} + +{{% note %}} +1. Blackfriday flags are *case sensitive* as of Hugo v0.15. +2. Blackfriday flags must be grouped under the `blackfriday` key and can be set on both the site level *and* the page level. Any setting on a page will override its respective site setting. +{{% /note %}} + +{{< code file="bf-config.toml" >}} +[blackfriday] + angledQuotes = true + fractions = false + plainIDAnchors = true + extensions = ["hardLineBreak"] +{{< /code >}} + +{{< code file="bf-config.yml" >}} +blackfriday: + angledQuotes: true + fractions: false + plainIDAnchors: true + extensions: + - hardLineBreak +{{< /code >}} + +## Configure Additional Output Formats + +Hugo v0.20 introduced the ability to render your content to multiple output formats (e.g., to JSON, AMP html, or CSV). See [Output Formats][] for information on how to add these values to your Hugo project's configuration file. + +## Configuration Format Specs + +* [TOML Spec][toml] +* [YAML Spec][yaml] +* [JSON Spec][json] + +[`.Site.Params`]: /variables/site/ +[directory structure]: /getting-started/directory-structure +[json]: /documents/ecma-404-json-spec.pdf +[lookup order]: /templates/lookup-order/ +[Output Formats]: /templates/output-formats/ +[templates]: /templates/ +[toml]: https://github.com/toml-lang/toml +[yaml]: http://yaml.org/spec/ \ No newline at end of file diff -Nru hugo-0.25.1/docs/content/getting-started/directory-structure.md hugo-0.26/docs/content/getting-started/directory-structure.md --- hugo-0.25.1/docs/content/getting-started/directory-structure.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/getting-started/directory-structure.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,82 @@ +--- +title: Directory Structure +linktitle: Directory Structure +description: Hugo's CLI scaffolds a project directory structure and then takes that single directory and uses it as the input to create a complete website. +date: 2017-01-02 +publishdate: 2017-02-01 +lastmod: 2017-03-09 +categories: [getting started,fundamentals] +#tags: [source, organization, directories] +menu: + docs: + parent: "getting-started" + weight: 50 +weight: 50 +sections_weight: 50 +draft: false +aliases: [/overview/source-directory/] +toc: true +--- + +## New Site Scaffolding + +Running the `hugo new site` generator from the command line will create a directory structure with the following elements: + +``` +. +├── archetypes +├── config.toml +├── content +├── data +├── layouts +├── static +└── themes +``` + + +## Directory Structure Explained + +The following is a high-level overview of each of the directories with links to each of their respective sections with in the Hugo docs. + +[`archetypes`](/content-management/archetypes/) +: You can create new content files in Hugo using the `hugo new` command. +By default, hugo will create new content files with at least `date`, `title` (inferred from the file name), and `draft = true`. This saves time and promotes consistency for sites using multiple content types. You can create your own [archetypes][] with custom preconfigured front matter fields as well. + +[`config.toml`](/getting-started/configuration/) +: Every Hugo project should have a configuration file in TOML, YAML, or JSON format at the root. Many sites may need little to no configuration, but Hugo ships with a large number of [configuration directives][] for more granular directions on how you want Hugo to build your website. + +[`content`][] +: All content for your website will live inside this directory. Each top-level folder in Hugo is considered a [content section][]. For example, if your site has three main sections---`blog`, `articles`, and `tutorials`---you will have three directories at `content/blog`, `content/articles`, and `content/tutorials`. Hugo uses sections to assign default [content types][]. + +[`data`](/templates/data-templates/) +: This directory is used to store configuration files that can be +used by Hugo when generating your website. You can write these files in YAML, JSON, or TOML format. In addition to the files you add to this folder, you can also create [data templates][] that pull from dynamic content. + +[`layouts`][] +: Stores templates in the form of `.html` files that specify how views of your content will be rendered into a static website. Templates include [list pages][lists], your [homepage][], [taxonomy templates][], [partials][], [single page templates][singles], and more. + +`static` +: stores all the static content for your future website: images, CSS, JavaScript, etc. When Hugo builds your site, all assets inside your static directory are copied over as-is. A good example of using the `static` folder is for [verifying site ownership on Google Search Console][searchconsole], where you want Hugo to copy over a complete HTML file without modifying its content. + +{{% note %}} +Hugo does not currently ship with an asset pipeline ([#3207](https://github.com/gohugoio/hugo/issues/3207)). You can solicit support from the community in the [Hugo forums](https://discourse.gohugo.io) or check out a few of the [Hugo starter kits](/tools/starter-kits/) for examples of how Hugo developers are managing static assets. +{{% /note %}} + + +[archetypes]: /content-management/archetypes/ +[configuration directives]: /getting-started/configuration/#all-variables-yaml +[`content`]: /content-management/organization/ +[content section]: /content-management/sections/ +[content types]: /content-management/types/ +[data templates]: /templates/data-templates/ +[homepage]: /templates/homepage/ +[`layouts`]: /templates/ +[lists]: /templates/list/ +[pagevars]: /variables/page/ +[partials]: /templates/partials/ +[searchconsole]: https://support.google.com/analytics/answer/1142414?hl=en +[singles]: /templates/single-page-templates/ +[starters]: /tools/starter-kits/ +[taxonomies]: /content-management/taxonomies/ +[taxonomy templates]: /templates/taxonomy-templates/ +[types]: /content-management/types/ diff -Nru hugo-0.25.1/docs/content/getting-started/_index.md hugo-0.26/docs/content/getting-started/_index.md --- hugo-0.25.1/docs/content/getting-started/_index.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/getting-started/_index.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,23 @@ +--- +title: Get Started +linktitle: Get Started Overview +description: Quick start and guides for installing Hugo on your preferred operating system. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [getting started] +#tags: [usage,docs] +menu: + docs: + parent: "getting-started" + weight: 1 +weight: 0001 #rem +draft: false +aliases: [/overview/introduction/] +toc: false +--- + +If this is your first time using Hugo and you've [already installed Hugo on your machine][installed], we recommend the [quick start][]. + +[installed]: /getting-started/installing/ +[quick start]: /getting-started/quick-start/ diff -Nru hugo-0.25.1/docs/content/getting-started/installing.md hugo-0.26/docs/content/getting-started/installing.md --- hugo-0.25.1/docs/content/getting-started/installing.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/getting-started/installing.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,493 @@ +--- +title: Install Hugo +linktitle: Install Hugo +description: Install Hugo on macOS, Windows, Linux, FreeBSD, and on any machine where the Go compiler tool chain can run. +date: 2016-11-01 +publishdate: 2016-11-01 +lastmod: 2017-02-20 +categories: [getting started,fundamentals] +authors: ["Michael Henderson"] +#tags: [install,pc,windows,linux,macos,binary,tarball] +menu: + docs: + parent: "getting-started" + weight: 30 +weight: 30 +sections_weight: 30 +draft: false +aliases: [/tutorials/installing-on-windows/,/tutorials/installing-on-mac/,/overview/installing/,/getting-started/install,/install/] +toc: true +--- + + +{{% note %}} +There is lots of talk about "Hugo being written in Go", but you don't need to install Go to enjoy Hugo. Just grab a precompiled binary! +{{% /note %}} + +Hugo is written in [Go](https://golang.org/) with support for multiple platforms. The latest release can be found at [Hugo Releases][releases]. + +Hugo currently provides pre-built binaries for the following: + +* macOS (Darwin) for x64, i386, and ARM architectures +* Windows +* Linux +* FreeBSD + +Hugo may also be compiled from source wherever the Go compiler tool chain can run; e.g., on other operating systems such as DragonFly BSD, OpenBSD, Plan 9, Solaris, and others. See for the full set of supported combinations of target operating systems and compilation architectures. + +## Quick Install + +### Binary (Cross-platform) + +Download the appropriate version for your platform from [Hugo Releases][releases]. Once downloaded, the binary can be run from anywhere. You don't need to install it into a global location. This works well for shared hosts and other systems where you don't have a privileged account. + +Ideally, you should install it somewhere in your `PATH` for easy use. `/usr/local/bin` is the most probable location. + +### Homebrew (macOS) + +If you are on macOS and using [Homebrew][brew], you can install Hugo with the following one-liner: + +{{< code file="install-with-homebrew.sh" >}} +brew install hugo +{{< /code >}} + +For more detailed explanations, read the installation guides that follow for installing on macOS and Windows. + +### Chocolatey (Windows) + +If you are on a Windows machine and use [Chocolatey][] for package management, you can install Hugo with the following one-liner: + +{{< code file="install-with-chocolatey.ps1" >}} +choco install hugo -confirm +{{< /code >}} + +### Source + +#### Prerequisite Tools + +* [Git][installgit] +* [Go 1.5+][installgo] +* [govendor][] + +#### Vendored Dependencies + +Hugo uses [govendor][] to vendor dependencies, but we don't commit the vendored packages themselves to the Hugo git repository. Therefore, a simple `go get` is *not* supported because the command is not vendor aware. *You must use `govendor` to fetch Hugo's dependencies.* + +#### Fetch from GitHub + +{{< code file="from-gh.sh" >}} +go get github.com/kardianos/govendor +govendor get github.com/gohugoio/hugo +go install github.com/gohugoio/hugo +{{< /code >}} + +`govendor get` will fetch Hugo and all its dependent libraries to `$GOPATH/src/github.com/gohugoio/hugo`, and `go install` compiles everything into a final `hugo` (or `hugo.exe`) executable inside `$GOPATH/bin/`. + +{{% note %}} +If you are a Windows user, substitute the `$HOME` environment variable above with `%USERPROFILE%`. +{{% /note %}} + +## macOS + +### Assumptions + +1. You know how to open the macOS terminal. +2. You're running a modern 64-bit Mac. +3. You will use `~/Sites` as the starting point for your site. (`~/Sites` is used for example purposes. If you are familiar enough with the command line and file system, you should have no issues following along with the instructions.) + +### Pick Your Method + +There are three ways to install Hugo on your Mac + +1. The [Homebrew][brew] `brew` utility +2. Distribution (i.e., tarball) +3. Building from Source + +There is no "best" way to install Hugo on your Mac. You should use the method that works best for your use case. + +#### Pros and Cons + +There are pros and cons to each of the aforementioned methods: + +1. **Homebrew.** Homebrew is the simplest method and will require the least amount of work to maintain. The drawbacks aren't severe. The default package will be for the most recent release, so it will not have bug fixes until the next release (i.e., unless you install it with the `--HEAD` option). Hugo `brew` releases may lag a few days behind because it has to be coordinated with another team. Nevertheless, `brew` is the recommended installation method if you want to work from a stable, widely used source. Brew works well and is easy to update. + +2. **Tarball.** Downloading and installing from the tarball is also easy, although it requires a few more command line skills than does Homebrew. Updates are easy as well: you just repeat the process with the new binary. This gives you the flexibility to have multiple versions on your computer. If you don't want to use `brew`, then the tarball/binary is a good choice. + +3. **Building from Source.** Building from source is the most work. The advantage of building from source is that you don't have to wait for a release to add features or bug fixes. The disadvantage is that you need to spend more time managing the setup, which is manageable but requires more time than the preceding two options. + +{{% note %}} +Since building from source is appealing to more seasoned command line users, this guide will focus more on installing Hugo via Homebrew and Tarball. +{{% /note %}} + +### Install Hugo with Brew + +#### Step 1: Install `brew` if you haven't already + +Go to the `brew` website, , and follow the directions there. The most important step is the installation from the command line: + +{{< code file="install-brew.sh" >}} +ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +{{< /code >}} + +#### Step 2: Run the `brew` Command to Install `hugo` + +Installing Hugo using `brew` is as easy as the following: + +{{< code file="install-brew.sh" >}} +brew install hugo +{{< /code >}} + +If Homebrew is working properly, you should see something similar to the following: + +``` +==> Downloading https://homebrew.bintray.com/bottles/hugo-0.21.sierra.bottle.tar.gz +######################################################################### 100.0% +==> Pouring hugo-0.21.sierra.bottle.tar.gz +🍺 /usr/local/Cellar/hugo/0.21: 32 files, 17.4MB +``` + +{{% note "Installing the Latest Hugo with Brew" %}} +Replace `brew install hugo` with `brew install hugo --HEAD` if you want the absolute latest in-development version. +{{% /note %}} + +`brew` should have updated your path to include Hugo. You can confirm by opening a new terminal window and running a few commands: + +``` +$ # show the location of the hugo executable +which hugo +/usr/local/bin/hugo + +# show the installed version +ls -l $( which hugo ) +lrwxr-xr-x 1 mdhender admin 30 Mar 28 22:19 /usr/local/bin/hugo -> ../Cellar/hugo/0.13_1/bin/hugo + +# verify that hugo runs correctly +hugo version +Hugo Static Site Generator v0.13 BuildDate: 2015-03-09T21:34:47-05:00 +``` + +### Install Hugo from Tarball + +#### Step 1: Decide on the location + +When installing from the tarball, you have to decide if you're going to install the binary in `/usr/local/bin` or in your home directory. There are three camps on this: + +1. Install it in `/usr/local/bin` so that all the users on your system have access to it. This is a good idea because it's a fairly standard place for executables. The downside is that you may need elevated privileges to put software into that location. Also, if there are multiple users on your system, they will all run the same version. Sometimes this can be an issue if you want to try out a new release. + +2. Install it in `~/bin` so that only you can execute it. This is a good idea because it's easy to do, easy to maintain, and doesn't require elevated privileges. The downside is that only you can run Hugo. If there are other users on your site, they have to maintain their own copies. That can lead to people running different versions. Of course, this does make it easier for you to experiment with different releases. + +3. Install it in your `Sites` directory. This is not a bad idea if you have only one site that you're building. It keeps every thing in a single place. If you want to try out new releases, you can make a copy of the entire site and update the Hugo executable. + +All three locations will work for you. In the interest of brevity, this guide focuses on option #2. + +#### Step 2: Download the Tarball + +1. Open in your browser. + +2. Find the current release by scrolling down and looking for the green tag that reads "Latest Release." + +3. Download the current tarball for the Mac. The name will be something like `hugo_X.Y_osx-64bit.tgz`, where `X.YY` is the release number. + +4. By default, the tarball will be saved to your `~/Downloads` directory. If you choose to use a different location, you'll need to change that in the following steps. + +#### Step 3: Confirm your download + +Verify that the tarball wasn't corrupted during the download: + +``` +tar tvf ~/Downloads/hugo_X.Y_osx-64bit.tgz +-rwxrwxrwx 0 0 0 0 Feb 22 04:02 hugo_X.Y_osx-64bit/hugo_X.Y_osx-64bit.tgz +-rwxrwxrwx 0 0 0 0 Feb 22 03:24 hugo_X.Y_osx-64bit/README.md +-rwxrwxrwx 0 0 0 0 Jan 30 18:48 hugo_X.Y_osx-64bit/LICENSE.md +``` + +The `.md` files are documentation for Hugo. The other file is the executable. + +#### Step 4: Install Into Your `bin` Directory + +``` +# create the directory if needed +mkdir -p ~/bin + +# make it the working directory +cd ~/bin + +# extract the tarball +tar -xvzf ~/Downloads/hugo_X.Y_osx-64bit.tgz +Archive: hugo_X.Y_osx-64bit.tgz + x ./ + x ./hugo + x ./LICENSE.md + x ./README.md + +# verify that it runs +./hugo version +Hugo Static Site Generator v0.13 BuildDate: 2015-02-22T04:02:30-06:00 +``` + +You may need to add your bin directory to your `PATH` variable. The `which` command will check for us. If it can find `hugo`, it will print the full path to it. Otherwise, it will not print anything. + +``` +# check if hugo is in the path +which hugo +/Users/USERNAME/bin/hugo +``` + +If `hugo` is not in your `PATH`, add it by updating your `~/.bash_profile` file. First, start up an editor: + +``` +nano ~/.bash_profile +``` + +Add a line to update your `PATH` variable: + +``` +export PATH=$PATH:$HOME/bin +``` + +Then save the file by pressing Control-X, then Y to save the file and return to the prompt. + +Close the terminal and open a new terminal to pick up the changes to your profile. Verify your success by running the `which hugo` command again. + +You've successfully installed Hugo. + +### Build from Source on Mac + +If you want to compile Hugo yourself, you'll need to install Go (aka Golang). You can [install Go directly from the Go website](https://golang.org/dl/) or via Homebrew using the following command: + +``` +brew install go +``` + +#### Step 1: Get the Source + +If you want to compile a specific version of Hugo, go to and download the source code for the version of your choice. If you want to compile Hugo with all the latest changes (which might include bugs), clone the Hugo repository: + +``` +git clone https://github.com/gohugoio/hugo +``` + +{{% warning "Sometimes \"Latest\" = \"Bugs\""%}} +Cloning the Hugo repository directly means taking the good with the bad. By using the bleeding-edge version of Hugo, you make your development susceptible to the latest features, as well as the latest bugs. Your feedback is appreciated. If you find a bug in the latest release, [please create an issue on GitHub](https://github.com/gohugoio/hugo/issues/new). +{{% /warning %}} + +#### Step 2: Compiling + +Make the directory containing the source your working directory and then fetch Hugo's dependencies: + +``` +mkdir -p src/github.com/gohugoio +ln -sf $(pwd) src/github.com/gohugoio/hugo + +# set the build path for Go +export GOPATH=$(pwd) + +go get +``` + +This will fetch the absolute latest version of the dependencies. If Hugo fails to build, it may be the result of a dependency's author introducing a breaking change. + +Once you have properly configured your directory, you can compile Hugo using the following command: + +``` +go build -o hugo main.go +``` + +Then place the `hugo` executable somewhere in your `$PATH`. You're now ready to start using Hugo. + +## Windows + +The following aims to be a complete guide to installing Hugo on your Windows PC. + +### Assumptions + +1. You will use `C:\Hugo\Sites` as the starting point for your new project. +2. You will use `C:\Hugo\bin` to store executable files. + +### Set up Your Directories + +You'll need a place to store the Hugo executable, your [content][], and the generated Hugo website: + +1. Open Windows Explorer. +2. Create a new folder: `C:\Hugo`, assuming you want Hugo on your C drive, although this can go anywhere +3. Create a subfolder in the Hugo folder: `C:\Hugo\bin` +4. Create another subfolder in Hugo: `C:\Hugo\Sites` + +### Technical Users + +1. Download the latest zipped Hugo executable from [Hugo Releases][releases]. +2. Extract all contents to your `..\Hugo\bin` folder. +3. The `hugo` executable will be named as `hugo_hugo-version_platform_arch.exe`. Rename the executable to `hugo.exe` for ease of use. +4. In PowerShell or your preferred CLI, add the `hugo.exe` executable to your PATH by navigating to `C:\Hugo\bin` (or the location of your hugo.exe file) and use the command `set PATH=%PATH%;C:\Hugo\bin`. If the `hugo` command does not work after a reboot, you may have to run the command prompt as administrator. + +### Less-technical Users + +1. Go to the [Hugo Releases][releases] page. +2. The latest release is announced on top. Scroll to the bottom of the release announcement to see the downloads. They're all ZIP files. +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. + +Now you need to add Hugo to your Windows PATH settings: + +#### For Windows 10 Users: + +* Right click on the **Start** button. +* Click on **System**. +* Click on **Advanced System Settings** on the left. +* Click on the **Environment Variables...** button on the bottom. +* In the User variables section, find the row that starts with PATH (PATH will be all caps). +* Double-click on **PATH**. +* Click the **New...** button. +* Type in the folder where `hugo.exe` was extracted, which is `C:\Hugo\bin` if you went by the instructions above. *The PATH entry should be the folder where Hugo lives and not the binary.* Press Enter when you're done typing. +* Click OK at every window to exit. + +{{% note "Path Editor in Windows 10"%}} +The path editor in Windows 10 was added in the large [November 2015 Update](https://blogs.windows.com/windowsexperience/2015/11/12/first-major-update-for-windows-10-available-today/). You'll need to have that or a later update installed for the above steps to work. You can see what Windows 10 build you have by clicking on the  Start button → Settings → System → About. See [here](https://www.howtogeek.com/236195/how-to-find-out-which-build-and-version-of-windows-10-you-have/) for more.) +{{% /note %}} + +#### For Windows 7 and 8.x users: + +Windows 7 and 8.1 do not include the easy path editor included in Windows 10, so non-technical users on those platforms are advised to install a free third-party path editor like [Windows Environment Variables Editor][Windows Environment Variables Editor] or [Path Editor](https://patheditor2.codeplex.com/). + +### Verify the Executable + +Run a few commands to verify that the executable is ready to run, and then build a sample site to get started. + +#### 1. Open a Command Prompt + +At the prompt, type `hugo help` and press the Enter key. You should see output that starts with: + +``` +hugo is the main command, used to build your Hugo site. + +Hugo is a Fast and Flexible Static Site Generator +built with love by spf13 and friends in Go. + +Complete documentation is available at https://gohugo.io/. +``` + +If you do, then the installation is complete. If you don't, double-check the path that you placed the `hugo.exe` file in and that you typed that path correctly when you added it to your `PATH` variable. If you're still not getting the output, search the [Hugo discussion forum][forum] to see if others have already figured out our problem. If not, add a note---in the "Support" category---and be sure to include your command and the output. + +At the prompt, change your directory to the `Sites` directory. + +``` +C:\Program Files> cd C:\Hugo\Sites +C:\Hugo\Sites> +``` + +#### 2. Run the Command + +Run the command to generate a new site. I'm using `example.com` as the name of the site. + +``` +C:\Hugo\Sites> hugo new site example.com +``` + +You should now have a directory at `C:\Hugo\Sites\example.com`. Change into that directory and list the contents. You should get output similar to the following: + +``` +C:\Hugo\Sites>cd example.com +C:\Hugo\Sites\example.com>dir + Directory of C:\hugo\sites\example.com +  +04/13/2015 10:44 PM . +04/13/2015 10:44 PM .. +04/13/2015 10:44 PM archetypes +04/13/2015 10:44 PM 83 config.toml +04/13/2015 10:44 PM content +04/13/2015 10:44 PM data +04/13/2015 10:44 PM layouts +04/13/2015 10:44 PM static + 1 File(s) 83 bytes + 7 Dir(s) 6,273,331,200 bytes free +``` + +### Troubleshoot Windows Installation + +[@dhersam][] has created a nice video on common issues: + +{{< youtube c8fJIRNChmU >}} + +## Linux + +### Snap Package + +In any of the [Linux distributions that support snaps][snaps]: + +``` +snap install hugo +``` + +{{% note %}} +Hugo-as-a-snap can write only inside the user’s `$HOME` directory---and gvfs-mounted directories owned by the user---because of Snaps’ confinement and security model. More information is also available [in this related GitHub issue](https://github.com/gohugoio/hugo/issues/3143). +{{% /note %}} + +### Debian and Ubuntu + +Debian and Ubuntu provide a `hugo` version via `apt-get`: + +``` +sudo apt-get install hugo +``` + +#### Pros + +* Native Debian/Ubuntu package maintained by Debian Developers +* Pre-installed bash completion script and `man` pages + +#### Cons + +* Might not be the latest version, especially if you are using an older, stable version (e.g., Ubuntu 16.04 LTS). Until backports and PPA are available, you may consider installing the Hugo snap package to get the latest version of Hugo. + +### Arch + +You can also install Hugo from the [Arch user repository](https://aur.archlinux.org/) on Arch Linux or derivatives such as Manjaro. + +Be aware that Hugo is built from source. This means that additional tools like [Git](https://git-scm.com) and [Go](https://golang.org/doc/install) will be installed as well. + +``` +sudo pacman -S yaourt +yaourt -S hugo +``` + +### Fedora, CentOS, and Red Hat + +* (updated to Hugo v0.16) +* (updated to Hugo v0.22); usually released a few days after the official Hugo release. + +See the [related discussion in the Hugo forums][redhatforum]. + + +## Upgrade Hugo + +Upgrading Hugo is as easy as downloading and replacing the executable you’ve placed in your `PATH`. + +## Install Pygments (Optional) + +The Hugo executable has one *optional* external dependency for source code highlighting ([Pygments][pygments]). + +If you want to have source code highlighting using the [highlight shortcode][], you need to install the Python-based Pygments program. The procedure is outlined on the [Pygments homepage][pygments]. + +## Next Steps + +Now that you've installed Hugo, read the [Quick Start guide][quickstart] and explore the rest of the documentation. If you have questions, ask the Hugo community directly by visiting the [Hugo Discussion Forum][forum]. + +[brew]: https://brew.sh/ +[Chocolatey]: https://chocolatey.org/ +[content]: /content-management/ +[@dhersam]: https://github.com/dhersam +[forum]: https://discourse.gohugo.io +[govendor]: https://github.com/kardianos/govendor +[highlight shortcode]: /content-management/shortcodes/#highlight +[installgit]: http://git-scm.com/ +[installgo]: https://golang.org/dl/ +[Path Editor]: https://patheditor2.codeplex.com/ +[pygments]: https://pygments.org +[quickstart]: /getting-started/quick-start/ +[redhatforum]: https://discourse.gohugo.io/t/solved-fedora-copr-repository-out-of-service/2491 +[releases]: https://github.com/gohugoio/hugo/releases +[snaps]: http://snapcraft.io/docs/core/install +[windowsarch]: https://esupport.trendmicro.com/en-us/home/pages/technical-support/1038680.aspx +[Windows Environment Variables Editor]: http://eveditor.com/ diff -Nru hugo-0.25.1/docs/content/getting-started/quick-start.md hugo-0.26/docs/content/getting-started/quick-start.md --- hugo-0.25.1/docs/content/getting-started/quick-start.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/getting-started/quick-start.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,140 @@ +--- +title: Quick Start +linktitle: Quick Start +description: Create a Hugo site using the beautiful Ananke theme. +date: 2013-07-01 +publishdate: 2013-07-01 +categories: [getting started] +#tags: [quick start,usage] +authors: [Shekhar Gulati, Ryan Watters] +menu: + docs: + parent: "getting-started" + weight: 10 +weight: 10 +sections_weight: 10 +draft: false +aliases: [/quickstart/,/overview/quickstart/] +toc: true +--- + +{{% note %}} +This quick start uses `macOS` in the examples. For instructions about how to install Hugo on other operating systems, see [install](/getting-started/installing). + +You also need [Git installed](https://git-scm.com/downloads) to run this tutorial. +{{% /note %}} + + + +## Step 1: Install Hugo + +{{% note %}} +`Homebrew`, a package manager for `macOS`, can be installed from [brew.sh](https://brew.sh/). See [install](/getting-started/installing) if you are running Windows etc. +{{% /note %}} + +```bash +brew install hugo +``` + +To verify your new install: + +```bash +hugo version +``` + + +{{< asciicast HDlKrUrbfT7yiWsbd6QoxzRTN >}} + + +## Step 2: Create a New Site + +```bash +hugo new site quickstart +``` + +The above will create a new Hugo site in a folder named `quickstart`. + +{{< asciicast 1PH9A2fs14Dnyarx5v8OMYQer >}} + + +## Step 3: Add a Theme + +See [themes.gohugo.io](https://themes.gohugo.io/) for a list of themes to consider. This quickstart uses the beautiful [Ananke theme](https://themes.gohugo.io/gohugo-theme-ananke/). + +```bash +cd quickstart;\ +git init;\ +git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke;\ + +# Edit your config.toml configuration file +# and add the Ananke theme. +echo 'theme = "ananke"' >> config.toml +``` + + +{{< asciicast WJM2LEZQs8VRhNeuZ5NiGPp9I >}} + +## Step 4: Add Some Content + +``` +hugo new posts/my-first-post.md +``` + + +Edit the newly created content file if you want. Now, start the Hugo server with [drafts](/getting-started/usage/#draft-future-and-expired-content) enabled: + +``` +▶ hugo server -D + +Started building sites ... +Built site for language en: +1 of 1 draft rendered +0 future content +0 expired content +1 regular pages created +8 other pages created +0 non-page files copied +1 paginator pages created +0 categories created +0 tags created +total in 18 ms +Watching for changes in /Users/bep/sites/quickstart/{data,content,layouts,static,themes} +Serving pages from memory +Web Server is available at http://localhost:1313/ (bind address 127.0.0.1) +Press Ctrl+C to stop +``` + + +**Navigate to your new site at [http://localhost:1313/](http://localhost:1313/).** + + + +## Step 5: Customize the Theme + +Your new site already looks great, but you will want to tweak it a little before you release it to the public. + +### Site Configuration + +Open up `config.toml` in a text editor: + +``` +baseURL = "https://example.org/" +languageCode = "en-us" +title = "My New Hugo Site" +theme = "ananke" +``` + +Replace the `title` above with something more personal. Also, if you already have a domain ready, set the `baseURL`. Note that this value is not needed when running the local development server. + +{{% note %}} +**Tip:** Make the changes to the site configuration or any other file in your site while the Hugo server is running, and you will see the changes in the browser right away. +{{% /note %}} + + +For theme specific configuration options, see the [theme site](https://github.com/budparr/gohugo-theme-ananke). + +**For further theme customization, see [Customize a Theme](/themes/customizing/).** + +## Recapitulation + +{{< asciicast pWp4uvyAkdWgQllD9RCfeBL5k >}} diff -Nru hugo-0.25.1/docs/content/getting-started/usage.md hugo-0.26/docs/content/getting-started/usage.md --- hugo-0.25.1/docs/content/getting-started/usage.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/getting-started/usage.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,228 @@ +--- +title: Basic Usage +linktitle: Basic Usage +description: Hugo's CLI is fully featured but simple to use, even for those who have very limited experience working from the command line. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [getting started] +#tags: [usage,livereload,command line,flags] +menu: + docs: + parent: "getting-started" + weight: 40 +weight: 40 +sections_weight: 40 +draft: false +aliases: [/overview/usage/,/extras/livereload/,/doc/usage/,/usage/] +toc: true +--- + +The following is a description of the most common commands you will use while developing your Hugo project. See the [Command Line Reference][commands] for a comprehensive view of Hugo's CLI. + +## Test Installation + +Once you have [installed Hugo][install], make sure it is in your `PATH`. You can test that Hugo has been installed correctly via the `help` command: + +``` +hugo help +``` + +The output you see in your console should be similar to the following: + +``` +hugo is the main command, used to build your Hugo site. + +Hugo is a Fast and Flexible Static Site Generator +built with love by spf13 and friends in Go. + +Complete documentation is available at http://gohugo.io/. + +Usage: + hugo [flags] + hugo [command] + +Available Commands: + benchmark Benchmark Hugo by building a site a number of times. + check Contains some verification checks + config Print the site configuration + convert Convert your content to different formats + env Print Hugo version and environment info + gen A collection of several useful generators. + help Help about any command + import Import your site from others. + list Listing out various types of content + new Create new content for your site + server A high performance webserver + undraft Undraft changes the content's draft status from 'True' to 'False' + version Print the version number of Hugo + +Flags: + -b, --baseURL string hostname (and path) to the root, e.g. http://spf13.com/ + -D, --buildDrafts include content marked as draft + -E, --buildExpired include expired content + -F, --buildFuture include content with publishdate in the future + --cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/ + --canonifyURLs 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 + -d, --destination string filesystem path to write files to + --disable404 do not render 404 page + --disableKinds stringSlice disable different kind of pages (home, RSS etc.) + --disableRSS do not build RSS files + --disableSitemap do not build Sitemap file + --enableGitInfo add Git revision, date and author info to the pages + --forceSyncStatic copy all files when static is changed. + -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 pluralize titles in lists using inflect (default true) + --preserveTaxonomyNames 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 + -t, --theme string theme to use (located in /themes/THEMENAME/) + --themesDir string filesystem path to themes directory + --uglyURLs 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 +``` + +## The `hugo` Command + +The most common usage is probably to run `hugo` with your current directory being the input directory. + +This generates your website to the `public/` directory by default, although you can customize the output directory in your [site configuration][config] by changing the `publishDir` field. + +The site Hugo renders into `public/` is ready to be deployed to your web server: + +``` +hugo +0 draft content +0 future content +99 pages created +0 paginator pages created +16 tags created +0 groups created +in 90 ms +``` + +## Draft, Future, and Expired Content + +Hugo allows you to set `draft`, `publishdate`, and even `expirydate` in your content's [front matter][]. By default, Hugo will not publish: + +1. Content with a future `publishdate` value +2. Content with `draft: true` status +3. Content with a past `expirydate` value + +All three of these can be overridden during both local development *and* deployment by adding the following flags to `hugo` and `hugo server`, respectively, or by changing the boolean values assigned to the fields of the same name (without `--`) in your [configuration][config]: + +1. `--buildFuture` +2. `--buildDrafts` +3. `--buildExpired` + +## LiveReload + +Hugo comes with [LiveReload](https://github.com/livereload/livereload-js) built in. There are no additional packages to install. A common way to use Hugo while developing a site is to have Hugo run a server with the `hugo server` command and watch for changes: + +``` +hugo server +0 draft content +0 future content +99 pages created +0 paginator pages created +16 tags created +0 groups created +in 120 ms +Watching for changes in /Users/yourname/sites/yourhugosite/{data,content,layouts,static} +Serving pages from /Users/yourname/sites/yourhugosite/public +Web Server is available at http://localhost:1313/ +Press Ctrl+C to stop +``` + +This will run a fully functioning web server while simultaneously watching your file system for additions, deletions, or changes within the following areas of your [project organization][dirs]: + +* `/static/*` +* `/content/*` +* `/data/*` +* `/i18n/*` +* `/layouts/*` +* `/themes//*` +* `config` + +Whenever you make changes, Hugo will simultaneously rebuild the site and continue to serve content. As soon as the build is finished, LiveReload tells the browser to silently reload the page. + +Most Hugo builds are so fast that you may not notice the change unless looking directly at the site in your browser. This means that keeping the site open on a second monitor (or another half of your current monitor) allows you to see the most up-to-date version of your website without the need to leave your text editor. + +{{% note "Closing `` Tag"%}} +Hugo injects the LiveReload `` ⇒ `` (Good!) -* `` ⇒ `` (Bad!) - -### singularize -Singularize the given word with a set of common English singularization rules. - -e.g. `{{ "cats" | singularize }}` → "cat" - -### slicestr - -Slicing in `slicestr` is done by specifying a half-open range with two indices, `start` and `end`. -For example, 1 and 4 creates a slice including elements 1 through 3. -The `end` index can be omitted; it defaults to the string's length. - -e.g. - -* `{{slicestr "BatMan" 3}}` → "Man" -* `{{slicestr "BatMan" 0 3}}` → "Bat" - -### truncate - -Truncate a text to a max length without cutting words or leaving unclosed HTML tags. Since Go templates are HTML-aware, truncate will handle normal strings vs HTML strings intelligently. It's important to note that if you have a raw string that contains HTML tags that you want treated as HTML, you will need to convert the string to HTML using the safeHTML template function before sending the value to truncate; otherwise, the HTML tags will be escaped by truncate. - -e.g. - -* `{{ "this is a text" | truncate 10 " ..." }}` → `this is a ...` -* `{{ "Keep my HTML" | safeHTML | truncate 10 }}` → `Keep my …` -* `{{ "With [Markdown](#markdown) inside." | markdownify | truncate 10 }}` → `With Markdown …` - -### split - -Split a string into substrings separated by a delimiter. - -e.g. - -* `{{split "tag1,tag2,tag3" "," }}` → ["tag1" "tag2" "tag3"] - -### string - -Creates a `string`. - -e.g. - -* `{{string "BatMan"}}` → "BatMan" - -### substr - -Extracts parts of a string, beginning at the character at the specified -position, and returns the specified number of characters. - -It normally takes two parameters: `start` and `length`. -It can also take one parameter: `start`, i.e. `length` is omitted, in which case -the substring starting from start until the end of the string will be returned. - -To extract characters from the end of the string, use a negative start number. - -In addition, borrowing from the extended behavior described at http://php.net/substr, -if `length` is given and is negative, then that many characters will be omitted from -the end of string. - -e.g. - -* `{{substr "BatMan" 0 -3}}` → "Bat" -* `{{substr "BatMan" 3 3}}` → "Man" - -### hasPrefix - -HasPrefix tests whether a string begins with prefix. - -* `{{ hasPrefix "Hugo" "Hu" }}` → true - -### title -Converts all characters in string to titlecase. - -e.g. `{{title "BatMan"}}` → "Batman" - - -### trim -Returns a slice of the string with all leading and trailing characters contained in cutset removed. - -e.g. `{{ trim "++Batman--" "+-" }}` → "Batman" - - -### upper -Converts all characters in string to uppercase. - -e.g. `{{upper "BatMan"}}` → "BATMAN" - - -### countwords - -`countwords` tries to convert the passed content to a string and counts each word -in it. The template functions works similar to [.WordCount]({{< relref "templates/variables.md#page-variables" >}}). - -```html -{{ "Hugo is a static site generator." | countwords }} - -``` - - -### countrunes - -Alternatively to counting all words , `countrunes` determines the number of runes in the content and excludes any whitespace. This can become useful if you have to deal with -CJK-like languages. - -```html -{{ "Hello, 世界" | countrunes }} - -``` - -### md5 - -`md5` hashes the given input and returns its MD5 checksum. - -```html -{{ md5 "Hello world, gophers!" }} - -``` - -This can be useful if you want to use Gravatar for generating a unique avatar: - -```html - -``` - - -### sha1 - -`sha1` hashes the given input and returns its SHA1 checksum. - -```html -{{ sha1 "Hello world, gophers!" }} - -``` - - -### sha256 - -`sha256` hashes the given input and returns its SHA256 checksum. - -```html -{{ sha256 "Hello world, gophers!" }} - -``` - - -## Internationalization - -### i18n - -This translates a piece of content based on your `i18n/en-US.yaml` -(and friends) files. You can use the [go-i18n](https://github.com/nicksnyder/go-i18n) tools to manage your translations. The translations can exist in both the theme and at the root of your repository. - -e.g.: `{{ i18n "translation_id" }}` - -For more information about string translations, see [Translation of strings]({{< relref "content/multilingual.md#translation-of-strings">}}). - -### T - -`T` is an alias to `i18n`. E.g. `{{ T "translation_id" }}`. - -## Times - -### time - -`time` converts a timestamp string into a [`time.Time`](https://godoc.org/time#Time) structure so you can access its fields. E.g. - -* `{{ time "2016-05-28" }}` → "2016-05-28T00:00:00Z" -* `{{ (time "2016-05-28").YearDay }}` → 149 -* `{{ mul 1000 (time "2016-05-28T10:30:00.00+10:00").Unix }}` → 1464395400000 (Unix time in milliseconds) - -### now - -`now` returns the current local time as a [`time.Time`](https://godoc.org/time#Time). - -## URLs -### absLangURL, relLangURL -These are similar to the `absURL` and `relURL` relatives below, but will add the correct language prefix when the site is configured with more than one language. - -So for a site `baseURL` set to `http://mysite.com/hugo/` and the current language is `en`: - -* `{{ "blog/" | absLangURL }}` → "http://mysite.com/hugo/en/blog/" -* `{{ "blog/" | relLangURL }}` → "/hugo/en/blog/" - -### absURL, relURL - -Both `absURL` and `relURL` considers the configured value of `baseURL`, so given a `baseURL` set to `http://mysite.com/hugo/`: - -* `{{ "mystyle.css" | absURL }}` → "http://mysite.com/hugo/mystyle.css" -* `{{ "mystyle.css" | relURL }}` → "/hugo/mystyle.css" -* `{{ "http://gohugo.io/" | relURL }}` → "http://gohugo.io/" -* `{{ "http://gohugo.io/" | absURL }}` → "http://gohugo.io/" - -The last two examples may look funky, but is useful if you, say, have a list of images, some of them hosted externally, some locally: - -``` - -``` - -The above also exploits the fact that the Go template parser JSON-encodes objects inside `script` tags. - - - -**Note:** These functions are smart about missing slashes, but will not add one to the end if not present. - - -### ref, relref -Looks up a content page by relative path or logical name to return the permalink (`ref`) or relative permalink (`relref`). Requires a `Page` object (usually satisfied with `.`). Used in the [`ref` and `relref` shortcodes]({{% ref "extras/crossreferences.md" %}}). - -e.g. {{ ref . "about.md" }} - -### safeURL -Declares the provided string as a "safe" URL or URL substring (see [RFC 3986][]). -A URL like `javascript:checkThatFormNotEditedBeforeLeavingPage()` from a trusted -source should go in the page, but by default dynamic `javascript:` URLs are -filtered out since they are a frequently exploited injection vector. - -[RFC 3986]: http://tools.ietf.org/html/rfc3986 - -Without `safeURL`, only the URI schemes `http:`, `https:` and `mailto:` -are considered safe by Go. If any other URI schemes, e.g. `irc:` and -`javascript:`, are detected, the whole URL would be replaced with -`#ZgotmplZ`. This is to "defang" any potential attack in the URL, -rendering it useless. - -Example: Given a site-wide `config.toml` that contains this menu entry: - - [[menu.main]] - name = "IRC: #golang at freenode" - url = "irc://irc.freenode.net/#golang" - -The following template: - - - -would produce `
  • IRC: #golang at freenode
  • ` -for the `irc://…` URL. - -To fix this, add ` | safeURL` after `.URL` on the 3rd line, like this: - -
  • {{ .Name }}
  • - -With this change, we finally get `
  • IRC: #golang at freenode
  • ` -as intended. - - -### urlize -Takes a string and sanitizes it for usage in URLs, converts spaces to "-". - -e.g. `{{ . }}` - - -### querify - -Takes a set of key-value pairs and returns a [query string](https://en.wikipedia.org/wiki/Query_string) that can be appended to a URL. E.g. - - Search - -will be rendered as - - Search - - -## Content Views - -### Render -Takes a view to render the content with. The view is an alternate layout, and should be a file name that points to a template in one of the locations specified in the documentation for [Content Views](/templates/views). - -This function is only available on a piece of content, and in list context. - -This example could render a piece of content using the content view located at `/layouts/_default/summary.html`: - - {{ range .Data.Pages }} - {{ .Render "summary"}} - {{ end }} - - - -## Advanced - -### apply - -Given a map, array, or slice, returns a new slice with a function applied over it. Expects at least three parameters, depending on the function being applied. The first parameter is the sequence to operate on; the second is the name of the function as a string, which must be in the Hugo function map (generally, it is these functions documented here). After that, the parameters to the applied function are provided, with the string `"."` standing in for each element of the sequence the function is to be applied against. An example is in order: - - +++ - names: [ "Derek Perkins", "Joe Bergevin", "Tanner Linsley" ] - +++ - - {{ apply .Params.names "urlize" "." }} → [ "derek-perkins", "joe-bergevin", "tanner-linsley" ] - -This is roughly equivalent to: - - {{ range .Params.names }}{{ . | urlize }}{{ end }} - -However, it isn’t possible to provide the output of a range to the `delimit` function, so you need to `apply` it. A more complete example should explain this. Let's say you have two partials for displaying tag links in a post, "post/tag/list.html" and "post/tag/link.html", as shown below. - - - {{ with .Params.tags }} -
    - Tags: - {{ $len := len . }} - {{ if eq $len 1 }} - {{ partial "post/tag/link" (index . 0) }} - {{ else }} - {{ $last := sub $len 1 }} - {{ range first $last . }} - {{ partial "post/tag/link" . }}, - {{ end }} - {{ partial "post/tag/link" (index . $last) }} - {{ end }} -
    - {{ end }} - - - - - -This works, but the complexity of "post/tag/list.html" is fairly high; the Hugo template needs to perform special behaviour for the case where there’s only one tag, and it has to treat the last tag as special. Additionally, the tag list will be rendered something like "Tags: tag1 , tag2 , tag3" because of the way that the HTML is generated and it is interpreted by a browser. - -This is Hugo. We have a better way. If this were your "post/tag/list.html" instead, all of those problems are fixed automatically (this first version separates all of the operations for ease of reading; the combined version will be shown after the explanation). - - - {{ with .Params.tags }} -
    - Tags: - {{ $sort := sort . }} - {{ $links := apply $sort "partial" "post/tag/link" "." }} - {{ $clean := apply $links "chomp" "." }} - {{ delimit $clean ", " }} -
    - {{ end }} - -In this version, we are now sorting the tags, converting them to links with "post/tag/link.html", cleaning off stray newlines, and joining them together in a delimited list for presentation. That can also be written as: - - - {{ with .Params.tags }} -
    - Tags: - {{ delimit (apply (apply (sort .) "partial" "post/tag/link" ".") "chomp" ".") ", " }} -
    - {{ end }} - -`apply` does not work when receiving the sequence as an argument through a pipeline. - -*** - -### base64Encode and base64Decode - -`base64Encode` and `base64Decode` let you easily decode content with a base64 encoding and vice versa through pipes. Let's take a look at an example: - - - {{ "Hello world" | base64Encode }} - - - {{ "SGVsbG8gd29ybGQ=" | base64Decode }} - - -You can also pass other datatypes as argument to the template function which tries -to convert them. Now we use an integer instead of a string: - - - {{ 42 | base64Encode | base64Decode }} - - -**Tip:** Using base64 to decode and encode becomes really powerful if we have to handle -responses of APIs. - - {{ $resp := getJSON "https://api.github.com/repos/gohugoio/hugo/readme" }} - {{ $resp.content | base64Decode | markdownify }} - -The response of the GitHub API contains the base64-encoded version of the [README.md](https://github.com/gohugoio/hugo/blob/master/README.md) in the Hugo repository. Now we can decode it and parse the Markdown. The final output will look similar to the rendered version on GitHub. - -*** - -### partialCached - -See [Template Partials]({{< relref "templates/partials.md#cached-partials" >}}) for an explanation of the `partialCached` template function. - - -## .Site.GetPage -Every `Page` has a `Kind` attribute that shows what kind of page it is. While this attribute can be used to list pages of a certain `kind` using `where`, often it can be useful to fetch a single page by its path. - -`GetPage` looks up an index page of a given `Kind` and `path`. This method may support regular pages in the future, but currently it is a convenient way of getting the index pages, such as the home page or a section, from a template: - - {{ with .Site.GetPage "section" "blog" }}{{ .Title }}{{ end }} - -This method wil return `nil` when no page could be found, so the above will not print anything if the blog section isn't found. - -The valid page kinds are: *home, section, taxonomy and taxonomyTerm.* diff -Nru hugo-0.25.1/docs/content/templates/go-templates.md hugo-0.26/docs/content/templates/go-templates.md --- hugo-0.25.1/docs/content/templates/go-templates.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/templates/go-templates.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,443 +0,0 @@ ---- -aliases: -- /layout/go-templates/ -- /layouts/go-templates/ -lastmod: 2015-11-30 -date: 2013-07-01 -menu: - main: - parent: layout -next: /templates/ace -prev: /templates/overview -title: Go Template Primer -weight: 15 -toc: true ---- - -Hugo uses the excellent [Go][] [html/template][gohtmltemplate] library for -its template engine. It is an extremely lightweight engine that provides a very -small amount of logic. In our experience it is just the right amount of -logic to be able to create a good static website. If you have used other -template systems from different languages or frameworks, you will find a lot of -similarities in Go templates. - -This document is a brief primer on using Go templates. The [Go docs][gohtmltemplate] -go into more depth and cover features that aren't mentioned here. - -## Introduction to Go Templates - -Go templates provide an extremely simple template language. It adheres to the -belief that only the most basic of logic belongs in the template or view layer. -One consequence of this simplicity is that Go templates parse very quickly. - -A unique characteristic of Go templates is they are content aware. Variables and -content will be sanitized depending on the context of where they are used. More -details can be found in the [Go docs][gohtmltemplate]. - -## Basic Syntax - -Go lang templates are HTML files with the addition of variables and -functions. - -**Go variables and functions are accessible within {{ }}** - -Accessing a predefined variable "foo": - - {{ foo }} - -**Parameters are separated using spaces** - -Calling the `add` function with input of 1, 2: - - {{ add 1 2 }} - -**Methods and fields are accessed via dot notation** - -Accessing the Page Parameter "bar" - - {{ .Params.bar }} - -**Parentheses can be used to group items together** - - {{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }} - - -## Variables - -Each Go template has a struct (object) made available to it. In Hugo, each -template is passed page struct. More details are available on the -[variables](/layout/variables/) page. - -A variable is accessed by referencing the variable name. - - {{ .Title }} - -Variables can also be defined and referenced. - - {{ $address := "123 Main St."}} - {{ $address }} - - -## Functions - -Go template ships with a few functions which provide basic functionality. The Go -template system also provides a mechanism for applications to extend the -available functions with their own. [Hugo template -functions](/layout/functions/) provide some additional functionality we believe -are useful for 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** - - {{ add 1 2 }} - -**Example 2: Comparing numbers** - - {{ lt 1 2 }} - -(There are more boolean operators, detailed in the -[template documentation](http://golang.org/pkg/text/template/#hdr-Functions).) - -## Includes - -When including another template, you will pass to it the data it will be -able to access. To pass along the current context, please remember to -include a trailing dot. The templates location will always be starting at -the /layout/ directory within Hugo. - -**Example:** - - {{ template "partials/header.html" . }} - -And, starting with Hugo v0.12, you may also use the `partial` call -for [partial templates](/templates/partials/): - - {{ partial "header.html" . }} - - -## 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. - -**Example 1: Using Context** - - {{ range array }} - {{ . }} - {{ end }} - -**Example 2: Declaring value variable name** - - {{range $element := array}} - {{ $element }} - {{ end }} - -**Example 2: Declaring key and value variable name** - - {{range $index, $element := array}} - {{ $index }} - {{ $element }} - {{ end }} - -### Conditionals - -`if`, `else`, `with`, `or` & `and` provide the framework for handling conditional -logic in Go Templates. Like `range`, each statement is closed with `end`. - -Go Templates treat the following values as false: - -* false -* 0 -* any array, slice, map, or string of length zero - -**Example 1: `if`** - - {{ if isset .Params "title" }}

    {{ index .Params "title" }}

    {{ end }} - -**Example 2: `if` … `else`** - - {{ if isset .Params "alt" }} - {{ index .Params "alt" }} - {{else}} - {{ index .Params "caption" }} - {{ end }} - -**Example 3: `and` & `or`** - - {{ if and (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}} - -**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 }}

    {{ . }}

    {{ end }} - -**Example 5: `if` … `else if`** - - {{ if isset .Params "alt" }} - {{ index .Params "alt" }} - {{ else if isset .Params "caption" }} - {{ index .Params "caption" }} - {{ end }} - -## 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. - -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 only can 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. - -**Example 1:** - - {{ shuffle (seq 1 5) }} - -is the same as - - {{ (seq 1 5) | shuffle }} - -**Example 2:** - - {{ index .Params "disqus_url" | html }} - -Access the page parameter called "disqus_url" and escape the HTML. - -The `index` function is a [Go][] built-in, and you can read about it [here][gostdlibpkgtexttemplate]. `index`: - -> ...returns the result of indexing its first argument by the following arguments. Thus "index x 1 2 3" is, in Go syntax, `x[1][2][3]`. Each indexed item must be a map, slice, or array. - -**Example 3:** - - {{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr") }} - Stuff Here - {{ end }} - -Could be rewritten as - - {{ if isset .Params "caption" | or isset .Params "title" | or isset .Params "attr" }} - Stuff Here - {{ end }} - -### Internet Explorer conditional comments using Pipes - -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: - - {{ "" | safeHTML }} - -Alternatively, 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, e.g.: - -``` -{{ `` | safeHTML }} -``` - -## Context (a.k.a. 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 a iteration, however, it will have -the value of the current item. When inside of a loop, the context has changed: -`{{ . }}` will no longer refer to the data available to the entire page. If you need -to -access this from within the loop, you will likely want to do one of the following: - -1. Set it to a variable instead of depending on the context. For example: - - {{ $title := .Site.Title }} - {{ range .Params.tags }} -
  • - {{ . }} - - {{ $title }} -
  • - {{ end }} - - Notice how once we have entered the loop the value of `{{ . }}` has changed. We - have defined a variable outside of the loop so we have access to it from within - the loop. - -2. Use `$.` to access the global context from anywhere. - Here is an equivalent example: - - {{ range .Params.tags }} -
  • - {{ . }} - - {{ $.Site.Title }} -
  • - {{ end }} - - This is because `$`, a special variable, is set to the starting value - of `.` the dot by default, - a [documented feature](http://golang.org/pkg/text/template/#hdr-Variables) - of Go text/template. Very handy, eh? - - > However, this little magic would cease to work if someone were to - > mischievously redefine `$`, e.g. `{{ $ := .Site }}`. - > *(No, don't do it!)* - > You may, of course, recover from this mischief by using `{{ $ := . }}` - > in a global context to reset `$` to its default value. - -## Whitespace - -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: - -```html -
    - {{ .Title }} -
    -``` - -will include the newlines and horizontal tab in its HTML output: - -```html -
    - Hello, World! -
    -``` - -whereas using - -```html -
    - {{- .Title -}} -
    -``` - -in that case will output simply `
    Hello, World!
    `. - -Go considers the following characters as whitespace: space, horizontal tab, carriage return and newline. - -# Hugo Parameters - -Hugo provides the option of passing values to the template language -through the site configuration (for sitewide values), or through the meta -data of each specific piece of content. You can define any values of any -type (supported by your front matter/config format) and use them however -you want to inside of your templates. - - -## Using Content (page) Parameters - -In each piece of content, you can provide variables to be used by the -templates. This happens in the [front matter](/content/front-matter/). - -An example of this is used in this documentation site. Most of the pages -benefit from having the table of contents provided. Sometimes the TOC just -doesn't make a lot of sense. We've defined a variable in our front matter -of some pages to turn off the TOC from being displayed. - -Here is the example front matter: - -``` ---- -title: "Permalinks" -lastmod: 2015-11-30 -date: "2013-11-18" -aliases: - - "/doc/permalinks/" -groups: ["extras"] -groups_weight: 30 -notoc: true ---- -``` - -Here is the corresponding code inside of the template: - - {{ if not .Params.notoc }} -
    - {{ .TableOfContents }} -
    - {{ end }} - - - -## Using Site (config) Parameters -In your top-level configuration file (e.g., `config.yaml`) you can define site -parameters, which are values which will be available to you in partials. - -For instance, you might declare: - -```yaml -params: - CopyrightHTML: "Copyright © 2013 John Doe. All Rights Reserved." - TwitterUser: "spf13" - SidebarRecentLimit: 5 -``` - -Within a footer layout, you might then declare a `
    ` which is only -provided if the `CopyrightHTML` parameter is provided, and if it is given, -you would declare it to be HTML-safe, 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}}
    -
    {{.Site.Params.CopyrightHTML | safeHTML}}
    -
    {{end}} -``` - -An alternative way of writing the "`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: - -``` -{{with .Site.Params.TwitterUser}}{{end}} -``` - -Finally, if you want to pull "magic constants" out of your layouts, you can do -so, such as in this example: - -``` - -``` - -# Template example: Show only upcoming events - -Go allows you to do more than what's shown here. Using Hugo's -[`where`](/templates/functions/#where) function and Go built-ins, we can list -only the items from `content/events/` whose date (set in the front matter) is in -the future: - -

    Upcoming Events

    -
      - {{ range where .Data.Pages.ByDate "Section" "events" }} - {{ if ge .Date.Unix .Now.Unix }} -
    • {{ .Type | title }} — - {{ .Title }} - on - {{ .Date.Format "2 January at 3:04pm" }} - at {{ .Params.place }} -
    • - {{ end }} - {{ end }} - -[go]: http://golang.org/ -[gohtmltemplate]: http://golang.org/pkg/html/template/ -[gostdlibpkgtexttemplate]: http://golang.org/pkg/text/template/ diff -Nru hugo-0.25.1/docs/content/templates/homepage.md hugo-0.26/docs/content/templates/homepage.md --- hugo-0.25.1/docs/content/templates/homepage.md 2017-07-14 12:59:47.000000000 +0000 +++ hugo-0.26/docs/content/templates/homepage.md 2017-08-07 07:09:19.000000000 +0000 @@ -1,81 +1,79 @@ --- -aliases: -- /layout/homepage/ -lastmod: 2015-08-04 -date: 2013-07-01 +title: Homepage Template +linktitle: Homepage Template +description: The homepage of a website is often formatted differently than the other pages. For this reason, Hugo makes it easy for you to define your new site's homepage as a unique template. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [templates] +#tags: [homepage] menu: - main: - parent: layout -next: /templates/terms -notoc: true -prev: /templates/list -title: Homepage -weight: 50 + docs: + parent: "templates" + weight: 30 +weight: 30 +sections_weight: 30 +draft: false +aliases: [/layout/homepage/,/templates/homepage-template/] +toc: true --- -The home page of a website is often formatted differently than the other -pages. In Hugo you can define your own homepage template. +Homepage is a `Page` and therefore has all the [page variables][pagevars] and [site variables][sitevars] available for use. -Homepage is a `Page` and have all the [page -variables](/templates/variables/) and [site -variables](/templates/variables/) available to use in the templates. +{{% note "The Only Required Template" %}} +The homepage template is the *only* required template for building a site and therefore useful when bootstrapping a new site and template. It is also the only required template if you are developing a single-page website. +{{% /note %}} -*This is the only required template for building a site and useful when -bootstrapping a new site and template. It is also the only required -template when using a single page site.* +## Homepage Template Lookup Order -In addition to the standard page variables, the homepage has access to -all site content accessible from `.Data.Pages`. Details on how to use the -list of pages can be found in the [Lists Template](/templates/list/). +The [lookup order][lookup] for the homepage template is as follows: -Note that a home page can also have a content file with frontmatter, see [Source Organization]({{< relref "overview/source-directory.md#content-for-home-page-and-other-list-pages" >}}). +1. `/layouts/index.html` +2. `/layouts/_default/list.html` +3. `/themes//layouts/index.html` +4. `/themes//layouts/_default/list.html` -## Which Template will be rendered? -Hugo uses a set of rules to figure out which template to use when -rendering a specific page. +## Add Content and Front Matter to the Homepage -Hugo will use the following prioritized list. If a file isn’t present, -then the next one in the list will be used. This enables you to craft -specific layouts when you want to without creating more templates -than necessary. For most sites, only the \_default file at the end of -the list will be needed. +The homepage, similar to other [list pages in Hugo][lists], accepts content and front matter from an `_index.md` file. This file should live at the root of your `content` folder (i.e., `content/_index.md`). You can then add body copy and metadata to your homepage the way you would any other content file. -* /layouts/index.html -* /layouts/\_default/list.html -* /layouts/\_default/single.html -* /themes/`THEME`/layouts/index.html -* /themes/`THEME`/layouts/\_default/list.html -* /themes/`THEME`/layouts/\_default/single.html +See the homepage template below or [Content Organization][contentorg] for more information on the role of `_index.md` in adding content and front matter to list pages. -## Example index.html -This content template is used for [spf13.com](http://spf13.com/). +## `.Data.Pages` on the Homepage -It makes use of [partial templates](/templates/partials/) and uses a similar approach as a [List](/templates/list/). +In addition to the standard [page variables][pagevars], the homepage template has access to *all* site content via `.Data.Pages`. - - - - +## Example Homepage Template - {{ partial "meta.html" . }} +The following is an example of a homepage template that uses [partial][partials], [base][] templates, and a content file at `content/_index.md` to populate the `{{.Title}}` and `{{Content}}` [page variables][pagevars]. - - {{ .Site.Title }} - - - - {{ partial "head_includes.html" . }} - - - - {{ partial "subheader.html" . }} - -
      +{{< code file="layouts/index.html" download="index.html" >}} +{{ define "main" }} +
      +
      +

      {{.Title}}

      + {{ with .Params.subtitle }} + {{.}} + {{ end }} +
      +
      + + {{.Content}} +
      + {{ range first 10 .Data.Pages }} {{ .Render "summary"}} {{ end }}
      -
      - - {{ partial "footer.html" . }} +
    +{{ end }} +{{< /code >}} + +[base]: /templates/base/ +[contentorg]: /content-management/organization/ +[lists]: /templates/lists/ +[lookup]: /templates/lookup-order/ +[pagevars]: /variables/page/ +[partials]: /templates/partials/ +[sitevars]: /variables/site/ diff -Nru hugo-0.25.1/docs/content/templates/_index.md hugo-0.26/docs/content/templates/_index.md --- hugo-0.25.1/docs/content/templates/_index.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/templates/_index.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,19 @@ +--- +title: Templates +linktitle: Templates Overview +description: Go templating, template types and lookup order, shortcodes, and data. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +menu: + docs: + parent: "templates" + weight: 01 +weight: 01 #rem +categories: [templates] +#tags: [] +draft: false +aliases: [/templates/overview/,/templates/content] +toc: false +notesforauthors: +--- diff -Nru hugo-0.25.1/docs/content/templates/internal.md hugo-0.26/docs/content/templates/internal.md --- hugo-0.25.1/docs/content/templates/internal.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/templates/internal.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,135 @@ +--- +title: Internal Templates +linktitle: Internal Templates +description: Hugo ships with a group of boilerplate templates that cover the most common use cases for static websites. +date: 2017-03-06 +publishdate: 2017-03-06 +lastmod: 2017-03-06 +categories: [templates] +#tags: [internal, analytics,] +menu: + docs: + parent: "templates" + weight: 168 +weight: 168 +sections_weight: 168 +draft: false +aliases: [] +toc: true +wip: true +--- + + +{{% warning %}} +While the following internal templates are called similar to partials, they do *not* observe the partial template lookup order. +{{% /warning %}} + +## Google Analytics + +Hugo ships with internal templates for Google Analytics tracking, including both synchronous and asynchronous tracking codes. + +### Configure Google Analytics + +Provide your tracking id in your configuration file: + +``` +googleAnalytics = "UA-123-45" +``` + +``` +googleAnalytics: "UA-123-45" +``` + +### Use the Google Analytics Template + +You can then include the Google Analytics internal template: + +``` +{{ template "_internal/google_analytics.html" . }} +``` + + +``` +{{ template "_internal/google_analytics_async.html" . }} +``` + +## Disqus + +Hugo also ships with an internal template for [Disqus comments][disqus], a popular commenting system for both static and dynamic websites. In order to effectively use Disqus, you will need to secure a Disqus "shortname" by [signing up for the free service][disqussignup]. + +### Configure Disqus + +To use Hugo's Disqus template, you first need to set a single value in your site's `config.toml` or `config.yml`: + +``` +disqusShortname = "yourdiscussshortname" +``` + +``` +disqusShortname: "yourdiscussshortname" +``` + +You also have the option to set the following in the front matter for a given piece of content: + +* `disqus_identifier` +* `disqus_title` +* `disqus_url` + +### Use the Disqus Template + +To add Disqus, include the following line in templates where you want your comments to appear: + +``` +{{ template "_internal/disqus.html" . }} +``` + +### Conditional Loading of Disqus Comments + +Users have noticed that enabling Disqus comments when running the Hugo web server on `localhost` (i.e. via `hugo server`) causes the creation of unwanted discussions on the associated Disqus account. + +You can create the following `layouts/partials/disqus.html`: + +{{< code file="layouts/partials/disqus.html" download="disqus.html" >}} +
    + + +comments powered by Disqus +{{< /code >}} + +The `if` statement skips the initialization of the Disqus comment injection when you are running on `localhost`. + +You can then render your custom Disqus partial template as follows: + +``` +{{ partial "disqus.html" . }} +``` + +``` +_internal/_default/robots.txt +_internal/_default/rss.xml +_internal/_default/sitemap.xml +_internal/_default/sitemapindex.xml + +_internal/disqus.html +_internal/google_news.html +_internal/google_analytics.html +_internal/google_analytics_async.html +_internal/opengraph.html +_internal/pagination.html +_internal/schema.html +_internal/twitter_cards.html +``` diff -Nru hugo-0.25.1/docs/content/templates/introduction.md hugo-0.26/docs/content/templates/introduction.md --- hugo-0.25.1/docs/content/templates/introduction.md 1970-01-01 00:00:00.000000000 +0000 +++ hugo-0.26/docs/content/templates/introduction.md 2017-08-07 07:09:19.000000000 +0000 @@ -0,0 +1,486 @@ +--- +title: Introduction to Hugo Templating +linktitle: Introduction +description: Hugo uses Go's `html/template` and `text/template` libraries as the basis for the templating. +godocref: https://golang.org/pkg/html/template/ +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-25 +categories: [templates,fundamentals] +#tags: [go] +menu: + docs: + parent: "templates" + weight: 10 +weight: 10 +sections_weight: 10 +draft: false +aliases: [/templates/introduction/,/layouts/introduction/,/layout/introduction/, /templates/go-templates/] +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/). +{{% /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. + +## Basic Syntax + +Golang templates are HTML files with the addition of [variables][variables] and [functions][functions]. Golang template variables and functions are accessible within `{{ }}`. + +### Access a Predefined Variable + +``` +{{ foo }} +``` + +Parameters for functions are separated using spaces. The following example calls the `add` function with inputs of `1` and `2`: + +``` +{{ add 1 2 }} +``` + +#### Methods and Fields are Accessed via dot Notation + +Accessing the Page Parameter `bar` defined in a piece of content's [front matter][]. + +``` +{{ .Params.bar }} +``` + +#### Parentheses Can be Used to Group Items Together + +``` +{{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }} +``` + +## Variables + +Each Go template gets a data object. In Hugo, each template is passed a `Page`. See [variables][] for more information. + +This is how you access a `Page` variable from a template: + +``` +{{ .Title }} +``` + +Values can also be stored in custom variables and referenced later: + +``` +{{ $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). + +Hugo has created a workaround for this issue in [Scratch](/functions/scratch). + +{{% /warning %}} + +## Functions + +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 + +``` +{{ add 1 2 }} +=> 3 +``` + +### Example 2: Comparing Numbers + +``` +{{ lt 1 2 }} +=> true (i.e., since 1 is less than 2) +``` + +Note that both examples make us of Go template's [math functions][]. + +{{% note "Additional Boolean Operators" %}} +There are more boolean operators than those listed in the Hugo docs in the [Golang template documentation](http://golang.org/pkg/text/template/#hdr-Functions). +{{% /note %}} + +## Includes + +When including another template, you will pass to it the data it will be +able to access. To pass along the current context, please remember to +include a trailing dot. The templates location will always be starting at +the `/layout/` directory within Hugo. + +### Template and Partial Examples + +``` +{{ template "partials/header.html" . }} +``` + +Starting with Hugo v0.12, you may also use the `partial` call +for [partial templates][partials]: + +``` +{{ partial "header.html" . }} +``` + +## 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. + +#### Example 1: Using Context + +``` +{{ range array }} + {{ . }} +{{ end }} +``` + +#### Example 2: Declaring Value => Variable name + +``` +{{range $element := array}} + {{ $element }} +{{ end }} +``` + +#### Example 3: Declaring Key-Value Variable Name + +``` +{{range $index, $element := array}} + {{ $index }} + {{ $element }} +{{ 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}}`. + +Go Templates treat the following values as false: + +* false +* 0 +* any zero-length array, slice, map, or string + +#### Example 1: `if` + +``` +{{ if isset .Params "title" }}

    {{ index .Params "title" }}

    {{ end }} +``` + +#### Example 2: `if` … `else` + +``` +{{ if isset .Params "alt" }} + {{ index .Params "alt" }} +{{else}} + {{ index .Params "caption" }} +{{ end }} +``` + +#### Example 3: `and` & `or` + +``` +{{ if and (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")}} +``` + +#### 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 }}

    {{ . }}

    {{ end }} +``` + +#### Example 5: `if` … `else if` + +``` +{{ if isset .Params "alt" }} + {{ index .Params "alt" }} +{{ else if isset .Params "caption" }} + {{ index .Params "caption" }} +{{ end }} +``` + +## 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. + +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. + +### Example 1: `shuffle` + +The following two examples are functionally the same: + +``` +{{ shuffle (seq 1 5) }} +``` + + +``` +{{ (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: + +``` +{{ index .Params "disqus_url" | html }} +``` + +### Example 3: `or` with `isset` + +``` +{{ if or (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr") }} +Stuff Here +{{ end }} +``` + +Could be rewritten as + +``` +{{ if isset .Params "caption" | or isset .Params "title" | or isset .Params "attr" }} +Stuff Here +{{ end }} +``` + +### Example 4: Internet Explorer Conditional Comments + +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: + +``` +{{ "" | safeHTML }} +``` + +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: + +``` +{{ `` | safeHTML }} +``` + +## Context (aka "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: + +### 1. Define a Variable Independent of Context + +The following shows how to define a variable independent of the context. + +{{< code file="tags-range-with-page-variable.html" >}} +{{ $title := .Site.Title }} +
      +{{ range .Params.tags }} +
    • + {{ . }} + - {{ $title }} +
    • +{{ end }} +
    +{{< /code >}} + +{{% note %}} +Notice how once we have entered the loop (i.e. `range`), the value of `{{ . }}` has changed. We have defined a variable outside of the loop (`{{$title}}`) that we've assigned a value so that we have access to the value from within the loop as well. +{{% /note %}} + +### 2. Use `$.` to Access the Global Context + +`$` has special significance in your templates. `$` is set to the starting value of `.` ("the dot") by default. This is a [documented feature of Go text/template][dotdoc]. This means you have access to the global context from anywhere. Here is an equivalent example of the preceding code block but now using `$` to grab `.Site.Title` from the global context: + +{{< code file="range-through-tags-w-global.html" >}} +
      +{{ range .Params.tags }} +
    • + {{ . }} + - {{ $.Site.Title }} +
    • +{{ end }} +
    +{{< /code >}} + +{{% warning "Don't Redefine the Dot" %}} +The built-in magic of `$` would cease to work if someone were to mischievously redefine the special character; e.g. `{{ $ := .Site }}`. *Don't do it.* You may, of course, recover from this mischief by using `{{ $ := . }}` in a global context to reset `$` to its default value. +{{% /warning %}} + +## Whitespace + +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: + +``` +
    + {{ .Title }} +
    +``` + +Which will output: + +``` +
    + Hello, World! +
    +``` + +Leveraging the `-` in the following example will remove the extra white space surrounding the `.Title` variable and remove the newline: + +``` +
    + {{- .Title -}} +
    +``` + +Which then outputs: + +``` +
    Hello, World!
    +``` + +Go considers the following characters whitespace: + +* space +* horizontal tab +* carriage return +* newline + +## Hugo Parameters + +Hugo provides the option of passing values to your template layer through your [site configuration][config] (i.e. for site-wide values) or through the metadata of each specific piece of content (i.e. the [front matter][]). You can define any values of any type and use them however you want in your templates, as long as the values are supported by the front matter format specified via `metaDataFormat` in your configuration file. + +## Use Content (`Page`) Parameters + +You can provide variables to be used by templates in individual content's [front matter][]. + +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: + +``` +--- +title: Roadmap +lastmod: 2017-03-05 +date: 2013-11-18 +notoc: true +--- +``` + +Here is an example of corresponding code that could be used inside a `toc.html` [partial template][partials]: + +{{< code file="layouts/partials/toc.html" download="toc.html" >}} +{{ if not .Params.notoc }} + + +{{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`. + +## Use Site Configuration Parameters + +You can arbitrarily define as many site-level parameters as you want in your [site's configuration file][config]. These parameters are globally available in your templates. + +For instance, you might declare the following: + +{{< code file="config.yaml" >}} +params: + copyrighthtml: "Copyright © 2017 John Doe. All Rights Reserved." + twitteruser: "spf13" + sidebarrecentlimit: 5 +{{< /code >}} + +Within a footer layout, you might then declare a `