Displaying a random quote in my daily note?

I don’t think this is possible natively with any plugin. I’ve defined a very simple Powershell script which I can then call with a user-defined function in Templater:

$quotefile = 'location of file'
Get-Random -InputObject (Get-Content $quotefile)

The quote file is just a series of quotes in separate paragraphs (so you can’t have multi-paragraph quotes). No reason why the file can’t be in your Obsidian vault.

In Templater define a user defined system command function which points to the above script. I needed to keep the .ps1 extension:

Then in your template just reference the new function as:

<% tp.user.randomquote() %>

This seems to work for me. I’d obviously prefer a more native solution, especially since this won’t work when I’m on my mobile devices. But it might help someone else.

1 Like