Hi!
I came across silverbullet a few weeks ago and I love it!
But I can not figure out how to create a query (or a command) to list all pages that are not linked on any other page.
Or the other way around: All pages that are mentioned but not exist and on which pages the mention is.
If I understand you (and SB) correctly, I think “pages that are mentioned but not exist” would just be Aspiring Pages? And I believe we already have a really simple query built in to pull up a list of those pages:
To list all pages that aren’t linked to from anywhere you could use something like this template, even though this could probably be done faster and cleaner in space-lua:
{{#each @p in ({page}) }}
{{#if count( ({link where toPage = @p.name and page != @page.name}) ) = 0}}
- [[{{@p.name}}]]
{{/if}}
{{/each}}
aspiring-page is the answer of the second part.
What left are the orphan pages: Existing pages that are not mentioned on any other page. @22rw’s solution does not work for me.
It seems to work fine for me with the (admittedly big) caveat that it doesn’t/can’t count links that are within a template/query. So while I have a page in my page that has links to all of my pages tagged with #linux, most of those pages are listed by @22rw’s template.
Also if you don’t care about template/meta pages you can add some extra checks:
{{#each @p in ({page}) }}
{{#if @p.tags != "template" and @p.tags != "meta" and (count( ({link where toPage = @p.name}}) ) = 0)}}
- [[{{@p.name}}]]
{{/if}}
{{/each}}