Proposal: "hardcode" Library/ prefix to mean "meta"

Once upon a time I thought it would a great idea to make as much in SilverBullet "location" independent. Up to that point a lot of "special" pages, like templates, page templates and other things relied on naming conventions, like page templates would have to live in "Templates/Page" (or whatever, I don't remember the specific thing).

Then one day I thought — no, this will make things harder (especially as I was thinking of how redistributable libraries and templates could work), we should not rely on names for filter, but use tags. Hence the `#meta/* mechanism was born on top of which this "page picker" vs "meta picker" split, and later index.contentPages() vs index.metaPages() were built: all on the rule "if it has a #meta or #meta/* tag, it's considered "meta").

Now, a few years later, I'm reconsidering again and thinking if a hybrid approach would not make sense. Right now I struggle a bit with functionality that is just makes most sense to be built on the server side (often for scalability or performance reasons) like full-text search. However, I find myself having to duplicate index-based logic there (like parsing the page text for the presence of #meta tags at specific ways) on the server, which I don't like. And in general, there have been an increasing number of hacks and exceptions to make this work.

So the proposal I have is to simplify and agree that whatever is in the Library folder is considered a meta page (or maybe library page, we may want to rebrand, opinions welcome). Period. That's the rule. Meta tags will stay around as before, because they're still useful to have location independent means to mark "this is a page template" (that can be scattered anywhere within the Library folder). It is already the case that Library/Std is mounted in to implement various built-in features (and plugs), in practicase you were already kind of forced/suggested to put all your "tool" pages and tweaks into that folder. This would just hardcoded that idea and make it clear: this is where to put this stuff.

Thoughts? Any strong objections?

FAQ:

  • Can we make this configurable? Hypothetically yes, but honestly I think it will make thing super difficult. As mentioned, it's already the case that Library/Std is what ends up in every space, and there's no way around it, so the "Library" folder in your space is effectively kind of reserved already.
  • What about CONFIG? Good question, either the rule will be "Library" and "CONFIG" or I implement a migration step that moves your CONFIG page into Library/Config for you.

Seems like a good idea to me.

I had to double check because I thought this was the default. Turns out I already have a page transform rule in CONFIG to do this:

local pageTags = {
  {match = function(p) return p.name:startsWith("Library/") end, tag = "meta"},
...
}

tag.define {
  name = "page",
  transform = function(p)
    for _, rule in ipairs(pageTags) do
      local tags = p.tags or {}
      if rule.match(p) and not table.includes(tags, rule.tag) then
        table.insert(tags, rule.tag)
        p.tags = tags
      end
    end
    return p
  end
}

For other config, I try to keep most of my personal config in Library/Personal/ but I wouldn't be opposed to CONFIG moving to Library/CONFIG. If you ever open your SB space in something other than SB, having it out of the root directory makes sense too.

That makes sense to me. Tiddlywiki does something similar with pages that start with the prefix $:/; those are "system" pages and don't show up in normal operations like search:

Ok, so this is going to happen soon I'll be working on this on the main branch, and if it all pans out it should simplify a lot of things on the technical side and have limited implications on the user side.

One thing I missed before is Repositories/ (which really should have been Repository/) which we'll have to move under Library as well.

To prepare for this today, simply move all your space-lua, space-style in pages under Library/ and all should be good.

I'll add automatic migration code to rename existing CONFIG pages to Library/Config to keep this simple.

Repository maintainers: change paths to Library/Repository/whatever already now.

Hate to be that guy, but I don't suppose we can make "Breaking:** [[Space Lua]] and [[Space Style]] blocks now only run from Library/" configurable?

Anything is always possible, but this one in particular would need a VERY good reason. So my question is: why? What’s your workflow that this is breaking?

It's just a preference. Carry on