diff options
author | Frederic Hemberger <mail@frederic-hemberger.de> | 2011-09-21 10:08:38 +0200 |
---|---|---|
committer | Frederic Hemberger <mail@frederic-hemberger.de> | 2011-09-21 10:08:38 +0200 |
commit | 0b5215c0f5530e29810deb71e2a27042c3e1284b (patch) | |
tree | 80d840218990378112811610e02d81d823ec9230 /.themes/classic | |
parent | 48a93a90a4b7a17e132f2b6ba80bbd5dbc1c99cb (diff) | |
download | my_new_personal_website-0b5215c0f5530e29810deb71e2a27042c3e1284b.tar.xz my_new_personal_website-0b5215c0f5530e29810deb71e2a27042c3e1284b.zip |
Adds first 150 chars of content as meta description, if no page.description specified. Fixes #162
Diffstat (limited to '')
-rw-r--r-- | .themes/classic/source/_includes/head.html | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/.themes/classic/source/_includes/head.html b/.themes/classic/source/_includes/head.html index be371e92..5d817657 100644 --- a/.themes/classic/source/_includes/head.html +++ b/.themes/classic/source/_includes/head.html @@ -6,18 +6,16 @@ <meta charset="utf-8"> <title>{% if page.title %}{{page.title}} - {% endif %}{{site.title}}</title> <meta name="author" content="{{site.author}}"> - {% if page.description %} - <meta name="description" content="{{page.description}}"/> - {% endif %} + + {% capture description %}{% if page.description %}{{ page.description }}{% else %}{{ content | raw_content }}{% endif %}{% endcapture %} + <meta name="description" content="{{ description | strip_newlines | strip_html | truncate:150 }}"> + {% if page.keywords %}<meta name="keywords" content="{{ page.keywords }}">{% endif %} <!-- http://t.co/dKP3o1e --> <meta name="HandheldFriendly" content="True"> <meta name="MobileOptimized" content="320"> <meta name="viewport" content="width=device-width, initial-scale=1"> - {% if page.keywords %} - <meta name="keywords" content="{{page.keywords}}"/> - {% endif %} {% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' }}{% endif %}{% endcapture %} <link rel="canonical" href="{{ canonical }}"> <link href="{{ root_url }}/favicon.png" rel="shortcut icon" /> |