Root directory for pages

One more question for today: I can set Journals in “./Journals”, people in “./People”, etc. But for general pages, can I change the directory in which the pages are created?

Example: If I create a page for [[Test]], right now it goes in ./Test.md. I’m wondering if it’s possible to put otherwise uncategorized pages in, e.g., ./Pages via a setting without manually typing the path? The use case is importing a large logseq collection (wish me luck) and not wanting my root directory to have several hundred files in it.

No, this is not possible and I also don’t really hoe this would work in practice to be honest.

I might not have explained this very well. I may see if I can whip up a proof of concept, because all I’m imagining is a user configurable “document root”. Or, put another way, a path that all documents go into if there is no path specified. I’m still feeling my way around SB coming from Logseq so please bear with me as I learn the tool, but for some reason having potentially thousands of documents in the root directory of the space is confusing me.

Anyway, let me take a look and see if I can work up something that isn’t dumb.

If you just want to import documents from another tool like Logseq then you can also easily move them via the command line or file explorer of your system.

If it’s for creating new pages, then I suppose you could make a dedicated command for it that creates the page in a specific sub folder if it doesn’t start with one that is predefined by you in the command.

Pseudo lua code (don’t know Lua nor the SB API by heart, but it might help):

command.define {
  name = 'New page',
  run = function()
    local name = prompt('New page name:')
    if (name == '') do
        return -- no page
    end

    local root = name.split('/')[1]
    if (root in { 'Journal', 'People', ... }) then
        createPage(name)
    else
        local defaultRoot = getSpaceConfig('newPageRoot', 'Pages'
        createPage(defaultRoot .. '/' .. name) 
    end
  end
}

Where prompt and newPage should be replaced with the right functions from the API.

You could even read the default root from the settings (system.getSpaceConfig if I remember correctly).

Downside is that creating new pages via navigation (Ctrl+K) will still create them in the regular root (Shift-Enter).