Merge commit 'a6e635ca7d905d9ec3ffd708db2694f680b03aae'

This commit is contained in:
Bjørn Erik Pedersen
2024-08-09 15:17:43 +02:00
143 changed files with 3258 additions and 2109 deletions

View File

@@ -1,13 +1,14 @@
---
title: Template lookup order
linkTitle: Lookup order
description: Hugo uses the rules below to select a template for a given page, starting from the most specific.
categories: [templates,fundamentals]
keywords: [templates]
keywords: []
menu:
docs:
parent: templates
weight: 30
weight: 30
weight: 40
weight: 40
toc: true
---
@@ -99,23 +100,29 @@ layouts/
└── single.html <-- renders about.md
```
## Home page
## Home templates
These template paths are sorted by specificity in descending order. The least specific path is at the bottom of each list.
{{< datatable-filtered "output" "layouts" "Kind == home" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
## Single pages
## Single templates
These template paths are sorted by specificity in descending order. The least specific path is at the bottom of each list.
{{< datatable-filtered "output" "layouts" "Kind == page" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
## Section pages
## Section templates
A section page is a list of pages within a given section.
These template paths are sorted by specificity in descending order. The least specific path is at the bottom of each list.
{{< datatable-filtered "output" "layouts" "Kind == section" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
## Taxonomy pages
## Taxonomy templates
A taxonomy page is a list of terms within a given taxonomy. The examples below assume the following site configuration:
These template paths are sorted by specificity in descending order. The least specific path is at the bottom of each list.
The examples below assume the following site configuration:
{{< code-toggle file=hugo >}}
[taxonomies]
@@ -124,9 +131,11 @@ category = 'categories'
{{< datatable-filtered "output" "layouts" "Kind == taxonomy" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
## Term pages
## Term templates
A term page is a list of pages associated with a given term. The examples below assume the following site configuration:
These template paths are sorted by specificity in descending order. The least specific path is at the bottom of each list.
The examples below assume the following site configuration:
{{< code-toggle file=hugo >}}
[taxonomies]
@@ -134,3 +143,16 @@ category = 'categories'
{{< /code-toggle >}}
{{< datatable-filtered "output" "layouts" "Kind == term" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}
## RSS templates
These template paths are sorted by specificity in descending order. The least specific path is at the bottom of each list.
The examples below assume the following site configuration:
{{< code-toggle file=hugo >}}
[taxonomies]
category = 'categories'
{{< /code-toggle >}}
{{< datatable-filtered "output" "layouts" "OutputFormat == rss" "Example" "OutputFormat" "Suffix" "Template Lookup Order" >}}