Language:: Dataview
Program:: Obsidian
Link::

Summary

Display random notes using Dataview JS

Code

const numberToShow = 5;
const notes = dv.pages('#πŸ“/🌞 and -"Calendar"') 
.sort(() => 0.5 - Math.random()) 
.slice (0, numberToShow) 
.map (note => note.file.link); 
dv.list(notes);

Result

[!code] Result

Evaluation Error: SyntaxError: Unexpected token '>'

at DataviewInlineApi.eval (plugin:dataview:18885:21)
at evalInContext (plugin:dataview:18886:7)
at asyncEvalInContext (plugin:dataview:18896:32)
at DataviewJSRenderer.render (plugin:dataview:18922:19)
at DataviewJSRenderer.onload (plugin:dataview:18464:14)
at e.load (app://obsidian.md/app.js:1:1248334)
at DataviewApi.executeJs (plugin:dataview:19465:18)
at DataviewCompiler.eval (plugin:digitalgarden:10760:23)
at Generator.next (<anonymous>)
at eval (plugin:digitalgarden:90:61)


up:: πŸ§ͺ Code Diary