瀏覽代碼

Adds meta tags

Talha Mansoor 12 年之前
父節點
當前提交
9a6e8f78d3
共有 6 個文件被更改,包括 37 次插入6 次删除
  1. 4 0
      templates/archives.html
  2. 5 0
      templates/article.html
  3. 17 4
      templates/base.html
  4. 3 0
      templates/categories.html
  5. 5 2
      templates/search.html
  6. 3 0
      templates/tags.html

+ 4 - 0
templates/archives.html

@@ -3,6 +3,10 @@
 All Posts - {{ super() }}
 {% endblock title %}
 
+{% block head_description %}
+Full archives of {{ SITENAME|striptags }} blog.
+{% endblock head_description %}
+
 {% block content %}
 
 <div class="row-fluid">

+ 5 - 0
templates/article.html

@@ -4,6 +4,11 @@
 {{ article.title }} - {{ super() }}
 {% endblock title %}
 
+{% block head_description %}
+        {% if article.summary %}
+        {{ article.summary|striptags }}
+        {% endif %}
+{% endblock head_description %}
 {% block content %}
 <article>
 <div class="row-fluid">

+ 17 - 4
templates/base.html

@@ -1,15 +1,28 @@
 <!DOCTYPE html>
 <html lang="en-US">
     <head>
-        <meta charset="UTF-8"> 
-        {% block head %}
-        <title>{% block title %}{{ SITENAME }}{% endblock title %}</title>
+        <meta charset="utf-8"> 
         <meta name="viewport" content="width=device-width, initial-scale=1.0">
+        {% if article and article.author %}
+        <meta name="author" content="{{ article.author }}" />
+        {% else %}
+        <meta name="author" content="{{ AUTHOR }}" />
+        {% endif %}
+
+        {% if SITE_LICENSE %}
+        <meta name="copyright" content="{{ SITE_LICENSE|striptags }}">
+        {% endif %}
+
+        {% if SITE_DESCRIPTION %}
+        <meta name="description" content="{% block head_description %}{{ SITE_DESCRIPTION }}{% endblock head_description %}">
+        {% endif %}
+        <title>{% block title %}{{ SITENAME|striptags }}{% endblock title %}</title>
+        {% block head_links %}
         <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/theme/css/bootstrap.css" media="screen"/>
         <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/theme/css/bootstrap-responsive.css" media="screen"/>
         <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/theme/css/style.css" media="screen"/>
         <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/theme/css/solarizedlight.css" media="screen"/>
-        {% endblock %}
+        {% endblock head_links %}
     </head>
     <body>
         <div id="content-sans-footer">

+ 3 - 0
templates/categories.html

@@ -4,6 +4,9 @@
 All Categories - {{ super() }}
 {% endblock title %}
 
+{% block head_description %}
+All categories of the {{ SITENAME|striptags }} blog. 
+{% endblock head_description %}
 {% block content %}
 <script  language="javascript" type="text/javascript">
     function uncollapse() {

+ 5 - 2
templates/search.html

@@ -4,12 +4,15 @@
 Search - {{ super() }}
 {% endblock title %}
 
-{% block head %}
+{% block head_links %}
 {{ super() }}
 <link href="http://fonts.googleapis.com/css?family=Lato:300,400|Open+Sans:300,400" rel="stylesheet" type="text/css">
 <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/theme/tipuesearch/tipuesearch.css">
-{% endblock head %}
+{% endblock head_links %}
 
+{% block head_description %}
+Search results for {{ SITENAME|striptags }} blog.
+{% endblock head_description %}
 
 {% block script %}
 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>

+ 3 - 0
templates/tags.html

@@ -4,6 +4,9 @@
 All Tags - {{ super() }}
 {% endblock title %}
 
+{% block head_description %}
+All tags used in the {{ SITENAME|striptags }} blog.
+{% endblock head_description %}
 {% block content %}
 
 <div class="row-fluid">