1
0
mirror of https://github.com/gohugoio/hugo.git synced 2024-05-11 05:54:58 +00:00

doc: Strip trailing whitespace; other revisions

Make some random and non-comprehensive changes to the
template functions documentation to make them more
consistent.
This commit is contained in:
Anthony Fok
2015-08-04 12:00:08 -06:00
parent b0416e9bef
commit 5505ac0d72
29 changed files with 217 additions and 206 deletions

View File

@@ -192,7 +192,7 @@ The application is added now, and Wercker will be offering you the chance to tri
## Adding steps
And now we're going to add the steps themselves. First, we go to the "Registry" action in the top menu and then search for "hugo build". The first result is the **Hugo-Build** task, which we select.
And now we're going to add the steps themselves. First, we go to the "Registry" action in the top menu and then search for "hugo build". The first result is the **Hugo-Build** task, which we select.
![][13]

View File

@@ -151,9 +151,9 @@ INFO: 2014/09/29 Using config file: config.toml
INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
WARN: 2014/09/29 Unable to locate layout: [404.html]
0 draft content
0 future content
0 pages created
0 draft content
0 future content
0 pages created
0 tags created
0 categories created
in 2 ms
@@ -200,9 +200,9 @@ INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
WARN: 2014/09/29 Unable to locate layout: [index.html _default/list.html _default/single.html]
WARN: 2014/09/29 Unable to locate layout: [404.html]
0 draft content
0 future content
0 pages created
0 draft content
0 future content
0 pages created
0 tags created
0 categories created
in 2 ms
@@ -333,9 +333,9 @@ INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
0 draft content
0 future content
0 pages created
0 draft content
0 future content
0 pages created
0 tags created
0 categories created
in 2 ms
@@ -455,9 +455,9 @@ INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
0 draft content
0 future content
0 pages created
0 draft content
0 future content
0 pages created
0 tags created
0 categories created
in 2 ms
@@ -469,9 +469,9 @@ INFO: 2014/09/29 File System Event: ["/Users/quoha/Sites/zafta/themes/zafta/layo
Change detected, rebuilding site
WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
0 draft content
0 future content
0 pages created
0 draft content
0 future content
0 pages created
0 tags created
0 categories created
in 1 ms
@@ -493,12 +493,12 @@ Right now, that page is empty because we don't have any content and we don't hav
```
$ vi themes/zafta/layouts/index.html
<!DOCTYPE html>
<html>
<body>
<p>hugo says hello!</p>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<p>hugo says hello!</p>
</body>
</html>
:wq
$
@@ -512,9 +512,9 @@ INFO: 2014/09/29 Using config file: /Users/quoha/Sites/zafta/config.toml
INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /Users/quoha/Sites/zafta/public/
INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
0 draft content
0 future content
0 pages created
0 draft content
0 future content
0 pages created
0 tags created
0 categories created
in 2 ms
@@ -522,11 +522,11 @@ in 2 ms
$ find public -type f -name '*.html' | xargs ls -l
-rw-r--r-- 1 quoha staff 78 Sep 29 21:26 public/index.html
$ cat public/index.html
<!DOCTYPE html>
<html>
<body>
<p>hugo says hello!</p>
$ cat public/index.html
<!DOCTYPE html>
<html>
<body>
<p>hugo says hello!</p>
</html>
```
@@ -535,15 +535,15 @@ $ cat public/index.html
Note: If you're running the server with the `--watch` option, you'll see different content in the file:
```
$ cat public/index.html
<!DOCTYPE html>
<html>
<body>
<p>hugo says hello!</p>
<script>document.write('<script src="http://'
+ (location.host || 'localhost').split(':')[0]
+ ':1313/livereload.js?mindelay=10"></'
+ 'script>')</script></body>
$ cat public/index.html
<!DOCTYPE html>
<html>
<body>
<p>hugo says hello!</p>
<script>document.write('<script src="http://'
+ (location.host || 'localhost').split(':')[0]
+ ':1313/livereload.js?mindelay=10"></'
+ 'script>')</script></body>
</html>
```
@@ -605,7 +605,7 @@ total 16
-rw-r--r-- 1 quoha staff 104 Sep 29 21:54 first.md
-rw-r--r-- 1 quoha staff 105 Sep 29 21:57 second.md
$ cat content/post/first.md
$ cat content/post/first.md
+++
Categories = []
Description = ""
@@ -616,7 +616,7 @@ title = "first"
+++
my first post
$ cat content/post/second.md
$ cat content/post/second.md
+++
Categories = []
Description = ""
@@ -640,9 +640,9 @@ INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /
INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
INFO: 2014/09/29 found taxonomies: map[string]string{"category":"categories", "tag":"tags"}
WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
0 draft content
0 future content
2 pages created
0 draft content
0 future content
2 pages created
0 tags created
0 categories created
in 4 ms
@@ -675,7 +675,7 @@ There are three other types of templates: partials, content views, and terms. We
The home page will contain a list of posts. Let's update its template to add the posts that we just created. The logic in the template will run every time we build the site.
```
$ vi themes/zafta/layouts/index.html
$ vi themes/zafta/layouts/index.html
<!DOCTYPE html>
<html>
<body>
@@ -713,26 +713,26 @@ INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /
INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
INFO: 2014/09/29 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
0 draft content
0 future content
2 pages created
0 draft content
0 future content
2 pages created
0 tags created
0 categories created
in 4 ms
$ find public -type f -name '*.html' | xargs ls -l
$ find public -type f -name '*.html' | xargs ls -l
-rw-r--r-- 1 quoha staff 94 Sep 29 22:23 public/index.html
-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/first/index.html
-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/index.html
-rw-r--r-- 1 quoha staff 0 Sep 29 22:23 public/post/second/index.html
$ cat public/index.html
$ cat public/index.html
<!DOCTYPE html>
<html>
<body>
<h1>second</h1>
<h1>first</h1>
</body>
</html>
$
@@ -764,7 +764,7 @@ Please see the Hugo documentation on template rendering for all the details on d
#### Update the Template File
```
$ vi themes/zafta/layouts/_default/single.html
$ vi themes/zafta/layouts/_default/single.html
<!DOCTYPE html>
<html>
<head>
@@ -790,9 +790,9 @@ INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /
INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
INFO: 2014/09/29 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
0 draft content
0 future content
2 pages created
0 draft content
0 future content
2 pages created
0 tags created
0 categories created
in 4 ms
@@ -803,7 +803,7 @@ $ find public -type f -name '*.html' | xargs ls -l
-rw-r--r-- 1 quoha staff 0 Sep 29 22:40 public/post/index.html
-rw-r--r-- 1 quoha staff 128 Sep 29 22:40 public/post/second/index.html
$ cat public/post/first/index.html
$ cat public/post/first/index.html
<!DOCTYPE html>
<html>
<head>
@@ -816,7 +816,7 @@ $ cat public/post/first/index.html
</body>
</html>
$ cat public/post/second/index.html
$ cat public/post/second/index.html
<!DOCTYPE html>
<html>
<head>
@@ -859,9 +859,9 @@ INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/themes/zafta/static/ to /
INFO: 2014/09/29 syncing from /Users/quoha/Sites/zafta/static/ to /Users/quoha/Sites/zafta/public/
INFO: 2014/09/29 found taxonomies: map[string]string{"tag":"tags", "category":"categories"}
WARN: 2014/09/29 Unable to locate layout: [404.html theme/404.html]
0 draft content
0 future content
2 pages created
0 draft content
0 future content
2 pages created
0 tags created
0 categories created
in 4 ms
@@ -872,15 +872,15 @@ $ find public -type f -name '*.html' | xargs ls -l
-rw-r--r-- 1 quoha staff 0 Sep 29 22:44 public/post/index.html
-rw-r--r-- 1 quoha staff 128 Sep 29 22:44 public/post/second/index.html
$ cat public/index.html
$ cat public/index.html
<!DOCTYPE html>
<html>
<body>
<h1><a href="/post/second/">second</a></h1>
<h1><a href="/post/first/">first</a></h1>
</body>
</html>
@@ -907,7 +907,7 @@ Let's add an "about" page and display it at the top level (as opposed to a sub-l
The default in Hugo is to use the directory structure of the content/ directory to guide the location of the generated html in the public/ directory. Let's verify that by creating an "about" page at the top level:
```
$ vi content/about.md
$ vi content/about.md
+++
title = "about"
description = "about this site"

View File

@@ -102,7 +102,7 @@ The final step in creating the blog is to add some actual blog posts. To do this
title: "Just another sample post"
date: "2014-03-29"
description: "This should be a more useful description"
categories:
categories:
- "hugo"
- "fun"
- "test"
@@ -131,7 +131,7 @@ To get this properly set up, we will execute a series of commands at the termina
git add .
git commit -m "INIT: initial commit on gh-pages branch"
# Push to remote gh-pages branch
# Push to remote gh-pages branch
git push origin gh-pages
# Return to master branch
@@ -159,12 +159,12 @@ To get this properly set up, we will execute a series of commands at the termina
# Push the public subtree to the gh-pages branch
git subtree push --prefix=public git@github.com:spencerlyon2/hugo_gh_blog.git gh-pages
After executing these commands and waiting for the GitHub servers to update, the website we just created was live at [http://spencerlyon2.github.io/hugo_gh_blog](http://spencerlyon2.github.io/hugo_gh_blog).
After executing these commands and waiting for the GitHub servers to update, the website we just created was live at [http://spencerlyon2.github.io/hugo_gh_blog](http://spencerlyon2.github.io/hugo_gh_blog).
### `deploy.sh`
Now, as you add new posts to your blog, you will follow steps that look something like the following:
* Create the Markdown source for the new post within the `content/posts` directory
* Preview your work by running Hugo in server mode with `hugo server --watch`
* Run Hugo not in server mode so that the generated urls will be correct for the website
@@ -176,7 +176,7 @@ The first two items in the previous list are simply a way to conveniently previe
**Note:**
The first command `hugo` assumes you are running with all the default settings.
The first command `hugo` assumes you are running with all the default settings.
To use a theme, make sure to specify it with `-t ThemeName` instead (or include the theme in the config file).
@@ -189,22 +189,22 @@ To build all draft posts *(If you only have drafts, no site will be generated)*
**Deploy.sh:**
#!/bin/bash
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
# Build the project.
# Build the project.
hugo
# Add changes to git.
git add -A
# Commit changes.
msg="rebuilding site `date`"
if [ $# -eq 1 ]
then msg="$1"
fi
git commit -m "$msg"
# Push source and build repos.
git push origin master
git subtree push --prefix=public git@github.com:spencerlyon2/hugo_gh_blog.git gh-pages
@@ -220,7 +220,7 @@ There's another approach:
2. Create an orphaned `gh-pages` branch. (See [here](https://help.github.com/articles/creating-project-pages-manually/) for more information.)
3. Follow the instructions below.
So, assuming you have your `gh-pages` set up, and `master` has a commit with some content you want to publish:
So, assuming you have your `gh-pages` set up, and `master` has a commit with some content you want to publish:
```
# Fetch the deployment script into the root of your source tree, make it executable.
@@ -262,7 +262,7 @@ Step by step:
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
# Build the project.
# Build the project.
hugo # if using a theme, replace by `hugo -t <yourtheme>`
# Go To Public folder