How to match all pages under `/Dailies/`?

Hi.

Coming from Journal previous day and next day navigation - Tricks & Techniques - SilverBullet Community. I want to port it to my layout.

Mine layout is:

  • /Dailies/<year>/<month>/<day>

So today would be /Dailies/2025/01/29.

I have tried several pattern, none of them work.

hooks.top.where: 'name =~ /^Dailies/'  # only works for top level `/Dailies` page
hooks.top.where: 'name =~ /^Dailies\/.+\/.+\/.+$/' # doesn't work
hooks.top.where: 'name =~ /^Dailies\/\d{4}\/\d{2}\/\d{2}$/' # doesn't work

Any suggestions?

Thanks!

Hi there,

Sorry you’re having difficulties.

The problem doesn’t seem to be the pattern - hooks.top.where: 'name =~ /^Dailies/' works fine for me as the way to match the pages.

But when it comes to figuring out the date from the page URL, it fails. The code is simplistic, and based on the assumption that ‘the last bit after the slash is the date in string form’. That’s not true in your new case (the code tries to parse ‘29’ as an entire date today).

As a quick (very inelegant) fix you could replace the space-script line:

const date = parts[parts.length - 1];

with:

const date = '' + parts[parts.length - 3] + '-' + parts[parts.length - 2] + '-' + parts[parts.length - 1];

and that should get you up and running, or at least give you a better place to start.

Hope this helps,

Geoff

Your hooks worked for me…

hooks.top.where: 'name =~ /^Dailies/'  # Worked on all levels
hooks.top.where: 'name =~ /^Dailies\/.+\/.+\/.+$/' # Worked on ONLY the "Dailies/<year>/<month>/<day>" pages
hooks.top.where: 'name =~ /^Dailies\/\d{4}\/\d{2}\/\d{2}$/' # Worked on ONLY the "Dailies/<year>/<month>/<day>" pages

I have this widget template:

---
description: test widget
tags: template
hooks.top.where: 'name =~ /^Dailies/'
---
# TEST WIDGET
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(expand for images)



So I think something else may be going on, can you post what you have added for your widget template and space-scripts to see if there is anything in the modifications you would have had to make to @OpinionatedGeek’s templates/scripts that may be causing issues?