Finding empty pages

The problem

To keep things easy to find, it’s nice to only have pages in your page picker and query results that actually have content.

I used to clean them up by finding them in the command line with commands like ls -l. But after I accidentally deleted the wrong files using rm*, I wanted to find a better way.

* No actual files were harmed in this process. I had backups. :smiley:

The solution

On my index page, I have a little section with this simple query that shows me any pages that don’t have (much) content yet. I can easily navigate to them using the projected Wiki Link and run the delete command.

# Empty Pages
${query[[from index.tag "page"
    where size < 20 and size >= 0
    select { 
      Page = "[[" .. ref .. "]]",
      Created = created,
      Modified = lastModified }
    order by created]] or "No empty pages."}

Just wanted to share this quick snippet with you, folks. Perhaps it will be useful for anyone else. :heart:

5 Likes