fix json ld

This commit is contained in:
2026-07-17 13:59:48 +03:00
parent 4d7e55bf90
commit d48835a270
6 changed files with 106 additions and 5 deletions
+50 -2
View File
@@ -8,8 +8,10 @@
{% block og_title %}{{ page.title }}{% endblock og_title %}
{% block og_description %}{{ page.description | default(value=config.description) }}{% endblock og_description %}
{% block og_url %}{{ page.permalink }}{% endblock og_url %}
{% block og_type %}article{% endblock og_type %}
{% block og_type %}{% if page.ancestors is containing("posts/_index.md") %}article{% else %}website{% endif %}{% endblock og_type %}
{% block og_image %}{{ config.base_url }}{{ page.extra.image | default(value="/images/og-image.png") }}{% endblock og_image %}
{% block og_extra %}
{% if page.ancestors is containing("posts/_index.md") %}
{% if page.date %}<meta property="article:published_time" content="{{ page.date | date(format="%+") }}">{% endif %}
{% if page.updated %}<meta property="article:modified_time" content="{{ page.updated | date(format="%+") }}">{% endif %}
<meta property="article:author" content="{{ config.extra.author | default(value="andwati") }}">
@@ -18,13 +20,16 @@
<meta property="article:tag" content="{{ tag }}">
{% endfor %}
{% endif %}
{% endif %}
{% endblock og_extra %}
{# Twitter Card overrides #}
{% block twitter_title %}{{ page.title }}{% endblock twitter_title %}
{% block twitter_description %}{{ page.description | default(value=config.description) }}{% endblock twitter_description %}
{% block twitter_image %}{{ config.base_url }}{{ page.extra.image | default(value="/images/og-image.png") }}{% endblock twitter_image %}
{% block head %}
{% if page.ancestors is containing("posts/_index.md") %}
<!-- SEO: BlogPosting JSON-LD -->
<script type="application/ld+json">
{
@@ -37,7 +42,7 @@
},
"headline": {{ page.title | json_encode | safe }},
"description": {{ page.description | default(value=config.description) | json_encode | safe }},
"image": "{{ config.base_url | safe }}/images/og-image.png",
"image": "{{ config.base_url | safe }}{{ page.extra.image | default(value="/images/og-image.png") | safe }}",
"url": "{{ page.permalink | safe }}",
"inLanguage": "en-US",
{% if page.date %}"datePublished": "{{ page.date | date(format="%+") }}",{% endif %}
@@ -66,6 +71,49 @@
}
</script>
<!-- SEO: BreadcrumbList JSON-LD -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{ "@type": "ListItem", "position": 1, "name": "Home", "item": "{{ config.base_url | safe }}/" },
{ "@type": "ListItem", "position": 2, "name": "Posts", "item": "{{ config.base_url | safe }}/posts/" },
{ "@type": "ListItem", "position": 3, "name": {{ page.title | json_encode | safe }}, "item": "{{ page.permalink | safe }}" }
]
}
</script>
{% else %}
<!-- SEO: WebPage JSON-LD -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebPage",
"@id": "{{ page.permalink | safe }}",
"name": {{ page.title | json_encode | safe }},
"description": {{ page.description | default(value=config.description) | json_encode | safe }},
"url": "{{ page.permalink | safe }}",
"inLanguage": "en-US",
"isPartOf": {
"@type": "WebSite",
"@id": "{{ config.base_url | safe }}/#website"
}
}
</script>
<!-- SEO: BreadcrumbList JSON-LD -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{ "@type": "ListItem", "position": 1, "name": "Home", "item": "{{ config.base_url | safe }}/" },
{ "@type": "ListItem", "position": 2, "name": {{ page.title | json_encode | safe }}, "item": "{{ page.permalink | safe }}" }
]
}
</script>
{% endif %}
{% if page.extra.math %}
<link rel="stylesheet" href="{{ get_url(path="css/katex/katex.min.css") }}">
<script defer src="{{ get_url(path="js/katex/katex.min.js") }}"></script>