jsonld support added. og as seperate partials
This commit is contained in:
parent
02dcad911b
commit
f3930d159d
8 changed files with 194 additions and 101 deletions
43
templates/partials/jsonld_article.html
Normal file
43
templates/partials/jsonld_article.html
Normal file
|
@ -0,0 +1,43 @@
|
|||
{# <!-- 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>
|
Loading…
Add table
Add a link
Reference in a new issue