Custom sorting based on YAML frontmatter creation date? #179
-
How do i use your add in to sort the files in a folder by the note’s “created” property in my YAML frontmatter? I want it to do it off of this frontmatter property, NOT the file property as the source of truth like some other admins do. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Hi @bloominburges, the base idea of sorting specification which you described is: ---
sorting-spec: |
> a-z by-metadata: created
--- The above simple sorting spec works under the following assumptions:
|
Beta Was this translation helpful? Give feedback.
-
Got it… thanks. |
Beta Was this translation helpful? Give feedback.
-
The syntax of sorting order specification in this particular example comprises three elements and two of them are relevant to your question:
To change the order direction to reverse you need to switch
The spec to use is then:
|
Beta Was this translation helpful? Give feedback.
-
Hi @SebastianMC, thank you for the great plugin! I am trying to achieve the same thing, except my metadata attribute is named "Last updated at" (containing an ISO date string).
I used the following
My notes don't get sorted in the folder. Is it because attribute |
Beta Was this translation helpful? Give feedback.
-
Hi @thomas-bouvier, in the scenario which you described you only need to remove the quotation marks and you should be good: ---
sorting-spec: |
< a-z by-metadata: Last updated at
--- The metadata values expressed using ISO date format of YYYY-MM-DD can be used directly for sorting: treating them as plain text for sorting gives correct result. |
Beta Was this translation helpful? Give feedback.
-
I confirm this is working. Thank you. I think this issue can be closed. |
Beta Was this translation helpful? Give feedback.
Hi @thomas-bouvier,
in the scenario which you described you only need to remove the quotation marks and you should be good:
The metadata values expressed using ISO date format of YYYY-MM-DD can be used directly for sorting: treating them as plain text for sorting gives correct result.