Sort Pages Alphabetically Option

This would be a cool addition.

Meanwhile if you’re struggling with this often, there’s a way to automate this for you. It uses hacks — nothing that looks dangerous but it’s discouraged by Coda anyways. And since that custom actions plugin is discontinued anyway, I’d just share the code — :warning: use at your own risk! This may break and I may not be around to update the post.

Here’s the snippet to copy-paste on the browser console:

((parentPage) => {
  let pm = coda.documentModel.pagesManager;
  let pages = parentPage ? pm.getByParentId(pm.getPageIdForCanvasId(parentPage)) : 
  pm.getTopLevelPages();
  pages.sort((a, b) => (a.name.localeCompare(b.name)));
  pages.forEach((p, i) => {pm.movePage(p.pageId, p.parentId, i);})
})('CANVAS_ID_HERE')

Open your doc, press F12, go to the Console tab, copy-paste this there with the page ID (or keep it empty like ('') or just () to sort root pages), and voila. You can get the page ID from the context menu when right clicking on a page. If you don’t see it, go to https://coda.io/account, scroll to the bottom, and under Labs enable Developer Mode, then reload the doc.

ezgif.com-optimize (3)

Cheers,
Paul

3 Likes