I’ll share a use case for Bases inspired by the Recent Files
community plugin. In short, I want to replicate the functionality of the Recent Files
plugin using the new core plugin, Bases.
Preview
In Obsidian, whenever you open note A and then switch to note B, note A will automatically appear in this “Recent Files” list.
Configuration Tutorial
Here is a detailed guide on how to configure Bases to automatically log your recently visited notes.
Bases Configuration
- First, create a new Base.
- Rename it to “Recent Files” (or any other name you prefer; this is just for easy recognition).
- Configure the filter.
Here are a few important tips:
- Select Configure for this view only to avoid interfering with other views you might have.
- Add two filter conditions:
- File extension
is .md
(this is optional, depending on your preference). - Define the file modification time using the query
file.mtime > now() - "1 d"
. This shows files modified in the last day. If you want to show files from the last 7 days, simply change the1
to a7
.
- File extension
Here’s the challenge: Bases filters notes based on their properties. However, there is no built-in “file opened time” property. The file.mtime
we used above is the file modified time. This means a note will only appear in our list if you actually modify its content. If you just open it without making any changes, it won’t be tracked. Therefore, Bases alone cannot fully replicate the Recent Files
functionality.
So, what’s the solution?
It’s actually quite simple.
Remember the Linter plugin I’ve shared before? (link to my previous article)). One of its essential features for my workflow is its ability to automatically manage created
and updated
time properties in the frontmatter.
We will leverage the Linter plugin to add an “updated” timestamp property to our notes (I use the property key updated
).
To do this, you need to enable a specific setting in Linter, as shown below.
The key is to enable the “Update the ‘updated’ date on file open” option. This will automatically update the updated
property in your note’s frontmatter every time you open it, even without making changes.
- Final Step: Sort. Now, go back to your Bases view and set the sorting rule. Sort by the property you defined in Linter (
updated
) and set the order to Newest to oldest (descending).
For quick and easy access, you can drag your newly created “Recent Files” Base from its tab into the sidebar. This will dock it as a permanent icon, just as shown in the first preview image of this guide.
Final Thoughts
Using plugins in combination to solve unique problems is one of my favorite things to explore in Obsidian. I hope you find this useful. Cheers!