-
-
Notifications
You must be signed in to change notification settings - Fork 703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Path parameters for custom pages #944
Comments
I created a template file called
The Here's the implementation of that But caching it would be pretty easy - either until the server is restarted or as an in-memory cache for a few seconds. |
These templates will need a way to raise a 404 - so that if the template itself is deciding if the page exists (for example using This can imitate the {{ custom_redirect("https://github.com/simonw/datasette", 301) }} It could be as simple as this:
|
I'm going to cache the |
Actually don't need |
Having tried this out I think it does need a |
Custom pages let you e.g. create a
templates/pages/about.html
page and have it automatically served at/about
.It would be useful if these pages could capture path patterns. I like the Python format string syntax for this (also used by Starlette):
/foo/bar/{slug}
.So... how about embedding those patterns in the filenames themselves?
Would capture any hits to
/museums/something
and use that page to serve them.The text was updated successfully, but these errors were encountered: