diff --git a/app.py b/app.py index ff9c410..ba23e16 100644 --- a/app.py +++ b/app.py @@ -336,6 +336,14 @@ def has_type(doc, _type): return False +@app.template_filter() +def has_actor_type(doc): + for t in ap.ACTOR_TYPES: + if has_type(doc, t.value): + return True + return False + + def _is_img(filename): filename = filename.lower() if ( diff --git a/templates/lookup.html b/templates/lookup.html index a8fb5f7..31932c1 100644 --- a/templates/lookup.html +++ b/templates/lookup.html @@ -15,7 +15,7 @@ {% if data %} {% set data = data.to_dict() %}
- {% if data | has_type('Person') or data | has_type('Service') %} + {% if data | has_actor_type %}
diff --git a/templates/utils.html b/templates/utils.html index 5cc6941..78cd27d 100644 --- a/templates/utils.html +++ b/templates/utils.html @@ -23,6 +23,7 @@ {% else %} {% set actor = obj.attributedTo | get_actor %} {% endif %} +
@@ -33,6 +34,7 @@
+ {% if obj.summary %}

{{ obj.summary | clean }}

{% endif %}
+ {% if obj | has_type('Article') %} + {{ obj.name }} {{ obj | url_or_id | get_url }} + {% else %} {{ obj.content | clean | safe }} + {% endif %}
- {% if obj.attachment %} + {% if obj.attachment and obj | has_type('Note') %}
{% if obj.attachment | not_only_imgs %}

Attachment

@@ -68,7 +75,7 @@ -{% if meta and meta.og_metadata %} +{% if meta and meta.og_metadata and obj | has_type('Note') %} {% for og in meta.og_metadata %}