SORT REFERENCES

The Sort Linked References extension adds an icon button to the user page that could be used to sort linked references. The name of the script is sort-references.

Installation

You could use the Copy Extension button below to individually install this extension. To install, just paste anywhere in your Roam graph and click "Yes, I Know What I'm Doing".

Manual Installation

If instead you prefer to manually install, first create a block with the text {{[[roam/js]]}} on any page in your Roam DB. Then, copy and paste this code block as a child of the block.

var existing = document.getElementById("sort-references");
if (!existing) {
  var extension = document.createElement("script");
  extension.src = "https://roamjs.com/sort-references.js";
  extension.id = "sort-references";
  extension.async = true;
  extension.type = "text/javascript";
  document.getElementsByTagName("head")[0].appendChild(extension);
}

Usage

The script supports the following configuration attributes, to be added in the [[roam/js/sort-references]] page:

  • Default Sort - (Optional) The default mode used to sort references on all pages. Valid values include all the options below, written without the 'Sort By' prefix. For example, Default Sort:: Page Title.

Near the linked references, there will appear a sort icon next to the filter icon. Clicking on the sort icon will make a sort menu visible to the user with the following options:

  • Sort By Page Title - This will sort all the linked references in ascending alphabetical order of the page title.
  • Sort By Page Title Descending - This will sort all the linked references in descending alphabetical order of the page title.
  • Sort By Created Date - This will sort all the linked references in ascending order that the page was created.
  • Sort By Created Date Descending - This will sort all the linked references in descending order that the page was created.
  • Sort By Daily Note - This will sort all the linked references in ascending order by Daily Note, followed by created date of non-daily note pages.
  • Sort By Daily Note Descending - This will sort all the linked references in descending order by Daily Note, followed by created date of non-daily note pages.

You could also add a Default Sort attribute with a valid value on the page itself to have a specific sorting for just that page.

Demo

Other Extensions