diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-02-06 15:03:30 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-02-06 15:03:30 +0300 |
commit | 1e5eb8679ece0ce8dab3aca6c3267d6a206b790d (patch) | |
tree | 3caa1e0963853490ddaa5ba536ac83ded1e81358 /docs/content/en/templates | |
parent | 7f0ebd4a3c9e016afddc2cf5e7dfe6a820aa099a (diff) | |
parent | 3c0036805d64fdd8290f1c4a31371780ff3ea365 (diff) |
Merge commit '3c0036805d64fdd8290f1c4a31371780ff3ea365'
Diffstat (limited to 'docs/content/en/templates')
-rw-r--r-- | docs/content/en/templates/alternatives.md | 61 | ||||
-rw-r--r-- | docs/content/en/templates/base.md | 34 | ||||
-rw-r--r-- | docs/content/en/templates/rss.md | 34 |
3 files changed, 9 insertions, 120 deletions
diff --git a/docs/content/en/templates/alternatives.md b/docs/content/en/templates/alternatives.md index 91de38488..8c57962e7 100644 --- a/docs/content/en/templates/alternatives.md +++ b/docs/content/en/templates/alternatives.md @@ -1,7 +1,7 @@ --- -title: Alternative Templating Languages +title: DEPRECATED - Alternative Templating Languages linktitle: Alternative Templating -description: In addition to Go templates, Hugo supports the powerful Ace templating from @yosssi and Amber templating from @eknkc. +description: DEPRECATED - Support for Ace & Amber templating has been removed in version 0.62 godocref: date: 2017-02-01 publishdate: 2017-02-01 @@ -19,59 +19,4 @@ aliases: [/templates/ace/,/templates/amber/] toc: true --- -## Ace Templates - -For template documentation, follow the links from the [Ace project](https://github.com/yosssi/ace). - -* Ace templates must be named with the ace-suffix; e.g., `list.ace` -* It's possible to use both Go templates and Ace templates side by side and even include one into the other -* Full Go template syntax support, including all the useful helper [template functions][] -* Partials can be included both with the Ace and the Go template syntax. For example, the following two will have the same output in Ace: - * `= include partials/foo.html .` - * `{{ partial "foo" . }}` - -One noticeable difference between Ace and the other templating engines in Hugo is [Ace's inheritance support through base and inner templates][aceinheritance]. - -In Hugo, the Ace base template will be chosen with the same rule set as for [Go base templates][]. - -``` -.: -index.ace - -./blog: -single.ace -baseof.ace - -./_default: -baseof.ace list.ace single.ace single-baseof.ace -``` - -{{% note %}} -Note that the `html` suffix is needed even if the filename is suffixed `ace`. This does not work from inside a theme ([issue #763](https://github.com/gohugoio/hugo/issues/763)). -{{% /note %}} - -Some examples for the layout files above: - -* Home page: `./index.ace` + `./_default/baseof.ace` -* Single page in the `blog` section: `./blog/single.ace` + `./blog/baseof.ace` -* Single page in another section: `./_default/single.ace` + `./_default/single-baseof.ace` -* Taxonomy page in any section: `./_default/list.ace` + `./_default/baseof.ace` - -{{% note %}} -In most cases, one `baseof.ace` in `_default` will suffice. An Ace template without a reference to a base section (e.g., `= content`) will be handled as a standalone template. -{{% /note %}} - -## Amber Templates - -For Amber template documentation, follow the links from the [Amber project][]. - -* Amber templates must be named with the Amber suffix; e.g., `list.amber` -* Partials in Amber or HTML can be included with the Amber template syntax: - * `import ../partials/test.html ` - * `import ../partials/test_a.amber ` - -[aceinheritance]: https://github.com/yosssi/ace/tree/master/examples/base_inner_template -[Amber Project]: https://github.com/eknkc/amber -[template functions]: /functions/ -[Go templates]: /templates/introduction/ -[Go base templates]: /templates/base/
\ No newline at end of file +Support for Amber and Ace templates has been removed since Hugo 0.62 per [issue #6609](https://github.com/gohugoio/hugo/issues/6609). diff --git a/docs/content/en/templates/base.md b/docs/content/en/templates/base.md index 5643f8d4b..a407325fe 100644 --- a/docs/content/en/templates/base.md +++ b/docs/content/en/templates/base.md @@ -25,37 +25,9 @@ The `block` keyword allows you to define the outer shell of your pages' one or m ## Base Template Lookup Order -The [lookup order][lookup] for base templates is as follows: - -1. `/layouts/section/<TYPE>-baseof.html` -2. `/themes/<THEME>/layouts/section/<TYPE>-baseof.html` -3. `/layouts/<TYPE>/baseof.html` -4. `/themes/<THEME>/layouts/<TYPE>/baseof.html` -5. `/layouts/section/baseof.html` -6. `/themes/<THEME>/layouts/section/baseof.html` -7. `/layouts/_default/<TYPE>-baseof.html` -8. `/themes/<THEME>/layouts/_default/<TYPE>-baseof.html` -9. `/layouts/_default/baseof.html` -10. `/themes/<THEME>/layouts/_default/baseof.html` - -Variables are denoted by capitalized text set within `<>`. Note that Hugo's default behavior is for `type` to inherit from `section` unless otherwise specified. - -### Example Base Template Lookup Order - -As an example, let's assume your site is using a theme called "mytheme" when rendering the section list for a `posts` section. Hugo picks `layout/section/posts.html` as the template for [rendering the section][]. The `{{define}}` block in this template tells Hugo that the template is an extension of a base template. - -Here is the lookup order for the `posts` base template: - -1. `/layouts/section/posts-baseof.html` -2. `/themes/mytheme/layouts/section/posts-baseof.html` -3. `/layouts/posts/baseof.html` -4. `/themes/mytheme/layouts/posts/baseof.html` -5. `/layouts/section/baseof.html` -6. `/themes/mytheme/layouts/section/baseof.html` -7. `/layouts/_default/posts-baseof.html` -8. `/themes/mytheme/layouts/_default/posts-baseof.html` -9. `/layouts/_default/baseof.html` -10. `/themes/mytheme/layouts/_default/baseof.html` +{{< new-in "0.63.0" >}} Since Hugo v0.63, the base template lookup order closely follows that of the template is applies to (e.g. `_default/list.html`). + +See [Template Lookup Order](/templates/lookup-order/) for details and examples. ## Define the Base Template diff --git a/docs/content/en/templates/rss.md b/docs/content/en/templates/rss.md index 30570f641..d6edc31c9 100644 --- a/docs/content/en/templates/rss.md +++ b/docs/content/en/templates/rss.md @@ -55,37 +55,9 @@ copyright = "This work is licensed under a Creative Commons Attribution-ShareAli ## The Embedded rss.xml -This is the default RSS template that ships with Hugo. It adheres to the [RSS 2.0 Specification][RSS 2.0]. - -```xml -{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }} -<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> - <channel> - <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> - <link>{{ .Permalink }}</link> - <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> - <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} - <language>{{.}}</language>{{end}}{{ with .Site.Author.email }} - <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} - <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} - <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} - <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} - {{ with .OutputFormats.Get "RSS" }} - {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} - {{ end }} - {{ range .Pages }} - <item> - <title>{{ .Title }}</title> - <link>{{ .Permalink }}</link> - <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> - {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} - <guid>{{ .Permalink }}</guid> - <description>{{ .Summary | html }}</description> - </item> - {{ end }} - </channel> -</rss> -``` +This is the default RSS template that ships with Hugo: + +https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml ## Reference your RSS Feed in `<head>` |