Content fix

This commit is contained in:
Bjørn Erik Pedersen 2017-07-15 23:36:35 +02:00
parent ef0564e281
commit 2d75e09066
5 changed files with 21 additions and 25 deletions

View File

@ -17,9 +17,9 @@ aliases: [/content/markdown-extras/,/content/supported-formats/,/doc/supported-f
toc: true 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 frontmatter) or its fork [Mmark][mmark] (name your files `*.mmark` or set `markup = "mmark"` in frontmatter), both very fast markdown engines written in Golang. **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 frontmatter) 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" %}} {{% 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., <kbd>tab</kbd>) rather than 2-space indentations. 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., <kbd>tab</kbd>) rather than 2-space indentations.
@ -234,7 +234,7 @@ Markdown syntax is simple enough to learn in a single sitting. The following are
[helperssource]: https://github.com/spf13/hugo/blob/77c60a3440806067109347d04eb5368b65ea0fe8/helpers/general.go#L65 [helperssource]: https://github.com/spf13/hugo/blob/77c60a3440806067109347d04eb5368b65ea0fe8/helpers/general.go#L65
[hl]: /tools/syntax-highlighting/ [hl]: /tools/syntax-highlighting/
[hlsc]: /content-management/shortcodes/#highlight [hlsc]: /content-management/shortcodes/#highlight
[hugocss]: /css/style.min.css [hugocss]: /css/style.css
[ietf]: https://tools.ietf.org/html/ [ietf]: https://tools.ietf.org/html/
[mathjaxdocs]: https://docs.mathjax.org/en/latest/ [mathjaxdocs]: https://docs.mathjax.org/en/latest/
[mdcheatsheet]: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet [mdcheatsheet]: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet

View File

@ -1,7 +1,6 @@
--- ---
title: scratch title: Scratch
# linktitle: Scratch description: Acts as a "scratchpad" to allow for writable page- or shortcode-scoped variables.
description: Acts as a "scratchpad" to allow for writable page-scoped variables.
godocref: godocref:
date: 2017-02-01 date: 2017-02-01
publishdate: 2017-02-01 publishdate: 2017-02-01
@ -22,7 +21,7 @@ draft: false
aliases: [/extras/scratch/,/doc/scratch/] aliases: [/extras/scratch/,/doc/scratch/]
--- ---
`Scratch` is a "scratchpad" for your [page-scoped variables][pagevars]. 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. 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: `Scratch` is added to both `Page` and `Shortcode` -- with following methods:

View File

@ -1,7 +1,7 @@
--- ---
title: Quick Start title: Quick Start
linktitle: Quick Start linktitle: Quick Start
description: Build an online bookshelf that taps into HUGO's CLI, directory structure, configuration, and theming. description: Build an online bookshelf that taps into Hugo's CLI, directory structure, configuration, and theming.
date: 2013-07-01 date: 2013-07-01
publishdate: 2013-07-01 publishdate: 2013-07-01
lastmod: 2017-06-22 lastmod: 2017-06-22
@ -26,10 +26,6 @@ This Quick Start was originally written by [Shekhar Gulati](https://twitter.com/
In this Quick Start, we will build an online bookshelf that lists books and their reviews. In this Quick Start, we will build an online bookshelf that lists books and their reviews.
## Assumptions
This quick start assumes you are using Hugo v0.15 or greater.
## Step 1. Install Hugo ## Step 1. Install Hugo
[Install Hugo][install]. If installing from [Hugo releases][releases], you'll need to save the main executable as `hugo` (or `hugo.exe` on Windows) somewhere in your `PATH`. You will need the `hugo` command in the following steps. [Install Hugo][install]. If installing from [Hugo releases][releases], you'll need to save the main executable as `hugo` (or `hugo.exe` on Windows) somewhere in your `PATH`. You will need the `hugo` command in the following steps.

View File

@ -1,7 +1,7 @@
--- ---
title: Introduction to Hugo Templating title: Introduction to Hugo Templating
linktitle: Introduction linktitle: Introduction
description: Hugo uses Go's html/template library, an extremely lightweight and performant engine, as the basis for all Hugo templating. description: Hugo uses Go's `html/template` and `text/template` libraries as the basis for the templating.
godocref: https://golang.org/pkg/html/template/ godocref: https://golang.org/pkg/html/template/
date: 2017-02-01 date: 2017-02-01
publishdate: 2017-02-01 publishdate: 2017-02-01
@ -19,21 +19,15 @@ aliases: [/templates/introduction/,/layouts/introduction/,/layout/introduction/,
toc: true toc: true
--- ---
Hugo uses the excellent [Go html/template][gohtmltemplate] library, an extremely lightweight engine that provides just the right amount of logic to be able to create any style of static website. If you have used other template systems from different languages or frameworks, you will find a lot of similarities in Go templates.
{{% note %}} {{% note %}}
The following is only a primer on Go templates. For an in-depth look into Go templates, check the official [Go docs](http://golang.org/pkg/html/template/). The following is only a primer on Go templates. For an in-depth look into Go templates, check the official [Go docs](http://golang.org/pkg/html/template/).
{{% /note %}} {{% /note %}}
## Introduction to Go Templates Go templates provide an extremely simple template language that adheres to the belief that only the most basic of logic belongs in the template or view layer.
Go templates provide an extremely simple template language that adheres to the belief that only the most basic of logic belongs in the template or view layer. As a positive consequence of this simplicity, Go templates parse very quickly.
A unique characteristic of Go templates is that they are *content aware*. Variables and content will be sanitized depending on the context of where they are used.
## Basic Syntax ## Basic Syntax
Golang templates are HTML files with the addition of [variables][variables] and [functions][hugofunctions]. Golang template variables and functions are accessible within `{{ }}`. Golang templates are HTML files with the addition of [variables][variables] and [functions][functions]. Golang template variables and functions are accessible within `{{ }}`.
### Accessing a Predefined Variable ### Accessing a Predefined Variable
@ -63,21 +57,28 @@ Accessing the Page Parameter `bar` defined in a piece of content's [front matter
## Variables ## Variables
Each Go template has a struct (object) made available to it. In Hugo, each template is passed a page's struct. More details on the structs passed to specific page kinds are in the [variables][] section. Each Go template gets a data object. In Hugo, each template is passed a `Page`. See [variables][] for more information.
A variable is accessed by referencing the variable name inside of a template: This is how you access a `Page` variable from a template:
```golang ```golang
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
``` ```
Variables can also be defined and referenced: Values can also be stored in custom variables and referenced later:
```golang ```golang
{{ $address := "123 Main St."}} {{ $address := "123 Main St."}}
{{ $address }} {{ $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 ## Functions
Go templates only ship with a few basic functions but also provide a mechanism for applications to extend the original set. Go templates only ship with a few basic functions but also provide a mechanism for applications to extend the original set.

View File

@ -37,7 +37,7 @@ Setting `Paginate` to a positive value will split the list pages for the homepag
## Listing Paginator Pages ## Listing Paginator Pages
{{% warning %}} {{% warning %}}
`.Paginator` is provided to help you build a pager menu. This features is currently only supported on homepage and list pages (i.e., taxonomies and section lists). `.Paginator` is provided to help you build a pager menu. This feature is currently only supported on homepage and list pages (i.e., taxonomies and section lists).
{{% /warning %}} {{% /warning %}}
There are two ways to configure and use a `.Paginator`: There are two ways to configure and use a `.Paginator`: