Skip to content

Commit

Permalink
Merge pull request artemsheludko#12 from kentonh/master
Browse files Browse the repository at this point in the history
reduces formatting required for Social Graph and Twitter Card
  • Loading branch information
artemsheludko authored Nov 12, 2017
2 parents e391102 + 3d399d9 commit 47c2931
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ description: > # this means to ignore newlines until "baseurl:"
permalink: ':title/'
baseurl: "/flexible-jekyll" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site, e.g. http://example.com
site-twitter: "" #if your site has a twitter account, enter it here

# Author Settings
author: David Freeman # add your name
Expand Down
24 changes: 15 additions & 9 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<meta charset="utf-8">
<title>{% if page.title %}{{page.title}} - {{site.title}}{% else %}{{site.title}}{% endif %}</title>

<meta content="{{ site.title }}" property="og:site_name">
<!-- Edit site and author settings in `_config.yml` to make the social details your own -->

<meta content="{{ site.title }}" property="og:site_name">
{% if page.title %}
<meta content="{{ page.title }}" property="og:title">
{% else %}
Expand All @@ -25,10 +27,10 @@
<meta content="{{ page.date | date_to_xmlschema }}" property="article:published_time">
<meta content="{{ site.url }}/about/" property="article:author">
{% endif %}
{% if page.image %}
<meta content="/img/srcset/{{ page.image }}" property="og:image">
{% if page.img %}
<meta content="{{ site.url }}{{ site.baseurl }}/assets/img/{{ page.img }}" property="og:image">
{% else %}
<meta content="/img/david-freeman.jpg" property="og:image">
<meta content="/img/{{ site.author-img }}" property="og:image">
{% endif %}
{% if page.categories %}
{% for category in page.categories limit:1 %}
Expand All @@ -41,9 +43,13 @@
{% endfor %}
{% endif %}

<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@site_username">
<meta name="twitter:creator" content="@creator_username">
{% if post.excerpt %}
<meta name="twitter:card" content="{{ post.excerpt }}">
{% else %}
<meta name="twitter:card" content="{{ page.description }}">
{% endif %}
<meta name="twitter:site" content="@{{ site-twitter }}">
<meta name="twitter:creator" content="@{{ twitter }}">
{% if page.title %}
<meta name="twitter:title" content="{{ page.title }}">
{% else %}
Expand All @@ -58,9 +64,9 @@
<meta name="twitter:description" content="{{ site.description }}">
{% endif %}
{% if page.image %}
<meta name="twitter:image:src" content="{{ site.url }}/path/to/image/{{ page.image }}">
<meta name="twitter:image:src" content="{{ site.url }}{{ site.baseurl }}/assets/img/{{ page.img }}">
{% else %}
<meta name="twitter:image:src" content="{{ site.url }}/path/to/image/logo.png">
<meta name="twitter:image:src" content="{{ site.url }}{{ site.baseurl }}/img/{{ site.author-img }}">
{% endif %}

<meta name="description" content="{{ page.description }}">
Expand Down

0 comments on commit 47c2931

Please sign in to comment.