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

docs: Add sections on node now being a page

Updates #2297
This commit is contained in:
Bjørn Erik Pedersen
2016-11-21 13:02:02 +01:00
parent 0eb5f54d30
commit e29f6fe527
7 changed files with 59 additions and 2 deletions

View File

@@ -989,3 +989,17 @@ responses of APIs.
{{ $resp.content | base64Decode | markdownify }}
The response of the GitHub API contains the base64-encoded version of the [README.md](https://github.com/spf13/hugo/blob/master/README.md) in the Hugo repository. Now we can decode it and parse the Markdown. The final output will look similar to the rendered version on GitHub.
## .Site.GetPage
Every `Page` as a `Kind` attribute that shows what kind of page it is. While this attribute can be used to list pages of a certain `kind` using `where`, often it can be useful to fetch a single page by its path.
GetPage looks up an index page of a given `Kind` and `path`. This method may support regular pages in the future, but currently it is a convenient way of getting the index pages such as the home page or a section from a template:
```
{{ with .Site.GetPage "section" "blog" }}{{ .Title }}{{ end }}
```
This method wil return `nil` when no page could be found, so the above will not print anything if the blog section isn't found.
The valid page kinds are: *home, section, taxonomy and taxonomyTerm.*