官方地址
其他教程
元数据
元数据是一系列的键值对,可以给笔记,可以给note,list item ,task 添加元数据
如何添加元数据
Frontmatter
- frontmatter 是markdown的一种扩展,可以使用yaml 来添加元数据
---
alias: "document"
last-reviewed: 2021-08-17
thoughts:
rating: 8
reviewable: false
---
inline fields
- 使用方法为在文件的任意位置添加
- 如果你需要标注list itme 或者 task 需要使用中括号
- [ ] Send an mail to David about the deadline [due:: 2022-04-05].
另外还有隐含的元数据
page 中的元数据
Field Name | Data Type | Description |
---|---|---|
file.name | Text | The file name as seen in Obsidians sidebar. |
file.folder | Text | The path of the folder this file belongs to. |
file.path | Text | The full file path, including the files name. |
file.ext | Text | The extension of the file type; generally md. |
file.link | Link | A link to the file. |
file.size | Number | The size (in bytes) of the file. |
file.ctime | Date with Time | The date that the file was created. |
file.cday | Date | The date that the file was created. |
file.mtime | Date with Time | The date that the file was last modified. |
file.mday | Date | The date that the file was last modified. |
file.tags | List | A list of all unique tags in the note. Subtags are broken down by each level, soA will be stored in the list as [#Tag,1,A]. |
file.etags | List | A list of all explicit tags in the note; unlike file.tags, does not break subtags down, i.e. [#Tag/1/A] |
file.inlinks | List | A list of all incoming links to this file, meaning all files that contain a link to this file. |
file.outlinks | List | A list of all outgoing links from this file, meaning all links the file contains. |
file.aliases | List | A list of all aliases for the note as defined via the YAML frontmatter. |
file.tasks | List | A list of all tasks (I.e., | [ ] some task) in this file. |
file.lists | List | A list of all list elements in the file (including tasks); these elements are effectively tasks and can be rendered in task views. |
file.frontmatter | List | Contains the raw values of all frontmatter in form of key | value text values; mainly useful for checking raw frontmatter values or for dynamically listing frontmatter keys. |
file.day | Date | Only available if the file has a date inside its file name (of form yyyy-mm-dd or yyyymmdd), or has a Date field/inline field. |
file.starred | Boolean | if this file has been starred via the Obsidian Core Plugin “Starred Files”. |
列表和任务中的元数据
Field name | Data Type | Description |
---|---|---|
status | Text | The completion status of this task, as determined by the character inside the [ ] brackets. Generally a space ” ” for incomplete tasks and a “x” for complete tasks, but allows for plugins which support alternative task statuses. |
checked | Boolean | Whether or not this task status is empty, meaning it has a space in its [ ] brackets |
completed | Boolean | Whether or not this specific task has been completed; this does not consider the completionnon-completion of any child tasks. A task is explicitly considered “completed” if it has been marked with an ‘x’. If you use a custom status, i.e. [-], checked will be true, whereas completed will be false. |
fullyCompleted | Boolean | Whether or not this task and all of its subtasks are completed. |
text | Text | The plain text of this task, including any metadata field annotations. |
visual | Text | The text of this task, which is rendered by Dataview. It can be modified to render arbitary text. |
line | Number | The line of the file this task shows up on. |
lineCount | Number | The number of Markdown lines that this task takes up. |
path | Text | The full path of the file this task is in. Equals to file.path for pages |
section | Link | link to the section this task is contained in. |
tags | List | Any tags inside of the text task. |
outlinks | List | Any links defined in this task. |
link | Link | link to the closest linkable block near this task; useful for making links which go to the task. |
children | List | ny subtasks or sublists of this task. |
task | Boolean | If true, this is a task; otherwise, it is a regular list element. |
annotated | Boolean | True if the task text contains any metadata fields, false otherwise. |
parent | Number | The line number of the task above this task, if present; will be null if this is a root-level task. |
blockId | Text | The block ID of this task / list element, if one has been defined with the ^blockId syntax; otherwise null. |
DQL
比较类似于sql, 可是实现以下的功能
- Choosing an output format of your output (the Query Type)
- Fetch pages from a certain source, i.e. a tag, folder or link
- Filtering pages/data by simple operations on fields, like comparison, existence checks, and so on
- Transforming fields for displaying, i.e. with calculations or splitting up multi-value fields
- Sorting results based on fields
- Grouping results based on fields
- Limiting your result count
查询语法
输出类型
- TABLE: A table of results with one row per result and one or many columns of field data.
- LIST: A bullet point list of pages which match the query. You can output one field for each page alongside their file links.
- TASK: An interactive task list of tasks that match the given query.
- CALENDAR: A calendar view displaying each hit via a dot on its referred date.
数据来源
- tags
- folders
- note
- lint
Lists all pages inside the folder Books and its sub folders
```dataview
LIST FROM "Books"
```
Lists all pages that include the tag #status/open or #status/wip
```dataview
LIST FROM #status/open OR #status/wip
```
Lists all pages that have either the tag #assignment and are inside folder "30 School" (or its sub folders), or are inside folder "30 School/32 Homeworks" and are linked on the page School Dashboard Current To Dos
```dataview
LIST FROM (#assignment AND "30 School") OR ("30 School/32 Homeworks" AND outgoing([[School Dashboard Current To Dos]]))
```
Filter, sort, group or limit results
- *FROM like explained above.
- WHERE: Filter notes based on information inside notes, the meta data fields.
- SORT: Sorts your results depending on a field and a direction.
- GROUP BY: Bundles up several results into one result row per group.
- LIMIT: Limits the result count of your query to the given number.
- FLATTEN: Splits up one result into multiple results based on a field or calculation.
Lists all pages that have a metadata field `due` and where `due` is before today
```dataview
LIST WHERE due AND due < date(today)
```
Lists the 10 most recently created pages in your vault that have the tag #status/open
```dataview
LIST FROM #status/open SORT file.ctime DESC LIMIT 10
```
Lists the 10 oldest and incompleted tasks of your vault as an interactive task list, grouped by their containing file and sorted from oldest to newest file.
```dataview
TASK WHERE !completed SORT created ASC LIMIT 10 GROUP BY file.link SORT rows.file.ctime ASC
```