From: Bjørn Erik Pedersen Date: Wed, 4 Oct 2017 07:27:30 +0000 (+0200) Subject: Merge commit 'dae5a7c61cceeb0de59f2d755f63e453f71dd9b2' X-Git-Tag: v0.30~22 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=06e563340;p=brevno-suite%2Fhugo Merge commit 'dae5a7c61cceeb0de59f2d755f63e453f71dd9b2' --- 06e5633400b37bec2ebb6e4a9ea4603a0afcd010 diff --cc docs/content/commands/hugo.md index d3b0b358,00000000..5521ee96 mode 100644,000000..100644 --- a/docs/content/commands/hugo.md +++ b/docs/content/commands/hugo.md @@@ -1,82 -1,0 +1,81 @@@ +--- - date: 2017-09-26T21:11:49+02:00 ++date: 2017-09-26T17:09:31-05:00 +title: "hugo" +slug: hugo +url: /commands/hugo/ +--- +## hugo + +hugo builds your site + +### Synopsis + + +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/. + +``` +hugo [flags] +``` + +### Options + +``` + -b, --baseURL string hostname (and path) to the root, e.g. http://spf13.com/ + -D, --buildDrafts include content marked as draft + -E, --buildExpired include expired content + -F, --buildFuture include content with publishdate in the future + --cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/ + --canonifyURLs if true, all relative URLs will be canonicalized using baseURL + --cleanDestinationDir remove files from destination not found in static directories + --config string config file (default is path/config.yaml|json|toml) + -c, --contentDir string filesystem path to content directory + --debug debug output + -d, --destination string filesystem path to write files to + --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 + --templateMetrics display metrics about template executions + -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 +``` + +### SEE ALSO +* [hugo benchmark](/commands/hugo_benchmark/) - Benchmark Hugo by building a site a number of times. - * [hugo check](/commands/hugo_check/) - Contains some verification checks +* [hugo config](/commands/hugo_config/) - Print the site configuration +* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats +* [hugo env](/commands/hugo_env/) - Print Hugo version and environment info +* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators. +* [hugo import](/commands/hugo_import/) - Import your site from others. +* [hugo list](/commands/hugo_list/) - Listing out various types of content +* [hugo new](/commands/hugo_new/) - Create new content for your site +* [hugo server](/commands/hugo_server/) - A high performance webserver +* [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 26-Sep-2017 diff --cc docs/content/content-management/cross-references.md index e0b32dbe,00000000..55335d6a mode 100644,000000..100644 --- a/docs/content/content-management/cross-references.md +++ b/docs/content/content-management/cross-references.md @@@ -1,123 -1,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] +keywords: ["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/ ++[shortcode]: /content-management/shortcodes/ diff --cc docs/content/contribute/documentation.md index e717d4b7,00000000..3d5956ac mode 100644,000000..100644 --- a/docs/content/contribute/documentation.md +++ b/docs/content/contribute/documentation.md @@@ -1,338 -1,0 +1,336 @@@ +--- +title: Contribute to the Hugo Docs +linktitle: Documentation +description: Documentation is an integral part of any open source project. The Hugo docs are as much a work in progress as the source it attempts to cover. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [contribute] +keywords: [docs,documentation,community, contribute] +menu: + docs: + parent: "contribute" + weight: 20 +weight: 20 +sections_weight: 20 +draft: false +aliases: [/contribute/docs/] +toc: true +--- + +## Create Your Fork + +It's best to make changes to the Hugo docs on your local machine to check for consistent visual styling. Make sure you've created a fork of [hugoDocs](https://github.com/gohugoio/hugoDocs) on GitHub and cloned the repository locally on your machine. For more information, you can see [GitHub's documentation on "forking"][ghforking] or follow along with [Hugo's development contribution guide][hugodev]. + +You can then create a separate branch for your additions. Be sure to choose a descriptive branch name that best fits the type of content. The following is an example of a branch name you might use for adding a new website to the showcase: + +``` +git checkout -b jon-doe-showcase-addition +``` + +## Add New Content + +The Hugo docs make heavy use of Hugo's [archetypes][] feature. All content sections in Hugo documentation have an assigned archetype. + +Adding new content to the Hugo docs follows the same pattern, regardless of the content section: + +``` +hugo new /.md +``` + +### Add a New Function + +Once you have cloned the Hugo repository, you can create a new function via the following command. Keep the file name lowercase. + +``` +hugo new functions/newfunction.md +``` + +The archetype for `functions` according to the Hugo theme is as follows: + +{{< code file="archetypes/functions.md" >}} +{{< readfile file="/themes/gohugoioTheme/archetypes/functions.md">}} +{{< /code >}} + +#### New Function Required Fields + +Here is a review of the front matter fields automatically generated for you using `hugo new functions/*`: + +***`title`*** +: this will be auto-populated in all lowercase when you use `hugo new` generator. + +***`linktitle`*** +: the function's actual casing (e.g., `replaceRE` rather than `replacere`). + +***`description`*** +: a brief description used to populate the [Functions Quick Reference](/functions/). + +`categories` +: currently auto-populated with 'functions` for future-proofing and portability reasons only; ignore this field. + +`tags` +: only if you think it will help end users find other related functions + +`signature` +: this is a signature/syntax definition for calling the function (e.g., `apply SEQUENCE FUNCTION [PARAM...]`). + +`workson` +: acceptable values include `lists`,`taxonomies`, `terms`, `groups`, and `files`. + +`hugoversion` +: the version of Hugo that will ship with this new function. + +`relatedfuncs` +: other [templating functions][] you feel are related to your new function to help fellow Hugo users. + +`{{.Content}}` +: an extended description of the new function; examples are not only welcomed but encouraged. + +In the body of your function, expand the short description used in the front matter. Include as many examples as possible, and leverage the Hugo docs [`code` shortcode](#adding-code-blocks). If you are unable to add examples but would like to solicit help from the Hugo community, add `needsexample: true` to your front matter. + +## Add Code Blocks + +Code blocks are crucial for providing examples of Hugo's new features to end users of the Hugo docs. Whenever possible, create examples that you think Hugo users will be able to implement in their own projects. + +### Standard Syntax + +Across all pages on the Hugo docs, the typical triple-back-tick markdown syntax is used. If you do not want to take the extra time to implement the following code block shortcodes, please use standard GitHub-flavored markdown. The Hugo docs use a version of [highlight.js](https://highlightjs.org/) with a specific set of languages. + +Your options for languages are `xml`/`html`, `go`/`golang`, `md`/`markdown`/`mkd`, `handlebars`, `apache`, `toml`, `yaml`, `json`, `css`, `asciidoc`, `ruby`, `powershell`/`ps`, `scss`, `sh`/`zsh`/`bash`/`git`, `http`/`https`, and `javascript`/`js`. + +``` +``` +

