官方地址

其他教程

元数据

元数据是一系列的键值对,可以给笔记,可以给note,list item ,task 添加元数据

如何添加元数据

Frontmatter

  • frontmatter 是markdown的一种扩展,可以使用yaml 来添加元数据
 --- 
 alias: "document" 
 last-reviewed: 2021-08-17 
 thoughts: 
	 rating: 8 
	 reviewable: false 
 ---

inline fields

  • 使用方法为在文件的任意位置添加
 
Basic Field:: Some random Value 
**Bold Field**:: Nice!
  
  • 如果你需要标注list itme 或者 task 需要使用中括号
- [ ] Send an mail to David about the deadline [due:: 2022-04-05].

另外还有隐含的元数据

page 中的元数据

# Metadata on Pages

Field NameData TypeDescription
file.nameTextThe file name as seen in Obsidians sidebar.
file.folderTextThe path of the folder this file belongs to.
file.pathTextThe full file path, including the files name.
file.extTextThe extension of the file type; generally md.
file.linkLinkA link to the file.
file.sizeNumberThe size (in bytes) of the file.
file.ctimeDate with TimeThe date that the file was created.
file.cdayDateThe date that the file was created.
file.mtimeDate with TimeThe date that the file was last modified.
file.mdayDateThe date that the file was last modified.
file.tagsListA 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.etagsListA list of all explicit tags in the note; unlike file.tags, does not break subtags down, i.e. [#Tag/1/A]
file.inlinksListA list of all incoming links to this file, meaning all files that contain a link to this file.
file.outlinksListA list of all outgoing links from this file, meaning all links the file contains.
file.aliasesListA list of all aliases for the note as defined via the YAML frontmatter.
file.tasksListA list of all tasks (I.e., | [ ] some task) in this file.
file.listsListA list of all list elements in the file (including tasks); these elements are effectively tasks and can be rendered in task views.
file.frontmatterListContains 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.dayDateOnly 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.starredBooleanif this file has been starred via the Obsidian Core Plugin “Starred Files”.

列表和任务中的元数据

# Metadata on Tasks and Lists

Field nameData TypeDescription
statusTextThe 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.
checkedBooleanWhether or not this task status is empty, meaning it has a space in its [ ] brackets
completedBooleanWhether 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.
fullyCompletedBooleanWhether or not this task and all of its subtasks are completed.
textTextThe plain text of this task, including any metadata field annotations.
visualTextThe text of this task, which is rendered by Dataview. It can be modified to render arbitary text.
lineNumberThe line of the file this task shows up on.
lineCountNumberThe number of Markdown lines that this task takes up.
pathTextThe full path of the file this task is in. Equals to file.path for pages
sectionLinklink to the section this task is contained in.
tagsListAny tags inside of the text task.
outlinksListAny links defined in this task.
linkLinklink to the closest linkable block near this task; useful for making links which go to the task.
childrenListny subtasks or sublists of this task.
taskBooleanIf true, this is a task; otherwise, it is a regular list element.
annotatedBooleanTrue if the task text contains any metadata fields, false otherwise.
parentNumberThe line number of the task above this task, if present; will be null if this is a root-level task.
blockIdTextThe 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

查询语法

```dataview 
	<QUERY-TYPE> <fields> 
	FROM <source> 
	<DATA-COMMAND> <expression> 
	<DATA-COMMAND> <expression> 
	...

输出类型

  • 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.
Lists all pages in your vault as a bullet point list
	```dataview 
	LIST 
	```
	
Lists all tasks (completed or not) in your vault 
	```dataview 
	TASK 
	```
	
Renders a Calendar view where each page is represented as a dot on its creation date. 
	```dataview 
	CALENDAR file.cday 
	```
	
Shows a table with all pages of your vault, their field value of due, the files' tags and an average of the values of multi-value field working-hours 
	```dataview 
	TABLE due, file.tags AS "tags", average(working-hours)
	 ```
 

数据来源

  • 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 
	```