Obsidian Publish: Invert default backlink sort order

Things I have tried

I searched the obsidian help forum extensively, only found this somewhat related post. The proposed solution here seems to use a custom publish.js file, I was not able to make that work.

What I’m trying to do

I would like to revert the automatic sort order of the obsidian publish UI. My posts feature ISO type date prefixes and in the current sort order these are being sorted from oldest to youngest post, leading to the newest stuff ending up at the bottom. I would like to have this inverted.

Does anybody here know how to do this?

Thank you in advance! :slight_smile:

Your title asks about inverting default “backlink” sort order. But what you’re trying to do seems to also require you to reverse the sort order in the side menu. The solutions that worked for me for both required adding some CSS in publish.css.

To reverse the sort of “backlinks” that are at the bottom of every entry, add this:

.backlink-items-container {
  display: flex;
  flex-direction: column-reverse;	
}

To reverse the sort of items in the left side menu, this works for me:

.tree-item-self[data-path^='wte/Blog'] + .tree-item-children {
  display: flex;
  flex-direction: column-reverse;
}

For the side menu, you have to edit the data path. All of my public files that I’m publishing in Obsidian Publish are in a folder that is titled wte. That is why my data path is wte/Blog. In my current Obsidian setup, I have a Blog folder in wte and the Blog folder has all of the “blog posts.” I discuss this and other tips for the side menu in another Obsidian Forum entry.