Move Hierarchy List Before Linked References

May be it would be convenient if moving Hierarchy list above the Linked References and bellow Pages tagged with “…” list.

It will give user to quick glance of Hierarchy list rather than scrolling down to the bottom after amount of Linked References list.

If you are interested, this is relatively easy to achieve with custom code.

I’d love to! Please let me know how I can start.

  • Add the following code into file custom.js (create inside folder logseq if missing):
    const hrchy = document.getElementsByClassName("page-hierarchy");
    const hrchyObserver = new MutationObserver(function onMutated(){
        if (hrchy.length < 1) return
    
        const div = hrchy[0]
        if (div.dataset.initialized) return
    
        const refs = document.querySelector('div:has(> .lazy-visibility .references.page-linked)')
        if (!refs) return
    
        refs.before(div)
        div.dataset.initialized = "true"
    });
    hrchyObserver.observe(document.getElementById("main-content-container"), {
        childList: true, subtree: true
    });
    
  • Restart Logseq and accept the warning.

Awesome. Thank you very much.