| 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 %} |