Skip to content

Commit 7173233

Browse files
committed
Updated filters
1 parent 1609058 commit 7173233

File tree

2 files changed

+90
-37
lines changed

2 files changed

+90
-37
lines changed

content/docs/dashboard/content-view.md

Lines changed: 77 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Content view
33
slug: content-view
44
description: null
55
date: 2022-11-28T14:55:04.221Z
6-
lastmod: 2023-10-06T13:36:12.765Z
6+
lastmod: 2024-02-22T10:46:27.387Z
77
weight: 300.1
88
---
99

@@ -55,21 +55,91 @@ If you want to use other statuses, you can do so by specifying your own draft fi
5555
5656
![Draft filters][04]
5757

58-
## Supported filters
58+
## Filters
5959

60+
By default, the content view will show all your pages, but you can filter them by using the following
61+
filter:
62+
63+
- Content folder (when you have multiple registered)
6064
- Tag filter
6165
- Category filter
62-
- Content folder (when you have multiple registered)
6366

64-
## Supported sorting
67+
You can change the default filters, or configure your own by updating the `frontMatter.content.filters`
68+
setting.
69+
70+
### Configure filters
71+
72+
The default filter configuration is as follows:
73+
74+
```json {{ "title": "Default content filters configuration" }}
75+
{
76+
"frontMatter.content.filters": [
77+
"contentFolders",
78+
"tags",
79+
"categories",
80+
]
81+
}
82+
```
83+
84+
You can change the default filters, or configure your own by updating the `frontMatter.content.filters`
85+
setting as follows:
86+
87+
```json {{ "title": "Example of adding custom filters" }}
88+
{
89+
"frontMatter.content.filters": [
90+
"contentFolders",
91+
"tags",
92+
{
93+
"title": "My custom filter",
94+
"name": "field-name",
95+
}
96+
]
97+
}
98+
```
99+
100+
> **Info**: The `name` property should be the name of the front matter field you want to filter by.
101+
102+
## Sorting
103+
104+
By default, the content is sorted by the following options:
65105

66106
- Last modified
67107
- Filename (asc/desc)
68108

69-
> **Info**: You can define custom sorting options by specifying these within the
70-
> [frontMatter.content.sorting][05] setting.
109+
You can change the sorting options by specifying the `frontMatter.content.sorting` setting. This
110+
setting allows you to define the sorting options for the content view.
111+
112+
### Configure sorting options
71113

72-
You are also able to define your default sorting options by setting the
114+
| Property | Description | Default |
115+
| --- | --- | --- |
116+
| `title` | The title of the sorting option | `""` |
117+
| `name` | The name of the field to sort by (needs to be present in your content its front matter) | `""` |
118+
| `order` | The order of the sorting (ascending or descending). Option values to use: `asc` or `desc`. | `""` |
119+
| `type` | The type of field value. Option values to use: `string`, `date`, and `number`. | `""` |
120+
121+
```json {{ "title": "Example of adding custom sorting options" }}
122+
{
123+
"frontMatter.content.sorting": [
124+
{
125+
"title": "Date (asc)",
126+
"name": "date",
127+
"order": "asc",
128+
"type": "date"
129+
},
130+
{
131+
"title": "Date (desc)",
132+
"name": "date",
133+
"order": "desc",
134+
"type": "date"
135+
}
136+
]
137+
}
138+
```
139+
140+
### Default sorting
141+
142+
To define your default sorting options by setting the
73143
`frontMatter.content.defaultSorting` setting for the content view, and the
74144
`frontMatter.media.defaultSorting` setting for the media view.
75145

@@ -98,5 +168,4 @@ of the content view. This will allow you to quickly access.
98168
[02]: /releases/v7.1.0/draft-filters.png
99169
[03]: /docs/content-creation/fields#draft
100170
[04]: /releases/v5.3.0/draft-status.png
101-
[05]: /docs/settings/overview#frontmatter.content.sorting
102171
[06]: /docs/experimental/ui-extensibility#registering-a-custom-ui-extension

content/docs/settings/available-settings.md

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Settings overview
33
slug: settings/overview
44
description: null
55
date: 2023-02-13T16:44:09.618Z
6-
lastmod: 2024-02-21T16:01:09.014Z
6+
lastmod: 2024-02-22T10:16:24.290Z
77
weight: 1100.2
88
---
99

@@ -169,41 +169,23 @@ you can use the following settings:
169169
- `source/images`: If you want to use the default image location of Hexo;
170170
- `hexo:post_asset_folder`: If you want to use the post asset folder functionality.
171171

172-
### frontMatter.content.sorting
172+
### frontMatter.content.filters
173173

174-
Define the sorting options for your dashboard content.
174+
Specify the filters you want to use for your content dashboard.
175175

176176
- Type: `object[]`
177-
- Default: `[]`
177+
- Default: `["contentFolders", "tags", "categories"]`
178178

179-
Properties:
179+
> **Info**: More information on how to use it can be found in the [Content View - Filters][23] section.
180180
181-
- `title`: The title of the sorting option
182-
- `name`: The name of the field to sort by (needs to be present in your content its front matter)
183-
- `order`: The order of the sorting (ascending or descending). Option values to use: `asc` or
184-
`desc`.
185-
- `type`: The type of field value. Option values to use: `string`, `date`, and `number`.
181+
### frontMatter.content.sorting
186182

187-
Sample:
183+
Define the sorting options for your dashboard content.
188184

189-
```json
190-
{
191-
"frontMatter.content.sorting": [
192-
{
193-
"title": "Date (asc)",
194-
"name": "date",
195-
"order": "asc",
196-
"type": "date"
197-
},
198-
{
199-
"title": "Date (desc)",
200-
"name": "date",
201-
"order": "desc",
202-
"type": "date"
203-
}
204-
]
205-
}
206-
```
185+
- Type: `object[]`
186+
- Default: `[]`
187+
188+
> **Info**: More information on how to use it can be found in the [Content View - Sorting][22] section.
207189
208190
### frontMatter.content.supportedFileTypes
209191

@@ -865,3 +847,5 @@ This setting has been deprecated since version `3.1.0` in favour of the newly in
865847
[19]: /docs/snippets#snippet-wrapper
866848
[20]: /docs/settings#extending-with-code
867849
[21]: /docs/content-creation/multilingual
850+
[22]: /docs/content-view#sorting
851+
[23]: /docs/content-view#filters

0 commit comments

Comments
 (0)