Skip to content

Commit b542627

Browse files
committed
feat(blog): add social media tags with blog content
macros - meta - filter description with striptag Signed-off-by: Lachezar Lechev <[email protected]>
1 parent 6872d22 commit b542627

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

templates/blog_post.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{% extends "base.html" %}
22

3+
34
{% block title %}{{ page.title }}{% endblock %}
45

6+
{% block meta -%}
7+
{{ meta_macros::facebook_meta(title=page.title, description=page.summary, url=current_url, image=page.extra.meta_image) }}
8+
{{ meta_macros::twitter_meta(title=page.title, description=page.summary, image=page.extra.meta_image) }}
9+
{% endblock -%}
10+
511
{% block content %}
612

713
<div class="row gx-5 mt-3">

templates/macros/meta.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
{% endif -%}
66
<meta property="og:type" content="{{ type }}" />
77
{% if description != "" -%}
8-
<meta property="og:description" content="{{ description }}" />
8+
<meta property="og:description" content="{{ description | striptags }}" />
99
{% endif -%}
1010
{# <meta property="og:locale" content="en_GB" />
1111
<meta property="og:locale:alternate" content="fr_FR" />
1212
<meta property="og:locale:alternate" content="es_ES" />
1313
<meta property="og:site_name" content="IMDb" /> -#}
14-
<meta property="og:url" content="{{ url | safe }}" />
14+
<meta property="og:url" content="{{ url | safe -}}" />
1515
{% if image != "" -%}
16-
<meta property="og:image" content="{{ image | safe }}" />
16+
<meta property="og:image" content="{{ image | safe -}}" />
1717
{% endif -%}
1818
{% endmacro %}
1919

@@ -22,7 +22,7 @@
2222
<meta name="twitter:title" content="{{ title }}">
2323
{% endif -%}
2424
{% if description != "" -%}
25-
<meta name="twitter:description" content="{{ description }}">
25+
<meta name="twitter:description" content="{{ description | striptags }}">
2626
{% endif -%}
2727
{% if image != "" -%}
2828
<meta name="twitter:image" content=" {{ image | safe }}">

0 commit comments

Comments
 (0)