mirror of
				https://github.com/gohugoio/hugo.git
				synced 2024-05-11 05:54:58 +00:00 
			
		
		
		
	[Docs] More copyediting
* Add link to https://travis-ci.org/spf13/hugo * Correct heading levels in docs/content/community/mailing-list.md * Mention RFC 3339 as the `date` format set by `hugo new` * Mention that `hugo new` does not add `draft = true` when the user provides an archetype * List short examples of TOML and YAML side by side * Compact the Math template functions into a table * Put some notes into a blockquote
This commit is contained in:
		@@ -24,7 +24,7 @@ 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.
 | 
			
		||||
  * Make sure `go test ./...` passes, and `go build` completes.  Our Travis CI loop will catch most things that are missing.  The exception: Windows.  We run on Windows from time to time, but if you have access, please check on a Windows machine too.
 | 
			
		||||
  * Make sure `go test ./...` passes, and `go build` completes.  Our [Travis CI loop](https://travis-ci.org/spf13/hugo) will catch most things that are missing.  The exception: Windows.  We run on Windows from time to time, but if you have access, please check on a Windows machine too.
 | 
			
		||||
 | 
			
		||||
## Contribution Overview
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,22 +9,22 @@ title: Mailing List
 | 
			
		||||
weight: 10
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Discussion Forum
 | 
			
		||||
## Discussion Forum
 | 
			
		||||
 | 
			
		||||
Hugo has its own [discussion forum](http://discuss.gohugo.io) powered by [Discourse](http://www.discourse.org/).
 | 
			
		||||
 | 
			
		||||
Please use this for all discussions, questions, etc.
 | 
			
		||||
 | 
			
		||||
# Mailing List
 | 
			
		||||
## Mailing List
 | 
			
		||||
 | 
			
		||||
Hugo has two mailing lists:
 | 
			
		||||
 | 
			
		||||
## Announcements
 | 
			
		||||
### Announcements
 | 
			
		||||
Very low traffic. Only releases will be emailed here.
 | 
			
		||||
 | 
			
		||||
https://groups.google.com/forum/#!forum/hugo-announce
 | 
			
		||||
 | 
			
		||||
## Discussion (Archive)
 | 
			
		||||
### Discussion (Archive)
 | 
			
		||||
 | 
			
		||||
**This has been replaced with the [Hugo discussion forum](http://discuss.gohugo.io).**
 | 
			
		||||
 | 
			
		||||
@@ -33,18 +33,18 @@ It is available for archival purposes.
 | 
			
		||||
https://groups.google.com/forum/#!forum/hugo-discuss
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Other Resources
 | 
			
		||||
## Other Resources
 | 
			
		||||
 | 
			
		||||
## GoNuts
 | 
			
		||||
### GoNuts
 | 
			
		||||
 | 
			
		||||
For general Go questions or discussion please refer to the Go mailing list.
 | 
			
		||||
 | 
			
		||||
https://groups.google.com/forum/#!forum/golang-nuts
 | 
			
		||||
 | 
			
		||||
## GitHub Issues
 | 
			
		||||
### GitHub Issues
 | 
			
		||||
 | 
			
		||||
https://github.com/spf13/hugo/issues
 | 
			
		||||
 | 
			
		||||
## Twitter
 | 
			
		||||
### Twitter
 | 
			
		||||
 | 
			
		||||
Hugo doesn't have its own Twitter handle, but feel free to tweet [@spf13](http://twitter.com/spf13).
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ We will use ‘tags’ and ‘categories’ for our taxonomies, so let's create
 | 
			
		||||
    categories = ["x", "y"]
 | 
			
		||||
    +++
 | 
			
		||||
 | 
			
		||||
__CAVEAT:__  Some editors (e.g. Sublime, Emacs) do not insert an EOL (end-of-line) character at the end of the file (i.e. EOF).  If you get a [strange EOF error](/troubleshooting/strange-eof-error/) when using `hugo new`, please open each archetype file (i.e. `archetypes/*.md`) and press <kbd>Enter</kbd> to type a carriage return after the closing `+++` or `---` as necessary.
 | 
			
		||||
> __CAVEAT:__  Some editors (e.g. Sublime, Emacs) do not insert an EOL (end-of-line) character at the end of the file (i.e. EOF).  If you get a [strange EOF error](/troubleshooting/strange-eof-error/) when using `hugo new`, please open each archetype file (i.e. `archetypes/*.md`) and press <kbd>Enter</kbd> to type a carriage return after the closing `+++` or `---` as necessary.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Step 2. Using the archetype
 | 
			
		||||
@@ -80,8 +80,13 @@ The following rules apply:
 | 
			
		||||
* If no archetype files are present, then the one that ships with Hugo will be used.
 | 
			
		||||
 | 
			
		||||
Hugo provides a simple archetype which sets the `title` (based on the
 | 
			
		||||
file name) and the `date` based on `now()`.
 | 
			
		||||
file name) and the `date` in RFC 3339 format based on
 | 
			
		||||
[`now()`](http://golang.org/pkg/time/#Now), which returns the current time.
 | 
			
		||||
 | 
			
		||||
Content type is automatically detected based on the path. You are welcome to declare which 
 | 
			
		||||
type to create using the `--kind` flag during creation.
 | 
			
		||||
> *Note: `hugo new` does not automatically add `draft = true` when the user
 | 
			
		||||
> provides an archetype.  This is by design, rationale being that
 | 
			
		||||
> the archetype should set its own value for all fields.
 | 
			
		||||
> `title` and `date`, which are dynamic and unique for each piece of content,
 | 
			
		||||
> are the sole exceptions.*
 | 
			
		||||
 | 
			
		||||
Content type is automatically detected based on the path. You are welcome to declare which type to create using the `--kind` flag during creation.
 | 
			
		||||
 
 | 
			
		||||
@@ -21,11 +21,26 @@ Luckily, this can be handled easily with aliases in Hugo.
 | 
			
		||||
## Example
 | 
			
		||||
**content/posts/my-awesome-blog-post.md**
 | 
			
		||||
 | 
			
		||||
    ---
 | 
			
		||||
    aliases:
 | 
			
		||||
<table class="table">
 | 
			
		||||
<tr>
 | 
			
		||||
<th>TOML</th><th>YAML</th>
 | 
			
		||||
</tr>
 | 
			
		||||
<tr valign="top">
 | 
			
		||||
<td><pre><code>---
 | 
			
		||||
aliases:
 | 
			
		||||
    - /posts/my-original-url/
 | 
			
		||||
    - /2010/even-earlier-url.html
 | 
			
		||||
    ---
 | 
			
		||||
---
 | 
			
		||||
</code></pre></td>
 | 
			
		||||
<td><pre><code>+++
 | 
			
		||||
aliases = [
 | 
			
		||||
    "/posts/my-original-url/",
 | 
			
		||||
    "/2010/even-earlier-url.html"
 | 
			
		||||
]
 | 
			
		||||
+++
 | 
			
		||||
</code></pre></td>
 | 
			
		||||
</tr>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
Now when you go to any of the aliases locations, they
 | 
			
		||||
will redirect to the page.
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ started.
 | 
			
		||||
 | 
			
		||||
Want to get a site built quickly?
 | 
			
		||||
 | 
			
		||||
    hugo new site /path/to/site
 | 
			
		||||
    $ hugo new site /path/to/site
 | 
			
		||||
 | 
			
		||||
Hugo will create all the needed directories and files to get started
 | 
			
		||||
quickly.
 | 
			
		||||
@@ -31,7 +31,7 @@ you... but luckily we have builders for content (see below).
 | 
			
		||||
 | 
			
		||||
Want to design a new theme?
 | 
			
		||||
 | 
			
		||||
    hugo new theme `THEME_NAME`
 | 
			
		||||
    $ hugo new theme THEME_NAME
 | 
			
		||||
 | 
			
		||||
Run from your working directory, this will create a new theme with all
 | 
			
		||||
the needed files in your themes directory. Hugo will provide you with a
 | 
			
		||||
@@ -49,12 +49,10 @@ Leveraging [content archetypes](/content/archetypes) the content builder
 | 
			
		||||
will not only insert the current date and appropriate metadata, but it
 | 
			
		||||
will pre-populate values based on the content type.
 | 
			
		||||
 | 
			
		||||
    hugo new relative/path/to/content
 | 
			
		||||
    $ hugo new relative/path/to/content
 | 
			
		||||
 | 
			
		||||
This assumes it is being run from your working directory and the content
 | 
			
		||||
path starts from your content directory.
 | 
			
		||||
 | 
			
		||||
I typically keep two different terminals open, one to run `hugo server
 | 
			
		||||
--watch`, and another to use the builders to create new content.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@ weight: 20
 | 
			
		||||
 | 
			
		||||
Hugo uses the excellent Go html/template 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
 | 
			
		||||
logic. In our experience, it is just the right amount of logic to be able
 | 
			
		||||
to create a good static website.
 | 
			
		||||
 | 
			
		||||
Go templates are lightweight but extensible. Hugo has added the following
 | 
			
		||||
@@ -63,7 +63,7 @@ Works on [lists](/templates/list/), [taxonomies](/taxonomies/displaying/), [term
 | 
			
		||||
e.g.
 | 
			
		||||
 | 
			
		||||
    {{ range where .Data.Pages "Section" "post" }}
 | 
			
		||||
       {{ .Content}}
 | 
			
		||||
       {{ .Content }}
 | 
			
		||||
    {{ end }}
 | 
			
		||||
 | 
			
		||||
It can be used with dot chaining second argument to refer a nested element of a value.
 | 
			
		||||
@@ -98,12 +98,10 @@ Following operators are now available
 | 
			
		||||
- `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
 | 
			
		||||
 | 
			
		||||
*where and first can be stacked*
 | 
			
		||||
 | 
			
		||||
e.g.
 | 
			
		||||
*`where` and `first` can be stacked, e.g.:*
 | 
			
		||||
 | 
			
		||||
    {{ range first 5 (where .Data.Pages "Section" "post") }}
 | 
			
		||||
       {{ .Content}}
 | 
			
		||||
       {{ .Content }}
 | 
			
		||||
    {{ end }}
 | 
			
		||||
 | 
			
		||||
### delimit
 | 
			
		||||
@@ -206,36 +204,54 @@ e.g.
 | 
			
		||||
 | 
			
		||||
## Math
 | 
			
		||||
 | 
			
		||||
### add
 | 
			
		||||
Adds two integers.
 | 
			
		||||
<table class="table table-bordered">
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
<th>Function</th>
 | 
			
		||||
<th>Description</th>
 | 
			
		||||
<th>Example</th>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
e.g. `{{add 1 2}}` → 3
 | 
			
		||||
<tbody>
 | 
			
		||||
<tr>
 | 
			
		||||
<td><code>add</code></td>
 | 
			
		||||
<td>Adds two integers.</td>
 | 
			
		||||
<td><code>{{add 1 2}}</code> → 3</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
### sub
 | 
			
		||||
Subtracts two integers.
 | 
			
		||||
<tr>
 | 
			
		||||
<td><code>sub</code></td>
 | 
			
		||||
<td>Subtracts two integers.</td>
 | 
			
		||||
<td><code>{{sub 3 2}}</code> → 1</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
e.g. `{{sub 3 2}}` → 1
 | 
			
		||||
<tr>
 | 
			
		||||
<td><code>mul</code></td>
 | 
			
		||||
<td>Multiplies two integers.</td>
 | 
			
		||||
<td><code>{{mul 2 3}}</code> → 6</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
### div
 | 
			
		||||
Divides two integers.
 | 
			
		||||
<tr>
 | 
			
		||||
<td><code>div</code></td>
 | 
			
		||||
<td>Divides two integers.</td>
 | 
			
		||||
<td><code>{{div 6 3}}</code> → 2</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
e.g. `{{div 6 3}}` → 2
 | 
			
		||||
<tr>
 | 
			
		||||
<td><code>mod</code></td>
 | 
			
		||||
<td>Modulus of two integers.</td>
 | 
			
		||||
<td><code>{{mod 15 3}}</code> → 0</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
### mul
 | 
			
		||||
Multiplies two integers.
 | 
			
		||||
<tr>
 | 
			
		||||
<td><code>modBool</code></td>
 | 
			
		||||
<td>Boolean of modulus of two integers.  <code>true</code> if modulus is 0.</td>
 | 
			
		||||
<td><code>{{modBool 15 3}}</code> → true</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
e.g. `{{mul 2 3}}` → 6
 | 
			
		||||
 | 
			
		||||
### mod
 | 
			
		||||
Modulus of two integers.
 | 
			
		||||
 | 
			
		||||
e.g. `{{mod 15 3}}` → 0
 | 
			
		||||
 | 
			
		||||
### modBool
 | 
			
		||||
Boolean of modulus of two integers.
 | 
			
		||||
true if modulus is 0.
 | 
			
		||||
 | 
			
		||||
e.g. `{{modBool 15 3}}` → true
 | 
			
		||||
 | 
			
		||||
## Strings
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,18 +9,18 @@ weight: 5
 | 
			
		||||
 | 
			
		||||
## Trouble: `hugo new` aborts with cryptic EOF error
 | 
			
		||||
 | 
			
		||||
I'm running into an issue where I cannot get archetypes working, when running `hugo new showcase/test.md`, for example, I see an `EOF` error thrown by Hugo.
 | 
			
		||||
 | 
			
		||||
I have set up this test repository to show exactly what I've done, but it is essentially a vanilla installation of Hugo. https://github.com/polds/hugo-archetypes-test
 | 
			
		||||
 | 
			
		||||
When in that repository, using Hugo v0.12 to run `hugo new -v showcase/test.md`, I see the following output:
 | 
			
		||||
 | 
			
		||||
    INFO: 2015/01/04 Using config file: /private/tmp/test/config.toml
 | 
			
		||||
    INFO: 2015/01/04 attempting to create  showcase/test.md of showcase
 | 
			
		||||
    INFO: 2015/01/04 curpath: /private/tmp/test/archetypes/showcase.md
 | 
			
		||||
    ERROR: 2015/01/04 EOF
 | 
			
		||||
 | 
			
		||||
Is there something that I am blatantly missing?
 | 
			
		||||
> I'm running into an issue where I cannot get archetypes working, when running `hugo new showcase/test.md`, for example, I see an `EOF` error thrown by Hugo.
 | 
			
		||||
>
 | 
			
		||||
> I have set up this test repository to show exactly what I've done, but it is essentially a vanilla installation of Hugo. https://github.com/polds/hugo-archetypes-test
 | 
			
		||||
>
 | 
			
		||||
> When in that repository, using Hugo v0.12 to run `hugo new -v showcase/test.md`, I see the following output:
 | 
			
		||||
>
 | 
			
		||||
>     INFO: 2015/01/04 Using config file: /private/tmp/test/config.toml
 | 
			
		||||
>     INFO: 2015/01/04 attempting to create  showcase/test.md of showcase
 | 
			
		||||
>     INFO: 2015/01/04 curpath: /private/tmp/test/archetypes/showcase.md
 | 
			
		||||
>     ERROR: 2015/01/04 EOF
 | 
			
		||||
>
 | 
			
		||||
> Is there something that I am blatantly missing?
 | 
			
		||||
 | 
			
		||||
## Solution
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user