mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-22 03:26:22 +00:00
docs: Clarifications in the Explorer Docs (#938)
add example to filter by tags.
This commit is contained in:
parent
66a5855fad
commit
b9dee0775c
1 changed files with 14 additions and 1 deletions
|
@ -61,7 +61,7 @@ export class FileNode {
|
||||||
children: FileNode[] // children of current node
|
children: FileNode[] // children of current node
|
||||||
name: string // last part of slug
|
name: string // last part of slug
|
||||||
displayName: string // what actually should be displayed in the explorer
|
displayName: string // what actually should be displayed in the explorer
|
||||||
file: QuartzPluginData | null // set if node is a file, see `QuartzPluginData` for more detail
|
file: QuartzPluginData | null // if node is a file, this is the file's metadata. See `QuartzPluginData` for more detail
|
||||||
depth: number // depth of current node
|
depth: number // depth of current node
|
||||||
|
|
||||||
... // rest of implementation
|
... // rest of implementation
|
||||||
|
@ -167,6 +167,19 @@ Component.Explorer({
|
||||||
|
|
||||||
You can customize this by changing the entries of the `omit` set. Simply add all folder or file names you want to remove.
|
You can customize this by changing the entries of the `omit` set. Simply add all folder or file names you want to remove.
|
||||||
|
|
||||||
|
### Remove files by tag
|
||||||
|
|
||||||
|
You can access the frontmatter of a file by `node.file?.frontmatter?`. This allows you to filter out files based on their frontmatter, for example by their tags.
|
||||||
|
|
||||||
|
```ts title="quartz.layout.ts"
|
||||||
|
Component.Explorer({
|
||||||
|
filterFn: (node) => {
|
||||||
|
// exclude files with the tag "explorerexclude"
|
||||||
|
return node.file?.frontmatter?.tags?.includes("explorerexclude") !== true
|
||||||
|
},
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
### Show every element in explorer
|
### Show every element in explorer
|
||||||
|
|
||||||
To override the default filter function that removes the `tags` folder from the explorer, you can set the filter function to `undefined`.
|
To override the default filter function that removes the `tags` folder from the explorer, you can set the filter function to `undefined`.
|
||||||
|
|
Loading…
Reference in a new issue