Skip to content

Instantly share code, notes, and snippets.

@rossjones
Last active October 7, 2016 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rossjones/31456fbb249c51787c06a824b45d72ca to your computer and use it in GitHub Desktop.
Save rossjones/31456fbb249c51787c06a824b45d72ca to your computer and use it in GitHub Desktop.
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Dataset",
"@id": "{% url_for 'dataset_read', id=c.pkg_dict.name, qualified=True %}",
"name": "{{ c.pkg_dict.title }}",
"description": "{{ c.pkg_dict.notes }}",
"catalog": {
"@type": "DataCatalog",
"@id": "{% url_for 'search',qualified=True %}"
},
"publisher": {
"@type": "Organization",
"@id": "{% url_for 'organization_read', id=c.pkg_dict.organization.name, qualified=True %}"
},
"distribution": [ {% for resource in c.pkg_dict.resources %}
{
"@type": "DataDownload",
"@id": "{% url_for controller='package',action='resource_read', id=c.pkg_dict.name,resource_id=resource.id, qualified=True %}",
"contentURL": "{{ resource.url }}",
{% if resource.mimetype %}"fileFormat": "{{ resource.mimetype }}",{% endif %}
"encodingFormat": "{{ resource.format }}"
}{% if not loop.last %},{% endif %}{% endfor %}
]
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment