Skip to content

Commit

Permalink
feat: add redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
jthodge committed Oct 18, 2023
1 parent 2ea3f46 commit 79cbc68
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions plugins/redirects.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from datasette import hookimpl
from datasette.utils.asgi import Response


@hookimpl
def register_routes():
return (
(
r"^/til/til/(?P<topic>[^_]+)_(?P<slug>[^\.]+)\.md$",
lambda request: Response.redirect(
"/{topic}/{slug}".format(**request.url_vars), status=301
),
),
)

0 comments on commit 79cbc68

Please sign in to comment.