Sort by newest keeps reseting #6399
Replies: 8 comments 3 replies
-
This is intended behavior: sorting a folder by newest using the context menu only applies temporarily and does not persist. To make a folder always sort by newest, you need to add special labels to the folder itself. Open the folder, then add the following labels:
This will make Trilium automatically and permanently sort the folder's notes by newest first every time you view it. You can find more details in the official sorting documentation. The UI sort action does not set these labels, so the sort order won't be remembered unless you add them manually. This is by design, not a bug. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
@dosu That worked amazingly for specific folders but the issue is for open today's journal notes I would have to put #sortDirection=desc into every new note everyday I wake up. Is there a way to make all new notes in journal example have #sortDirection=desc automatically when I go to my calender or use the open today's journal notes button? Oh and is there a way to shortcut open todays journal? |
Beta Was this translation helpful? Give feedback.
-
You only need to set #sorted and #sortDirection=desc on your journal's parent folder (the one with all your day notes). This will make all new and existing journal notes sort by newest automatically—no need to add the label to each day note individually. See details in the sorting docs. To quickly open today's journal note, use the built-in "todayInJournal" launcher. You can add this launcher to your sidebar or assign it a keyboard shortcut for instant access. To set a shortcut, right-click the launcher, choose "Edit," and set your preferred key combo. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
@dosu I'm not sure what I am doing wrong. The journal that contains all notes I put into the owned attributes #sorted #sortDirection=desc and yet the dates in the month notes don't sort based on newest. |
Beta Was this translation helpful? Give feedback.
-
The sorting labels (#sorted, #sortDirection=desc) only affect the immediate children of the folder they're attached to—they don't cascade to subfolders. So if your journal is structured like Year > Month > Day, you need to add those labels to each month folder (not just the top-level journal) to have the days inside each month sort by newest. The same applies if you have a Month > Day structure. There's currently no way to make these labels automatically apply to all subfolders—each relevant parent folder needs the labels set directly. More details are in the sorting documentation. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
@dosu if the labels only effect the immediate children and thus cannot automatically apply to "open todays journal note" then is there a way through maybe a script to do what I want? |
Beta Was this translation helpful? Give feedback.
-
You can use a script in Trilium to set sorting attributes (like #sorted and #sortDirection=desc) on your journal folders, but scripts can't run automatically when you open a note—there's no "note-open" event hook yet. Instead, you can create a custom launcher (button or keyboard shortcut) that runs a script to set the sorting labels on the relevant folders whenever you need. Here's a sample script you could use in a JavaScript code note (set to "frontend" type): // Replace with the noteId of your month folder or any folder you want to sort
const targetNoteId = "YOUR_MONTH_FOLDER_NOTE_ID";
await api.setNoteAttribute(targetNoteId, "sorted", "dateCreated");
await api.setNoteAttribute(targetNoteId, "sortDirection", "desc"); To use this:
This approach lets you automate the repetitive part, but you'll still need to trigger the script manually when needed. There isn't a way to have this happen automatically every time you open a note or create a new one, due to current Trilium limitations (reference, reference). To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
@whyeverythingsohard , you don't need scripts for that, Trilium already supports templates. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Hello! I've been trying to make sort by newest for folders where I put in daily stuff to remember but every time I do sort by newest it happens that one time instead of making that folder always sort by newest. Is this intended for some reason or is this a bug? Is there anyway to make this behavior changed to make the folder remember to always sort by the way it was told to sort?
TriliumNext Version
v96
What operating system are you using?
Windows
What is your setup?
Local (no sync)
Operating System Version
win10
Error logs
No response
Beta Was this translation helpful? Give feedback.
All reactions