til / Obsidian Bases
Obsidian v1.9.0
, currently in beta, introduces a new core plugin called Bases. In the current iteration of my notes, I can replace all my needs for dataview.
For example, the notes created today example can be recreated using the following Bases code. To get to this code, you’ll need to open the *.base
file in a text editor. That’s at least the only way I’ve found so far.
It’s all very new and shiny, but I think this can be a great addition to Obsidian in the long run.
# Without filters, you'll see all the files in the vault.
# Use these to narrow down the files for the views.
filters:
# Any of the conditions can be true
or:
# Any file that links to this daily note
- linksTo(file.file, this.file.path)
# Any file that was created today
- contains(property.created, this.file.name)
# Formulas allows us to create custom data for the views
formulas:
# This formula prints a time as HH:mm if the note was created today
# and YYYY-MM-DD HH:mm when the note _wasn't_ created today.
# It's currently a bit verbose, but I couldn't find a way of
# getting the HH:mm format. The built-in time function
# returned it as HH:mm:ss.
created_time: if(dateBefore(created, date(updated)), created, concat(hour(created), ":", if(minute(created) < 10, concat(0, minute(created)), minute(created))))
# Which properties to display and the prettified title to show in the header
display:
file.name: Note
formula.created_time: Created
# Views to display (currently only table exists)
views:
- type: table
name: Daily notes
# Same as filters above, but only applied to this view
filters:
# All filters need to be true
and:
- not(taggedWith(file.file, "daily"))
- not(taggedWith(file.file, "monthly"))
# Order to display the columns
order:
- file.name
- formula.created_time
# How to sort columns
# Sort by:
# - Our custom created_time ascending first
# - Then by the file name descending
sort:
- column: formula.created_time
direction: ASC
- column: file.name
direction: DESC