attila_pelican_theme/templates/partials/jsonld_article.html
2016-12-17 15:48:53 +05:30

43 lines
1.4 KiB
HTML

{# <!-- Choosing cover image --> #}
{% if article.og_image %}
{% if article.og_image|lower|truncate(4, True, '') == "http" %}
{% set default_cover = article.og_image %}
{% else %}
{% set default_cover = SITEURL+"/"+article.og_image %}
{% endif %}
{% elif article.cover %}
{% if article.cover|lower|truncate(4, True, '') == "http" %}
{% set default_cover = article.cover %}
{% else %}
{% set default_cover = SITEURL+"/"+article.cover %}
{% endif %}
{% elif HEADER_COVER %}
{% set default_cover = SITEURL+"/"+HEADER_COVER %}
{% else %}
{% set default_cover = SITEURL+"/"+THEME_STATIC_DIR+"/images/post-bg.jpg" %}
{% endif %}
{# <!-- Choosing description --> #}
{% if article.headline %}
{% set description = article.headline %}
{% elif article.summary %}
{% set description = article.summary|striptags|truncate(140) %}
{% endif %}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Article",
"name": "{{ article.title|striptags }}",
"headline": "{{ article.title|striptags }}",
"datePublished": "{{ article.date }}",
"dateModified": "{{ article.modified }}",
"author": {
"@type": "Person",
"name": "{{ article.author.name }}",
"url": "{{ SITEURL }}/{{ article.author.url }}"
},
"image": "{{ default_cover }}",
"url": "{{ SITEURL }}/{{ article.url }}",
"description": "{{ description }}"
}
</script>