Muut stores data in a hierarchical structure, and you see a lot of different terms floating around that may not be immediately obvious. We’re going to bring some clarity to how Muut stores its data, what the terminology means, and why hierarchical data is so bloody cool.

Let's take a look

Hierarchical data

Hierarchical structures are essentially a set of buckets that have a parent and can have children. In the example above the “food” bucket contains all types of food and the “fruit” bucket only contains food that’s of type “fruit”.

You can consider each of these boxes in the diagram a “bucket.” In Muut terminology, we call these buckets pages. Pages can contain other pages as well as threads. In the example above you could place threads in the “fruit” bucket in addition to the “red” and “yellow” pages within it.

In Muut, every page has a string based address. We can’t just say “Red” since “Red” exists in both Meat and Fruit. We list the full address like so: /food/fruit/red. This address is called a path.

So:

  • Path: address to a particular page, thread, or even reply.
  • Page: a bucket that exists in the hierarchical structure. Can contain other pages and/or threads.
  • Threads: Exist inside pages.

If you want to write a path (address) to a particular thread you only add the thread key at the end of the path to the page using a : as a delimiter.

/food/fruit/red:a-thread would be the address to a thread inside the /food/fruit/red page.

In Muut, if you load any particular path, all of the threads in any page under it are also retrieved. That means if I use the path /food/fruit then all threads relating to fruit will be returned; this includes any content that exists all the way down in /food/fruit/red/cherry.

Channels

If you’ve played with Muut, you may be curious how the channels concept comes into play. Channels are unique types of pages and get treated slightly differently.

Muut has what’s called an "all posts" view. The "all posts" view is essentially a merge of all the results for each channel. If I made /food/fruit/red and /food/meat both channels then the "all posts" view would be all threads that would be returned by /food/fruit/red in addition to /food/meat. This mode allows you to build the custom view meant as the community default view.

The path for the "all posts" view is simply /, so this means if I had made channels as I described above, then using the path / would return only /food/fruit/red and /food/meat content. If you used the default Muut client, you would also see the channels listed on the right nav (this is by default and this can be completely customized).

Creating pages

When you create content, you pass along the path to the page on which the thread exists. When you query for content, you pass along the path to the page from which you want to query for threads.

You might ask how to create the pages that you address with the path.

The answer? You don’t.

You can embed and query any path regardless of whether there are threads on it. I can query and post to /food/fruit/red/apple even though it doesn’t exist. Once I post to the apple page, then that thread will also be returned for any queries to /food/fruit or any other parent page.

Since I made /food/fruit/red a channel earlier then the thread I posted to apple will now also exist in the "all posts" view.

You can embed and query any path regardless of whether there are threads on it

The same goes for creating threads. You can reply to a thread that doesn’t exist, and the thread and page are created as necessary to handle the content. The standard Muut client implements flat commenting by querying for a thread that doesn’t exist using something like /project/comments/blog:blog-post-slug and as you might recall from above : is used to delimit between the path to the page, and the key for the thread. For a new blog post, this thread wouldn’t exist, but that doesn’t matter. You can just post to that path, and suddenly queries to it will return the replies.

Putting it together

In Muut, you are always working within the context of a project: the community or forum you created. The project name prefixes the front of the path. So, if my project is myfoodcommunity then a full path to any fruit-related content would be: /myfoodcommunity/food/fruit. The path to the "all posts" view I created above would be /myfoodcommunity/

Since the "all posts" view excludes any content not added within a channel, it allows me to create somewhat hidden content. The content will still come up via searches, but it won’t be immediately visible.

Muut’s hierarchical structure along with the channels capability gives you an incredible amount of flexibility in how you structure your data

Let’s say I am storing blog comments in addition to my regular content. If I used the path /myfoodcommunity/blog/comments for comments, then when someone loads the community they will not see it without searching or visiting the blog since this content exists outside of the children of the channel pages.

If I wanted to, I could create a page that aggregates all the blog comments by querying for /myfoodcommunity/blog/comments as well.

Using Muut’s hierarchical structure along with the channels capability gives you an incredible amount of flexibility in how you structure your data as well as how you aggregate/view it. Paths can be as deep as you need (up to 500 characters), and since you don’t have to create the structure to use it, you can just start querying and posting data wherever you need to. If you decide you want to change the structure you can move your threads around to the appropriate pages.

Tl;dr

Page = bucket full of other buckets and/or threads
Path = address to a bucket or thread
Channel = bucket to add to "all posts"

— Your Muut team

Get started with Muut IO

muut.io

Next Post Previous Post