Skip to content

Commit 5eccda2

Browse files
committed
Include Twitter cards
1 parent 848b6cf commit 5eccda2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

templates/entry.twig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
{% extends "base.twig" %}
22

3+
{% set stripped = entry.contents|striptags|replace({"\n": ' '})|split(' ') %}
4+
{% if stripped|length >= 20 %}
5+
{% set description = stripped|slice(0, 20)|join(' ')|trim ~ "..." %}
6+
{% else %}
7+
{% set description = stripped|slice(0, 20)|join(' ')|trim %}
8+
{% endif %}
9+
310
{% block main %}
411
<div id="front-entry-wrapper">
512
<h1 id="entry-title">{{ entry.title }}</h1>
@@ -56,9 +63,13 @@
5663
{# OpenGraph Integration! #}
5764
{% block head_extra %}
5865
<meta property="og:title" content="{{ entry.title|e('html_attr') }}" />
66+
<meta name="twitter:title" content="{{ entry.title|e('html_attr') }}">
67+
<meta name="og:description" content="{{ description|e('html_attr') }}">
68+
<meta name="twitter:description" content="{{ description|e('html_attr') }}">
5969
<meta property="og:type" content="website" />
6070
<meta property="og:url" content="{{ faqoff_custom.vars['hostname'] }}/e/{{ entry.uniqueid|e('html') }}" />
6171
{% if entry.opengraph_image_url %}
6272
<meta property="og:image" content="{{ entry.opengraph_image_url|e('html_attr') }}" />
73+
<meta property="twitter:image" content="{{ entry.opengraph_image_url|e('html_attr') }}" />
6374
{% endif %}
6475
{% endblock %}

0 commit comments

Comments
 (0)