From 50df8bfb8371a0fcd13e4ad63284150ec720a257 Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Mon, 16 Jul 2018 16:15:54 -0400 Subject: [PATCH] Replace .Data.Pages with .Pages --- content/en/content-management/authors.md | 2 +- content/en/content-management/shortcodes.md | 4 +- content/en/content-management/summaries.md | 6 +- .../content-management/syntax-highlighting.md | 4 +- content/en/functions/after.md | 4 +- content/en/functions/first.md | 3 +- content/en/functions/last.md | 3 +- content/en/functions/render.md | 2 +- content/en/functions/where.md | 10 ++-- content/en/templates/404.md | 2 +- content/en/templates/base.md | 2 +- content/en/templates/homepage.md | 8 +-- content/en/templates/introduction.md | 2 +- content/en/templates/lists.md | 60 +++++++++---------- content/en/templates/ordering-and-grouping.md | 56 ++++++++--------- content/en/templates/pagination.md | 8 +-- content/en/templates/robots.md | 2 +- content/en/templates/rss.md | 2 +- content/en/templates/sitemap-template.md | 4 +- content/en/templates/taxonomy-templates.md | 4 +- content/en/templates/template-debugging.md | 8 +-- content/en/templates/views.md | 2 +- content/en/variables/page.md | 4 +- content/zh/templates/base.md | 2 +- 24 files changed, 102 insertions(+), 102 deletions(-) diff --git a/content/en/content-management/authors.md b/content/en/content-management/authors.md index afc94fa62..530557ac0 100644 --- a/content/en/content-management/authors.md +++ b/content/en/content-management/authors.md @@ -170,7 +170,7 @@ Last but not least, we have to create the second list that contains all publicat The layout for this page can be defined in the template `layouts/taxonomy/author.html`. {{< code file="layouts/taxonomy/author.html" download="author.html" >}} -{{ range .Data.Pages }} +{{ range .Pages }}

{{ .Title }}

written by {{ .Author.DisplayName }} {{ .Summary }} diff --git a/content/en/content-management/shortcodes.md b/content/en/content-management/shortcodes.md index 0116078f4..35305764c 100644 --- a/content/en/content-management/shortcodes.md +++ b/content/en/content-management/shortcodes.md @@ -178,7 +178,7 @@ This shortcode will convert the source code provided into syntax-highlighted HTM

{{ .Title }}

- {{ range .Data.Pages }} + {{ range .Pages }} {{ .Render "summary"}} {{ end }}
@@ -194,7 +194,7 @@ The `highlight` shortcode example above would produce the following HTML when th <section id="main"> <div> <h1 id="title">{{ .Title }}</h1> - {{ range .Data.Pages }} + {{ range .Pages }} {{ .Render "summary"}} {{ end }} </div> diff --git a/content/en/content-management/summaries.md b/content/en/content-management/summaries.md index 1c341400e..0f8939377 100644 --- a/content/en/content-management/summaries.md +++ b/content/en/content-management/summaries.md @@ -1,7 +1,7 @@ --- title: Content Summaries linktitle: Summaries -description: Hugo generates summaries of your content. +description: Hugo generates summaries of your content. date: 2017-01-10 publishdate: 2017-01-10 lastmod: 2017-01-10 @@ -57,7 +57,7 @@ Be careful to enter <!--more--> exactly You can show content summaries with the following code. You could use the following snippet, for example, in a [section template][]. {{< code file="page-list-with-summaries.html" >}} -{{ range first 10 .Data.Pages }} +{{ range first 10 .Pages }}
@@ -78,4 +78,4 @@ Note how the `.Truncated` boolean valuable may be used to hide the "Read More... [org]: /content-management/formats/ [pagevariables]: /variables/page/ -[section template]: /templates/section-templates/ \ No newline at end of file +[section template]: /templates/section-templates/ diff --git a/content/en/content-management/syntax-highlighting.md b/content/en/content-management/syntax-highlighting.md index 4576624d0..841ecbd3d 100644 --- a/content/en/content-management/syntax-highlighting.md +++ b/content/en/content-management/syntax-highlighting.md @@ -134,7 +134,7 @@ Highlighting is carried out via the [built-in shortcode](/content-management/sho

