mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Order ByTitle and ByLinkTitle added
Added documentation for new order possibilities
This commit is contained in:
parent
eec0e512f9
commit
d5c58b457f
1 changed files with 25 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
title: "Ordering Content"
|
title: "Ordering Content"
|
||||||
date: "2013-07-01"
|
date: "2014-03-06"
|
||||||
linktitle: "Ordering"
|
linktitle: "Ordering"
|
||||||
groups: ['content']
|
groups: ['content']
|
||||||
groups_weight: 60
|
groups_weight: 60
|
||||||
|
@ -8,7 +8,7 @@ groups_weight: 60
|
||||||
|
|
||||||
In Hugo you have a good degree of control of how your content can be ordered.
|
In Hugo you have a good degree of control of how your content can be ordered.
|
||||||
|
|
||||||
By default, content is ordered by weight, then by date with the most recent date first.
|
By default, content is ordered by weight, then by date with the most recent date first, but alternative sorting (by title and linktitle) is also available.
|
||||||
|
|
||||||
_Both the date and weight fields are optional._
|
_Both the date and weight fields are optional._
|
||||||
|
|
||||||
|
@ -16,8 +16,6 @@ Unweighted pages appear at the end of the list.
|
||||||
If no weights are provided (or if weights are the same) date will be used to sort. If neither are provided
|
If no weights are provided (or if weights are the same) date will be used to sort. If neither are provided
|
||||||
content will be ordered based on how it's read off the disk and no order is guaranteed.
|
content will be ordered based on how it's read off the disk and no order is guaranteed.
|
||||||
|
|
||||||
Alternative sorting is also available to order content by date (ignoring weight), length and reverse the order.
|
|
||||||
|
|
||||||
## Assigning Weight to content
|
## Assigning Weight to content
|
||||||
|
|
||||||
+++
|
+++
|
||||||
|
@ -49,7 +47,6 @@ Alternative sorting is also available to order content by date (ignoring weight)
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{% /highlight %}}
|
{{% /highlight %}}
|
||||||
|
|
||||||
|
|
||||||
## Order by Date
|
## Order by Date
|
||||||
|
|
||||||
{{% highlight html %}}
|
{{% highlight html %}}
|
||||||
|
@ -84,6 +81,29 @@ Can be applied to any of the above. Using Date for an example.
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{% /highlight %}}
|
{{% /highlight %}}
|
||||||
|
|
||||||
|
## Order by Title
|
||||||
|
|
||||||
|
{{% highlight html %}}
|
||||||
|
{{ range .Data.Pages.ByTitle }}
|
||||||
|
<li>
|
||||||
|
<a href="{{ .Permalink }}">{{ .Title }}</a>
|
||||||
|
<div class="meta">{{ .Date.Format "Mon, Jan 2, 2006" }}</div>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
{{% /highlight %}}
|
||||||
|
|
||||||
|
## Order by LinkTitle
|
||||||
|
|
||||||
|
{{% highlight html %}}
|
||||||
|
{{ range .Data.Pages.ByLinkTitle }}
|
||||||
|
<li>
|
||||||
|
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
|
||||||
|
<div class="meta">{{ .Date.Format "Mon, Jan 2, 2006" }}</div>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
{{% /highlight %}}
|
||||||
|
|
||||||
|
|
||||||
## Ordering Content Within Indexes
|
## Ordering Content Within Indexes
|
||||||
|
|
||||||
Please see the [Index Ordering Documentation](/indexes/ordering/)
|
Please see the [Index Ordering Documentation](/indexes/ordering/)
|
||||||
|
|
Loading…
Reference in a new issue