From 9f221287021296a9e6761777f355edd3169e9039 Mon Sep 17 00:00:00 2001 From: Andrew Senetar Date: Tue, 30 Jul 2013 14:48:42 -0400 Subject: [PATCH] Update base template Base template now figures out the page title property & heading title. This allows the title block to be not be used in sub templates. The feed and navigation sections of the base template are now in seperate files to make it easier to navigate the source. --- templates/_feeds.html | 24 +++++++ templates/_navigation.html | 84 ++++++++++++++++++++++ templates/base.html | 143 ++++++++++--------------------------- 3 files changed, 146 insertions(+), 105 deletions(-) create mode 100644 templates/_feeds.html create mode 100644 templates/_navigation.html diff --git a/templates/_feeds.html b/templates/_feeds.html new file mode 100644 index 0000000..2ad14bc --- /dev/null +++ b/templates/_feeds.html @@ -0,0 +1,24 @@ + {% if FEED_ATOM -%} + + {% endif %} + {%if FEED_RSS -%} + + {% endif %} + {% if FEED_ALL_ATOM -%} + + {% endif %} + {%if FEED_ALL_RSS -%} + + {% endif %} + {% if CATEGORY_FEED_ATOM and category -%} + + {% endif %} + {%if CATEGORY_FEED_RSS and category -%} + + {% endif %} + {% if TAG_FEED_ATOM and tag -%} + + {% endif %} + {%if TAG_FEED_RSS and tag -%} + + {% endif %} \ No newline at end of file diff --git a/templates/_navigation.html b/templates/_navigation.html new file mode 100644 index 0000000..cd08ef3 --- /dev/null +++ b/templates/_navigation.html @@ -0,0 +1,84 @@ + diff --git a/templates/base.html b/templates/base.html index 7ef67e8..b09b6a3 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,16 +1,26 @@ - - + + - - - - + {# Get a generic title element #} + {% set page_title = article.title if article else page.title if page else category.name if category else tag.name if tag else author.name if author else page_name|title %} + {# fetch description, tags, author from article, page or CONFIGURATION file #} + {% set page_descrip = article.summary|striptags if article else page.summary|striptags if page else PAGE_DESC[title.lower()]|default(SITE_DESCR) if PAGE_DESC else SITE_DESCR %} + {% set page_tags = article.tags|join(', ') if (article and article.tags) else page.tags|join(', ') if (page and page.tags) else SITE_KEY %} + {% set page_author = article.author if article else page.author if page else AUTHOR %} + + + + + + + - {% block title %}{{ SITENAME }}{% endblock %} + {% block title %}{{ SITENAME }}{{ ' - '+page_title if not page_title.lower() =='index' }}{% endblock %} + @@ -19,109 +29,31 @@ - + - {% if FEED_ATOM -%} - - {% endif %} - {%if FEED_RSS -%} - - {% endif %} - {% if FEED_ALL_ATOM -%} - - {% endif %} - {%if FEED_ALL_RSS -%} - - {% endif %} - {% if CATEGORY_FEED_ATOM and category -%} - - {% endif %} - {%if CATEGORY_FEED_RSS and category -%} - - {% endif %} - {% if TAG_FEED_ATOM and tag -%} - - {% endif %} - {%if TAG_FEED_RSS and tag -%} - - {% endif %} - + {% include '_feeds.html' %} + - + + {% include '_navigation.html' %}
-
-

{% block content_title %}{% endblock %}

+
+ {% block content_title %} +

{{ page_title if not page_title.lower()=='index' else SITENAME }}

+ {% endblock %} {% block content_image %}{% endblock %}
{% block content %} -
    +
      + {% for article in articles_page.object_list %} {% include '_list_item.html' %} {% endfor %} @@ -133,37 +65,38 @@
-
-