From b59dd163ec268853e8aa136504cbc60ff1a1ab34 Mon Sep 17 00:00:00 2001 From: Anthony Fok Date: Sat, 17 Jan 2015 00:45:53 -0700 Subject: [PATCH] [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 --- docs/content/community/contributing.md | 2 +- docs/content/community/mailing-list.md | 16 ++-- docs/content/content/archetypes.md | 13 +++- docs/content/extras/aliases.md | 25 +++++-- docs/content/extras/builders.md | 8 +- docs/content/templates/functions.md | 74 +++++++++++-------- .../troubleshooting/strange-eof-error.md | 24 +++--- 7 files changed, 98 insertions(+), 64 deletions(-) diff --git a/docs/content/community/contributing.md b/docs/content/community/contributing.md index 44368fde7..6119ffb13 100644 --- a/docs/content/community/contributing.md +++ b/docs/content/community/contributing.md @@ -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 diff --git a/docs/content/community/mailing-list.md b/docs/content/community/mailing-list.md index 4961b747b..95e6ce603 100644 --- a/docs/content/community/mailing-list.md +++ b/docs/content/community/mailing-list.md @@ -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). diff --git a/docs/content/content/archetypes.md b/docs/content/content/archetypes.md index 1426841bb..898c0f6ba 100644 --- a/docs/content/content/archetypes.md +++ b/docs/content/content/archetypes.md @@ -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 Enter 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 Enter 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. diff --git a/docs/content/extras/aliases.md b/docs/content/extras/aliases.md index 1822135e2..41ba6f1e1 100644 --- a/docs/content/extras/aliases.md +++ b/docs/content/extras/aliases.md @@ -21,11 +21,26 @@ Luckily, this can be handled easily with aliases in Hugo. ## Example **content/posts/my-awesome-blog-post.md** - --- - aliases: - - /posts/my-original-url/ - - /2010/even-earlier-url.html - --- + + + + + + + + +
TOMLYAML
---
+aliases:
+    - /posts/my-original-url/
+    - /2010/even-earlier-url.html
+---
+
+++
+aliases = [
+    "/posts/my-original-url/",
+    "/2010/even-earlier-url.html"
+]
++++
+
Now when you go to any of the aliases locations, they will redirect to the page. diff --git a/docs/content/extras/builders.md b/docs/content/extras/builders.md index 8d59a93aa..43b904cb2 100644 --- a/docs/content/extras/builders.md +++ b/docs/content/extras/builders.md @@ -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. - - diff --git a/docs/content/templates/functions.md b/docs/content/templates/functions.md index da794a36d..fcc0f45ac 100644 --- a/docs/content/templates/functions.md +++ b/docs/content/templates/functions.md @@ -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. + + + + + + + + -e.g. `{{add 1 2}}` → 3 + + + + + + -### sub -Subtracts two integers. + + + + + -e.g. `{{sub 3 2}}` → 1 + + + + + -### div -Divides two integers. + + + + + -e.g. `{{div 6 3}}` → 2 + + + + + -### mul -Multiplies two integers. + + + + + + +
FunctionDescriptionExample
addAdds two integers.{{add 1 2}} → 3
subSubtracts two integers.{{sub 3 2}} → 1
mulMultiplies two integers.{{mul 2 3}} → 6
divDivides two integers.{{div 6 3}} → 2
modModulus of two integers.{{mod 15 3}} → 0
modBoolBoolean of modulus of two integers. true if modulus is 0.{{modBool 15 3}} → true
-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 diff --git a/docs/content/troubleshooting/strange-eof-error.md b/docs/content/troubleshooting/strange-eof-error.md index 9837e2269..fde5cf1f0 100644 --- a/docs/content/troubleshooting/strange-eof-error.md +++ b/docs/content/troubleshooting/strange-eof-error.md @@ -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