about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--doc/config.md3
1 files changed, 2 insertions, 1 deletions
diff --git a/doc/config.md b/doc/config.md
index db8fd560..8ecf54a4 100644
--- a/doc/config.md
+++ b/doc/config.md
@@ -474,7 +474,8 @@ host = '(www\.)?npr\.org'
 rewrite-url = '''
 (x) => {
 	x.host = "text.npr.org";
-	x.pathname = x.pathname.replace(/(.*)\/.*/, "$1").replace(/.*\//, "");
+	const s = x.pathname.split('/');
+	x.pathname = s.at(s.length > 2 ? -2 : 1);
 	/* No need to return; URL objects are passed by reference. */
 }
 '''