Add tree.txt

This commit is contained in:
Ryan Watters
2017-02-21 02:22:06 -06:00
parent 03d0a338a7
commit d04a24578e
7 changed files with 414 additions and 80 deletions
+71 -54
View File
@@ -14,11 +14,10 @@ toc: true
needsreview: true
---
Hugo has a simple yet powerful menu system that permits content to be
placed in menus with a good degree of control without a lot of work.
Hugo has a simple yet powerful menu system that permits content to be placed in menus with a good degree of control without a lot of work.
{{% note "Lazy Blogger"%}}
If all you want is a simple menu for your sections, see [Section Menu for "the Lazy Blogger"](#section-menu-for-the-lazy-blogger).
If all you want is a simple menu for your sections, see the ["Section Menu for Lazy Bloggers" in Menu Templates](/templates/menu-templates/#section-menu-for-lazy-blogger).
{{% /note %}}
Some of the features of Hugo Menus:
@@ -28,47 +27,63 @@ Some of the features of Hugo Menus:
* Create menu entries without being attached to any content
* Distinguish active element (and active branch)
## What is a menu?
## What is a Menu?
A menu is a named array of menu entries accessible on the site under
`.Site.Menus` by name. For example, if I have a menu called `main`, I would
access it via `.Site.Menus.main`.
A menu is a named array of menu entries accessible on the site under `.Site.Menus` by name. For example, if I have a menu called `main`, I would access it via `.Site.Menus.main`.
If you make use of the [multilingual feature](content-management/multilingual-mode/) you can define menus language independent.
If you make use of the [multilingual feature](content-management/multilingual-mode/) you can define language-independent menus.
A menu entry has the following properties:
* **URL** string
* **Name** string
* **Menu** string
* **Identifier** string
* **Pre** template.HTML
* **Post** template.HTML
* **Weight** int
* **Parent** string
* **Children** Menu
`URL`
: string
`Name`
: string
`Menu`
: string
`Identifier`
: string
`Pre`
: template.HTML
`Post`
: template.HTML
`Weight`
: int
`Parent`
: string
`Children`
: Menu
And the following functions:
* **HasChildren** bool
`HasChildren`
: boolean
Additionally, there are some relevant functions available on the page:
* **IsMenuCurrent** (menu string, menuEntry *MenuEntry ) bool
* **HasMenuCurrent** (menu string, menuEntry *MenuEntry) bool
`IsMenuCurrent`
: (menu string, menuEntry *MenuEntry ) boolean
`HasMenuCurrent`
: (menu string, menuEntry *MenuEntry) bool
## Adding content to menus
Hugo supports a couple of different methods of adding a piece of content
to the front matter.
Hugo supports a couple of different methods of adding a piece of content to the front matter.
### Simple
If all you need to do is add an entry to a menu, the simple form works
well.
If all you need to do is add an entry to a menu, the simple form works well.
**A single menu:**
#### A Single Menu:
```yaml
---
@@ -76,7 +91,7 @@ menu: "main"
---
```
**Multiple menus:**
#### Multiple Menus:
```yaml
---
@@ -84,7 +99,6 @@ menu: ["main", "footer"]
---
```
### Advanced
Take the advanced approach if more control is required. All of the menu entry properties listed above are available.
@@ -100,38 +114,41 @@ 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/).
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/).
Heres an example `config.toml`:
[[menu.main]]
name = "about hugo"
pre = "<i class='fa fa-heart'></i>"
weight = -110
identifier = "about"
url = "/about/"
[[menu.main]]
name = "getting started"
pre = "<i class='fa fa-road'></i>"
weight = -100
url = "/getting-started/"
```toml
[[menu.main]]
name = "about hugo"
pre = "<i class='fa fa-heart'></i>"
weight = -110
identifier = "about"
url = "/about/"
[[menu.main]]
name = "getting started"
pre = "<i class='fa fa-road'></i>"
weight = -100
url = "/getting-started/"
```
And the equivalent example `config.yaml`:
---
menu:
main:
- Name: "about hugo"
Pre: "<i class='fa fa-heart'></i>"
Weight: -110
Identifier: "about"
URL: "/about/"
- Name: "getting started"
Pre: "<i class='fa fa-road'></i>"
Weight: -100
URL: "/getting-started/"
---
```yaml
---
menu:
main:
- Name: "about hugo"
Pre: "<i class='fa fa-heart'></i>"
Weight: -110
Identifier: "about"
URL: "/about/"
- Name: "getting started"
Pre: "<i class='fa fa-road'></i>"
Weight: -100
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`. Using an absolute URL will overide the baseURL. If the `URL` is `http://subdomain.example.com/`, the output will be `http://subdomain.example.com`.
@@ -157,4 +174,4 @@ and all content entries are attached to one of these entries via the
## Rendering Menus
See [Menu Templates](/templates/menu-templates/) for more information on how to render your site menus to your deployable Hugo website.
See [Menu Templates](/templates/menu-templates/) for information on how to render your site menus.
+7 -3
View File
@@ -134,8 +134,10 @@ publishDir: "public"
pygmentsCodeFencesGuessSyntax: false
# color-codes for highlighting derived from this style
pygmentsStyle: "monokai"
# true: use pygments-css or false: color-codes directly
# true use pygments-css or false will color code directly
pygmentsUseClasses: false
# see "Section Menu for Lazy Bloggers", /templates/menu-templates for more info
SectionPagesMenu: ""
# default sitemap configuration map
sitemap:
# filesystem path to read files relative from
@@ -190,7 +192,7 @@ The following is the full list of Hugo-defined variables in an example TOML file
{{% input "config.toml" %}}
```toml
---
+++
archetypeDir = "archetypes"
# hostname (and path) to the root, e.g. http://spf13.com/
baseURL = ""
@@ -271,6 +273,8 @@ pygmentsCodeFencesGuessSyntax = false
pygmentsStyle = "monokai"
# true: use pygments-css or false: color-codes directly
pygmentsUseClasses = false
# see "Section Menu for Lazy Bloggers", /templates/menu-templates for more info
SectionPagesMenu =
# default sitemap configuration map
sitemap =
# filesystem path to read files relative from
@@ -293,7 +297,7 @@ watch = true
[taxonomies]
category = "categories"
tag = "tags"
---
+++
```
{{% /input %}}
+16 -20
View File
@@ -11,16 +11,14 @@ tags: [lists,sections,menus]
draft: false
slug:
aliases: [/templates/menus/]
toc: false
toc: true
needsreview: true
---
Hugo makes no assumptions about how your rendered HTML will be
structured. Instead, it provides all of the functions you will need to be
able to build your menu however you want.
The following is an example:
```html
@@ -63,10 +61,10 @@ The following is an example:
```
{{% 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).
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 on the [`absLangUrl`](/functions/abslangurl) and [`relLangUrl`](/functions/rellangurl) functions.
{{% /note %}}
## Section Menu for "the Lazy Blogger"
## Section Menu for Lazy Bloggers
To enable this menu, add the following to your site `config`:
@@ -78,27 +76,25 @@ The menu name can be anything, but take a note of what it is.
This will create a menu with all the sections as menu items and all the sections' pages as "shadow-members". The _shadow_ implies that the pages isn't represented by a menu-item themselves, but this enables you to create a top-level menu like this:
```
<nav class="sidebar-nav">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
<a class="sidebar-nav-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{.URL}}">{{ .Name }}</a>
{{ end }}
</nav>
```html
<nav class="sidebar-nav">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
<a class="sidebar-nav-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{.URL}}">{{ .Name }}</a>
{{ end }}
</nav>
```
In the above, the menu item is marked as active if on the current section's list page or on a page in that section.
The above is all that's needed. But if you want custom menu items, e.g. changing weight or name, you can define them manually in the site config, i.e. `config.toml`:
```
[[menu.main]]
name = "This is the blog section"
weight = -110
identifier = "blog"
url = "/blog/"
```toml
[[menu.main]]
name = "This is the blog section"
weight = -110
identifier = "blog"
url = "/blog/"
```
**Note** that the `identifier` must match the section name.
@@ -84,8 +84,40 @@ The `.Hugo` variable provides easy access to Hugo-related data and contains the
We highly recommend using `.Hugo.Generator` in your website. It is already included in all theme headers. The generator tag is significant in that it 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
[configuration]: /getting-started/configuration/
[getfunction]: /functions/get/
[markdownshortcode]: /content-management/shortcodes/#shortcodes-with-markdown
[shortcodes]: /templates/shortcode-templates/
[menu template]: /templates/menu-templates/
[shortcodes]: /templates/shortcode-templates/
+1 -1
View File
File diff suppressed because one or more lines are too long
+3
View File
@@ -11,6 +11,9 @@
padding:6px;
z-index:9999;
overflow:visible;
text-align:center;
border-radius:15px;
@include card(5);
}
// .twitter-tweet-rendered {
+282
View File
@@ -0,0 +1,282 @@
.
├── _index.md
├── about-hugo
│   ├── _index.md
│   ├── benefits-of-static.md
│   ├── hugo-features.md
│   ├── license.md
│   ├── roadmap.md
│   ├── what-is-hugo.md
│   └── why-i-built-hugo.md
├── commands
│   └── _index.md
├── content-management
│   ├── _index.md
│   ├── archetypes.md
│   ├── content-organization.md
│   ├── content-sections.md
│   ├── content-summaries.md
│   ├── content-types.md
│   ├── cross-references.md
│   ├── front-matter.md
│   ├── menus.md
│   ├── multilingual-mode.md
│   ├── shortcodes.md
│   ├── supported-content-formats.md
│   ├── table-of-contents.md
│   ├── taxonomies.md
│   └── url-management.md
├── contribute-to-hugo
│   ├── _index.md
│   ├── add-your-site-to-the-showcase.md
│   ├── contribute-to-hugo-development.md
│   └── contribute-to-the-hugo-docs.md
├── developer-tools
│   ├── _index.md
│   ├── migrate-to-hugo.md
│   └── syntax-highlighting.md
├── functions
│   ├── _index.md
│   ├── abslangurl.md
│   ├── absurl.md
│   ├── after.md
│   ├── apply.md
│   ├── base64decode.md
│   ├── base64encode.md
│   ├── chomp.md
│   ├── countrunes.md
│   ├── countwords.md
│   ├── dateformat.md
│   ├── default-function.md
│   ├── delimit.md
│   ├── dict.md
│   ├── echoparam.md
│   ├── emojify.md
│   ├── findre.md
│   ├── first.md
│   ├── get.md
│   ├── getenv.md
│   ├── getpage.md
│   ├── haschildren.md
│   ├── hasmenucurrent.md
│   ├── hasprefix.md
│   ├── highlight.md
│   ├── htmlescape.md
│   ├── htmlunescape.md
│   ├── humanize.md
│   ├── i18n.md
│   ├── imageconfig.md
│   ├── in.md
│   ├── index-function.md
│   ├── int.md
│   ├── intersect.md
│   ├── ismenucurrent.md
│   ├── isset.md
│   ├── jsonify.md
│   ├── last.md
│   ├── lower.md
│   ├── markdownify.md
│   ├── math.md
│   ├── md5.md
│   ├── param.md
│   ├── partialcached.md
│   ├── plainify.md
│   ├── pluralize.md
│   ├── printf.md
│   ├── querify.md
│   ├── range.md
│   ├── readdir.md
│   ├── readfile.md
│   ├── rel.md
│   ├── rellangurl.md
│   ├── relref.md
│   ├── relurl.md
│   ├── render.md
│   ├── replace.md
│   ├── safecss.md
│   ├── safehtml.md
│   ├── safehtmlattr.md
│   ├── safejs.md
│   ├── safeurl.md
│   ├── scratch.md
│   ├── seq.md
│   ├── sha1.md
│   ├── sha256.md
│   ├── shuffle.md
│   ├── singularize.md
│   ├── slice.md
│   ├── slicestr.md
│   ├── sort.md
│   ├── split.md
│   ├── string.md
│   ├── substr.md
│   ├── the-dot.md
│   ├── time.md
│   ├── title.md
│   ├── trim.md
│   ├── unix.md
│   ├── upper.md
│   ├── urlize.md
│   ├── where.md
│   └── with.md
├── getting-started
│   ├── _index.md
│   ├── basic-usage.md
│   ├── configuration.md
│   ├── directory-structure.md
│   ├── install-hugo.md
│   ├── quick-start.md
│   └── using-the-hugo-docs.md
├── hosting-and-deployment
│   ├── _index.md
│   ├── deployment-with-rsync.md
│   ├── deployment-with-wercker.md
│   ├── hosting-on-bitbucket.md
│   ├── hosting-on-github.md
│   └── hosting-on-gitlab.md
├── mailing-list.md
├── news
│   ├── _index.md
│   ├── press-and-articles.md
│   └── release-notes.md
├── showcase
│   ├── 2626info.md
│   ├── _index.md
│   ├── antzucaro.md
│   ├── appernetic.md
│   ├── arresteddevops.md
│   ├── asc.md
│   ├── astrochili.md
│   ├── aydoscom.md
│   ├── barricade.md
│   ├── bepsays.md
│   ├── bugtrackers.io.md
│   ├── camunda-blog.md
│   ├── camunda-docs.md
│   ├── cdnoverview.md
│   ├── chinese-grammar.md
│   ├── chingli.md
│   ├── chipsncookies.md
│   ├── christianmendoza.md
│   ├── cinegyopen.md
│   ├── clearhaus.md
│   ├── cloudshark.md
│   ├── coding-journal.md
│   ├── consequently.md
│   ├── ctlcompiled.md
│   ├── danmux.md
│   ├── datapipelinearchitect.md
│   ├── davidepetilli.md
│   ├── davidrallen.md
│   ├── davidyates.md
│   ├── devmonk.md
│   ├── dmitriid.com.md
│   ├── emilyhorsman.com.md
│   ├── esolia-com.md
│   ├── esolia-pro.md
│   ├── eurie.md
│   ├── fale.md
│   ├── fixatom.md
│   ├── fxsitecompat.md
│   ├── gntech.md
│   ├── gogb.md
│   ├── goin5minutes.md
│   ├── h10n.me.md
│   ├── hugo.md
│   ├── jamescampbell.md
│   ├── jorgennilsson.md
│   ├── kieranhealy.md
│   ├── klingt-net.md
│   ├── launchcode5.md
│   ├── leepenney.md
│   ├── leowkahman.md
│   ├── lk4d4.darth.io.md
│   ├── losslesslife.md
│   ├── mariosanchez.md
│   ├── mayan-edms.md
│   ├── michaelwhatcott.md
│   ├── mongodb-eng-journal.md
│   ├── mtbhomer.md
│   ├── nickoneill.md
│   ├── ninjaducks.in.md
│   ├── ninya.io.md
│   ├── nodesk.md
│   ├── novelist-xyz.md
│   ├── npf.md
│   ├── peteraba.md
│   ├── rahulrai.md
│   ├── rakutentech.md
│   ├── rdegges.md
│   ├── readtext.md
│   ├── richardsumilang.md
│   ├── rick-cogley-info.md
│   ├── ridingbytes.md
│   ├── robertbasic.md
│   ├── scottcwilson.md
│   ├── shapeshed.md
│   ├── shelan.md
│   ├── silvergeko.md
│   ├── softinio.md
│   ├── spf13.md
│   ├── steambap.md
│   ├── stefano.chiodino.md
│   ├── stou.md
│   ├── szymonkatra.md
│   ├── techmadeplain.md
│   ├── tendermint.md
│   ├── thecodeking.md
│   ├── thehome.md
│   ├── tutorialonfly.md
│   ├── ucsb.md
│   ├── upbeat.md
│   ├── vamp.md
│   ├── viglug.org.md
│   ├── vurt.co.md
│   ├── yslow-rules.md
│   ├── ysqi.md
│   └── yulinling.net.md
├── templates
│   ├── _index.md
│   ├── ace-templating.md
│   ├── amber-templating.md
│   ├── base-templates-and-blocks.md
│   ├── content-view-templates.md
│   ├── custom-404-page.md
│   ├── data-templates.md
│   ├── go-template-primer.md
│   ├── homepage-template.md
│   ├── list-and-section-templates.md
│   ├── local-file-templates.md
│   ├── menu-templates.md
│   ├── pagination.md
│   ├── partial-templates.md
│   ├── rss-templates.md
│   ├── shortcode-templates.md
│   ├── single-page-templates.md
│   ├── sitemap-template.md
│   ├── taxonomy-templates.md
│   └── template-debugging.md
├── themes
│   ├── _index.md
│   ├── creating-a-theme.md
│   ├── customizing-a-theme.md
│   ├── installing-and-using-themes.md
│   └── theme-showcase.md
├── tree.txt
├── troubleshooting
│   ├── _index.md
│   ├── accented-characters-in-urls.md
│   └── eof-error.md
├── tutorials
│   ├── _index.md
│   ├── creating-a-multilingual-site.md
│   └── migrate-from-jekyll-to-hugo.md
└── variables-and-params
├── _index.md
├── file-variables.md
├── page-variables.md
├── shortcode-git-and-hugo-variables.md
├── site-variables.md
└── taxonomy-variables.md
15 directories, 264 files