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

Delta Between Two Patch Sets: 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
Left Patch Set: Created July 5, 2017, 9:43 p.m.
Right Patch Set: Rebased Created Aug. 22, 2017, 1:17 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « filters/to_og_locale.py ('k') | settings.ini » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 {# open graph #} 1 {#
2 # This file is part of website-defaults
3 # Copyright (C) 2016-2017 eyeo GmbH
4 #
5 # website-defaults is free software: you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # website-defaults is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with website-defaults. If not, see <http://www.gnu.org/licenses/>.
17 #}
2 18
3 {% if host and page %} 19 {% macro meta_tag(property, content, defaultContent=None) -%}
4 <meta property="og:url" content="{{ host }}/{{ page }}"> 20 {% if content %}
juliandoucette 2017/07/05 21:47:25 Note: I created an issue to provide us with a bett
ire 2017/07/07 16:05:06 Acknowledged.
5 {% endif %} 21 <meta property="{{ property }}" content="{{ content }}">
6 {% if og_type %} 22 {% elif defaultContent %}
7 <meta property="og:type" content="{{ og_type }}"> 23 <meta property="{{ property }}" content="{{ defaultContent }}">
8 {% endif %} 24 {% endif %}
9 {% if og_site_name %} 25 {%- endmacro %}
10 <meta property="og:site_name" content="{{ og_site_name }}"> 26
11 {% endif %} 27 {% set social_media_meta = [
12 {% if og_title %} 28 ('og:url', og_url, get_canonical_url(page)),
13 <meta property="og:title" content="{{ og_title }}"> 29 ('og:type', og_type, 'website'),
14 {% endif %} 30 ('og:site_name', og_site_name, get_string('site-name', 'global') if has_string ('site-name', 'global') else None),
15 {% if og_description %} 31 ('og:title', og_title, title | translate('page-title', 'Meta data') if title e lse None),
16 <meta property="og:descirption" content="{{ og_description }}"> 32 ('og:description', og_description, description | translate('page-description', 'Meta data') if description else None),
ire 2017/07/07 16:05:06 Typo in "og:descirption"
juliandoucette 2017/07/07 20:05:20 Done. Good eye.
ire 2017/07/10 07:50:57 Thanks :)
17 {% endif %} 33 ('og:image', og_image, image),
18 {% if og_image %} 34 ('og:image:alt', og_image_alt, image_alt),
19 <meta property="og:image" content="{{ og_image }}"> 35 ('og:locale', og_locale, locale | to_og_locale),
20 {% else if og_site_image %} 36 ('fb:app_id', facebook_id, None),
21 <meta property="og:image" content="{{ og_site_image }}"> 37 ('twitter:site', twitter_site, '@eyeo'),
22 {% endif %} 38 ('twitter:card', twitter_card, 'summary_large_image' if og_image or twitter_im age or image else 'summary'),
23 <meta property="og:locale" content="{{ locale }}"> 39 ('twitter:image', twitter_image, None),
juliandoucette 2017/07/05 21:47:25 Note: I'm not sure if the accepted locales are the
ire 2017/07/07 16:05:06 Should this be wrapped in an if statement? Or is l
juliandoucette 2017/07/07 20:05:20 locale is always set. A default must be set in set
ire 2017/07/10 07:50:57 Acknowledged.
24 {% for alternate_locale in locales %} 40 ('twitter:image:alt', twitter_image_alt, None),
41 ('p:domain_verify', pinterest_id, None),
42 ] %}
43
44 {% for property, content, defaultContent in social_media_meta %}
45 {{ meta_tag(property, content, defaultContent) }}
46 {% endfor %}
47
48 {% for alternate_locale in available_locales %}
25 {% if alternate_locale != locale %} 49 {% if alternate_locale != locale %}
26 <meta property="og:locale:alternate" content="{{ alternate_locale }}"> 50 {{ meta_tag(('og:locale:alternate', alternate_locale | to_og_locale)) }}
27 {% endif %} 51 {% endif %}
28 {% endfor %} 52 {% endfor %}
29
30 {# twitter #}
31
32 {% if twitter_site %}
33 <meta name="twitter:site" content="@{{ twitter_site }}">
34 {% endif %}
35 {% if twitter_card %}
36 <meta name="twitter:card" content="{{ twitter_card }}">
37 {% else if og_image or og_site_image %}
38 <meta name="twitter:card" content="summary_large_image">
39 {% else %}
40 <meta name="twitter:card" content="summary">
41 {% endif %}
42 {% if twitter_image_alt %}
43 <meta name="twitter:image:alt" content="{{ twitter_image_alt }}">
44 {% endif %}
LEFTRIGHT

Powered by Google App Engine
This is Rietveld