Best way to detect virtual (generated on the fly) pages

What is the best way to detect virtual (generated on the fly) pages?

The primary use case is for hooks.{top|bottom}.where clauses. I do not want my hooks to appear in the πŸ“Œ tag listing pages (when you click a tag) as well as in the πŸ” pages (the search results pages). I tried where page !=~ /^πŸ“Œ/ but without success. Thanks for sharing some ideas.


Normally, I use queries to see what kind of objects and values are there to be potentionally matched in the object of interest (page, in this case). But this can’t be done with the virtual (generated on the fly) pages! So I think that accessing data in these pages should be documented? @zef

that’s because pages don’t have the β€œpage” as attribute but as β€œtag”. Have you tried β€œname” instead of it?
where tag = "page" and name !=~ /^πŸ“Œ/
or the same simpler without the need of regex
where tag = "page" and name !=~ "πŸ“Œ "

But the correct syntax for widget hooks to achieve this would be:

hooks.top.where: 'name !=~ "πŸ“Œ "'

or to include both :mag: and :pushpin:

with regex:

hooks.top.where: 'name !=~ /^πŸ” / and name !=~ /^πŸ“Œ /'

without Regex:

hooks.top.where: 'name !=~ "πŸ” " and name !=~ "πŸ“Œ "'

EDIT: sorry for the many edits, I was experimenting and discovering things on the go, and edited my initial reply, to not create multiple replies.

1 Like

Thanks, @Mr.Red. I settled on:

hooks.top.where: 'name !=~ /^[πŸ“ŒπŸ”] /' # and ...
1 Like

good choice & elegant … I’m not that good with regex, so i completely forgot about the β€œ[…]” One learns something something new every day…