Skip to content

Instantly share code, notes, and snippets.

@Lanace
Created July 12, 2018 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lanace/e7a34a48aa82e62eb10ec11b1fb183c4 to your computer and use it in GitHub Desktop.
Save Lanace/e7a34a48aa82e62eb10ec11b1fb183c4 to your computer and use it in GitHub Desktop.
open-graph.html 설정
<!-- Twitter Cards -->
<meta name="twitter:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}">
{% if page.excerpt %}<meta name="twitter:description" content="{{ page.excerpt | strip_html }}">{% endif %}
{% if site.owner.twitter %}<meta name="twitter:site" content="@{{ site.owner.twitter }}">{% endif %}
{% if author.twitter %}<meta name="twitter:creator" content="@{{ author.twitter }}">{% endif %}
{% if page.image.feature %}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="{{ site.url }}/images/{{ page.image.feature }}">
{% else %}
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="{% if page.image.thumb %}{{ site.url }}/images/{{ page.image.thumb }}{% else %}{{ site.url }}/images/{{ site.logo }}{% endif %}">
{% endif %}
<!-- Open Graph -->
<meta property="og:locale" content="{{ site.locale }}">
<meta property="og:type" content="article">
<meta property="og:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}">
{% if page.image.feature %}
<meta name="og:image" content="{{ site.url }}/images/{{ page.image.feature }}">
{% else %}
<meta name="og:image" content="{% if page.image.thumb %}{{ site.url }}/images/{{ page.image.thumb }}{% else %}{{ site.url }}/images/{{ site.logo }}{% endif %}">
{% endif %}
{% if page.excerpt %}<meta property="og:description" content="{{ page.excerpt | strip_html }}">{% endif %}
<meta property="og:url" content="{{ page.url | replace:'index.html','' | prepend: site.url }}">
<meta property="og:site_name" content="{{ site.title }}">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment