*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit 96e03646 authored by Moser, Maximilian's avatar Moser, Maximilian
Browse files

Handle errors while generating schema.org metadata

* this can happen for drafts, e.g. when "date" metadata fields aren't
  filled out which crashes with a `KeyError`
parent 1d9abe4a
No related branches found
No related tags found
1 merge request!168Provide theme assets for Invenio-Curations
......@@ -134,7 +134,11 @@ def create_blueprint(app):
@blueprint.app_template_global("tuw_create_schemaorg_metadata")
def tuw_create_schemaorg_metadata(record):
"""Create schema.org metadata to include in a <script> tag."""
return SchemaorgJSONLDSerializer().serialize_object(record)
try:
return SchemaorgJSONLDSerializer().serialize_object(record)
except Exception as e:
current_app.logger.error(e)
return '{"@context": "http://schema.org"}'
@blueprint.app_template_global("record_count")
def record_count():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment