Created
January 5, 2013 19:03
-
-
Save jbrooksuk/4463111 to your computer and use it in GitHub Desktop.
Open graph tags used in my Octopress blog.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Rich Object stuff --> | |
<meta property="og:url" value="{{ site.url }}{{ page.url }}"> | |
<meta property="og:type" content="website" /> | |
{% if page.title %}<meta property="og:title" value="{% if page.title %}{{ page.title }}{% endif %}"> | |
<meta property="og:description" value="{% if page.description %}{{ page.description }}{% else %}{{site.description}}{% endif %}"> | |
{% else %}<meta property="og:title" value="{{ site.title }}"> | |
<meta property="og:description" value="{{ description }}"> | |
{% endif %}{% if page.cover %}<meta property="og:image" value="{{ site.url }}{{ page.cover }}">{% endif %} |
hi egid,
if you are using the default octopress theme, then you should be using:
<meta property="og:description" value="{{ description | strip_html | condense_spaces | truncate:150 }}">
if using default theme, some of those blocks in the gist can be used simply like this (copied from elsewhere in the same file). Add this to the bottom of head.html
:
<meta property="og:title" value="{% if page.title %}{{ page.title }} - {% endif %}{{ site.title }}" />
<meta property="og:description" value="{{ description | strip_html | condense_spaces | truncate:150 }}" />
<meta property="og:url" value="{{ site.url }}{{ page.url }}" />
<meta property="og:type" content="website" />
{% if page.cover %}<meta property="og:image" value="{{ site.url }}{{ page.cover }}" />{% endif %}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 7 is throwing the entire contents of my page into the og:description tag - my fix has it like so: