Index: filters/to_og_locale.py
===================================================================
new file mode 100644
--- /dev/null
+++ b/filters/to_og_locale.py
@@ -0,0 +1,33 @@
+og_locales = {
+ 'ar': 'ar_AR',
+ 'bg': 'bg_BG',
+ 'de': 'de_DE',
+ 'dk': 'da_DK',
+ 'da': 'da_DK',
+ 'en': 'en_US',
+ 'es': 'es_LA',
+ 'fr': 'fr_FR',
+ 'el': 'el_GR',
+ 'he': 'he_IL',
+ 'hu': 'hu_HU',
+ 'it': 'it_IT',
+ 'ja': 'ja_JP',
+ 'ko': 'ko_KR',
+ 'lt': 'lt_LT',
+ 'nl': 'nl_NL',
+ 'pl': 'pl_PL',
+ 'pt': 'pt_PT',
+ 'pt_BR': 'pt_BR',
+ 'ro': 'ro_RO',
+ 'ru': 'ru_RU',
+ 'sk': 'sk_SK',
+ 'sl': 'sl_SI',
+ 'sv': 'sv_SE',
+ 'tr': 'tr_TR',
+ 'vi': 'vi_VN',
+ 'zh_CN': 'zh_CN',
+ 'zh_TW': 'zh_TW',
+}
+
+def to_og_locale(locale):
+ return og_locales[locale]
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 .
+ #}
+
+{% macro meta_tag(property, content, defaultContent=None) -%}
+ {% if content %}
+
+ {% elif 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 %}
Index: settings.ini
===================================================================
--- a/settings.ini
+++ b/settings.ini
@@ -1,7 +1,7 @@
[general]
-siteurl=http://localhost
+siteurl = http://localhost:5000
defaultlocale = en
defaultpage = index
[langnames]
en = English
Index: templates/default.tmpl
===================================================================
--- a/templates/default.tmpl
+++ b/templates/default.tmpl
@@ -1,13 +1,14 @@
+ include meta/social ?>
include meta/standard ?>
{{ body | safe }}