Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 {% from "macros/meta-tag" import meta_tag %} | |
2 | |
1 {% set social_media_meta = [ | 3 {% set social_media_meta = [ |
2 ('og:url', | 4 ('og:url', |
juliandoucette
2018/01/30 04:04:40
NIT: I'm really not digging this
('multi',
line
ire
2018/01/30 08:19:08
I don't think it's very ideal either, but I also t
juliandoucette
2018/01/31 19:03:22
Acknowledged.
| |
3 og_url, | 5 og_url, |
4 get_canonical_url(page)), | 6 get_canonical_url(page)), |
5 ('og:type', | 7 ('og:type', |
juliandoucette
2018/01/30 04:04:40
NIT: I think the default is website and we don't n
ire
2018/01/30 08:19:08
I doesn't seem that this data is implied without b
juliandoucette
2018/01/31 19:03:21
Acknowledged.
| |
6 og_type, | 8 og_type, |
7 'website'), | 9 'website'), |
8 ('og:site_name', | 10 ('og:site_name', |
9 og_site_name, | 11 og_site_name, |
10 get_string('name', 'site') if has_string('name', 'site') else None), | 12 get_string('name', 'site') if has_string('name', 'site')), |
ire
2018/01/26 11:33:59
I changed this to use the same site name string as
juliandoucette
2018/01/30 04:04:39
NIT: `condition and output` can replace `output if
juliandoucette
2018/01/30 04:04:40
Acknowledged.
ire
2018/01/30 08:19:08
Are you saying a valid way to write this is `has_s
juliandoucette
2018/01/31 19:03:21
Yes. But apparently you can also just drop the `el
ire
2018/02/01 09:07:01
The line `has_string('name', 'site') and get_strin
| |
11 ('og:title', | 13 ('og:title', |
12 og_title, | 14 og_title | translate('og-title', 'Meta data') if og_title, |
ire
2018/01/26 11:33:59
Should `og_title` be translated as well (since tit
juliandoucette
2018/01/30 04:04:40
Yes.
ire
2018/01/30 08:19:08
Done.
| |
13 title | translate('title', 'Meta data') if title else None), | 15 title | translate('title', 'Meta data') if title), |
14 ('og:description', | 16 ('og:description', |
15 og_description, | 17 og_description | translate('og-description', 'Meta data') if og_description, |
16 description | translate('page-description', 'Meta data') if description else None), | 18 description | translate('page-description', 'Meta data') if description), |
17 ('og:image', | 19 ('og:image', |
18 og_image, | 20 og_image, |
19 featured_img_url), | 21 featured_img_url), |
20 ('og:image:alt', | 22 ('og:image:alt', |
21 og_image_alt, | 23 og_image_alt, |
22 featured_img_alt), | 24 featured_img_alt), |
23 ('og:locale', | 25 ('og:locale', |
24 og_locale, | 26 og_locale, |
25 locale | to_og_locale), | 27 locale | to_og_locale), |
26 | 28 |
27 ('twitter:site', | 29 ('twitter:site', |
28 twitter_site, | 30 '@' + twitter_site if twitter_site, |
29 config.get('social', 'twitter') if config.has_option('social', 'twitter') el se '@eyeo'), | 31 '@' + config.get('social', 'twitter') if config.has_option('social', 'twitte r') else '@eyeo'), |
ire
2018/01/26 11:33:59
I think the site's twitter username, facebook id,
juliandoucette
2018/01/30 04:04:40
NIT: Long line
juliandoucette
2018/01/30 04:04:40
Acknowledged.
ire
2018/01/30 08:19:08
I can't think of any better way to write this than
juliandoucette
2018/01/31 19:03:21
Acknowledged.
| |
30 ('twitter:card', | 32 ('twitter:card', |
31 twitter_card, | 33 twitter_card, |
32 'summary_large_image' if og_image or twitter_image or featured_img_url else 'summary'), | 34 'summary_large_image' if og_image or twitter_image or featured_img_url else 'summary'), |
33 ('twitter:image', | 35 ('twitter:image', |
juliandoucette
2018/01/30 04:04:40
NIT: We may not want to add og:image and twitter:i
ire
2018/01/30 08:19:08
Ack. But there's no reason to exclude it now, is t
juliandoucette
2018/01/31 19:03:21
We should not maintain code that we do not and pro
ire
2018/02/01 09:07:01
It will be used for pages that already have a feat
| |
34 twitter_image, | 36 twitter_image, |
35 featured_img_url), | 37 featured_img_url), |
36 ('twitter:image:alt', | 38 ('twitter:image:alt', |
37 twitter_image_alt, | 39 twitter_image_alt, |
38 featured_img_alt), | 40 featured_img_alt), |
39 | 41 |
40 ('fb:app_id', | 42 ('fb:app_id', |
41 facebook_id, | 43 facebook_id, |
42 config.get('social', 'facebook_id') if config.has_option('social', 'facebook _id') else None), | 44 config.get('social', 'facebook_id') if config.has_option('social', 'facebook _id')), |
43 | 45 |
44 ('p:domain_verify', | 46 ('p:domain_verify', |
45 pinterest_id, | 47 pinterest_id, |
46 config.has_option('social', 'pinterest_id') if config.has_option('social', ' pinterest_id') else None), | 48 config.has_option('social', 'pinterest_id') if config.has_option('social', ' pinterest_id')), |
47 ] %} | 49 ] %} |
48 | |
49 {% macro meta_tag(property, content, defaultContent=None) -%} | |
juliandoucette
2018/01/30 04:04:40
NIT: We could use this macro elsewhere if you sepa
ire
2018/01/30 08:19:07
Done.
| |
50 {% if content or defaultContent %} | |
51 <meta property='{{ property }}' content='{{ content or defaultContent }}'> | |
52 {% endif %} | |
53 {%- endmacro %} | |
54 | 50 |
55 {% for property, content, defaultContent in social_media_meta %} | 51 {% for property, content, defaultContent in social_media_meta %} |
juliandoucette
2018/01/30 04:04:40
NIT: You could use a for in loop here instead of d
ire
2018/01/30 08:19:08
That seems more messy to me. I think it's better t
juliandoucette
2018/01/31 19:03:21
Acknowledged.
| |
56 {{ meta_tag(property, content, defaultContent) }} | 52 {{ meta_tag(property, content, defaultContent) }} |
57 {% endfor %} | 53 {% endfor %} |
58 | |
59 {% for alternate_locale in available_locales %} | |
60 {% if alternate_locale != locale %} | |
61 {{ meta_tag(('og:locale:alternate', alternate_locale | to_og_locale)) }} | |
juliandoucette
2018/01/30 04:04:40
Detail: This implementation is correct but it does
ire
2018/01/30 08:19:08
Ack. I think you're right it should go into standa
| |
62 {% endif %} | |
63 {% endfor %} | |
LEFT | RIGHT |