zk icon indicating copy to clipboard operation
zk copied to clipboard

Supporting YAML frontmatters for metadata

Open mickael-menu opened this issue 3 years ago • 8 comments

Many Zettelkasten use a YAML frontmatter to provide note metadata, e.g.:

---
title: Improve the structure of essays by rewriting
date: 2011-05-16 09:58:57
keywords: [writing, essay, practice]
---

zk only supports title, we should support the rest as well:

  • [x] ~~date for the creation date~~
  • [x] ~~keywords and tags for tags~~
  • [ ] unknown keys could be saved and indexed for targeted search

Neuron also supports unlisted: true which could be interesting to disable indexing of particular notes.

mickael-menu avatar Feb 27 '21 13:02 mickael-menu

Hi! is the last task something that is still planned to be added? I am looking for the ability to use custom YAML keys for my own notes and have zk be able to search through for them.

jin-ahn avatar Dec 25 '21 19:12 jin-ahn

I didn't plan to implement it yet but that could be interesting. Could you give me an example of frontmatter and how you would like to use it from the CLI?

mickael-menu avatar Dec 25 '21 19:12 mickael-menu


title: week 1 date: 2011-05-16 09:58:57 class: WR101 Professor: Dr Joe Smith Reading: Smith 20-25 keywords: [writing, essay, practice]

I want to be able to do something where I find all notes from class 'wr101' or that have 'professor' as a keyword I understand that technically I can just add Wr101 and Dr Joe Smith to tags or keywords to be searchable, but I also want the ability to categorize my notes based on certain custom fontmattee keys that it has (like my 'professor' example above)

jin-ahn avatar Dec 26 '21 11:12 jin-ahn

Would something like this work?

zk list --metadata "professor:Dr Joe Smith"

or that have 'professor' as a keyword

For this, do you mean that zk list --metadata professor should match any note that has a professor metadata, no matter its value?

mickael-menu avatar Dec 26 '21 15:12 mickael-menu

Yes to both! Some of my notes are for classes, some of my notes are for work, so they don't always share the same metadata fields. I want to search based on a metadata field as a way to "categorize" my notes

jin-ahn avatar Dec 29 '21 00:12 jin-ahn

Hi, I am just wondering if this is still a planned feature. Thanks.

lyndhurst avatar May 29 '23 15:05 lyndhurst

I don't have the bandwidth to work on zk anymore, so the project is in maintenance mode for now.

However if someone wants to contribute this particular feature, I'd be happy to help navigate the codebase and review a PR.

mickael-menu avatar May 29 '23 18:05 mickael-menu

Thanks for maintaining the application even though you are lacking the time, please keep it alive !

For now I manage to do my filtering with the regex match strategy. I have spent months migrating my notes to nvim and zk, and I am just starting to get into more advanced zk configuration. It might seem simple but there is actually a lot of possibilities there.

Anyway I do plan to try and get familiar with the code base for other aspects like fzf searches and actions, so when I do, and if I feel capable, I will keep your offer to review / help with a PR in mind.

Thanks again for your time and effort :+1:

lyndhurst avatar May 30 '23 07:05 lyndhurst