Sorting Folders by Dates in Titles #183
-
Hi @SebastianMC, Thank you for this incredible plugin! I’m having trouble configuring it to handle folders with dates in their titles and would appreciate your guidance. I also use the Folder Notes plugin, but I know your plugin supports it, so I suspect the issue is with my configuration. Problem:I have folders with dates in the format
What I’ve Tried:
Example:Initial Structure:
Desired Output:
Is there a way to configure the plugin to sort by dates extracted from folder names while using Folder Notes? Thank you for your time and help! Best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
Hi @JSG-1 you example involves a series of tricky cases: 1. Sorting by folder datesIn Obsidian, folders don't come with date metadata (no creation date, no modification date). By design. This prevents any sorting based on folder creation/update dates. 2. Use dates in titles for sortingThe plugin supports part of the scenarios which you describe.
This works because the dates in format 'YYYY-MM-DD' can be treated as a dash-separated sequence of numbers An example snippet of sorting specification would be then: /+ \-D+ ...
/+ ... \-D+
> a-z The additional syntax At the same time, there is no support for infix matching-and-extraction of numbers. It is intentional. Overall, the plugin doesn't support free-form regexp matching against titles intentionally. It is easy to create a regexp introducing backtracking and kill the performance in result, blocking the Obsidian UI even for relatively small vaults. Matching of infix notation (e.g. dates anywhere in the title) is a good example of that. 3. Mixing of different sorting methods for a single-pass sortingThis is not supported, a far too advanced feature. You cannot specify: for a folder take the date from tile, and if there is no date in title, take the date from metadata. Not supported. RecapThere are three unsupported features:
Excluding these unsupported features, an example sorting spec could look like: sorting-spec: |
target-folder: /
/+ /folders \-D+ ...
/+ /folder ... \-D+
> a-z, > advanced created The resulting sorting would be:
|
Beta Was this translation helpful? Give feedback.
-
Hi @SebastianMC Thank you so much for your detailed response and for taking the time to explain the plugin's capabilities and limitations. Your explanation has given me the clarity I need on how best to proceed, and I now have a much better understanding of how to configure my sorting rules effectively. I really appreciate your help and the work you’ve put into this amazing plugin. Best regards, |
Beta Was this translation helpful? Give feedback.
-
Hi @SebastianMC , I saw that you moved this to a discussion. I wanted to let you know that I tried every which way to implement the change you suggested with no luck. I also used Chat-01 to try multiple ways of getting the sort order i want with also no luck. Attached are my config file, a screenshot of a testing folder i created to test the sort, and a screenshot of the plugin settihngs. Is there anything you would suggest that I could try next? Best regards, JSG |
Beta Was this translation helpful? Give feedback.
-
Hi @SebastianMC, Thank you for your quick response and helpful feedback! I followed your suggestions step-by-step, and here’s what I found:
This behavior seems to suggest that the first line of the configuration might take precedence over subsequent rules. Next Steps:What would you recommend I try next to troubleshoot this issue in my main vault? Is there a way to ensure that the folder date sorting rule is applied correctly after the initial ordering of top-level folders? Attachments:To clarify the issue, I’ll include the following:
Thank you again for your time and assistance! Best regards, ![]() ![]() ![]() |
Beta Was this translation helpful? Give feedback.
-
Forgot to include the updated config file. |
Beta Was this translation helpful? Give feedback.
-
Hi @SebastianMC, Thank you so much for your detailed explanation and guidance—it worked perfectly! I really appreciate your patience and the effort you put into helping me resolve this issue. Do you happen to have a Buy Me a Coffee page or a similar platform? I’d love to show my appreciation for your help and the work you’ve done on this amazing plugin. Wishing you a very happy new year and all the best for 2025! Best regards, |
Beta Was this translation helpful? Give feedback.
Hi @JSG-1
thanks for the impressive amount of details and context and log of steps!
Putting all of this together, the answer lies in the complex sorting rules :-)
In this case, the relevant logic of the plugin is to always choose the more specific rules if multiple rules are specified and applicable to a folder.
In your example, the problematic folder is:
Projects/FUNDING/Testing
Its subfolders aren't sorted as expected.
Then, when I read all the sorting rules in
JSGsorting
I see two applicable rules:target-folder: /*
/*
means to apply a rule to all folders in the vault, regardless of the depthtarget-folder: Projects/*