The Most Legit Use of Namespaces

Thanks for those hints! This is one of the cases where I wish there would be more communication from developers. For me this is one of the Logseq “core” features, as it provides an new, additional solution for basic organizing and tagging. I like to think of nested tags as a form of composition, bigger things being constructed from smaller parts. Naming is arguably one of the hardest things in organizing, hence if the program takes care of dynamic names, that would be great!

I see. With Markdown I haven’t encountered any problems so far.

It even works with current approach, no database needed! Markdown files are renamed correctly, when nested!

OK, need to have a second look at it later.

@WQing I guess I’d be one of the naysayers of using namespaces to implement hierarchies, even strict ones (I just outlined some reasons here).

Your post made me realize that this is not only because of flexibility, but because we need both concepts, namespaces, and hierarchies, and we should not mix them up.

I feel that namespaces are a very import and much needed concept, and that they should be reserved for actual namespaces (i.e. disambiguating the same names in different contexts).

Your example is actually an excellent use case for using namespaces (in the Logseq sense) as proper namespaces (in the computer science sense), for keeping things with the same names apart, but not for building hierarchies.

A taxonomy is

The classification and naming of organisms in an ordered system that is intended to indicate natural relationships, especially evolutionary relationships.

A tag like “subproject 1” wouldn’t be part of any properly designed taxonomy. (like “car” in “vehicles”, “cat” in “animals”). On the other hand, there would still be many “subproject 1” around, this is why they need to be put into a namespace, such as “Project 1”/“subproject 1” to distinguish them.

One of the main criticisms of using namespaces to implement hierarchies (in the sense of taxonomies) is that there is no way to centrally edit the hierarchy. If you’ve tagged a page “cat”, once there are a lot of pages, you might want to organize them into a taxonomy without editing each tagged block individually.

One the other hand, in the “subproject 1” case, “subproject 1” isn’t a meaningful name by itself, like “cat” is. It makes sense to centrally sort all of the “cat” blocks under “mammals”, but it doesn’t make sense to centrally reclassify all “subproject 1” tags, because they all live under different projects. A category “mammals/cats” makes sense, a category “All projects/first subprojects” doesn’t.

If someone made the mistake of individually tagging his pages separately with “Project 1”, “Project 2” and “subproject 1”, the tag “subproject 1” by itself is ambiguous. Many projects have a “subproject 1”, and there is no way to further classify them.

That’s why in your case, the use of namespaces is correct, even a naysayer like myself can absolutely agree with this use.

All of these projects should be tagged, as you suggested, “Project 1/subproject 1”.

This is the proper use of namespaces (to keep the same names used in different contexts apart), but not a good example of a hierarchy (in the taxonomic sense, to classify things in a system).

Ultimately, we’ll need a way to specify relations between tags, and these tags could very well be disambiguated by the use of namespaces.

tl;dr namespaces are good for keeping identical names apart, they are not good for taxonomies.


