Logseq as a Journal app

Here is a workaround:

  • Put the following code in file custom.js (create inside folder logseq if missing):
    document.addEventListener('keyup', (e)=>{    
        if (e.altKey && e.key === "s") {
            const divJournals = document.querySelector("#journals")
            if (!divJournals) return
    
            const journals = divJournals.querySelectorAll("div.journal-item")
            const arr = Array.prototype.map.call(journals, (j)=>j )
            arr.sort( (a, b)=>{
                const aname = a.querySelector(".journal-title h1").textContent
                const bname = b.querySelector(".journal-title h1").textContent
                return aname.localeCompare(bname)            
            })
            divJournals.querySelector("div").prepend(...arr)
        }
    });
    
  • Go to SettingsEditor and set the Preferred date format to: yyyy/mm/dd
  • Press Alt + s to sort the loaded journals from top to bottom
    • Repeat when more journals are loaded
      • That could be by scrolling, pressing End etc.
1 Like