Dataviewjs that pulls random notes only from a subfolder

Hey ShoulderMonster

I’m in the process of learning to pull a random note as well, and before i move to pure javascript in Templater instead of dataview (will share my method when done), let me share here a simple dataview implementation that may work for you :

­­(```dataview)
LIST quote 
FROM "Inspirational/Art"
FLATTEN hash(dateformat(date(today), "YYYY-MM-DD"), file.name, date(now).hour + date(now).minute + date(now).second) AS hash
SORT hash
LIMIT 1
(```)

In order to output more than one random note, you could either :

  • use LIMIT X where X is the number of random notes you want to see
  • or import this dataview more than once but make each hash variable unique, like hash1 and hash2 for example

Thanks to this forum post and this reddit post helped me with figuring this out.