home / docs / sections

sections: writing_plugins:writing-plugins-custom-templates

This data as json

id page ref title content breadcrumbs references
writing_plugins:writing-plugins-custom-templates writing_plugins writing-plugins-custom-templates Custom templates If your plugin has a templates/ directory, Datasette will attempt to load templates from that directory before it uses its own default templates. The priority order for template loading is: templates from the --template-dir argument, if specified templates from the templates/ directory in any installed plugins default templates that ship with Datasette See Custom pages and templates for more details on how to write custom templates, including which filenames to use to customize which parts of the Datasette UI. Templates should be bundled for distribution using the same package_data mechanism in setup.py described for static assets above, for example: package_data = ( { "datasette_plugin_name": [ "templates/my_template.html", ], }, ) You can also use wildcards here such as templates/*.html . See datasette-edit-schema for an example of this pattern. ["Writing plugins"] [{"href": "https://github.com/simonw/datasette-edit-schema", "label": "datasette-edit-schema"}]
Powered by Datasette · Queries took 1.121ms