Hello world!

+``` +``` + +### Code Block Shortcode + +The Hugo documentation comes with a very robust shortcode for adding interactive code blocks. + +{{% note %}} +With the `code` shortcodes, *you must include triple back ticks and a language declaration*. This was done by design so that the shortcode wrappers were easily added to legacy documentation and will be that much easier to remove if needed in future versions of the Hugo docs. +{{% /note %}} + +### `code` + +`code` is the Hugo docs shortcode you'll use most often. `code` requires has only one named parameter: `file`. Here is the pattern: + +``` +{{%/* code file="smart/file/name/with/path.html" download="download.html" copy="true" */%}} +``` +A whole bunch of coding going on up in here! +``` +{{%/* /code */%}} +``` + +The following are the arguments passed into `code`: + +***`file`*** +: the only *required* argument. `file` is needed for styling but also plays an important role in helping users create a mental model around Hugo's directory structure. Visually, this will be displayed as text in the top left of the code block. + +`download` +: if omitted, this will have no effect on the rendered shortcode. When a value is added to `download`, it's used as the filename for a downloadable version of the code block. + +`copy` +: a copy button is added automatically to all `code` shortcodes. If you want to keep the filename and styling of `code` but don't want to encourage readers to copy the code (e.g., a "Do not do" snippet in a tutorial), use `copy="false"`. + +#### Example `code` Input + +This example HTML code block tells Hugo users the following: + +1. This file *could* live in `layouts/_default`, as demonstrated by `layouts/_default/single.html` as the value for `file`. +2. This snippet is complete enough to be downloaded and implemented in a Hugo project, as demonstrated by `download="single.html"`. + +``` - {{%/* code file="layouts/_default/single.html" download="single.html" */%}} - ``` ++{{}} +{{ define "main" }} +
+
+
+

