Merge commit '77b976dd92b4f66657d83d875aef0c617df492d9'

This commit is contained in:
Bjørn Erik Pedersen
2023-08-30 19:24:34 +02:00
302 changed files with 1289 additions and 19021 deletions

View File

@@ -1,6 +1,6 @@
---
title: Configure markup
description: How to handle Markdown and other markup related configuration.
description: Configure rendering of markup to HTML.
categories: [fundamentals, getting started]
keywords: [configuration,highlighting]
menu:
@@ -12,9 +12,9 @@ slug: configuration-markup
toc: true
---
## Configure markup
## Default configuration
See [Goldmark](#goldmark) for settings related to the default Markdown handler in Hugo.
See [Goldmark](#goldmark) for settings related to the default markdown handler in Hugo.
Below are all markup related configuration in Hugo with their default settings:
@@ -22,7 +22,7 @@ Below are all markup related configuration in Hugo with their default settings:
**See each section below for details.**
### Goldmark
## Goldmark
[Goldmark](https://github.com/yuin/goldmark/) is from Hugo 0.60 the default library used for Markdown. It's fast, it's [CommonMark](https://spec.commonmark.org/0.29/) compliant and it's very flexible.
@@ -38,7 +38,7 @@ hardWraps
: By default, Goldmark ignores newlines within a paragraph. Set to `true` to render newlines as `<br>` elements.
unsafe
: By default, Goldmark does not render raw HTMLs and potentially dangerous links. If you have lots of inline HTML and/or JavaScript, you may need to turn this on.
: By default, Goldmark does not render raw HTML and potentially dangerous links. If you have lots of inline HTML and/or JavaScript, you may need to turn this on.
typographer
: This extension substitutes punctuations with typographic entities like [smartypants](https://daringfireball.net/projects/smartypants/).
@@ -82,7 +82,7 @@ Note that attributes in [code fences](/content-management/syntax-highlighting/#h
autoHeadingIDType ("github")
: The strategy used for creating auto IDs (anchor names). Available types are `github`, `github-ascii` and `blackfriday`. `github` produces GitHub-compatible IDs, `github-ascii` will drop any non-Ascii characters after accent normalization, and `blackfriday` will make the IDs compatible with Blackfriday, the default Markdown engine before Hugo 0.60. Note that if Goldmark is your default Markdown engine, this is also the strategy used in the [anchorize](/functions/anchorize/) template func.
### Highlight
## Highlight
This is the default `highlight` configuration. Note that some of these settings can be set per code block, see [Syntax Highlighting](/content-management/syntax-highlighting/).
@@ -95,7 +95,7 @@ For `style`, see these galleries:
For CSS, see [Generate Syntax Highlighter CSS](/content-management/syntax-highlighting/#generate-syntax-highlighter-css).
### Table of contents
## Table of contents
{{< code-toggle config="markup.tableOfContents" />}}
@@ -108,7 +108,7 @@ endLevel
: The heading level, inclusive, to stop render the table of contents.
ordered
: Whether or not to generate an ordered list instead of an unordered list.
: If `true`, generates an ordered list instead of an unordered list.
## Markdown render hooks

View File

@@ -411,7 +411,7 @@ Maximum number of items in the RSS feed.
### sectionPagesMenu
See [Menus](/content-management/menus/#define-in-site-configuration).
See [Menus](/content-management/menus/#define-automatically).
### security
@@ -491,28 +491,7 @@ enableemoji: true
The `build` configuration section contains global build-related configuration options.
{{< code-toggle file="hugo" >}}
[build]
noJSConfigInAssets = false
useResourceCacheWhen = 'fallback'
[build.buildStats]
disableClasses = false
disableIDs = false
disableTags = false
enable = false
[[build.cachebusters]]
source = 'assets/.*\.(js|ts|jsx|tsx)'
target = '(js|scripts|javascript)'
[[build.cachebusters]]
source = 'assets/.*\.(css|sass|scss)$'
target = '(css|styles|scss|sass)'
[[build.cachebusters]]
source = '(postcss|tailwind)\.config\.js'
target = '(css|styles|scss|sass)'
[[build.cachebusters]]
source = 'assets/.*\.(.*)$'
target = '$1'
{{< /code-toggle >}}
{{< code-toggle config="build" />}}
buildStats {{< new-in "0.115.1" >}}
: When enabled, creates a `hugo_stats.json` file in the root of your project. This file contains arrays of the `class` attributes, `id` attributes, and tags of every HTML element within your published site. Use this file as data source when [removing unused CSS] from your site. This process is also known as pruning, purging, or tree shaking.
@@ -735,13 +714,7 @@ Dates are important in Hugo, and you can configure how Hugo assigns dates to you
The default configuration is:
{{< code-toggle file="hugo" >}}
[frontmatter]
date = ["date", "publishDate", "lastmod"]
lastmod = [":git", "lastmod", "date", "publishDate"]
publishDate = ["publishDate", "date"]
expiryDate = ["expiryDate"]
{{< /code-toggle >}}
{{< code-toggle config="frontmatter" />}}
If you, as an example, have a non-standard date parameter in some of your content, you can override the setting for `date`:
@@ -797,27 +770,7 @@ Default configuration:
Since Hugo 0.52 you can configure more than just the `cacheDir`. This is the default configuration:
{{< code-toggle file="hugo" >}}
[caches]
[caches.getjson]
dir = ":cacheDir/:project"
maxAge = -1
[caches.getcsv]
dir = ":cacheDir/:project"
maxAge = -1
[caches.getresource]
dir = ":cacheDir/:project"
maxAge = -1
[caches.images]
dir = ":resourceDir/_gen"
maxAge = -1
[caches.assets]
dir = ":resourceDir/_gen"
maxAge = -1
[caches.modules]
dir = ":cacheDir/modules"
maxAge = -1
{{< /code-toggle >}}
{{< code-toggle config="caches" />}}
You can override any of these cache settings in your own `hugo.toml`.
@@ -850,12 +803,12 @@ dir
[lookup order]: /templates/lookup-order/
[Output Formats]: /templates/output-formats/
[templates]: /templates/
[toml]: https://github.com/toml-lang/toml
[toml]: https://toml.io/en/latest
[yaml]: https://yaml.org/spec/
[static-files]: /content-management/static-files/
# Configure cacheDir
## Configure cacheDir
This is the directory where Hugo by default will store its file caches. See [Configure File Caches](#configure-file-caches).

View File

@@ -37,7 +37,7 @@ example/
The following is a high-level overview of each of the directories with links to each of their respective sections within the Hugo docs.
[`archetypes`](/content-management/archetypes/)
: You can create new content files in Hugo using the `hugo new` command.
: You can create new content files in Hugo using the `hugo new content` 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.
[`assets`]

View File

@@ -5,8 +5,8 @@ keywords: [books, tutorials, learning, usage]
menu:
docs:
parent: getting-started
weight: 60
weight: 60
weight: 70
weight: 70
---
## Books

View File

@@ -0,0 +1,266 @@
---
title: Glossary of terms
description: Terms commonly used throughout the documentation.
keywords: [glossary]
menu:
docs:
parent: getting-started
weight: 60
weight: 60
type: glossary
---
<!-- Use level 3 headings for each term in the glossary. -->
### action
See [template action](#template-action).
### archetype
A template for new content. See [details](/content-management/archetypes/).
### argument
A [scalar](#scalar), [array](#array), [slice](#slice), [map](#map), or [object](#object) passed to a [function](#function), [method](#method), or [shortcode](#shortcode).
### array
A numbered sequence of elements. Unlike Go's [slice](#slice) data type, an array has a fixed length. See the [Go&nbsp;documentation](https://go.dev/ref/spec#Array_types) for details.
### bool
See [boolean](#boolean).
### boolean
A data type with two possible values, either `true` or `false`.
### branch bundle
A [page bundle](#page-bundle) with an&nbsp;_index.md file and zero or more [resources](#resource). Analogous to a physical branch, a branch bundle may have descendants including regular pages, [leaf bundles](/getting-started/glossary/#leaf-bundle), and other branch bundles. See [details](/content-management/page-bundles/).
### build
To generate a static site that includes HTML files and assets such as images, CSS, and JavaScript. The build process includes rendering and resource transformations.
### bundle
See [page bundle](#page-bundle).
### cache
A software component that stores data so that future requests for the same data are faster.
### collection
Typically, a collection of pages, but may also refer to an [array](#array), [slice](#slice), or [map](#map). For example, the pages within a site's "articles" section are a page collection.
### content format
A markup language for creating content. Typically markdown, but may also be HTML, AsciiDoc, Org, Pandoc, or reStructuredText. See [details](/content-management/formats/).
### content type
A classification of content inferred from the top-level directory name or the `type` set in [front matter](#front-matter). Pages in the root of the content directory, including the home page, are of type "page". Accessed via `.Page.Type` in [templates](#template). See&nbsp;[details](/content-management/types/).
### context
Represented by a period "." within a [template action](#template-action), context is the current location in a data structure. For example, while iterating over a [collection](#collection) of pages, the context within each iteration is the page's data structure. The context received by each template depends on template type and/or how it was called. See [details](/templates/introduction/#the-dot).
### flag
An option passed to a command-line program, beginning with one or two hyphens. See [details](/commands/hugo/).
### float
See [floating point](#floating-point).
### floating point
A numeric data type with a fractional component. For example, `3.14159`.
### function
Used within a [template action](#template-action), a function takes one or more [arguments](#argument) and returns a value. Unlike [methods](#method), functions are not associated with an [object](#object). See [details](/functions/).
### front matter
Metadata at the beginning of each content page, separated from the content by format-specific delimiters. See&nbsp;[details](/content-management/front-matter/).
### int
See [integer](#integer).
### integer
A numeric data type without a fractional component. For example, `42`.
### internationalization
Software design and development efforts that enable [localization](#localization). See the [W3C definition](https://www.w3.org/International/questions/qa-i18n). Abbreviated i18n.
### kind
See [page kind](#page-kind).
### layout
See [template](#template).
### leaf bundle
A [page bundle](#page-bundle) with an index.md file and zero or more [resources](#resource). Analogous to a physical leaf, a leaf bundle is at the end of a branch. Hugo ignores content (but not resources) beneath the leaf bundle. See [details](/content-management/page-bundles/).
### list page
Any [page kind](#page-kind) that receives a page [collection](#collection) in [context](#context). This includes the home page, [section pages](#section-page), [taxonomy pages](#taxonomy-page), and [term pages](#term-page).
### localization
Adaptation of a site to meet language and regional requirements. This includes translations, language-specific media, date and currency formats, etc. See [details](/content-management/multilingual/) and the [W3C definition](https://www.w3.org/International/questions/qa-i18n). Abbreviated l10n.
### map
An unordered group of elements, each indexed by a unique key. See the [Go&nbsp;documentation](https://go.dev/ref/spec#Map_types) for details.
### method
Used within a [template action](#template-action) and associated with an [object](#object), a method takes zero or more [arguments](#argument) and either returns a value or performs an action. For example, `.IsHome` is a method on the `.Page` object which returns `true` if the current page is the home page. See also [function](#function).
### module
Like a [theme](#theme), a module is a packaged combination of [archetypes](#archetype), assets, content, data, [templates](#template), translations, or configuration settings. A module may serve as the basis for a new site, or to augment an existing site. See [details](/hugo-modules/).
### object
A data structure with or without associated [methods](#method).
### page bundle
A directory that encapsulates both content and associated [resources](#resource). There are two types of page bundles: [leaf bundles](/getting-started/glossary/#leaf-bundle) and [branch bundles](/getting-started/glossary/#branch-bundle). See [details](/content-management/page-bundles/).
### page kind
A classification of rendered pages, one of "home", "page", "section", "taxonomy", or "term". Accessed via `.Page.Kind` in [templates](#template). See&nbsp;[details](/templates/section-templates/#page-kinds).
### pager
Created during [pagination](#pagination), a pager contains a subset of a section list, and navigation links to other pagers.
### paginate
To split a [section](#section) list into two or more [pagers](#pager) See&nbsp;[details](/templates/pagination/).
### pagination
The process of [paginating](#paginate) a [section](#section) list.
### parameter
Typically, a user-defined key/value pair at the site or page level, but may also refer to a configuration setting or an [argument](#argument).
### partial
A [template](#template) called from any other template including [shortcodes](#shortcode), [render hooks](#render-hook), and other partials. A partial either renders something or returns something. A partial can also call itself, for example, to [walk](#walk) a data structure.
### permalink
The absolute URL of a rendered page, including scheme and host.
### pipe
See [pipeline](#pipeline).
### pipeline
Within a [template action](#template-action), a pipeline is a possibly chained sequence of values, [function](#function) calls, or [method](#method) calls. Functions and methods in the pipeline may take multiple [arguments](#argument).
A pipeline may be *chained* by separating a sequence of commands with pipeline characters "|". In a chained pipeline, the result of each command is passed as the last argument to the following command. The output of the final command in the pipeline is the value of the pipeline. See the [Go&nbsp;documentation](https://pkg.go.dev/text/template#hdr-Pipelines) for details.
### publish
See [build](#build).
### regular page
Content with the "page" [page kind](#page-kind). See also [section page](#section-page).
### render hook
A [template](#template) that overrides standard markdown rendering. See [details](/templates/render-hooks/).
### resource
Any file consumed by the build process to augment or generate content, structure, behavior, or presentation. For example: images, videos, content snippets, CSS, Sass, Javascript, and data.
Hugo supports three types of resources: page resources (located in a [page bundle](/getting-started/glossary/#page-bundle)), global resources (located in the assets directory), and remote resources (typically accessed via https).
### scalar
A single value, one of [string](#string), [integer](#integer), [floating point](#floating-point), or [boolean](#boolean).
### section
A top-level content directory, or any content directory with an&nbsp;_index.md file. A content directory with an&nbsp;_index.md file is also known as a [branch bundle](/getting-started/glossary/#branch-bundle). Section templates receive one or more page [collections](#collection) in [context](#context). See [details](/content-management/sections/).
### section page
Content with the "section" [page kind](#page-kind). Typically a listing of [regular pages](#regular-page) and/or [section pages](#section-page) within the current [section](#section). See also [regular page](#regular-page).
### shortcode
A [template](#template) called from within markdown, taking zero or more [arguments](#argument). See [details](/content-management/shortcodes/).
### slice
A numbered sequence of elements. Unlike Go's [array](#array) data type, slices are dynamically sized. See the [Go&nbsp;documentation](https://go.dev/ref/spec#Slice_types) for details.
### string
A sequence of bytes. For example, `"What is 6 times 7?"`&nbsp;.
### taxonomy
A group of related [terms](#term) used to classify content. For example, a "colors" taxonomy might include the terms "red", "green", and "blue". See&nbsp;[details](/content-management/taxonomies/).
### taxonomy page
Content with the "taxonomy" [page kind](#page-kind). Typically a listing of [terms](#term) within a given [taxonomy](#taxonomy).
### template
An HTML file with [template actions](#template-action), located within the layouts directory of a project, theme, or module. See&nbsp;[details](/templates/).
### template action
A data evaluation or control structure within a [template](#template), delimited by "{{"&nbsp;and&nbsp;"}}". See the [Go&nbsp;documentation](https://pkg.go.dev/text/template#hdr-Actions) for details.
### term
A member of a [taxonomy](#taxonomy), used to classify content. See&nbsp;[details](/content-management/taxonomies/).
### term page
Content with the "term" [page kind](#page-kind). Typically a listing of [regular pages](#regular-page) and [section pages](#section-page) with a given [term](#term).
### theme
A packaged combination of [archetypes](#archetype), assets, content, data, [templates](#template), translations, or configuration settings. A theme may serve as the basis for a new site, or to augment an existing site. See also [module](#module).
### token
An identifier within a format string, beginning with a colon and replaced with a value when rendered. For example, use tokens in format strings for both [permalinks](/content-management/urls/#permalinks) and [dates](/functions/dateformat/#datetime-formatting-layouts).
### type
See [content type](#content-type).
### variable
A variable initialized within a [template action](#template-action).
### walk
To recursively traverse a nested data structure. For example, rendering a multilevel menu.

View File

@@ -103,7 +103,7 @@ Press `Ctrl + C` to stop Hugo's development server.
Add a new page to your site.
```text
hugo new posts/my-first-post.md
hugo new content posts/my-first-post.md
```
Hugo created the file in the `content/posts` directory. Open the file with your editor.