From 3d1757476a258c649a265e4d73e65a6bc2de0a98 Mon Sep 17 00:00:00 2001 From: Francesco Siddi Date: Thu, 13 Jul 2017 12:34:54 +0200 Subject: [PATCH] Support for OpenGraph and Twitter cards in blogposts --- src/templates/nodes/custom/post/view.jade | 16 ++++++++++++++++ .../nodes/custom/post/view_main_project.jade | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/templates/nodes/custom/post/view.jade b/src/templates/nodes/custom/post/view.jade index ea1b0520..52547fee 100644 --- a/src/templates/nodes/custom/post/view.jade +++ b/src/templates/nodes/custom/post/view.jade @@ -1,6 +1,22 @@ | {% extends 'projects/view.html' %} | {% set title = 'blog' %} +| {% block og %} +meta(property="og:title", content="{{ node.name }}") +meta(property="og:url", content="{{ url_for('main.project_blog', project_url=project.url, url=node.properties.url, _external=True)}}") +meta(property="og:type", content="website") +| {% if node.picture %} +meta(property="og:image", content="{{ node.picture.thumbnail('l', api=api) }}") +| {% endif %} +meta(property="og:description", content="Blender Cloud is a web based service developed by Blender Institute that allows people to access the training videos and all the data from the open projects.") + +meta(name="twitter:title", content="{{ node.name }}") +meta(name="twitter:description", content="Blender Cloud is a web based service developed by Blender Institute that allows people to access the training videos and all the data from the open projects.") +| {% if node.picture %} +meta(property="og:image", content="{{ node.picture.thumbnail('l', api=api) }}") +| {% endif %} +| {% endblock %} + | {% block page_title %}{{node.name}} - Blog{% endblock%} | {% block css %} diff --git a/src/templates/nodes/custom/post/view_main_project.jade b/src/templates/nodes/custom/post/view_main_project.jade index 9dca9c07..428ceacf 100644 --- a/src/templates/nodes/custom/post/view_main_project.jade +++ b/src/templates/nodes/custom/post/view_main_project.jade @@ -1,4 +1,21 @@ | {% extends 'layout.html' %} + +| {% block og %} +meta(property="og:title", content="{{ node.name }}") +meta(property="og:url", content="{{ url_for('main.main_blog', url=node.properties.url, _external=True)}}") +meta(property="og:type", content="website") +| {% if node.picture %} +meta(property="og:image", content="{{ node.picture.thumbnail('l', api=api) }}") +| {% endif %} +meta(property="og:description", content="Blender Cloud is a web based service developed by Blender Institute that allows people to access the training videos and all the data from the open projects.") + +meta(name="twitter:title", content="{{ node.name }}") +meta(name="twitter:description", content="Blender Cloud is a web based service developed by Blender Institute that allows people to access the training videos and all the data from the open projects.") +| {% if node.picture %} +meta(property="og:image", content="{{ node.picture.thumbnail('l', api=api) }}") +| {% endif %} +| {% endblock %} + | {% block page_title %}{{node.name}} - Blog{% endblock%} | {% set title = 'blog' %}