{{ .Title }}

- {{ range .Data.Pages }} + {{ range .Pages }} {{ .Render "summary"}} {{ end }}
@@ -157,7 +157,7 @@ It is also possible to add syntax highlighting with GitHub flavored code fences.

{{ .Title }}

- {{ range .Data.Pages }} + {{ range .Pages }} {{ .Render "summary"}} {{ end }}
diff --git a/content/en/functions/after.md b/content/en/functions/after.md index f01ba1436..d627f792a 100644 --- a/content/en/functions/after.md +++ b/content/en/functions/after.md @@ -39,7 +39,7 @@ You can use `after` in combination with the [`first` function][] and Hugo's [pow {{ define "main" }}

Featured Article

- {{ range first 1 .Data.Pages.ByPublishDate.Reverse }} + {{ range first 1 .Pages.ByPublishDate.Reverse }}

{{.Title}}

@@ -48,7 +48,7 @@ You can use `after` in combination with the [`first` function][] and Hugo's [pow

Recent Articles

- {{ range first 3 (after 1 .Data.Pages.ByPublishDate.Reverse) }} + {{ range first 3 (after 1 .Pages.ByPublishDate.Reverse) }}

{{.Title}}

diff --git a/content/en/functions/first.md b/content/en/functions/first.md index 29ba3ac1c..464dfa671 100644 --- a/content/en/functions/first.md +++ b/content/en/functions/first.md @@ -21,8 +21,7 @@ aliases: [] ``` -{{ range first 10 .Data.Pages }} +{{ range first 10 .Pages }} {{ .Render "summary" }} {{ end }} ``` - diff --git a/content/en/functions/last.md b/content/en/functions/last.md index ea633837b..f992b980a 100644 --- a/content/en/functions/last.md +++ b/content/en/functions/last.md @@ -23,8 +23,7 @@ aliases: [] ``` -{{ range last 10 .Data.Pages }} +{{ range last 10 .Pages }} {{ .Render "summary" }} {{ end }} ``` - diff --git a/content/en/functions/render.md b/content/en/functions/render.md index a4abfa81d..c76af39fe 100644 --- a/content/en/functions/render.md +++ b/content/en/functions/render.md @@ -26,7 +26,7 @@ This function is only available when applied to a single piece of content within This example could render a piece of content using the content view located at `/layouts/_default/summary.html`: ``` -{{ range .Data.Pages }} +{{ range .Pages }} {{ .Render "summary"}} {{ end }} ``` diff --git a/content/en/functions/where.md b/content/en/functions/where.md index eb3111215..9ad8daf2a 100644 --- a/content/en/functions/where.md +++ b/content/en/functions/where.md @@ -23,7 +23,7 @@ needsexample: true `where` filters an array to only the elements containing a matching value for a given field. ```go-html-template -{{ range where .Data.Pages "Section" "post" }} +{{ range where .Pages "Section" "post" }} {{ .Content }} {{ end }} ``` @@ -45,7 +45,7 @@ series: golang It can also be used with the logical operators `!=`, `>=`, `in`, etc. Without an operator, `where` compares a given field with a matching value equivalent to `=`. ```go-html-template -{{ range where .Data.Pages "Section" "!=" "post" }} +{{ range where .Pages "Section" "!=" "post" }} {{ .Content }} {{ end }} ``` @@ -104,7 +104,7 @@ You can also put the returned value of the `where` clauses into a variable: The following grabs the first five content files in `post` using the [default ordering](/templates/lists/) for lists (i.e., `weight => date`): {{< code file="where-with-first.html" >}} -{{ range first 5 (where .Data.Pages "Section" "post") }} +{{ range first 5 (where .Pages "Section" "post") }} {{ .Content }} {{ end }} {{< /code >}} @@ -114,7 +114,7 @@ The following grabs the first five content files in `post` using the [default or You can also nest `where` clauses to drill down on lists of content by more than one parameter. The following first grabs all pages in the "blog" section and then ranges through the result of the first `where` clause and finds all pages that are *not* featured: ```go-html-template -{{ range where (where .Data.Pages "Section" "blog" ) ".Params.featured" "!=" "true" }} +{{ range where (where .Pages "Section" "blog" ) ".Params.featured" "!=" "true" }} ``` ## Unset Fields @@ -129,7 +129,7 @@ Only the following operators are available for `nil` * `!=`, `<>`, `ne`: True if the given field is set. ```go-html-template -{{ range where .Data.Pages ".Params.specialpost" "!=" nil }} +{{ range where .Pages ".Params.specialpost" "!=" nil }} {{ .Content }} {{ end }} ``` diff --git a/content/en/templates/404.md b/content/en/templates/404.md index eaa479d29..64ebe1694 100644 --- a/content/en/templates/404.md +++ b/content/en/templates/404.md @@ -21,7 +21,7 @@ When using Hugo with [GitHub Pages](http://pages.github.com/), you can provide y 404 pages will have all the regular [page variables][pagevars] available to use in the templates. -In addition to the standard page variables, the 404 page has access to all site content accessible from `.Data.Pages`. +In addition to the standard page variables, the 404 page has access to all site content accessible from `.Pages`. ``` ▾ layouts/ diff --git a/content/en/templates/base.md b/content/en/templates/base.md index 94d4cb2ef..4948f6f35 100644 --- a/content/en/templates/base.md +++ b/content/en/templates/base.md @@ -90,7 +90,7 @@ From the above base template, you can define a [default list template][hugolists {{< code file="layouts/_default/list.html" download="list.html" >}} {{ define "main" }}

Posts

- {{ range .Data.Pages }} + {{ range .Pages }}

{{ .Title }}

{{ .Content }} diff --git a/content/en/templates/homepage.md b/content/en/templates/homepage.md index 833664866..6789bdfc8 100644 --- a/content/en/templates/homepage.md +++ b/content/en/templates/homepage.md @@ -36,9 +36,9 @@ The homepage, similar to other [list pages in Hugo][lists], accepts content and See the homepage template below or [Content Organization][contentorg] for more information on the role of `_index.md` in adding content and front matter to list pages. -## `.Data.Pages` on the Homepage +## `.Pages` on the Homepage -In addition to the standard [page variables][pagevars], the homepage template has access to *all* site content via `.Data.Pages`. +In addition to the standard [page variables][pagevars], the homepage template has access to *all* site content via `.Pages`. ## Example Homepage Template @@ -58,8 +58,8 @@ The following is an example of a homepage template that uses [partial][partials] {{.Content}}
- - {{ range first 10 .Data.Pages }} + + {{ range first 10 .Pages }} {{ .Render "summary"}} {{ end }}
diff --git a/content/en/templates/introduction.md b/content/en/templates/introduction.md index f13378ef0..7f3a862ef 100644 --- a/content/en/templates/introduction.md +++ b/content/en/templates/introduction.md @@ -504,7 +504,7 @@ Go allows you to do more than what's shown here. Using Hugo's [`where` function] {{< code file="layouts/partials/upcoming-events.html" download="upcoming-events.html" >}}

Upcoming Events

    -{{ range where .Data.Pages.ByDate "Section" "events" }} +{{ range where .Pages.ByDate "Section" "events" }} {{ if ge .Date.Unix .Now.Unix }}
  • diff --git a/content/en/templates/lists.md b/content/en/templates/lists.md index 431407e43..2871b181e 100644 --- a/content/en/templates/lists.md +++ b/content/en/templates/lists.md @@ -101,7 +101,7 @@ You can now access this `_index.md`'s' content in your list template: