Update other vars to individual pages

Closes rdwatters/hugo-docs-concept#25
This commit is contained in:
Ryan Watters 2017-03-12 20:21:01 -05:00
parent c315f532b5
commit 201c999aed
20 changed files with 257 additions and 159 deletions

View File

@ -213,18 +213,18 @@ Site showcase has stayed more or less as is, including styling, etc. However...
### Press & Articles
* The press and article pages have been moved under "News" along with "Release Notes". Also, this whole section is lower on the navigation because it's less frequently visited---I'm assuming---than just about everything on the site.
* Like everything else, I've kept up with changes to the docs upstream on GitHub, but in this case, I also includes a [half dozen *new* articles as well](/news/press-and-articles/).
* The press and article pages have been moved under "News" along with "Release Notes". This section is lower on the navigation because it's less frequently visited than other areas (my assumption).
* Like everything else, I've kept up with changes to the docs upstream on GitHub, but in this case, I also included a [half dozen *new* articles as well](/news/press-and-articles/).
### About Hugo
* Content is more or less the same, but I've cleaned up a lot of the language, and copy edited for consistency throughout. I've also added in some extra frills (e.g. resources that extoll and teach more about the benefits of SSGs on [/about/benefits](/about/benefits/)).
* Release notes are now in the "News" section, although I'm still iffy on this decision. I can gladly move this back into "About" to give it a higher degree of discoverability in the menu.
* Release notes are now in the "News" section, although I'm still unsure on this decision. I can gladly move this back into "About" to give it a higher degree of discoverability in the menu.
### Getting Started
* **[[UPDATE 2017-03-12]]**
* The Quick Start need to be completely reworked; this could include a walkthrough of a new default theme (#)
* The Quick Start needs to be completely reworked; this could include a walkthrough of a new default theme (#)
* ~~The [Quick Start][] has been completely updated for more consistent heading structure, etc. Also, **I may delete the "deployment" section of the Quick Start** since this a) adds unnecessary length, making the guide less "quick" and b) detracts from the new "hosting and deployment" section, which offers better advice, and c) is redundant with [Hosting on Github](https://hugodocsconcept.netlify.com/hosting-and-deployment/hosting-on-github/). For example, the Quick Start didn't mention that files already written to public are not necessarily erased at build time. This can cause problems with drafts. I think the other options—e.g. Arjen's Wercker tutorial—are more viable and represent better practices for newcomers to Hugo. If future versions of Hugo include baked-in deployment features, I think it's worth reconsidering adding the deployment step back to the Quick Start.~~
### Content
@ -268,7 +268,7 @@ Themes section organization has only changed slightly in that the 6 content page
* Cross-References. Added as its own page under Content Management (`/content-management/cross-references/`)
* Custom robots.txt. Incorporated into [/templates/robots/](/templates/robots/)
* Data Files and Data-Driven Content. Combined and incorporated into [/templates/data-templates/](/templates/data-templates/)
* GitInfo. Incorporated into [/variables/other/](/variables/other/)
* GitInfo. Incorporated into [/variables/git/](/variables/git/)
* LiveReload. This doesn't really merits its own page. It's mentioned in features, usage, about, and elsewhere.
* Menus. This is broken into [/content-management/menus/](/content-management/menus/) and [/templates/menu-templates/](/templates/menu-templates/)
* Pagination. Now in [/templates/pagination/](/templates/pagination/)
@ -278,7 +278,7 @@ Themes section organization has only changed slightly in that the 6 content page
* URLS. Now combined with permalinks and others as a heading/subsection of [/content-management/urls/](/content-management/urls/)
* Syntax Highlighting. The shortcode is featured and explained with usage examples at [/content-management/shortcodes/](/content-management/shortcodes/), as well as expaned upon in it's own page under [/tools/syntax-highlighting/](/tools/syntax-highlighting/). I did this under the assumption that *developers* are most interested in adding code blocks to their content.
* Table of Contents. This is now it's own page under [/content-management/toc](/content-management/toc/) and referenced in [/variables/page-variables](/variables/page/).
* Traversing Local Files. This is now split into [/templates/files/](/templates/files/) and variables delimited at [/variables/other/](/variables/other/).
* Traversing Local Files. This is now split into [/templates/files/](/templates/files/) and variables delimited at [/variables/files/](/variables/files/).
### Community
@ -416,7 +416,10 @@ Apache License - 60
* Page Variables - 20
* Taxonomy Variables - 30
* File Variables - 40
* Other (Shortcode, Git, Menu, and Hugo vars) - 50
* Menu Variables - 50
* Hugo Variables - 60
* Git Variables - 70
* Sitemap Variables - 80
### "themes" Ordering (`.OrderByWeight`)

View File

@ -36,7 +36,45 @@ If you make use of the [multilingual feature](/content-management/multilingual/)
A menu entry has the following properties (i.e., variables) available to it:
{{< readfile file="content/readfiles/menuvars.md" markdown="true" >}}
`.URL`
: string
`.Name`
: string
`.Menu`
: string
`.Identifier`
: string
`.Pre`
: template.HTML
`.Post`
: template.HTML
`.Weight`
: int
`.Parent`
: string
`.Children`
: Menu
Note that menus also have the following functions available as well:
`.HasChildren`
: boolean
Additionally, there are some relevant functions available to menus on a page:
`.IsMenuCurrent`
: (menu string, menuEntry *MenuEntry ) boolean
`.HasMenuCurrent`
: (menu string, menuEntry *MenuEntry) boolean
## Adding content to menus

View File

@ -46,7 +46,7 @@ The examples above use two different delimiters, the difference being the `%` ch
### Shortcodes with Markdown
The `%` character indicates that the shortcode's inner content---called in the [shortcode template](/templates/shortcode-templates/) with the [`.Inner` variable](/variables/other/)---needs further processing by the page's rendering processor (i.e. Markdown via Blackfriday). In the following example, Blackfriday would convert `**World**` to `<strong>World</strong>`:
The `%` character indicates that the shortcode's inner content---called in the [shortcode template](/templates/shortcode-templates/) with the [`.Inner` variable](/variables/shortcodes/)---needs further processing by the page's rendering processor (i.e. Markdown via Blackfriday). In the following example, Blackfriday would convert `**World**` to `<strong>World</strong>`:
```golang
{{%/* myshortcode */%}}Hello **World!**{{%/* /myshortcode */%}}

View File

@ -194,7 +194,7 @@ content/posts/post-1.md
## Ugly URLs
If you would like to have are often referred to as "ugly URLs" (e.g.,&nbsp;http://example.com/extras/urls.html), set `uglyurls = true` or `uglyurls: true` to your site's `config.toml` or `config.yaml`, respectively. You can also use the `--uglyURLs=true` [flag from the command line][usage] with `hugo` or `hugo server`..
If you would like to have are often referred to as "ugly URLs" (e.g., yoursite.com/urls.html), set `uglyurls = true` or `uglyurls: true` in your site's `config.toml` or `config.yaml`, respectively. You can also use the `--uglyURLs=true` [flag from the command line][usage] with `hugo` or `hugo server`..
If you want a specific piece of content to have an exact URL, you can specify this in the [front matter][] under the `url` key. The following are examples of the same content directory and what the eventual URL structure will be when Hugo runs with its default behavior.

View File

@ -14,8 +14,9 @@ workson: []
hugoversion:
relatedfuncs: []
deprecated: false
draft: true
draft: false
aliases: []
needsexamples: true
---
Use in [menu templates](/templates/menu-templates/).
Used in [menu templates](/templates/menu-templates/).

View File

@ -8,14 +8,15 @@ publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
tags: [menus]
toc:
signature:
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
draft: true
toc: false
draft: false
aliases: []
needsexamples: true
---
**Needs examples?**
Used in [menu templates](/templates/menu-templates/).

View File

@ -13,6 +13,8 @@ workson: []
hugoversion:
relatedfuncs: []
deprecated: false
draft: true
draft: false
aliases: []
---
---
Used in [menu templates](/templates/menu-templates/).

View File

@ -40,7 +40,7 @@ You can learn more about each component of a newly scaffolded site in its respec
* [archetypes](/content-management/archetypes/)
* [content](/content-management/organization/)
* [layouts](/templates/)
* [static](/themes/creating-a-theme/)
* [static](/themes/creating/)
* [themes](/themes/)

View File

@ -461,7 +461,7 @@ Now that you've installed Hugo, read the [Quick Start guide][quickstart] and exp
[Chocolatey]: https://chocolatey.org/
[highlight shortcode]: /content-management/shortcodes/#highlight
[forum]: https://discuss.gohugo.io
[installgit]: (http://git-scm.com/)
[installgit]: http://git-scm.com/
[installgo]: https://golang.org/dl/
[Path Editor]: https://patheditor2.codeplex.com/
[pygments]: http://pygments.org

View File

@ -559,7 +559,7 @@ Here's what you should look into next:
[bookurl]: https://www.amazon.com/Good-Great-Some-Companies-Others/dp/0066620996/
[bleaktheme]: http://themes.gohugo.io/bleak/
[configuration]: /getting-started/configuration/
[createtheme]: /themes/creating-a-theme/
[createtheme]: /themes/creating/
[datatemplates]: /templates/data-templates/
[forum]: https://discuss.gohugo.io
[fm]: /content-management/front-matter/

View File

@ -149,7 +149,7 @@ The other steps are the same as with the worktree approach.
As mentioned [in this GitHub Help article](https://help.github.com/articles/user-organization-and-project-pages/), you can host a user/organization page in addition to project pages. Here are the key differences in GitHub Pages websites for Users and Organizations:
1. You must use the `username.github.io` naming scheme.
1. You must use the `<username>.github.io` naming scheme.
2. Content from the `master` branch will be used to build and publish your GitHub Pages site.
It becomes much simpler in this case: we'll create two separate repos, one for Hugo's content, and a git submodule with the `public` folder's content in it.
@ -192,7 +192,7 @@ cd ..
```
7. `./deploy.sh "Your optional commit message"` to send changes to `<username>.github.io` (careful, you may also want to commit changes on the `<your-project>-hugo` repo).
That's it! Your personal page is running at [http://username.github.io/](http://username.github.io/)(after up to 10 minutes delay).
That's it! Your personal page is running (after up to 10 minutes delay).
## Using a Custom Domain

View File

@ -30,7 +30,7 @@ A theme consists of templates and static assets such as javascript and css files
{{% note "Use the Hugo Generator Tag" %}}
The [`.Hugo.Generator`](/variables/other/) tag is included in all themes featured in the [Hugo Themes Showcase](http://themes.gohugo.io). We ask that you include the generator tag in all sites and themes you create with Hugo to help the core team track Hugo's usage and popularity.
The [`.Hugo.Generator`](/variables/hugo/) tag is included in all themes featured in the [Hugo Themes Showcase](http://themes.gohugo.io). We ask that you include the generator tag in all sites and themes you create with Hugo to help the core team track Hugo's usage and popularity.
{{% /note %}}
## Layouts

51
content/variables/git.md Normal file
View File

@ -0,0 +1,51 @@
---
title: Git Info Variables
linktitle: Git Variables
description:
date: 2017-03-12
publishdate: 2017-03-12
lastmod: 2017-03-12
categories: [variables and params]
tags: [git]
draft: false
weight: 70
aliases: [/extras/gitinfo/]
toc: false
wip: false
---
Hugo provides a way to integrate Git data into your website.
{{% note "`.GitInfo` Performance Considerations" %}}
Hugo's Git integrations should be fairly performant but *can* increase your build time. This will depend on the size of your Git history.
{{% /note %}}
## `.GitInfo` Prerequisites
1. The Hugo site must be in a Git-enabled directory.
2. The Git executable must be installed and in your system `PATH`.
3. The `.GitInfo` feature must be enabled in your Hugo project by passing `--enableGitInfo` flag on the command line or by setting `enableGitInfo` to `true` in your [site's configuration file][configuration].
## The `.GitInfo` Object
The `GitInfo` object contains the following fields:
`.AbbreviatedHash`
: the abbreviated commit hash (e.g., `866cbcc`)
`.AuthorName`
: the author's name, respecting `.mailmap`
`.AuthorEmail`
: the author's email address, respecting `.mailmap`
`.AuthorDate`
: the author date
`.Hash`
: the commit hash (e.g., `866cbccdab588b9908887ffd3b4f2667e94090c3`)
`.Subject`
: commit message subject (e.g., `tpl: Add custom index function`)
[configuration]: /getting-started/configuration/

34
content/variables/hugo.md Normal file
View File

@ -0,0 +1,34 @@
---
title: Hugo-specific Variables
linktitle: Hugo Variables
description: Hugo variables can be used in your templates to show metadata such as Hugo version and commit hashes.
date: 2017-03-12
publishdate: 2017-03-12
lastmod: 2017-03-12
categories: [variables and params]
tags: [hugo,generator]
draft: false
weight: 60
aliases: []
toc: false
wip: false
---
The `.Hugo` variable provides easy access to Hugo-related data and contains the following fields:
`.Hugo.Generator`
: `<meta>`` tag for the version of Hugo that generated the site. `.Hugo.Generator` outputs a *complete* HTML tag; e.g. `<meta name="generator" content="Hugo 0.18" />`
`.Hugo.Version`
: the current version of the Hugo binary you are using e.g. `0.13-DEV`<br>
`.Hugo.CommitHash`
: the git commit hash of the current Hugo binary e.g. `0e8bed9ccffba0df554728b46c5bbf6d78ae5247`
`.Hugo.BuildDate`
: the compile date of the current Hugo binary formatted with RFC 3339 e.g. `2002-10-02T10:00:00-05:00`<br>
{{% note "Use the Hugo Generator Tag" %}}
We highly recommend using `.Hugo.Generator` in your website's `<head>`. `.Hugo.Generator` is included by default in all themes hosted on [themes.gohugo.io](http://themes.gohugo.io). The generator tag allows the Hugo team to track the usage and popularity of Hugo.
{{% /note %}}

View File

@ -0,0 +1,45 @@
---
title: Menu Variables
linktitle: Menu Variables
description: A menu entry in a menu template has specific variables and functions to make menu management easier.
date: 2017-03-12
publishdate: 2017-03-12
lastmod: 2017-03-12
categories: [variables and params]
tags: [menus]
draft: false
weight: 50
aliases: [/variables/menu/]
toc: false
---
A menu entry in a [menu template][] has the following properties:
`.URL`
: string
`.Name`
: string
`.Menu`
: string
`.Identifier`
: string
`.Pre`
: template.HTML
`.Post`
: template.HTML
`.Weight`
: int
`.Parent`
: string
`.Children`
: Menu
[menu template]: /templates/menu-templates/

View File

@ -1,135 +0,0 @@
---
title: Shortcode, Git, Menu, and Hugo Variables
linktitle: Shortcode, Git, and Hugo Variables
description: Many of Hugo's additional features come with their own pre-packaged variables to keep your templating lightweight.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [variables and params]
tags: [shortcodes,git]
draft: false
weight: 50
aliases: [/extras/gitinfo/,/variables/other-variables/]
toc: true
wip: false
---
## Shortcode Variables
[Shortcodes][shortcodes] have access to parameters delimited in the shortcode declaration via [`.Get`][getfunction], page- and site-level variables, and also the following shortcode-specific fields:
`.Parent`
: provides access to the parent shortcode context in nested shortcodes. This can be very useful for inheritance of common shortcode parameters from the root.
`.IsNamedParams`
: boolean that returns `true` when the shortcode in question uses [named rather than positional parameters][shortcodes]
`.Inner`
: represents the content between the opening and closing shortcode tags when a [closing shortcode][markdownshortcode] is used
## Git Variables
Hugo provides a way to integrate Git data into your website.
{{% note "`.GitInfo` Performance Considerations" %}}
Hugo's Git integrations should be fairly performant but *can* increase your build time. This will depend on the size of your Git history.
{{% /note %}}
### `.GitInfo` Prerequisites
1. The Hugo site must be in a Git-enabled directory.
2. The Git executable must be installed and in your system `PATH`.
3. The `.GitInfo` feature must be enabled in your Hugo project by passing `--enableGitInfo` flag on the command line or by setting `enableGitInfo` to `true` in your [site's configuration file][configuration].
### The `.GitInfo` Object
The `GitInfo` object contains the following fields:
`.AbbreviatedHash`
: the abbreviated commit hash (e.g., `866cbcc`)
`.AuthorName`
: the author's name, respecting `.mailmap`
`.AuthorEmail`
: the author's email address, respecting `.mailmap`
`.AuthorDate`
: the author date
`.Hash`
: the commit hash (e.g., `866cbccdab588b9908887ffd3b4f2667e94090c3`)
`.Subject`
: commit message subject (e.g., `tpl: Add custom index function`)
## Hugo Variables
The `.Hugo` variable provides easy access to Hugo-related data and contains the following fields:
`.Hugo.Generator`
: `<meta>`` tag for the version of Hugo that generated the site. `.Hugo.Generator` outputs a *complete* HTML tag; e.g. `<meta name="generator" content="Hugo 0.18" />`
`.Hugo.Version`
: the current version of the Hugo binary you are using e.g. `0.13-DEV`<br>
`.Hugo.CommitHash`
: the git commit hash of the current Hugo binary e.g. `0e8bed9ccffba0df554728b46c5bbf6d78ae5247`
`.Hugo.BuildDate`
: the compile date of the current Hugo binary formatted with RFC 3339 e.g. `2002-10-02T10:00:00-05:00`<br>
{{% note "Use the Hugo Generator Tag" %}}
We highly recommend using `.Hugo.Generator` in your website's `<head>`. `.Hugo.Generator` is included by default in all themes hosted on [themes.gohugo.io](http://themes.gohugo.io). The generator tag allows the Hugo team to track the usage and popularity of Hugo.
{{% /note %}}
## Menu Variables
A menu entry in a [menu template][] has the following properties:
`.URL`
: string
`.Name`
: string
`.Menu`
: string
`.Identifier`
: string
`.Pre`
: template.HTML
`.Post`
: template.HTML
`.Weight`
: int
`.Parent`
: string
`.Children`
: Menu
## Sitemap Variable
A sitemap is a `Page` and therefore has all the [page variables][pagevars] available to use sitemap templates. They also have the following sitemap-specific variables available to them:
`.Sitemap.ChangeFreq`
: the page change frequency
`.Sitemap.Priority`
: the priority of the page
`.Sitemap.Filename`
: the sitemap filename
[configuration]: /getting-started/configuration/
[getfunction]: /functions/get/
[markdownshortcode]: /content-management/shortcodes/#shortcodes-with-markdown
[menu template]: /templates/menu-templates/
[shortcodes]: /templates/shortcode-templates/

View File

@ -43,7 +43,7 @@ See [`.Scratch`](/functions/scratch/) for page-scoped, writable variables.
: the approximate number of words in the content.
`.Hugo`
: see [Hugo Variables](/variables/other/).
: see [Hugo Variables](/variables/hugo/).
`.IsHome`
: `true` in the context of the [home page](/templates/homepage/).

View File

@ -0,0 +1,31 @@
---
title: Shortcode Variables
linktitle: Shortcode Variables
description: Shortcodes can access page variables and also have their own specific built-in variables.
date: 2017-03-12
publishdate: 2017-03-12
lastmod: 2017-03-12
categories: [variables and params]
tags: [shortcodes]
draft: false
weight: 20
aliases: []
toc: false
---
[Shortcodes][shortcodes] have access to parameters delimited in the shortcode declaration via [`.Get`][getfunction], page- and site-level variables, and also the following shortcode-specific fields:
`.Parent`
: provides access to the parent shortcode context in nested shortcodes. This can be very useful for inheritance of common shortcode parameters from the root.
`.IsNamedParams`
: boolean that returns `true` when the shortcode in question uses [named rather than positional parameters][shortcodes]
`.Inner`
: represents the content between the opening and closing shortcode tags when a [closing shortcode][markdownshortcode] is used
[getfunction]: /functions/get/
[markdownshortcode]: /content-management/shortcodes/#shortcodes-with-markdown
[shortcodes]: /templates/shortcode-templates/

View File

@ -0,0 +1,27 @@
---
title: Sitemap Variables
linktitle: Sitemap Variables
description:
date: 2017-03-12
publishdate: 2017-03-12
lastmod: 2017-03-12
categories: [variables and params]
tags: [sitemap]
draft: false
weight: 80
aliases: []
toc: false
---
A sitemap is a `Page` and therefore has all the [page variables][pagevars] available to use sitemap templates. They also have the following sitemap-specific variables available to them:
`.Sitemap.ChangeFreq`
: the page change frequency
`.Sitemap.Priority`
: the priority of the page
`.Sitemap.Filename`
: the sitemap filename
[pagevars]: /variables/page/

0
untitled Normal file
View File