Closed lpaiu closed 9 months ago
Hi @lpaiu
technically, the custom-sort
plugin is driven by textual sorting specifications.
The bookmarks integration is no exception from that rule. However, in this specific case, the textual sorting specification is created and consumed on-the-fly, automatically. That's why from the user perspective it behaves like config-free sorting.
Knowing the above technical aspect you can easily manipulate the sorting and change or extend it beyond the default behavior, if you are not discouraged by the need to write and modify the textual sorting specification by yourself.
The starting point is the sorting configuration injected on-the-fly if bookmarks integration is enabled in settings:
---
sorting-spec: |
target-folder: /*
bookmarked:
< by-bookmarks-order
sorting: standard
---
The above configuration is not visible anywhere in your vault.
The first step is to copy and paste the exact text of the above configuration, including the leading and trailing ---
lines and text indentation (using spaces, not tabs). Paste this at the top of a note named sortspec
(underlying file sortspec.md
obviously) in any location of your vault. I recommend editing the content of the sortspec
note in source mode in Obsidian (in the view menu) - this would keep the properties editor from interfering. After creating and populating the sortspec
note, as described, you can refresh sorting (via ribbon button, or 'sort-on' command, or file explorer context menu). The observable effect should be... exactly the same and without the sortspec
note. This is because - technically - the sorting specification should be read from the sortspec
now, with the sorting specification being exactly the same :-) Explicit sorting specification in note(s) override the one automatically injected on-the-fly (I'm skipping here the advanced scenarios, where the two configurations coexist)
When the above step works, you can start changing the order of non-bookmarked items by simply manipulating a single line in the sortspec
note and refreshing the sort (ribbon button, or ...)
The line to manipulate is sorting: standard
(the indentation is important, with spaces, not tabs)
To get the not bookmarked items (files and folders) ordered alphabetically, transform the line to < a-z
(and remember to refresh the sorting).
For ordering by creation date use > created
(newest items go first) - in this case creation date of folders remains undetermined, and folders get pushed to the bottom sorted alphabetically. To include folders in sorting by creation date use > advanced created
(the creation date of a folder in this case is derived from its children notes, if any exists).
An example modified sorting specification in sortspec
note could look like then:
---
sorting-spec: |
target-folder: /*
bookmarked:
< by-bookmarks-order
> advanced created
---
From this point, the way is open for more advanced specifications, for example - a different sorting per folder or per group of folders. Or you can insert (pin) some notes/folders above the ones sorted-by-bookmarks order, and so on.
thank you for your input! best wish, Seb
@SebastianMC
Hi SebastianMC,
I'm obsidian user of using your Plugin. I have been successfully using Standard sorting with bookmarks. So thank you for your hard work. However, I am wondering how to further define rules for notes that are not sorted in this way. For example, in a folder with 10 files, if only 5 are sorted using bookmarks, how can I sort the remaining 5? Perhaps in an a-z order or by creation date. I want to use this method to simplify the sorting of the remaining notes according to my bookmark sorting preferences.
Best wish, Kim Juno