Specify and display relations between pages/tags


Following the discussion here I think I have a viable and concise proposal to address most use cases of the “hierarchically organize pages/tags”.

The point is specifying hierarchies using page properties.

For me the ideal would some syntax that, given an arbitrary user-defined <property>, (for example extends::), looks like this:

Specify relations between pages

<property>:: [[Child]]


<property>:: [[Teddy]]

Display these relations


{{tree <property>}}

displays an indented list of pages by following that <property> specified by the user, i.e.

- [[Parent]]
  - [[Child]]
      - [[Teddy]]

Reverse tree

{{reverse-tree <property>}}

display another indented list but by following <property> in the other direction:

- [[Teddy]]
  - [[Child]]
      - [[Parent]


{{breadcrumb <property>}}

used in a page involved in the hierarchy above, for example Child.md, displays:

[[Parent]] > [[Child]] > [[Teddy]]

in case Child.md is involved in a more complex hierarchy it would be:

[[Parent 1]] > [[Child]] > [[Teddy 1]]
                         > [[Teddy 2]]
[[Parent 2]] > [[Child]] > [[Teddy 1]]
                         > [[Teddy 2]]

Reverse breadcrumb

(you got the idea)

Graph view

In addition it would be nice to display in the graph view only certain relations and not other ones (including “reference” that is the only type of relation we have now in the graph view).

For me it would be also useful to display the graph directly on a page with the command:

{{graph <property>}}

and for the graph of the current page only (like the one we already have in the sidebar):

{{page-graph <property>}}

CC @gax @boisjere

So then the specific thing Logseq devs would have to add are the reserved “tree” and “reverse-tree” queries, as well as “breadcrumb” and “reverse-breadcrumb” queries, such that they recursively fetch and display all the page links that fall along each branch of the hierarchy, right?

It seems to me that you’re saying we can do much of this already, except that transitive crawling of implied, property based “links”.

1 Like

Sounds they are really achievable with the existing UI components.
Happy to see PR on this.

1 Like