Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: includes/meta/social.tmpl

Issue 29480675: Issue 5329 - Added standard social media meta data to website-defaults (Closed) Base URL: https://hg.adblockplus.org/website-defaults
Patch Set: Rebased Created Aug. 22, 2017, 1:17 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « filters/to_og_locale.py ('k') | settings.ini » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: includes/meta/social.tmpl
===================================================================
new file mode 100644
--- /dev/null
+++ b/includes/meta/social.tmpl
@@ -0,0 +1,52 @@
+{#
+ # This file is part of website-defaults
+ # Copyright (C) 2016-2017 eyeo GmbH
+ #
+ # website-defaults is free software: you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation, either version 3 of the License, or
+ # (at your option) any later version.
+ #
+ # website-defaults is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with website-defaults. If not, see <http://www.gnu.org/licenses/>.
+ #}
+
+{% macro meta_tag(property, content, defaultContent=None) -%}
+ {% if content %}
+ <meta property="{{ property }}" content="{{ content }}">
+ {% elif defaultContent %}
+ <meta property="{{ property }}" content="{{ defaultContent }}">
+ {% endif %}
+{%- endmacro %}
+
+{% set social_media_meta = [
+ ('og:url', og_url, get_canonical_url(page)),
+ ('og:type', og_type, 'website'),
+ ('og:site_name', og_site_name, get_string('site-name', 'global') if has_string('site-name', 'global') else None),
+ ('og:title', og_title, title | translate('page-title', 'Meta data') if title else None),
+ ('og:description', og_description, description | translate('page-description', 'Meta data') if description else None),
+ ('og:image', og_image, image),
+ ('og:image:alt', og_image_alt, image_alt),
+ ('og:locale', og_locale, locale | to_og_locale),
+ ('fb:app_id', facebook_id, None),
+ ('twitter:site', twitter_site, '@eyeo'),
+ ('twitter:card', twitter_card, 'summary_large_image' if og_image or twitter_image or image else 'summary'),
+ ('twitter:image', twitter_image, None),
+ ('twitter:image:alt', twitter_image_alt, None),
+ ('p:domain_verify', pinterest_id, None),
+] %}
+
+{% for property, content, defaultContent in social_media_meta %}
+ {{ meta_tag(property, content, defaultContent) }}
+{% endfor %}
+
+{% for alternate_locale in available_locales %}
+ {% if alternate_locale != locale %}
+ {{ meta_tag(('og:locale:alternate', alternate_locale | to_og_locale)) }}
+ {% endif %}
+{% endfor %}
« no previous file with comments | « filters/to_og_locale.py ('k') | settings.ini » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld