File tree Expand file tree Collapse file tree 2 files changed +28
-5
lines changed
themes/vocabulary_theme/templates Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Original file line number Diff line number Diff line change 1717{% endif %}
1818< meta property ="og:url " content ="{{ this|url }} " />
1919< meta property ="og:type " content ="article " />
20- {% set image = this.attachments.images.first() %}
21- {% if image %}
22- < meta property ="og:image " content ="{{ image|url(external=true)}} " />
23- {% endif %}
20+ {% from "macros/og_image.html" import og_image %}
21+ {{ og_image(this) }}
2422< meta name ="twitter:card " content ="summary_large_image " />
2523< meta name ="twitter:title " content ="{{ this.title }} ">
2624< meta name ="twitter:description " content ="{{ desc }} ">
4139< script >
4240 const globalHeaderInstance = vocabulary . createGlobalHeader ( ) ;
4341</ script >
44- < title > {% block title %}Welcome{% endblock %} — Creative Commons on GitHub </ title >
42+ < title > {% block title %}Welcome{% endblock %} — Creative Commons Open Source </ title >
4543
4644< body >
4745 < div class ="ga-script "> {{ generate_google_analytics() }}</ div >
Original file line number Diff line number Diff line change 1+ {% from "macros/author_name.html" import render_author_name %}
2+
3+ {% macro og_image(page) %}
4+ {% set baseUrl = 'https://cc-og-image.vercel.app/' %}
5+ {% set queryParams = '?&md=1&fontFamily=roboto-condensed&fontSize=100px&images=https%3A%2F%2Fcc-vocabulary.netlify.app%2Flogos%2Fproducts%2Fopen_source.svg%23opensource' %}
6+
7+ {% if page.title %}
8+ {% set pageTitle = page.title %}
9+ {% else %}
10+ {% set pageTitle = 'Open Source at CC' %}
11+ {% endif %}
12+
13+ {% if page.author %}
14+ {% set author = page.parent.parent.children.get('authors').children.get(page.author) %}
15+ {% if author and author.md5_hashed_email %}
16+ {% set gravatarURL = 'https://secure.gravatar.com/avatar/' + author.md5_hashed_email + '?size=300' %}
17+ {% set queryParams = queryParams + '&images=' + gravatarURL %}
18+ {% set pageTitle = page.title + '< br > < sm style ="font-size:70px; "> By '+ render_author_name(author) + '</ sm > ' %}
19+ {% endif %}
20+ {% endif %}
21+
22+ {% set url = baseUrl + pageTitle + '.png' + queryParams %}
23+
24+ < meta property ="og:image " content ="{{ url }} " />
25+ {% endmacro %}
You can’t perform that action at this time.
0 commit comments