diff --git a/content/templates/lookup-order.md b/content/templates/lookup-order.md index 4a9b5c5f0..2961d442a 100644 --- a/content/templates/lookup-order.md +++ b/content/templates/lookup-order.md @@ -45,4 +45,4 @@ See examples of the lookup order for each of the Hugo template types: [singlelookup]: templates/single-page-templates/#single-page-template-lookup-order [switch]: https://en.wikipedia.org/wiki/Switch_statement#Fallthrough [taxonomylookup]: /templates/taxonomy-templates/#taxonomy-list-template-lookup-order -[termslookup]: /templates/taxonomy-templtes/#taxonomy-terms-template-lookup-order \ No newline at end of file +[termslookup]: /templates/taxonomy-templates/#taxonomy-terms-template-lookup-order \ No newline at end of file diff --git a/content/templates/taxonomy-templates.md b/content/templates/taxonomy-templates.md index c1f939473..a0ac81e5f 100644 --- a/content/templates/taxonomy-templates.md +++ b/content/templates/taxonomy-templates.md @@ -21,7 +21,7 @@ Hugo includes support for user-defined groupings of content called **taxonomies* Hugo provides multiple ways to use taxonomies throughout your project: * Order the way the terms for a taxonomy are displayed in a [taxonomy terms template](#taxonomy-terms-template) -* Order the way content associated with a taxonomy term are display in a [taxonomy list template](#taxonomy-list-template) +* Order the way content associated with a taxonomy term is displayed in a [taxonomy list template](#taxonomy-list-template) * List a single content's taxonomy terms within a [single page template][] ## Taxonomy List Templates @@ -30,14 +30,14 @@ Taxonomy list page templates are lists and therefore have all the variables and ### Taxonomy List Template Lookup Order -A Taxonomy will be rendered at /`PLURAL`/`TERM`/ (e.g. http://spf13.com/topics/golang/) from: +A Taxonomy will be rendered at /`PLURAL`/`TERM`/ (e.g., http://spf13.com/topics/golang/) from according to the following lookup order: -* `/layouts/taxonomy/.html` -* /layouts/_default/taxonomy.html -* /layouts/_default/list.html -* /themes//layouts/taxonomy/.html -* /themes//layouts/_default/taxonomy.html -* /themes/`THEME`/layouts/_default/list.html +1. `/layouts/taxonomy/.html` +2. `/layouts/_default/taxonomy.html` +3. `/layouts/_default/list.html` +4. `/themes//layouts/taxonomy/.html` +5. `/themes//layouts/_default/taxonomy.html` +6. `/themes//layouts/_default/list.html` ## Taxonomy Terms Template @@ -113,7 +113,7 @@ Taxonomies can be ordered by either alphabetical key or by the number of content ### Order Alphabetically Example -``` +```html
    {{ $data := .Data }} {{ range $key, $value := .Data.Taxonomy.Alphabetical }} @@ -124,7 +124,7 @@ Taxonomies can be ordered by either alphabetical key or by the number of content ### Order by Popularity Example -``` +```html
      {{ $data := .Data }} {{ range $key, $value := .Data.Taxonomy.ByCount }} @@ -195,10 +195,9 @@ using the [list templates](/templates/list/): Within your content templates, you may wish to display the taxonomies that piece of content is assigned to. -Because we are leveraging the front matter system to define taxonomies for content, the taxonomies assigned to each content piece are located in the usual place -(.Params.`plural`). +Because we are leveraging the front matter system to define taxonomies for content, the taxonomies assigned to each content piece are located in the usual place (i.e., `.Params.`). -### Example +### Example: List Tags in a Single Page Template ```html
        @@ -208,11 +207,11 @@ Because we are leveraging the front matter system to define taxonomies for conte
      ``` -If you want to list taxonomies inline, you will have to take care of optional plural ending in the title (if multiple taxonomies), as well as commas. Let's say we have a taxonomy "directors" such as `directors: [ "Joel Coen", "Ethan Coen" ]` in the TOML-format front matter. +If you want to list taxonomies inline, you will have to take care of optional plural endings in the title (if multiple taxonomies), as well as commas. Let's say we have a taxonomy "directors" such as `directors: [ "Joel Coen", "Ethan Coen" ]` in the TOML-format front matter. To list such taxonomies, use the following: -### Example +### Example: Comma-delimit Tags in a Single Page Template ```html {{ if .Params.directors }} @@ -223,11 +222,11 @@ To list such taxonomies, use the following: Alternatively, you may use the [delimit template function][delimit] as a shortcut if the taxonomies should just be listed with a separator. See {{< gh 2143 >}} on GitHub for discussion. -## Listing content with the Same Taxonomy Term +## Listing Content with the Same Taxonomy Term -First, you may be asking why you would use this. If you are using a taxonomy for something like a series of posts, this is exactly how you would do it. It’s also a quick and dirty way to show some related content. +If you are using a taxonomy for something like a series of posts, you can list individual pages associated with the same taxonomy. This is also a quick and dirty method for showing related content: -### Example +### Example: Showing Content in Same Series ```html
        @@ -237,11 +236,11 @@ First, you may be asking why you would use this. If you are using a taxonomy for
      ``` -## Listing all content in a given taxonomy +## Listing All content in a Given taxonomy This would be very useful in a sidebar as “featured content”. You could even have different sections of “featured content” by assigning different terms to the content. -### Example +### Example: Grouping "Featured" Content ```html