mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
metadata.json support for per-table/per-database metadata
Also added support for descriptions and HTML descriptions.
Here's an example metadata.json file illustrating custom per-database and per-
table metadata:
{
"title": "Overall datasette title",
"description_html": "This is a <em>description with HTML</em>.",
"databases": {
"db1": {
"title": "First database",
"description": "This is a string description & has no HTML",
"license_url": "http://example.com/",
"license": "The example license",
"queries": {
"canned_query": "select * from table1 limit 3;"
},
"tables": {
"table1": {
"title": "Custom title for table1",
"description": "Tables can have descriptions too",
"source": "This has a custom source",
"source_url": "http://example.com/"
}
}
}
}
}
Closes #165, Refs #164
This commit is contained in:
parent
515eaa8ccb
commit
80bf3afa43
7 changed files with 54 additions and 31 deletions
|
|
@ -20,19 +20,17 @@
|
|||
<div class="ft">
|
||||
Powered by <a href="https://github.com/simonw/datasette" title="Datasette v{{ datasette_version }}">Datasette</a>
|
||||
{% if query_ms %}· Query took {{ query_ms|round(3) }}ms{% endif %}
|
||||
{% if metadata.license %}· Data license:
|
||||
{% if metadata.license or metadata.license_url %}· Data license:
|
||||
{% if metadata.license_url %}
|
||||
<a href="{{ metadata.license_url }}">{{ metadata.license }}</a>
|
||||
<a href="{{ metadata.license_url }}">{{ metadata.license or metadata.license_url }}</a>
|
||||
{% else %}
|
||||
{{ metadata.license }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if metadata.source_url %}·
|
||||
{% if metadata.source %}
|
||||
Data source: <a href="{{ metadata.source_url }}">{{ metadata.source }}</a>
|
||||
{% else %}
|
||||
<a href="{{ metadata.source_url }}">Data source</a>
|
||||
{% endif %}
|
||||
{% if metadata.source or metadata.source_url %}·
|
||||
Data source: {% if metadata.source_url %}
|
||||
<a href="{{ metadata.source_url }}">
|
||||
{% endif %}{{ metadata.source or metadata.source_url }}{% if metadata.source_url %}</a>{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue