sawhney17 / logseq-schrodinger

A plugin to export pages in Logseq to Hugo.
MIT License
311 stars 37 forks source link

Generate page hierarchies #30

Open flyinggrizzly opened 1 year ago

flyinggrizzly commented 1 year ago

As noted in #29, I make use of Logseq's built-in hierarchy functionality, where creating a page like [[Mr Color/GX/3 Red]] creates a new page nested underneath parent pages. In this case, [[Mr Color]], [[Mr Color/GX]], and finally [[Mr Color/GX/3 Red]]. If the parent pages do not exist,they are added to the graph automatically, analogous to mkdir -p mr-color/gx/3-red.

Additionally, the generated pages are aware of their hierarchies:

Parent:

Screen Shot 2022-11-05 at 4 40 16 PM

(Grand) child:

Screen Shot 2022-11-05 at 4 40 31 PM

Schrodinger already creates these pages, but they lose awareness of their hierarchy links. It would be useful for these to be surfaceable in a published site link backlinks. Unfortunately, because they are not links present in the content, they do not get generated, and would require new work to do so.

Could these be added to page front matter? Maybe

# Mr Color
hierarchy:
  - {{ ref . "pages/mr-color/gx" }}
  - {{ ref . "pages/mr-color/gx/3-red" }}
  - {{ ref . "pages/mr-color/gx/1-white" }}
  - {{ ref . "pages/mr-color/surfacer" }}
  - {{ ref . "pages/mr-color/surfacer/500" }}

# Mr Color/GX
hierarchy:
  - {{ ref . "pages/mr-color/gx/3-red" }}
  - {{ ref . "pages/mr-color/gx/1-white" }}

# Mr Color/GX/1 White
hierarchy:
  - {{ ref . "pages/mr-color/gx" }}