{{.Title}}

+ {{with .Params.subtitle}} + {{.}} +
+
+ {{.Content}} +
+ +
+
+{{ end }} - ``` - {{%/* /code */%}} ++{{}} +``` + +##### Example 'code' Display + +The output of this example will render to the Hugo docs as follows: + +{{< code file="layouts/_default/single.html" download="single.html" >}} +{{ define "main" }} +
+
+
+

{{.Title}}

+ {{with .Params.subtitle}} + {{.}} +
+
+ {{.Content}} +
+ +
+
+{{ end }} +{{< /code >}} + + + +## Blockquotes + +Blockquotes can be added to the Hugo documentation using [typical Markdown blockquote syntax][bqsyntax]: + +``` +> Without the threat of punishment, there is no joy in flight. +``` + +The preceding blockquote will render as follows in the Hugo docs: + +> Without the threat of punishment, there is no joy in flight. + +However, you can add a quick and easy `` element (added on the client via JavaScript) by separating your main blockquote and the citation with a hyphen with a single space on each side: + +``` +> Without the threat of punishment, there is no joy in flight. - [Kobo Abe](https://en.wikipedia.org/wiki/Kobo_Abe) +``` + +Which will render as follows in the Hugo docs: + +> Without the threat of punishment, there is no joy in flight. - [Kobo Abe][abe] + +{{% note "Blockquotes `!=` Admonitions" %}} +Previous versions of Hugo documentation used blockquotes to draw attention to text. This is *not* the [intended semantic use of `
`](http://html5doctor.com/cite-and-blockquote-reloaded/). Use blockquotes when quoting. To note or warn your user of specific information, use the admonition shortcodes that follow. +{{% /note %}} + +## Admonitions + +**Admonitions** are common in technical documentation. The most popular is that seen in [reStructuredText Directives][sourceforge]. From the SourceForge documentation: + +> Admonitions are specially marked "topics" that can appear anywhere an ordinary body element can. They contain arbitrary body elements. Typically, an admonition is rendered as an offset block in a document, sometimes outlined or shaded, with a title matching the admonition type. - [SourceForge][sourceforge] + +The Hugo docs contain three admonitions: `note`, `tip`, and `warning`. + +### `note` Admonition + +Use the `note` shortcode when you want to draw attention to information subtly. `note` is intended to be less of an interruption in content than is `warning`. + +#### Example `note` Input + +{{< code file="note-with-heading.md" >}} +{{%/* note */%}} +Here is a piece of information I would like to draw your **attention** to. +{{%/* /note */%}} +{{< /code >}} + +#### Example `note` Output + +{{< output file="note-with-heading.html" >}} +{{% note %}} +Here is a piece of information I would like to draw your **attention** to. +{{% /note %}} +{{< /output >}} + +#### Example `note` Display + +{{% note %}} +Here is a piece of information I would like to draw your **attention** to. +{{% /note %}} + +### `tip` Admonition + +Use the `tip` shortcode when you want to give the reader advice. `tip`, like `note`, is intended to be less of an interruption in content than is `warning`. + +#### Example `tip` Input + +{{< code file="using-tip.md" >}} +{{%/* tip */%}} +Here's a bit of advice to improve your productivity with Hugo. +{{%/* /tip */%}} +{{< /code >}} + +#### Example `tip` Output + +{{< output file="tip-output.html" >}} +{{% tip %}} +Here's a bit of advice to improve your productivity with Hugo. +{{% /tip %}} +{{< /output >}} + +#### Example `tip` Display + +{{% tip %}} +Here's a bit of advice to improve your productivity with Hugo. +{{% /tip %}} + +### `warning` Admonition + +Use the `warning` shortcode when you want to draw the user's attention to something important. A good usage example is for articulating breaking changes in Hugo versions, known bugs, or templating "gotchas." + +#### Example `warning` Input + +{{< code file="warning-admonition-input.md" >}} +{{%/* warning */%}} +This is a warning, which should be reserved for *important* information like breaking changes. +{{%/* /warning */%}} +{{< /code >}} + +#### Example `warning` Output + +{{< output file="warning-admonition-output.html" >}} +{{% warning %}} +This is a warning, which should be reserved for *important* information like breaking changes. +{{% /warning %}} +{{< /output >}} + +#### Example `warning` Display + +{{% warning %}} +This is a warning, which should be reserved for *important* information like breaking changes. +{{% /warning %}} + +{{% note "Pull Requests and Branches" %}} +Similar to [contributing to Hugo development](/contribute/development/), the Hugo team expects you to create a separate branch/fork when you make your contributions to the Hugo docs. +{{% /note %}} + +[abe]: https://en.wikipedia.org/wiki/Kobo_Abe +[archetypes]: /content-management/archetypes/ +[bqsyntax]: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#blockquotes +[charcount]: http://www.lettercount.com/ +[`docs/static/images/showcase/`]: https://github.com/gohugoio/hugo/tree/master/docs/static/images/showcase/ +[ghforking]: https://help.github.com/articles/fork-a-repo/ +[hugodev]: /contribute/development/ +[shortcodeparams]: content-management/shortcodes/#shortcodes-without-markdown +[sourceforge]: http://docutils.sourceforge.net/docs/ref/rst/directives.html#admonitions +[templating function]: /functions/ diff --cc docs/content/functions/partialCached.md index 83ef5e2c,00000000..515143d4 mode 100644,000000..100644 --- a/docs/content/functions/partialCached.md +++ b/docs/content/functions/partialCached.md @@@ -1,40 -1,0 +1,40 @@@ +--- +title: partialCached +linktitle: partialCached +description: Allows for caching of partials that do not need to be re-rendered on every invocation. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" - keywords: [] ++keywords: [performance] +signature: ["partialCached LAYOUT INPUT [VARIANT...]"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +aliases: [] +--- + +The `partialCached` template function can offer significant performance gains for complex templates that don't need to be re-rendered on every invocation. Here is the simplest usage: + +``` +{{ partialCached "footer.html" . }} +``` + +You can also pass additional parameters to `partialCached` to create *variants* of the cached partial. For example, if you have a complex partial that should be identical when rendered for pages within the same section, you could use a variant based upon section so that the partial is only rendered once per section: + +{{< code file="partial-cached-example.html" >}} +{{ partialCached "footer.html" . .Section }} +{{< /code >}} + +If you need to pass additional parameters to create unique variants, you can pass as many variant parameters as you need: + +``` +{{ partialCached "footer.html" . .Params.country .Params.province }} +``` + +Note that the variant parameters are not made available to the underlying partial template. They are only use to create a unique cache key. diff --cc docs/content/getting-started/configuration.md index 2dafdb52,00000000..8137cc53 mode 100644,000000..100644 --- a/docs/content/getting-started/configuration.md +++ b/docs/content/getting-started/configuration.md @@@ -1,399 -1,0 +1,401 @@@ +--- +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] +keywords: [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: "" +# the length of text to show in a .Summary +summaryLength: 70 +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 ++# display metrics about template executions ++templateMetrics: false +# theme to use (located by default in /themes/THEMENAME/) +themesDir: "themes" +theme: "" +title: "" +# 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" +# 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 >}} + +## 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 = "" +# the length of text to show in a .Summary +summaryLength: 70 +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]: https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf "Specification for JSON, JavaScript Object Notation" +[lookup order]: /templates/lookup-order/ +[Output Formats]: /templates/output-formats/ +[templates]: /templates/ +[toml]: https://github.com/toml-lang/toml +[yaml]: http://yaml.org/spec/ diff --cc docs/content/getting-started/usage.md index 39b8a491,00000000..198dc25f mode 100644,000000..100644 --- a/docs/content/getting-started/usage.md +++ b/docs/content/getting-started/usage.md @@@ -1,228 -1,0 +1,234 @@@ +--- +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] +keywords: [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' ++ undraft Undraft resets the content's draft status + 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 ++ --debug debug output + -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 ++ --templateMetrics display metrics about template executions + -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 ++ ++Additional help topics: ++ hugo check Contains some verification checks ++ ++Use "hugo [command] --help" for more information about a command. +``` + +## 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 `