Sort Pages Alphabetically Option

Our company is in a “one doc to rule them all” situation and as a result has a massive number of pages. As the admin, I’m constantly shifting pages around after people add content and leave the new page nestled lazily at the bottom of the page list.

Would love to see an option in the doc menu (“…”) for a quick alphabetical sort of pages; subpages being sorted alphabetically beneath their parent, of course. Or maybe the sort takes place at the parent-level only and you need to dig deeper and sort again if that’s what you’d like.

I wouldn’t see this feature as being a toggle where it stays on/off (causing some to lose track of their new pages), but instead a one-off sort for when the mood strikes. And maybe this is such a dramatic move that it would require a reassurance pop-up (“are you sure about this?”)

Just brainstorming!

1 Like

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)) : 
  pages.sort((a, b) => (;
  pages.forEach((p, i) => {pm.movePage(p.pageId, p.parentId, i);})

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, scroll to the bottom, and under Labs enable Developer Mode, then reload the doc. (3)



Thanks, Paul! And noted on the “at your own risk” flag.

Adjusted the script to work with the methods the pagesManager object has as of now

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

1 Like