Skip to content

Commit cad8f24

Browse files
committed
Add twitter/facebook share hints
1 parent f51a2c8 commit cad8f24

File tree

3 files changed

+54
-5
lines changed

3 files changed

+54
-5
lines changed

_config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# 'jekyll serve'. If you change this file, please restart the server process.
77

88
# Site settings
9-
title: The Allan Lab
9+
title: Compiler Research
1010
1111
description: > # this means to ignore newlines until "baseurl:"
1212
Write an awesome description for your new site here. You can edit this

_includes/head.html

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
<meta http-equiv="X-UA-Compatible" content="IE=edge">
44
<meta name="viewport" content="width=device-width, initial-scale=1">
55
<title>{% if page.title %}{{ page.title | escape }}{% else %}{{ site.title | escape }}{% endif %}</title>
6-
<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">
7-
{% if page.banner_image %}
8-
<meta name="og:image" content="{{ site.url }}{{ site.baseurl }}/{{page.banner_image}}">
9-
{% endif %}
6+
{% include og.html %}
7+
108
<link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl | prepend: site.url}}">
119
<link rel="stylesheet" href="{{ "/css/syntax.css" | prepend: site.baseurl | prepend: site.url}}">
1210
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">

_includes/og.html

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<meta name="author" content="{% if page.author %} {{ page.author }} {% else %} Compiler Research Team {% endif %}" />
2+
<meta property="og:url" content="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}" />
3+
<meta property="og:title" content="{% if page.title %}{{ page.title | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.title }}{% endif %}" />
4+
<meta property="og:description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}" />
5+
<meta property="og:locale" content="en_US" />
6+
<meta name="twitter:site" content="" />
7+
<meta name="twitter:description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}" />
8+
<meta name="twitter:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}" />
9+
10+
{% assign type = "website" %}
11+
{% if page.layout == "post" %}
12+
{% assign type = "article" %}
13+
{% endif %}
14+
15+
<meta property="og:type" content="{{ type }}" />
16+
{% if type == "article" %}
17+
<!-- Article specific OG data -->
18+
<meta property="article:published_time" content="{{ page.date }}" />
19+
{% if page.modified %}
20+
<meta property="article:modified_time" content="{{ page.modified }}" />
21+
{% endif %}
22+
<meta property="article:author" content="{{ page.author }}" />
23+
<meta property="article:publisher" content="Compiler Research Team" />
24+
<meta property="article:section" content="{{ page.vertical }}" />
25+
{% for tag in page.categories %}
26+
<meta property="article:tag" content="{{ tag }}" />
27+
{% endfor %}
28+
<meta name="keywords" content="{{ page.categories | join: ', ' }}" />
29+
<meta name="twitter:card" content="summary_large_image" />
30+
<meta name="twitter:creator" content="" />
31+
32+
{% if page.ogimagenull %}
33+
<!-- no og image -->
34+
{% elsif page.banner_image %}
35+
<meta property="og:image" content="{{ page.banner_image }}" />
36+
<meta name="twitter:image" content="{{ page.banner_image }}" />
37+
<meta property="og:image:width" content="600" />
38+
<meta property="og:image:height" content="315" />
39+
{% elsif page.image %}
40+
<meta property="og:image" content="{{ page.image }}" />
41+
<meta name="twitter:image" content="{{ page.image }}" />
42+
{% else %}
43+
{% endif %}
44+
45+
{% else %}
46+
<!-- OG data for non-post pages -->
47+
<meta property="og:type" content="website" />
48+
<meta property="og:image" content="" />
49+
<meta name="twitter:card" content="summary_large_image" />
50+
<meta name="twitter:image" content="" />
51+
{% endif %}

0 commit comments

Comments
 (0)