Skip to content

Commit

Permalink
Update Hugo docs with the initialisms suggested by golint
Browse files Browse the repository at this point in the history
In particular:

 * .Url → .URL (for node, menu and paginator)
 * .Site.BaseUrl → .Site.BaseURL
 * getJson → getJSON
 * getCsv → getCSV
 * safeHtml → safeHTML
 * safeCss → safeCSS
 * safeUrl → safeURL

Continued effort in fixing #959.
  • Loading branch information
anthonyfok authored and bep committed Mar 18, 2015
1 parent 8b8fb41 commit b3bd71f
Show file tree
Hide file tree
Showing 14 changed files with 87 additions and 87 deletions.
20 changes: 10 additions & 10 deletions docs/content/content/organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,26 @@ This isn't in the front matter, but is the actual name of the file minus the
extension. This will be the name of the file in the destination.

### slug
Defined in the front matter, the slug can take the place of the filename for the
Defined in the front matter, the `slug` can take the place of the filename for the
destination.

### filepath
The actual path to the file on disk. Destination will create the destination
with the same path. Includes [section](/content/sections/).

### section
section can be provided in the front matter overriding the section derived from
`section` can be provided in the front matter overriding the section derived from
the source content location on disk. See [section](/content/sections/).

### path
path can be provided in the front matter. This will replace the actual
`path` can be provided in the front matter. This will replace the actual
path to the file on disk. Destination will create the destination with the same
path. Includes [section](/content/sections/).

### url
A complete URL can be provided. This will override all the above as it pertains
to the end destination. This must be the path from the baseurl (starting with a "/").
When a url is provided, it will be used exactly. Using url will ignore the
to the end destination. This must be the path from the baseURL (starting with a "/").
When a `url` is provided, it will be used exactly. Using `url` will ignore the
`--uglyUrls` setting.


Expand Down Expand Up @@ -116,27 +116,27 @@ When a url is provided, it will be used exactly. Using url will ignore the
http://spf13.com/projects/hugo


baseUrl section slug
baseURL section slug
⊢-----^--------⊣ ⊢--^---⊣ ⊢-^⊣
http://spf13.com/projects/hugo


baseUrl section slug
baseURL section slug
⊢-----^--------⊣ ⊢--^--⊣ ⊢--^--⊣
http://spf13.com/extras/indexes/example


baseUrl path slug
baseURL path slug
⊢-----^--------⊣ ⊢------^-----⊣ ⊢--^--⊣
http://spf13.com/extras/indexes/example


baseUrl url
baseURL url
⊢-----^--------⊣ ⊢-----^-----⊣
http://spf13.com/projects/hugo


baseUrl url
baseURL url
⊢-----^--------⊣ ⊢--------^-----------⊣
http://spf13.com/extras/indexes/example

