I’m looking for a way to display a quote of the day on my main tiddler. Well more specifically, an anything of the day. I can’t figure out if there is a way to get it to update each morning. Does anyone have any ideas?
From where should come the quote ? Do you have a list from which you need to pick a quote at random each day, sort of like what minecraft does for its splashscreen ? Should a quote appear on a given day ?
EDIT:
Here’s a possible solution, depending on your requirements:
<$let
quotes="[{!!list-of-quotes}split[
]]"
quotes-count={{{ [subfilter<quotes>count[]] }}}
day-of-year=<<now dddd>>
quotes-index={{{ [<day-of-year>remainder<quotes-count>] }}}
quote-of-the-day={{{ [subfilter<quotes>zth<quotes-index>] }}}
>
<<<.tc-big-quote
<<quote-of-the-day>>
<<<
</$let>
The quotes are in the field “list-of-quotes”, the order is not random. Each quote will be cycled every day. The downside is that it will cycle trough a list of max 365 quotes, since it’s based on the number of the day in the year.
https://demos.tiddlyhost.com/#Quote%20of%20the%20day
Another option is to create a startup action on each new day and cycle trough the list if the day is greater than the last day when the list was cycled:
\define startup-action-new-day()
<!-- In a tiddler with the tag $:/tags/StartupAction and the field list-of-quotes containg a list of quote separated by linebreaks -->
<$action-setfield list-of-quotes={{{
[{!!list-of-quotes}split[
]butfirst[]]
[{!!list-of-quotes}split[
]first[]]
+[join[
]]
}}}/>
\end
<$list filter="[{!!modified}format:date[YYYY0MM0DD]match<now YYYY0MM0DD>]" variable="ignore">
<<startup-action-new-day>>
</$list>
Then display the quote:
{{{
[{!!list-of-quotes}split[
]first[]]
}}}
That’s really good I didn’t mention how I was making the list as I was generally wondering how to make something happen daily. This should work great. Out of curiosity, how would you make these work with random quotes, instead of sequential ones?
saqimtiaz has made a shuffle filter operator, I think it would be appropriate for this use: Demos — Q&A and tools for tiddlywiki
Well after quite a bit of help, and a lot of searching around, I got this properly working. So anyone that wants a working quote of the day tiddler, here:
$__tags_macro_seededrandom.js.tid
I’ll also leave this here, for anyone wanting to gather some quotes