Open simonw opened 5 months ago
This could also support "public" v.s. "draft" templates - so you can work on a new set of templates, preview them in some way and then swap them in when they're ready.
I'm going to add a pack
column to the table (ensuring it's there on startup if the table already exists) - it can be null
for the default template pack.
Datasette 1.0 now has a plugin hook that lets you vary the Jinja environment based on the incoming request: https://docs.datasette.io/en/latest/plugin_hooks.html#jinja2-environment-from-request-datasette-request-env
I built this hook initially for Datasette Cloud, but I'm also excited about being able to serve different templates for different hosts on a single Datasette instance - so I could do things like host two custom websites on one server.
I want to use
datasette-edit-templates
for a feature on Datasette Cloud that lets users edit their public templates (served throughname.datasette.site
while not affecting their regularname.datasette.cloud
site, using this hook.I'm going to give
datasette-edit-templates
knowledge of multiple template packs, which I can then map to hosts using this plugin hook.