From adaec2ca5820ea6d5f4d26ad85f50c9308de2150 Mon Sep 17 00:00:00 2001 From: Kai Yorke Date: Thu, 20 Mar 2025 14:01:50 +1300 Subject: [PATCH] Add examples to documentation --- docs/data-sources/vault-data.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/data-sources/vault-data.md b/docs/data-sources/vault-data.md index 4e618df..56bb70c 100644 --- a/docs/data-sources/vault-data.md +++ b/docs/data-sources/vault-data.md @@ -51,4 +51,27 @@ Introduced in 0.20.0 | `target` | Full path of the target of the link | | `position` | JSON object containing information about location of the link | | `display_text` | Text displayed on the page for that link | -| `target_exists` | information if the target file exists. 1 if it exists, 0 otherwise | \ No newline at end of file +| `target_exists` | information if the target file exists. 1 if it exists, 0 otherwise | + +#### Frontmatter links + +Links that appear in a file's frontmatter (Obsidian properties) contain a `frontmatterKey` property in the `position` +JSON object. This can be used to identify links that are in the note body or within a specific frontmatter property. + +For instance, to query all links to the current file that appear in the body of a note: + +```sql +SELECT * FROM links +WHERE target = @path +AND json_extract(position, '$.frontmatterKey') IS NULL +``` + +`frontmatterKey` can be used to select links within a specific property. A Map of Content, for instance, may wish to +show a list of files that list the MOC as a type: + +```sql +LIST +SELECT a(path) FROM links +WHERE target = @path +AND json_extract(position, '$.frontmatterKey') = 'type' +```