How to update config option ":default-home" from javascript?

If you’re trying to make it so your home page is always the journal page for today, you could make a sneaky redirection page with this content and set that as your default home page:

- #+BEGIN_QUERY
  {:inputs [:today]
   :query
   [:find (pull ?p [:block/name])
    :in $ ?t
    :where
    [?p :block/journal? true]
    [?p :block/journal-day ?t]]
   :view (fn [[p]] (call-api "push_state" :page {:name (:block/name p)}))}
  #+END_QUERY

It’ll query for the page with today’s date, then when it goes to render it, instead trigger a redirection.

2 Likes