nathanupchurch.com/_includes/structuredData.njk

37 lines
1.7 KiB
Plaintext

{% if title and structuredData != "none" %}
<!-- Structured Data -->
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "BlogPosting",
"articleBody": "{{ content | striptags }}"
"author": {
"@type": "Person",
"familyName": "{{ metadata.author.familyName }}",
"givenName": "{{ metadata.author.givenName }}",
"image": "{{ metadata.url }}{{ metadata.author.profilePic }}",
"name": "{{ metadata.author.name }}",
"url": "{{ metadata.author.url }}"
},
"datePublished": "{{ date }}",
"description": "{% if synopsis %}{{ synopsis}}{% endif %}",
"headline": "{{ title }}",
"image": "{% if imageURL %}{{ imageURL | htmlBaseUrl(metadata.url) }}{% else %}{{ metadata.defaultPostImageURL | htmlBaseUrl(metadata.url) }}{% endif %}",
"inLanguage": "{{ metadata.language }}",
"name": "{{ title }}",
"url": "{{ page.url | htmlBaseUrl(metadata.url) }}",
}
</script>
<!-- Open Graph -->
<meta property="og:type" content="article" />
<meta property="og:title" content="{{ title }}" />
<meta property="og:description" content="{{ synopsis}}" />
<meta property="og:url" content="{{ page.url | htmlBaseUrl(metadata.url) }}" />
<meta property="og:image" content="{% if imageURL %}{{ imageURL | htmlBaseUrl(metadata.url) }}{% else %}{{ metadata.defaultPostImageURL | htmlBaseUrl(metadata.url) }}{% endif %}" />
<!-- Twitter card -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="{{ title }}" />
<meta name="twitter:description" content="{{ synopsis}}" />
<meta name="twitter:image" content="{% if imageURL %}{{ imageURL | htmlBaseUrl(metadata.url) }}{% else %}{{ metadata.defaultPostImageURL | htmlBaseUrl(metadata.url) }}{% endif %}" />
{% endif %}