Update functions content footer and added new funcs for menus

This commit is contained in:
Ryan Watters
2017-02-21 01:55:58 -06:00
parent d2f2d9a3f0
commit 03d0a338a7
20 changed files with 139 additions and 93 deletions
+26 -24
View File
@@ -9,9 +9,8 @@ weight:
categories: [templating]
tags: [lists,sections,menus]
draft: false
slug:
aliases: [/extras/menus/]
toc: false
toc: true
needsreview: true
---
@@ -71,32 +70,35 @@ well.
**A single menu:**
---
menu: "main"
---
```yaml
---
menu: "main"
---
```
**Multiple menus:**
---
menu: ["main", "footer"]
---
```yaml
---
menu: ["main", "footer"]
---
```
### Advanced
If more control is required, then the advanced approach gives you the
control you want. All of the menu entry properties listed above are
available.
Take the advanced approach if more control is required. All of the menu entry properties listed above are available.
---
menu:
main:
parent: 'extras'
weight: 20
---
```yaml
---
menu:
main:
parent: 'extras'
weight: 20
---
```
## Adding (non-content) entries to a menu
## Adding Non-content Entries to a Menu
You can also add entries to menus that arent attached to a piece of
content. This takes place in the sitewide [config file](/overview/configuration/).
@@ -143,11 +145,11 @@ Identifier should be unique (within a menu).
The following order is used to determine an Identifier:
> Name > LinkTitle > Title.
* Name >
* LinkTitle >
* Title
This means that the title will be used unless
linktitle is present, etc. In practice Name and Identifier are never
displayed and only used to structure relationships.
This means that `title` will be used unless `linktitle` is present, etc. In practice, Name and Identifier are never displayed and only used to structure relationships.
In this example, the top level of the menu is defined in the config file
and all content entries are attached to one of these entries via the
@@ -155,4 +157,4 @@ and all content entries are attached to one of these entries via the
## Rendering Menus
See [Menu Templates](/templates/menu-templates/).
See [Menu Templates](/templates/menu-templates/) for more information on how to render your site menus to your deployable Hugo website.
@@ -10,9 +10,9 @@ tags: [docs,documentation,community]
weight: 20
draft: false
slug:
aliases: []
aliases: [/docs-contribute/,/docscontrib/]
toc: true
notesforauthors:
needsreview: true
---
Documentation is an integral part of any open source project. The Hugo docs were completely reworked in anticipation of the release of v0.19, but there is always room for improvement.
+1 -1
View File
@@ -1,6 +1,6 @@
---
title: Functions Quick Reference
linktitle: Overview
linktitle: Quick Reference
description: Comprehensive list of Hugo templating functions, including basic and advanced usage examples.
date: 2017-02-01
publishdate: 2017-02-01
+16
View File
@@ -0,0 +1,16 @@
---
title: haschildren
linktitle: HasChildren
description:
godocref:
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
tags: [menus]
toc: false
draft: false
aliases: []
---
Use in [menu templates](/templates/menu-templates/).
+14
View File
@@ -0,0 +1,14 @@
---
title: hasmenucurrent
linktitle: HasMenuCurrent
description:
godocref:
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
tags: [menus]
toc: false
draft: false
aliases: []
---
+14
View File
@@ -0,0 +1,14 @@
---
title: ismenucurrent
linktitle: IsMenuCurrent
description:
godocref:
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
tags: [menus]
toc: false
draft: false
aliases: []
---
+4 -4
View File
@@ -17,7 +17,7 @@ notesforauthors:
## Testing Installation with Hugo Help
Once you have [installed Hugo][install], make sure it is in your `PATH` (or provide a path to it). You can test that Hugo has been installed correctly via the `help` command:
Once you have [installed Hugo][install], make sure it is in your `PATH`. You can test that Hugo has been installed correctly via the `help` command:
```bash
hugo help
@@ -143,8 +143,7 @@ Hugo may not be the first static site generator to utilize LiveReload
technology, but its the first to do it right.
The combination of Hugos insane build speed and LiveReload make
crafting your content pure joy. Virtually instantly after you hit save
your rebuilt content will appear in your browser.
crafting your content pure joy. Your updated content appears virtually instantly in your browser as soon as you save your changes.
### LiveReload
@@ -154,7 +153,7 @@ Hugo comes with [LiveReload](https://github.com/livereload/livereload-js) built
hugo server
```
This will run a full functioning web server while simultaneously watching your file system for additions, deletions, or changes within the following
This will run a fully functioning web server while simultaneously watching your file system for additions, deletions, or changes within the following the following areas of your [project organization][directorystructure]
* `/static/*`
* `/content/*`
@@ -255,6 +254,7 @@ Interested? Here are some great tutorials contributed by Hugo users:
[Amazon S3]: http://aws.amazon.com/s3/
[Apache]: http://httpd.apache.org/ "Apache HTTP Server"
[CloudFront]: http://aws.amazon.com/cloudfront/ "Amazon CloudFront"
[directorystructure]: /getting-started/directory-structure/
[DreamHost]: http://www.dreamhost.com/
[Firebase Hosting]: https://firebase.google.com/docs/hosting/
[GitHub Pages]: https://pages.github.com/
@@ -1,5 +1,5 @@
---
title: Deployment with rysnc
title: Deployment with Rysnc
linktitle:
description:
date: 2017-02-01
+41 -37
View File
@@ -23,50 +23,54 @@ able to build your menu however you want.
The following is an example:
<!--sidebar start-->
<aside>
<div id="sidebar" class="nav-collapse">
<!-- sidebar menu start-->
<ul class="sidebar-menu">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
```html
<!--sidebar start-->
<aside>
<div id="sidebar" class="nav-collapse">
<!-- sidebar menu start-->
<ul class="sidebar-menu">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<li class="sub-menu{{if $currentPage.HasMenuCurrent "main" . }} active{{end}}">
<a href="javascript:;" class="">
{{ .Pre }}
<span>{{ .Name }}</span>
<span class="menu-arrow arrow_carrot-right"></span>
</a>
<ul class="sub">
{{ range .Children }}
<li{{if $currentPage.IsMenuCurrent "main" . }} class="active"{{end}}><a href="{{.URL}}"> {{ .Name }} </a> </li>
{{ end }}
</ul>
{{else}}
<li>
<a href="{{.URL}}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
{{end}}
</li>
{{end}}
<li> <a href="https://github.com/spf13/hugo/issues" target="blank">Questions and Issues</a> </li>
<li> <a href="#" target="blank">Edit this Page</a> </li>
<li class="sub-menu{{if $currentPage.HasMenuCurrent "main" . }} active{{end}}">
<a href="javascript:;" class="">
{{ .Pre }}
<span>{{ .Name }}</span>
<span class="menu-arrow arrow_carrot-right"></span>
</a>
<ul class="sub">
{{ range .Children }}
<li{{if $currentPage.IsMenuCurrent "main" . }} class="active"{{end}}><a href="{{.URL}}"> {{ .Name }} </a> </li>
{{ end }}
</ul>
<!-- sidebar menu end-->
</div>
</aside>
<!--sidebar end-->
{{else}}
<li>
<a href="{{.URL}}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
{{end}}
</li>
{{end}}
<li> <a href="https://github.com/spf13/hugo/issues" target="blank">Questions and Issues</a> </li>
<li> <a href="#" target="blank">Edit this Page</a> </li>
</ul>
<!-- sidebar menu end-->
</div>
</aside>
<!--sidebar end-->
```
> **Note**: use the `absLangURL` or `relLangURL` if your theme makes use of the [multilingual feature](/content-management/multilingual-mode/). In contrast to `absURL` and `relURL` it adds the correct language prefix to the url. [Read more](/functions/).
{{% note "`absLangURL` and `relLangURL`" %}}
Use the `absLangURL` or `relLangURL` if your theme makes use of the [multilingual feature](/content-management/multilingual-mode/). In contrast to `absURL` and `relURL`, these two functions add the correct language prefix to the url. [Read more](/functions/abslangurl).
{{% /note %}}
## Section Menu for "the Lazy Blogger"
To enable this menu, add this to your site config, i.e. `config.toml`:
To enable this menu, add the following to your site `config`:
```
```toml
SectionPagesMenu = "main"
```
+7 -9
View File
@@ -10,7 +10,7 @@ tags: [themes, source, organization, directories]
weight: 30
draft: false
aliases: [/themes/creation/]
toc: false
toc: true
needsreview: true
---
@@ -33,6 +33,11 @@ A theme consists of templates and static assets such as javascript and css
files. Themes can also optionally provide [archetypes](/content/archetypes/)
which are archetypal content types used by the `hugo new` command.
{{% note "Use the Hugo Generator Tag" %}}
The [`.Hugo.Generator`](/variables-and-params/other/) tag is included in all themes featured in the [Hugo Them Showcase](/http://themes.gohugo.io). We ask that you include the generator tag in all sites and themes you create with Hugo. The generator tag is significant in that it allows the Hugo team to track Hugo's usage and popularity.
{{% /note %}}
### Layouts
Hugo is built around the concept that things should be as simple as possible.
@@ -72,15 +77,8 @@ common to organize the static content into:
The actual structure is entirely up to you, the theme creator, on how you would like to organize your files.
### Archetypes
If your theme makes use of specific keys in the front matter, it is a good idea
to provide an archetype for each content type you have. Archetypes follow the
[guidelines provided](/content/archetypes/).
### Generator meta tag
With a growing community around Hugo we recommend theme creators to include the [Generator meta tag](/templates/variables/) with `.Hugo.Generator` in the `<head>` of your HTML code. The output might looks like `<meta name="generator" content="Hugo 0.13" />` and helps us to analyse the usage and popularity of Hugo.
[guidelines provided](/content/archetypes/).
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -11,5 +11,5 @@ draft: true
slug: ""
aliases: []
toc: false
notesforauthors: "Categories are not required metadata but should mirror the section name (e.g., a file in Functions should contain `categories: [functions]`). If you are adding a document to a specific section of the Hugo docs, be sure to use the appropriate archetype. For more information, visit gohugo.io/contribute-to-hugo/contribute-to-the-hugo-docs/. As always, you can delete `notesforauthors:` before publication or modify accordingly."
z_notesforauthors: "Go to gohugo.io/docscontrib for info on req fields"
---
+2 -2
View File
@@ -9,5 +9,5 @@ categories: [functions]
toc: false
draft: false
aliases: []
notesforauthors: "Functions do not include 'weight' because they are sorted by title. Keep the 'title:' value all lowercase for sorting purposes. Always include a 'linktitle' with casing that reflects actual usage of the function. EVERY function needs a description, even if it's only a sentence or two. If possible, include the full URL for the related godoc in `godocref:`."
---
z_notesforauthors: "Go to gohugo.io/docscontrib for info on req fields"
---
+1 -1
View File
@@ -9,5 +9,5 @@ categories: [showcase]
tags: []
image: "yourimage.jpg"
toc: false
notesforauthors: "For the image, only include the file name *without* a directory/path, which is taken care of in the templating. See the showcase contribution page at gohugo.io/contribute-to-hugo/add-your-site-to-the-showcase/ for more details. As always, feel free to delete `notesforauthors` or modify for anyone in the future who may edit the content in this file."
z_notesforauthors: "Go to gohugo.io/docscontrib for info on req fields"
---
@@ -8,5 +8,5 @@ tags: []
draft: false
aliases: []
toc: true
notesforauthors: "All troubleshooting docs should include two h2-headings, one for 'Trouble:' and one for 'Solution:'. Additional h2-headings include 'Discussion Forum Threads', 'Related Hugo Issues', and 'Additional References'."
z_notesforauthors: "Go to gohugo.io/docscontrib for info on req fields"
---
+3 -5
View File
@@ -13,8 +13,6 @@ tags: [tutorials]
weight:
draft: false
aliases: []
notesforauthors: "1. The publishdate and lastmod are in the context of Hugo and not necessarily the original publication for your website. Tutorials are ordered according to title.
2. TAGS ARE IMPORTANT, but keep the categories at "tutorials." Please try to reuse existing tags whenever possible (see gohugo.io/tags on the docs site).
3. `author:`, `authorurl:`, and `originalurl:` are all optional. If used, please include the *full url*. `originalurl:` is the link to the originally published article, if there is one.
4. As always, feel free to remove 'notesforauthors' before publishing your tutorial."
---
z_notesforauthors: "Go to gohugo.io/docscontrib for info on req fields"
---
+1 -1
View File
@@ -8,7 +8,7 @@
{{partial "content-header-links.html" . }}
{{partial "tags.html" . }}
{{if .Params.needsreview }}
<div id="beingreviewed">UNDERGOING REVIEW</div>
<div id="beingreviewed">WORK IN PROGRESS</div>
{{end}}
</header>
<div class="body-copy">
@@ -16,7 +16,7 @@
<i class="fa fa-chevron-left"></i>
<div class="page-info">
<span>Previous</span>
<h5 class="{{$section}}">{{.Title}} of {{.Section | humanize | title}}</h5>
<h5 class="{{$section}}">{{.Title}}{{if ne .Section "functions"}} of {{.Section | humanize | title}}{{end}}</h5>
</div>
</a>
{{ end }}
@@ -21,7 +21,7 @@
{{end}}
{{ else }}
{{range (where $.Site.Pages "Section" $section).ByWeight}}
<li class="submenu-item"><a class="submenu-item-link {{$section}}{{if eq ($.Scratch.Get "url") .URL}} active-page{{end}}" href="{{.Permalink}}">{{with .LinkTitle}}{{. | markdownify }}{{else}}{{.Title | markdownify}}{{end}}</a></li>
<li class="submenu-item"><a class="submenu-item-link {{$section}}{{if eq ($.Scratch.Get "url") .URL}} active-page{{end}}" href="{{with .Params.redirecturl}}{{.}}{{else}}{{.Permalink}}{{end}}">{{with .LinkTitle}}{{. | markdownify }}{{else}}{{.Title | markdownify}}{{end}}</a></li>
{{end}}
{{- end }}
</ul>
@@ -5,7 +5,7 @@ $S:480px;
$SM: 560px;
$M:760px;
$L:960px;
$XL:1240px;
$XL:1200px;
$HUGE:1600px;
//Color Palette