Forráskód Böngészése

Set keyword meta tags for article and pages

Talha Mansoor 11 éve
szülő
commit
05e580f631
3 módosított fájl, 16 hozzáadás és 0 törlés
  1. 7 0
      templates/article.html
  2. 2 0
      templates/base.html
  3. 7 0
      templates/page.html

+ 7 - 0
templates/article.html

@@ -9,6 +9,13 @@
 {{ article.summary|striptags }}
 {% endif %}
 {% endblock head_description %}
+
+{% block meta_tags_in_head %}
+{% if article.tags or article.category or article.keywords %}
+<meta name="keywords" content="{{ [article.tags|join(', '), article.category, article.keywords]|join(', ') }}" />
+{% endif %}
+{% endblock meta_tags_in_head %}
+
 {% block content %}
 <article>
 <div class="row-fluid">

+ 2 - 0
templates/base.html

@@ -17,6 +17,8 @@
         {% if SITE_DESCRIPTION %}
         <meta name="description" content="{% block head_description %}{{ SITE_DESCRIPTION }}{% endblock head_description %}" />
         {% endif %}
+        {% block meta_tags_in_head %}
+        {% endblock meta_tags_in_head %}
         <title>{% block title %}{{ SITENAME|striptags }}{% endblock title %}</title>
         {% block head_links %}
         <link href="http://cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css">

+ 7 - 0
templates/page.html

@@ -9,6 +9,13 @@
 {{ page.summary|striptags }}
 {% endif %}
 {% endblock head_description %}
+
+{% block meta_tags_in_head %}
+{% if page.keywords %}
+<meta name="keywords" content="{{ page.keywords }}" />
+{% endif %}
+{% endblock meta_tags_in_head %}
+
 {% block content %}
 <article>
 <div class="row-fluid">