Yes exactly. To say it in other words: child should automatically get tagged with namespace (parent), so that inside child page we can search combinations of tags like (and [[namespace]] [[Logseq]]. This is not consistent yet.

Agreed. It makes sense to define all kinds of relationships between pages/tags via properties. Relationship could be strict hierarchical, polyhierarchical (multiple parents), part-of and so on. Something, which cannot be reflected by using Logseq namespaces. What Logseq currently is missing in my opinion: an effective query and search mechanism for these relations.

One afterthought: I think Logseq namespaces can model a strict hierarchy, if you solely want to model a parent-child relation, with no other kinds of relations. Problem here is: In reality there rarely is one-dimensional thinking. And it definitely would be cleaner design to distinguish between hierarchy and distinguishing namespace as concepts.

1 Like

Have found another bug: Nested tags don’t work, if they start and end with inner brackets, for example: [[[[test]] [[Tag]]]] gets the page name test]] [[Tag.
It works, if you put something either before or after:

  • [[_[[test]] [[Tag]]]]
  • [[[[test]] [[Tag]]_]].

(Not wanting to pollute your post further with non-namespace things, but I don’t even know if this “nested tags” is a feature at all or how it’s called. Some more love for it would be highly appreciated!)

1 Like

I’ve solved this one with advanced queries.
I had a discussion with gax and alex0 in the thread you mentioned, which ended with this post:

It was a lot of fun so to speak :slight_smile:

1 Like

In the Logseq concept, Namespaces don’t make sense. 1 of the advantages of Logseq is that you don’t have to worry, waste time, in which folder to store a file as Logseq does not use folders.

Yet, with Namespaces under which parent, child, grandchild your page or file should be subsumed.

So, while everyone should of course use whichever system works best for them, Namespaces, in a way, don’t make sense here.


As a developer pointed out once, namespaces are meant to disambiguate two different pages that otherwise would have the same name (just like namespaces in some programming languages) :slight_smile:

If you think of them that way there are valid use cases like the ones I mentioned in this thread:

Instead to organize things hierarchically there are better alternatives and indented blocks is one of them. When it comes to pages, the concept of indexes that I described later in that thread is the best one to organize pages hierarchically, in my opinion :slight_smile:


thanks for the explanation.

I looked at the page you linked to, and boy there is some impressive stuff in there. I have no database background and am a Logseq newbie so a lot of the stuff discussed there is a bit beyond me.

We may see some interesting developments in Logseq yet.

1 Like

To add a practical example to Alex’s answer:

Namespaces are useful for keeping the same name apart if used in different contexts. Think about “apple”, which could be a fruit, a company etc.

So you can use a namespace “companies/apple”, “fruits/apple” to keep them separate.

A programming example would be if you have multiple functions named “print”, you could keep them apart by namespaces “std::print”, or “myLibrary::print”.

That doesn’t imply a taxonomy (a system for organizing things into different categories), it is just to keep the names apart. More details in my other answer above.

Unfortunately the two concepts get mixed up in Logseq, which causes a lot of confusion.

Thank you. I still have a lot to learn. I guess I won’t be confronted with the issue because I always try to use unique page names. To take the apple example, I would call 1 of the 2 pages Apple-company and the other Apple-fruit, so a search for apple would yield 2 results.

As for taxonomy, I am reading a non-fiction book and making notes with the built-in PDF viewer. I made a 1st page with some early notes that set the scene.

After that I make a page for each chapter or group of chapters that deals with a specific issue. In the page properties I have a property called parent, and I put a link to the parent there. In the parent properties I have a property called children where I have put a link to each of the children, all of which have their own unique name.

Being a newbie, I am not sure if this is a reply that is relevant to your comment. If it is not, I apologize.

1 Like

I’m still on the fence for one of my namespaces. I have notes for DnD (Dungeons & Dragons)
I had a very involved namespace for it, but made it a little bit more manageable by changing DnD/campaign name to DnD campaign name.
However for one campaign I ran I moved my Google docs to Logseq 1 to 1. There’s a lot of files and my hierarchy now looks like this:

And that’s just a fraction of the total amount.

This seems a legit use of namespaces as most of those pages won’t make sense in terms of their name on their own.

Anyone any thoughts on this? (Really enjoying these discussions on structure tbh!)

There are a couple of good reasons to use real namespaces instead of unique names

  • A namespace tells you what the namespace, and what the name is. Is Apple-fruit in namespace “fruit”, or is “Apple-fruit” some common name? What about “Mary-Jane”?
  • you can use search functionality to query namespaces (see also other answers from @Siferiax ), Logseq doesn’t know that “Apple-fruit” is a fruit.
  • one might be required to use certain names for compatibility with other users (e.g. courts use naming conventions like “Exhibit A”)
  • two people might have picked the same name, and you want to merge the graphs
  • print is a name of the function, and it wouldn’t be a good idea to rename it everywhere to print_std)
  • if you have a given taxonomy, you wouldn’t want to rename the individual groups to avoid conflicts with your own preexisting tags. E.g. you decide to classify animals. A housecat would be under
    Animalia > Chordata > Mammalia > Carnivora > Feliformia > Felidae> Felinae > Felis > F. catus. (I am using “>” to show that we are not talking about the namespace operator “/” in Logseq.
    But what if you already have a page “Felidae” (for the movie)?. You could rename “Felidae” into “Felidae-animal-kingdom”, but now you are not using the established naming scheme for animals, but your own. This will cause confusion. So instead, you create a page for each group in its own namespace AnimalTaxonomy/AnimaliaAnimalTaxonomy/F. catus. Then each page gets a property that tells which parents (one or more) it has.
  • If you use namespaces, you get some syntax checking when you enter the names. Otherwise it’s really easy to accidentally end up with lot’s of synonyms, like Apple-company, Apple-business, Apple-corporation, Apple-corp etc.
  • You can rename namespaces in bulk (still needs a script, but hopefully will eventually be part of a tag management UI)

That’s a good way to do it.

If you want to dig deep, look at these posts: Specify and display relations between pages/tags , Would a rich commitment to hierarchies and classification be an anathema to Logseq culture? , Knowledge Management for Tags / Tag Hierarchies


Thanks for your detailed reply. I’ll check out those posts.

Your points make a lot of sense but many/most are not applicable to me: I am a home user and the only one to use Logseq. But then again …… never say never :grinning:

1 Like

This makes me think: if Logseq will get templates of properties based on tags like Tana, namespaces could be used to chain templates like Tana’s inheritance between its supertags™. For example:

- Alice #person

- Bob #person/author

- Charlie #person/actor

Looks like a good scheme to me.
These are the alternatives I could think of. Did I miss any?

  • Namespaces
    • lightweight, easy to search
    • interface of properties and namespaces could be tricky (e.g. if we also start to categorize games into a hierarchy)
  • Properties
    • ok for hierarchies, but would still need a namespace to keep all of the “Notes Session 1” pages
    • I don’t think it’s a good solution, like you said, it’s not really a taxonomy
  • Unique names like “Notes Session 1 DnD Asken”
    • not good…
  • Everything in one big page
    • might render slowly
    • interferes with normal indentation (but could use subheadings instead of indentation)
    • not as easy to navigate (but a search script might create a good index page)
  • Nested tags
    • don’t seem to be stable (I haven’t tried in a while)
    • easy to get wrong without typing
1 Like

Thanks for confirming namespaces are probably the best fit here!

Hah yeah, that would be a ridiculously big page. Not useful to navigate as you said.

You can do something like this with the powertag plugin.

I use namespace in only one scenario : months of a year. (I’m used to follow track of time with something similar to bullet journal methodology)


Year’s page will contain events of the “future”. When a new month starts, I move the bullets on the newly created month’s page.

As said in this discussion, namespace helps to make 2 pages with “same name” unique.

With this convention, I can have monthly pages of a year nicely sorted at the bottom of page 2023.
I can also use the same naming convention for months of next year, as namespace guarantees unique page name (2023/01-Jan <> 2024/01-Jan).


Lol I do the exact same thing for the exact same reason! :smiley:
Though my year page only contains year related info (like a year theme) as I’ve never really been one to use a future log.