Expand Down
26 changes: 13 additions & 13 deletions docs/content/extras/dynamiccontent.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,42 @@ any [JSON](http://www.json.org/) or
[CSV](http://en.wikipedia.org/wiki/Comma-separated_values) file
from nearly any resource.

"Dynamic Content" currently consists of two functions, `getJson`
and `getCsv`, which are available in **all template files**.
"Dynamic Content" currently consists of two functions, `getJSON`
and `getCSV`, which are available in **all template files**.

## Implementation details

### Calling the functions with an URL

In any HTML template or Markdown document, call the functions like this:

{{ $dataJ := getJson "url" }}
{{ $dataC := getCsv "separator" "url" }}
{{ $dataJ := getJSON "url" }}
{{ $dataC := getCSV "separator" "url" }}

or, if you use a prefix or postfix for the URL, the functions
accept [variadic arguments](http://en.wikipedia.org/wiki/Variadic_function):

{{ $dataJ := getJson "url prefix" "arg1" "arg2" "arg n" }}
{{ $dataC := getCsv "separator" "url prefix" "arg1" "arg2" "arg n" }}
{{ $dataJ := getJSON "url prefix" "arg1" "arg2" "arg n" }}
{{ $dataC := getCSV "separator" "url prefix" "arg1" "arg2" "arg n" }}

The separator for `getCsv` must be put in the first position and can only
The separator for `getCSV` must be put in the first position and can only
be one character long.

All passed arguments will be joined to the final URL; for example:

{{ $urlPre := "https://api.github.com" }}
{{ $gistJ := getJson $urlPre "/users/GITHUB_USERNAME/gists" }}
{{ $gistJ := getJSON $urlPre "/users/GITHUB_USERNAME/gists" }}

will resolve internally to:

{{ $gistJ := getJson "https://api.github.com/users/GITHUB_USERNAME/gists" }}
{{ $gistJ := getJSON "https://api.github.com/users/GITHUB_USERNAME/gists" }}

Finally, you can range over an array. This example will output the
first 5 gists for a GitHub user:

<ul>
{{ $urlPre := "https://api.github.com" }}
{{ $gistJ := getJson $urlPre "/users/GITHUB_USERNAME/gists" }}
{{ $gistJ := getJSON $urlPre "/users/GITHUB_USERNAME/gists" }}
{{ range first 5 $gistJ }}
{{ if .public }}
<li><a href="{{ .html_url }}" target="_blank">{{ .description }}</a></li>
Expand All @@ -65,7 +65,7 @@ first 5 gists for a GitHub user:

### Example for CSV files

For `getCsv`, the one-character long separator must be placed in the
For `getCSV`, the one-character long separator must be placed in the
first position followed by the URL.

<table>
Expand All @@ -79,7 +79,7 @@ first position followed by the URL.
<tbody>
{{ $url := "http://a-big-corp.com/finance/employee-salaries.csv" }}
{{ $sep := "," }}
{{ range $i, $r := getCsv $sep $url }}
{{ range $i, $r := getCSV $sep $url }}
<tr>
<td>{{ index $r 0 }}</td>
<td>{{ index $r 1 }}</td>
Expand Down Expand Up @@ -113,7 +113,7 @@ other authentication methods are not implemented.

### Loading local files

To load local files with the two functions `getJson` and `getCsv`, the
To load local files with the two functions `getJSON` and `getCSV`, the
source files must reside within Hugo's working directory. The file
extension does not matter but the content.

Expand Down
12 changes: 6 additions & 6 deletions docs/content/extras/menus.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ access it via `.Site.Menus.main`.

A menu entry has the following properties:

* **Url** string
* **URL** string
* **Name** string
* **Menu** string
* **Identifier** string
Expand Down Expand Up @@ -112,15 +112,15 @@ And the equivalent example `config.yaml`:
Pre: "<i class='fa fa-heart'></i>"
Weight: -110
Identifier: "about"
Url: "/about/"
URL: "/about/"
- Name: "getting started"
Pre: "<i class='fa fa-road'></i>"
Weight: -100
Url: "/getting-started/"
URL: "/getting-started/"
---


**NOTE:** The urls must be relative to the context root. If the `BaseUrl` is `http://example.com/mysite/`, then the urls in the menu must not include the context root `mysite`.
**NOTE:** The URLs must be relative to the context root. If the `BaseURL` is `http://example.com/mysite/`, then the URLs in the menu must not include the context root `mysite`.

## Nesting

Expand Down Expand Up @@ -164,12 +164,12 @@ The following is an example:
</a>
<ul class="sub">
{{ range .Children }}
<li{{if $currentNode.IsMenuCurrent "main" . }} class="active"{{end}}><a href="{{.Url}}"> {{ .Name }} </a> </li>
<li{{if $currentNode.IsMenuCurrent "main" . }} class="active"{{end}}><a href="{{.URL}}"> {{ .Name }} </a> </li>
{{ end }}
</ul>
{{else}}
<li>
<a class="" href="{{.Url}}">
<a class="" href="{{.URL}}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
Expand Down
10 changes: 5 additions & 5 deletions docs/content/extras/pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ Hugo supports pagination for the home page, sections and taxonomies. It's built

Pagination can be configured in the site configuration (e.g. `config.toml`):

* `Paginate` (default `10`)
* `Paginate` (default `10`)
* `PaginatePath` (default `page`)

Setting `Paginate` to a positive value will split the list pages for the home page, sections and taxonomies into chunks of that size. But note that the generation of the pagination pages for sections, taxonomies and home page is *lazy* --- the pages will not be created if not referenced by a `.Paginator` (see below).

`PaginatePath` is used to adapt the `Url` to the pages in the paginator (the default setting will produce urls on the form `/page/1/`.
`PaginatePath` is used to adapt the `URL` to the pages in the paginator (the default setting will produce URLs on the form `/page/1/`.

## List the pages

**A `.Paginator` is provided to help building a pager menu. This is only relevant for the templates for the home page and the list pages (sections and taxonomies).**
**A `.Paginator` is provided to help building a pager menu. This is only relevant for the templates for the home page and the list pages (sections and taxonomies).**

There are two ways to configure and use a `.Paginator`:

Expand All @@ -37,7 +37,7 @@ For a given **Node**, it's one of the options above. The `.Paginator` is static

## Build the navigation

The `.Paginator` contains enough information to build a paginator interface.
The `.Paginator` contains enough information to build a paginator interface.

The easiest way to add this to your pages is to include the built-in template (with `Bootstrap`-compatible styles):

Expand Down Expand Up @@ -67,7 +67,7 @@ Without the where-filter, the above is simpler:
If you want to build custom navigation, you can do so using the `.Paginator` object:

* `PageNumber`: The current page's number in the pager sequence
* `Url`: The relative Url to the current pager
* `URL`: The relative URL to the current pager
* `Pages`: The pages in the current pager
* `NumberOfElements`: The number of elements on this page
* `HasPrev`: Whether there are page(s) before the current
Expand Down
52 changes: 26 additions & 26 deletions docs/content/overview/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ The following is an example of a toml config file with some of the default value
builddrafts = false
baseurl = "http://yoursite.example.com/"
canonifyurls = true

[taxonomies]
category = "categories"
tag = "tags"

[params]
description = "Tesla's Awesome Hugo Site"
author = "Nikola Tesla"
Expand Down Expand Up @@ -74,67 +74,67 @@ Following is a list of Hugo-defined variables that you can configure and their c
---
archetypedir: "archetype"
# hostname (and path) to the root eg. http://spf13.com/
baseurl: ""
baseURL: ""
# include content marked as draft
buildDrafts: false
buildDrafts: false
# include content with datePublished in the future
buildFuture: false
canonifyUrls: false
buildFuture: false
canonifyURLs: false
# config file (default is path/config.yaml|json|toml)
config: "config.toml"
config: "config.toml"
contentdir: "content"
dataDir: "data"
defaultExtension: "html"
defaultLayout: "post"
# filesystem path to write files to
destination: ""
destination: ""
disableLiveReload: false
# Do not build RSS files
disableRSS: false
disableRSS: false
# Do not build Sitemap file
disableSitemap: false
disableSitemap: false
# edit new content with this editor, if provided
editor: ""
editor: ""
footnoteAnchorPrefix: ""
footnoteReturnLinkContents: ""
languageCode: ""
layoutdir: "layouts"
# Enable Logging
log: false
log: false
# Log File path (if set, logging enabled automatically)
logFile: ""
logFile: ""
# "yaml", "toml", "json"
metaDataFormat: "toml"
metaDataFormat: "toml"
newContentEditor: ""
# Don't sync modification time of files
noTimes: false
noTimes: false
paginate: 10
paginatePath: "page"
permalinks:
permalinks:
# Pluralize titles in lists using inflect
pluralizeListTitles: true
pluralizeListTitles: true
publishdir: "public"
# color-codes for highlighting derived from this style
pygmentsStyle: "monokai"
# true: use pygments-css or false: color-codes directly
pygmentsUseClasses: false
pygmentsUseClasses: false
sitemap: ""
# filesystem path to read files relative from
source: ""
# filesystem path to read files relative from
source: ""
staticdir: "static"
# display memory and timing of different steps of the program
stepAnalysis: false
stepAnalysis: false
# theme to use (located in /themes/THEMENAME/)
theme: ""
theme: ""
title: ""
# if true, use /filename.html instead of /filename/
uglyUrls: false
uglyURLs: false
# verbose output
verbose: false
verbose: false
# verbose logging
verboseLog: false
verboseLog: false
# watch filesystem for changes and recreate as needed
watch: false
watch: false
---


Expand Down
2 changes: 1 addition & 1 deletion docs/content/taxonomies/displaying.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ content.

<ul>
{{ range .Site.Taxonomies.series.golang }}
<li><a href="{{ .Url }}">{{ .Name }}</a></li>
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
</ul>

Expand Down
4 changes: 2 additions & 2 deletions docs/content/templates/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ It makes use of [partial templates](/templates/partials/)

{{ partial "header.html" . }}
{{ partial "subheader.html" . }}
{{ $baseurl := .Site.BaseUrl }}
{{ $baseurl := .Site.BaseURL }}

<section id="main">
<h1 id="title">{{ .Title }}</h1>
Expand Down Expand Up @@ -116,7 +116,7 @@ It makes use of [partial templates](/templates/partials/)

{{ partial "header.html" . }}
{{ partial "subheader.html" . }}
{{ $baseurl := .Site.BaseUrl }}
{{ $baseurl := .Site.BaseURL }}

<section id="main">
<h1 id="title">{{ .Title }}</h1>
Expand Down
Loading

0 comments on commit b3bd71f

Please sign in to comment.