mirror of
				https://github.com/Wonderfall/hugo-WonderMod.git
				synced 2025-10-31 11:45:26 +01:00 
			
		
		
		
	Fix minor typos and update copyright year
This commit is contained in:
		| @@ -1,8 +1,7 @@ | |||||||
| baseurl = "http://hugo.spf13.com/" | baseurl = "https://gohugo.io/" | ||||||
| title = "Hugo Themes" | title = "Hugo Themes" | ||||||
| author = "Steve Francia" | author = "Steve Francia" | ||||||
| copyright = "Copyright (c) 2008 - 2014, Steve Francia; all rights reserved." | copyright = "Copyright © 2008–2018, Steve Francia and the Hugo Authors; all rights reserved." | ||||||
| canonifyurls = true | canonifyurls = true | ||||||
| paginate = 3 | paginate = 3 | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,29 +16,29 @@ categories = [ | |||||||
| menu = "main" | menu = "main" | ||||||
| +++ | +++ | ||||||
|  |  | ||||||
| Hugo uses the excellent [go][] [html/template][gohtmltemplate] library for | Hugo uses the excellent [Go][] [html/template][gohtmltemplate] library for | ||||||
| its template engine. It is an extremely lightweight engine that provides a very | its template engine. It is an extremely lightweight engine that provides a very | ||||||
| small amount of logic. In our experience that it is just the right amount of | small amount of logic. In our experience that it is just the right amount of | ||||||
| logic to be able to create a good static website. If you have used other | 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 | template systems from different languages or frameworks you will find a lot of | ||||||
| similarities in go templates. | similarities in Go templates. | ||||||
|  |  | ||||||
| This document is a brief primer on using go templates. The [go docs][gohtmltemplate] | This document is a brief primer on using Go templates. The [Go docs][gohtmltemplate] | ||||||
| provide more details. | provide more details. | ||||||
|  |  | ||||||
| ## Introduction to Go Templates | ## Introduction to Go Templates | ||||||
|  |  | ||||||
| Go templates provide an extremely simple template language. It adheres to the | 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. | 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. | 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 | 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 | content will be sanitized depending on the context of where they are used. More | ||||||
| details can be found in the [go docs][gohtmltemplate]. | details can be found in the [Go docs][gohtmltemplate]. | ||||||
|  |  | ||||||
| ## Basic Syntax | ## Basic Syntax | ||||||
|  |  | ||||||
| Go lang templates are html files with the addition of variables and | Golang templates are HTML files with the addition of variables and | ||||||
| functions. | functions. | ||||||
|  |  | ||||||
| **Go variables and functions are accessible within {{ }}** | **Go variables and functions are accessible within {{ }}** | ||||||
| @@ -66,7 +66,7 @@ Accessing the Page Parameter "bar" | |||||||
|  |  | ||||||
| ## Variables | ## Variables | ||||||
|  |  | ||||||
| Each go template has a struct (object) made available to it. In hugo each | Each Go template has a struct (object) made available to it. In hugo each | ||||||
| template is passed either a page or a node struct depending on which type of | template is passed either a page or a node struct depending on which type of | ||||||
| page you are rendering. More details are available on the | page you are rendering. More details are available on the | ||||||
| [variables](/layout/variables) page. | [variables](/layout/variables) page. | ||||||
| @@ -83,7 +83,7 @@ Variables can also be defined and referenced. | |||||||
|  |  | ||||||
| ## Functions | ## Functions | ||||||
|  |  | ||||||
| Go template ship with a few functions which provide basic functionality. The go | Go template ship with a few functions which provide basic functionality. The Go | ||||||
| template system also provides a mechanism for applications to extend the | template system also provides a mechanism for applications to extend the | ||||||
| available functions with their own. [Hugo template | available functions with their own. [Hugo template | ||||||
| functions](/layout/functions) provide some additional functionality we believe | functions](/layout/functions) provide some additional functionality we believe | ||||||
| @@ -113,7 +113,7 @@ Go templates provide the most basic iteration and conditional logic. | |||||||
|  |  | ||||||
| ### Iteration | ### Iteration | ||||||
|  |  | ||||||
| Just like in go, the go templates make heavy use of range to iterate over | 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 | a map, array or slice. The following are different examples of how to use | ||||||
| range. | range. | ||||||
|  |  | ||||||
| @@ -184,12 +184,12 @@ The first example above could be simplified as: | |||||||
|  |  | ||||||
| ## Pipes | ## Pipes | ||||||
|  |  | ||||||
| One of the most powerful components of go templates is the ability to | 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 | 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 | from unix pipes, the concept is simple, each pipeline's output becomes the | ||||||
| input of the following pipe. | input of the following pipe. | ||||||
|  |  | ||||||
| Because of the very simple syntax of go templates, the pipe is essential | 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 | 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 | pipes is that they only can work with a single value and that value | ||||||
| becomes the last parameter of the next pipeline. | becomes the last parameter of the next pipeline. | ||||||
| @@ -228,7 +228,7 @@ Could be rewritten as | |||||||
|  |  | ||||||
| ## Context (aka. the dot) | ## Context (aka. the dot) | ||||||
|  |  | ||||||
| The most easily overlooked concept to understand about go templates is that {{ . }} | 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 | 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 it will have | will be the data set made available to it. Inside of a iteration it will have | ||||||
| the value of the current item. When inside of a loop the context has changed. . | the value of the current item. When inside of a loop the context has changed. . | ||||||
| @@ -340,5 +340,5 @@ so, such as in this example: | |||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  |  | ||||||
| [go]: <http://golang.org/> | [go]: https://golang.org/ | ||||||
| [gohtmltemplate]: <http://golang.org/pkg/html/template/> | [gohtmltemplate]: https://golang.org/pkg/html/template/ | ||||||
|   | |||||||
| @@ -17,12 +17,12 @@ menu = "main" | |||||||
|  |  | ||||||
| ## Step 1. Install Hugo | ## Step 1. Install Hugo | ||||||
|  |  | ||||||
| Goto [hugo releases](https://github.com/spf13/hugo/releases) and download the | Go to [Hugo releases](https://github.com/spf13/hugo/releases) and download the | ||||||
| appropriate version for your os and architecture. | appropriate version for your OS and architecture. | ||||||
|  |  | ||||||
| Save it somewhere specific as we will be using it in the next step. | Save it somewhere specific as we will be using it in the next step. | ||||||
|  |  | ||||||
| More complete instructions are available at [installing hugo](/overview/installing/) | More complete instructions are available at [Install Hugo](https://gohugo.io/getting-started/installing/) | ||||||
|  |  | ||||||
| ## Step 2. Build the Docs | ## Step 2. Build the Docs | ||||||
|  |  | ||||||
| @@ -31,7 +31,7 @@ you are reading right now. | |||||||
|  |  | ||||||
| Follow the following steps: | Follow the following steps: | ||||||
|  |  | ||||||
|  1. Clone the [hugo repository](http://github.com/spf13/hugo) |  1. Clone the [Hugo repository](http://github.com/spf13/hugo) | ||||||
|  2. Go into the repo |  2. Go into the repo | ||||||
|  3. Run hugo in server mode and build the docs |  3. Run hugo in server mode and build the docs | ||||||
|  4. Open your browser to http://localhost:1313 |  4. Open your browser to http://localhost:1313 | ||||||
| @@ -51,7 +51,7 @@ Once you've gotten here, follow along the rest of this page on your local build. | |||||||
|  |  | ||||||
| ## Step 3. Change the docs site | ## Step 3. Change the docs site | ||||||
|  |  | ||||||
| Stop the Hugo process by hitting ctrl+c. | Stop the Hugo process by hitting Ctrl+C. | ||||||
|  |  | ||||||
| Now we are going to run hugo again, but this time with hugo in watch mode. | Now we are going to run hugo again, but this time with hugo in watch mode. | ||||||
|  |  | ||||||
| @@ -81,7 +81,7 @@ Change and save this file.. Notice what happened in your terminal. | |||||||
|  |  | ||||||
| Refresh the browser and observe that the typo is now fixed. | Refresh the browser and observe that the typo is now fixed. | ||||||
|  |  | ||||||
| Notice how quick that was. Try to refresh the site before it's finished building.. I double dare you. | Notice how quick that was. Try to refresh the site before it's finished building. I double dare you. | ||||||
| Having nearly instant feedback enables you to have your creativity flow without waiting for long builds. | Having nearly instant feedback enables you to have your creativity flow without waiting for long builds. | ||||||
|  |  | ||||||
| ## Step 4. Have fun | ## Step 4. Have fun | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Anthony Fok
					Anthony Fok