mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
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
25 lines
1 KiB
HTML
25 lines
1 KiB
HTML
{% if metadata.description_html or metadata.description %}
|
|
<div class="metadata-description">
|
|
{% if metadata.description_html %}
|
|
{{ metadata.description_html|safe }}
|
|
{% else %}
|
|
{{ metadata.description }}
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
{% if metadata.license or metadata.license_url or metadata.source or metadata.source_url %}
|
|
<p>
|
|
{% if metadata.license or metadata.license_url %}Data license:
|
|
{% if metadata.license_url %}
|
|
<a href="{{ metadata.license_url }}">{{ metadata.license or metadata.license_url }}</a>
|
|
{% else %}
|
|
{{ metadata.license }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if metadata.source or metadata.source_url %}{% if metadata.license or metadata.license_url %}·{% endif %}
|
|
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 %}
|
|
</p>
|
|
{% endif %}
|