Enhancement: Add the ability to sort by date field. #136

Closed
opened 2026-10-05 02:27:18 +02:00 by adam · 5 comments
Owner

Currently, you can sort by last modified, but my content doesn't have that field.
The file list shows the 'date' field that I do have in my content, but I can't sort files by it.

image

Currently, you can sort by last modified, but my content doesn't have that field. The file list shows the 'date' field that I do have in my content, but I can't sort files by it. ![image](https://user-images.githubusercontent.com/30990811/140983804-6fff3c2c-86f8-4a93-9d88-5495de1cc144.png) <!-- github-sync-id:1048942690 -->
adam closed this issue 2026-10-05 02:27:19 +02:00
Author
Owner

This can be linked to #76 as I want to allow open sorting based on anything you define.

Currently, the last modified sorting is done based on the file stats itself, not from a metadata field in the file,

This can be linked to #76 as I want to allow open sorting based on anything you define. Currently, the last modified sorting is done based on the file stats itself, not from a metadata field in the file, <!-- github-comment-id:964958518 -->
Author
Owner

Support for custom sorting will be added in 5.5.0. You can already test it out in the latest beta. For this, a new setting has been added. More information about it can be found here: https://beta.frontmatter.codes/docs/settings#frontmatter.content.sorting

"frontMatter.content.sorting": [
  {
    "title": "Date (asc)",
    "name": "date",
    "order": "asc",
    "type": "date"
  },
  {
    "title": "Date (desc)",
    "name": "date",
    "order": "desc",
    "type": "date"
  }
]
Support for custom sorting will be added in `5.5.0`. You can already test it out in the latest beta. For this, a new setting has been added. More information about it can be found here: https://beta.frontmatter.codes/docs/settings#frontmatter.content.sorting ``` "frontMatter.content.sorting": [ { "title": "Date (asc)", "name": "date", "order": "asc", "type": "date" }, { "title": "Date (desc)", "name": "date", "order": "desc", "type": "date" } ] ``` <!-- github-comment-id:965254942 -->
Author
Owner

It works as expected in beta. One preference I would have is to find a way to preserve the last chosen sort method, so that when you go back to the Dashboard, the same sort as last time is applied.

It works as expected in beta. One preference I would have is to find a way to preserve the last chosen sort method, so that when you go back to the Dashboard, the same sort as last time is applied. <!-- github-comment-id:966871425 -->
Author
Owner

Again, a great suggestion!

Again, a great suggestion! <!-- github-comment-id:966921692 -->
Author
Owner

@bwklein sorting state is now kept. So when opening the dashboard again, it will use the last used selection.

@bwklein sorting state is now kept. So when opening the dashboard again, it will use the last used selection. <!-- github-comment-id:967020241 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#136