Auto create pages and assign page-tags when using namespaces

Problem:

It is cumbersome to type out [[[[Book]] Name of Book]]. And, currently, doing so breaks the page with the linked references filters (see here: Double Brackers in Filters prevents the page from loading · Issue #1455 · logseq/logseq · GitHub).

Proposed Solution:

Auto-create page and auto-assign page-tags when using namespaces in links.

Use Case:

  1. User creates page: [[Book/Title of Book]]
  2. If [[Book]] does not exist Logseq automatically creates the page
  3. Logseq auto-assigns page-tags: Book to [[Book/Title of Book]] page
  4. On the [[Book]] page user can filter the linked references by selecting [[Book/Title of Book]]

Related feature request with many reasons why namespaces are useful:

copy/pasting from the discord convo [[20210313]]

@luke @andrea @tienson I’d love to have namespaces, but I wonder what delimiter should be used ? forward slash / is an illegal character for filenames in windows/linux, so I guess it will be autoreplaced by _ so [[this/page]] will correspond to this_page.md ? I’d rather use . so [[this.page]] is actually this.page.md (dendron style)(edited)

this would avoid conflicting cases when titles use illegal characters for filenames like [[this/page]] and [[this*page]] ?

luke85 Today at 6:48 PM

yeah, you are right, they are auto-replaced with _
I think Book.Name of Book works just fine
gives the same aesthetic appeal imo

cannibalox Today at 6:50 PM

yes me too, I prefer . as a namespace delimiter because it will retains the same possibilities and avoid the weird edge-cases where fileTitle is different from fileName

3 Likes

The initial support for namespace pages is on logseq.com now!

If there’s a page reference [[Book/Title of the book]], it’ll create three page references including Book, Tittle of the book and Book/Title of the book. The pages will be created if not existed.

On the [[Book]] page user can filter the linked references by selecting [[Book/Title of Book]]

This should be working too.

  1. Logseq auto-assigns page-tags: Book to [[Book/Title of Book]] page

This is not added yet, and I agree it’s quite useful to have a hierarchical relationship, and we can jump to the parent page by clicking the page-tag. page-tags might not be the best place for defining the relationship, I’ll give it more thoughts and reply later.

5 Likes

yes me too, I prefer . as a namespace delimiter because it will retains the same possibilities and avoid the weird edge-cases where fileTitle is different from fileName

this would avoid conflicting cases when titles use illegal characters for filenames like [[this/page]] and [[this*page]] ?

[[this/page]] is corresponding to this.page now, [[this*page]] is still this_page :smiley:

3 Likes

Creating a hierarchical relationship between namespace pages is perhaps also related to nested links.

For example, [[[[Logseq]] is a, open-source platform for knowledge sharing and management.]] works just fine. However, on both pages there is no linked reference to the other page.

It would be great if the linked references could happen automatically, perhaps in the same way that the namespace pages are auto-related.

2 Likes

I agree, it makes sense to have bidirectional links for parent and child namespace pages rather then just child auto linking to parent (and parent appearing in child Linked References). Because it would be much convenient to navigate/browse the hierarchy, kind of tree browsing experience.

To accomplish this I think it makes sense to have new Children list and Parent automatically populated (not editable, like Lined References that we have already now).

@tienson Hi, could you please give a short statement if this would conflict with existing tags and pages that already use . (dot) as delimiter between “words”?

I opened a specific discussion here:

What I am not shure:
If I already have tags like #task.project.topic1.subtopic or pages like [[BACKUP.task]] will these pages/tags generate also a corresponding [[BACKUP/task]] and #task/project/... page and tag or does it only work the other way around.

Am I “safe” to continue using those dot-delimiter-tags or should I change them to avoid conflicts with the namespace pages?

Thanks for your advice

Is there a reason why Logseq needs to use a delimiter such as “.” for namespaces instead of just using forward slash “/” to mean directory and each namespace actually uses a folder on the filesystem. When I used to use markdown files manually I would use folders to store collections in.

I am guessing there is no easy way to write a plugin that changes the behavior to folders instead of single filename with delimiter?

1 Like

Of couse, I have an another method. We can create a page with the same name of a folder instead a file “init”. The page in the folder meas it have a namespaces with the name of folder. For example:

  • Section 1 (file)
  • Section 1 (folder)
    • Chapter 1
    • Chapter 2

The file “Chapter 1” in the folder “Section 1” have a namespace of “section 1”. It like the file “Section 1.Chapter 1” in the present version of logseq

I know the logseq did not recommend use the folder, but we implement the namespace with the help of folder. So the folder should not use for the classification, just use it for namespace to prevent the same name of the file, because all files in a folder “page” can occur an inevitable case that the files have the same name.

I see some people have the need of the folder. We can combine the folder and the namespaces.

The advantage can avoid multiple modification when changing the name of the parent page (only change 2 times) . Also it solves the need of the folder.

3 Likes

Is there any way to prevent the creation of new pages when there’s a slash in the title? This is causing issues in my graph