Named routing in Sage-powered web app

Hello.

I’m working on a web site, or rather web app. WordPress “pages” are stored in the database by default. However, I would like to accomplish a similar routing as in Rails or Laravel. At least have a single place of truth for page premalinks. It would be nice if I could print page’s permalink in the navigation template on the site instead of having to write it manually, hoping it won’t change in the future.

A solution could be to create a map between a name of the page and its permalink as a PHP variable and use that in the templates. The problem is that there are still two places where permalinks are defined for a single page: DB and the PHP variable. Not very good.

I know this is more of a WordPress related issue but from what I can observer, there is a lot of smart developers on these forums, so I’m asking here.

I don’t know if you would want to necessarily handle routing yourself. I don’t know of any routing- specific plugins or packages for WP. You could check out Timber if you want to give Twig a try, and I believe custom routing is built in. There’s also Themosis, which looks like a way to Laravel-ize your theme. Either could probably work in your situation

Themosis looks promising, thanks.