nx-router

A declarative URL routing extension for Nyxt

  • common-lisp
  • browser

nx-router is a declarative URL routing extension for the Nyxt browser.

It offers a convenient wrapper around the built-in request resource handling functionality in Nyxt by introducingrouter objects users can include in their configuration to define redirects, blocklists, and resource openers with an easy and declarative syntax.

It aims to be simple while staying composable and flexible. Routers are defined like this:

(make-instance 'router:redirector
  :route "https://([\w'-]+)\.fandom.com/wiki/(.*)"
  :redirect "https://breezewiki.com/\1/wiki/\2")

You can also set reverse redirects so that certain URLs get recorded with their original path, which is useful if you don't want to have to deal with unmaintained instances of privacy frontends.

(make-instance 'router:redirector
  :route (match-regex "https://.*google.com/search.*")
  :redirect (quri:uri "http://localhost:5000")
  :reverse (quri:uri "https://www.google.com"))