summaryrefslogtreecommitdiffstats
path: root/docs/content/en/functions/collections/Sort.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/content/en/functions/collections/Sort.md')
-rw-r--r--docs/content/en/functions/collections/Sort.md44
1 files changed, 39 insertions, 5 deletions
diff --git a/docs/content/en/functions/collections/Sort.md b/docs/content/en/functions/collections/Sort.md
index 6b9ea2c34..2277f883c 100644
--- a/docs/content/en/functions/collections/Sort.md
+++ b/docs/content/en/functions/collections/Sort.md
@@ -5,13 +5,13 @@ categories: []
keywords: []
action:
aliases: [sort]
+ related:
+ - functions/collections/Reverse
+ - functions/collections/Shuffle
+ - functions/collections/Uniq
returnType: any
signatures: ['collections.Sort COLLECTION [KEY] [ORDER]']
-related:
- - collections.Reverse
- - collections.Shuffle
- - collections.Sort
- - collections.Uniq
+toc: true
aliases: [/functions/sort]
---
@@ -105,6 +105,40 @@ This produces:
Victor Marius Jean
```
+### First level key removal
+
+Hugo removes the first level keys when sorting a map.
+
+Original map:
+
+```json
+{
+ "felix": {
+ "breed": "malicious",
+ "type": "cat"
+ },
+ "spot": {
+ "breed": "boxer",
+ "type": "dog"
+ }
+}
+```
+
+After sorting:
+
+```json
+[
+ {
+ "breed": "malicious",
+ "type": "cat"
+ },
+ {
+ "breed": "boxer",
+ "type": "dog"
+ }
+]
+```
+
## Sort a page collection
{{% note %}}