# Displaying a random quote in my daily note?

**URL:** <https://forum.obsidian.md/t/displaying-a-random-quote-in-my-daily-note/27225>\
**Category:** Basement\
**Created:** [November 16, 2021, 5:29pm UTC](https://forum.obsidian.md/t/displaying-a-random-quote-in-my-daily-note/27225 "2021-11-16T17:29:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![notflip](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/n/3e96dc/32.png) [@notflip](https://forum.obsidian.md/u/notflip)\
**Post date:** [November 16, 2021, 5:29pm UTC](https://forum.obsidian.md/t/displaying-a-random-quote-in-my-daily-note/27225/1 "2021-11-16T17:29:43Z")

</div>

### Things I have tried

I’ve been looking at Dataview, but it seems (I might be wrong!) that Dataview only works with full pages, and not with blocks? I was thinking of having a “Quotes” page, with different blocks, and was hoping to select a random one to be places in my daily note template.

Has anyone tried or achieved this?

---

<div class="post-metadata">

**Author:** ![argentum](https://forum.obsidian.md/user_avatar/forum.obsidian.md/argentum/32/7733_2.png) [@argentum](https://forum.obsidian.md/u/argentum)\
**Post date:** [November 17, 2021, 10:34pm UTC](https://forum.obsidian.md/t/displaying-a-random-quote-in-my-daily-note/27225/2 "2021-11-17T22:34:45Z")

</div>

I have a vague feeling that there is a plugin for this?

---

<div class="post-metadata">

**Author:** ![dknight212](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dknight212](https://forum.obsidian.md/u/dknight212)\
**Post date:** [November 25, 2021, 10:25am UTC](https://forum.obsidian.md/t/displaying-a-random-quote-in-my-daily-note/27225/3 "2021-11-25T10:25:09Z")

</div>

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:

```auto
$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:

```auto
<% 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.

---

<div class="post-metadata">

**Author:** ![Craig](https://forum.obsidian.md/user_avatar/forum.obsidian.md/craig/32/8831_2.png) [@Craig](https://forum.obsidian.md/u/Craig)\
**Post date:** [November 25, 2021, 11:58am UTC](https://forum.obsidian.md/t/displaying-a-random-quote-in-my-daily-note/27225/4 "2021-11-25T11:58:16Z")

</div>

The Dice Roller plugin can do this. If you had a page with different quotes, where each quote was a block, e.g.:

**Quotes.md**

```auto
This is quote one.

This is quote two.

This is quote three.

```

…then you can use Dice Roller to display a random block from your quotes page:

**MyPage.md (edit)**

```auto
`dice: [[Quotes]]`

```

**MyPage.md (preview)**

```auto
This is quote two.

```

---

<div class="post-metadata">

**Author:** ![dknight212](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/d/c77e96/32.png) [@dknight212](https://forum.obsidian.md/u/dknight212)\
**Post date:** [November 25, 2021, 12:10pm UTC](https://forum.obsidian.md/t/displaying-a-random-quote-in-my-daily-note/27225/5 "2021-11-25T12:10:34Z")

</div>

Much better solution!

---

<div class="post-metadata">

**Author:** ![system](https://forum.obsidian.md/uploads/default/original/3X/b/e/bec35fbd23ab28909bb6bfe62cb32eb82dd34019.png) [@system](https://forum.obsidian.md/u/system)\
**Post date:** [December 25, 2021, 12:11pm UTC](https://forum.obsidian.md/t/displaying-a-random-quote-in-my-daily-note/27225/6 "2021-12-25T12:11:15Z")

</div>

Closed on December 25, 2021, 12:11pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
