get rid of crazy include-vars-magic and pretitles, at the expense of more layouts
authorRalf Jung <post@ralfj.de>
Sat, 2 Jan 2016 19:45:26 +0000 (20:45 +0100)
committerRalf Jung <post@ralfj.de>
Sat, 2 Jan 2016 19:45:26 +0000 (20:45 +0100)
14 files changed:
ralf/_config.yml
ralf/_includes/vars/blog-category.html [deleted file]
ralf/_includes/vars/blog-index.html [deleted file]
ralf/_includes/vars/blog-page.html [deleted file]
ralf/_layouts/category_feed.html
ralf/_layouts/category_index.html
ralf/_layouts/default.html [new file with mode: 0644]
ralf/_layouts/feed.html
ralf/_layouts/page.html
ralf/_layouts/post.html [new file with mode: 0644]
ralf/_plugins/categories.rb
ralf/blog/archive.html
ralf/blog/feed.xml
ralf/blog/index.html

index 0b6ab46e8d40df1d0064dc967c02634db99426a5..d63d6396baddb24318fa5df8f4313a05887f80d7 100644 (file)
@@ -31,8 +31,7 @@ defaults:
     values:
         permalink: "/blog/:year/:month/:day/:title.html"
         rss: true
-        post: true
-        vars: "blog-page.html"
+        layout: "post"
 
 # Build settings
 markdown: kramdown
diff --git a/ralf/_includes/vars/blog-category.html b/ralf/_includes/vars/blog-category.html
deleted file mode 100644 (file)
index a16df5a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{% assign pretitle = site.blog.title %}
diff --git a/ralf/_includes/vars/blog-index.html b/ralf/_includes/vars/blog-index.html
deleted file mode 100644 (file)
index e738b23..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{% assign title = site.blog.title %}
diff --git a/ralf/_includes/vars/blog-page.html b/ralf/_includes/vars/blog-page.html
deleted file mode 100644 (file)
index a16df5a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{% assign pretitle = site.blog.title %}
index db32965c466580c76f8050ba263e7f5e3fecd6db..5dcab9d84978214155d01439bd64f99a244bedde 100644 (file)
@@ -1,8 +1,8 @@
 ---
 layout: feed
 hide: true
-vars: "blog-category.html"
 ---
 
+<title>{{ page.title | xml_escape }}</title>
 {% assign posts = site.categories[page.category] %}
 {% include post-feed.html posts=posts %}
index 315dd44b9444eb9eae9294f6abb731f2a83a46b6..d3cbd2e9ededa417151bd2fc64fd4b97d72f51da 100644 (file)
@@ -2,7 +2,6 @@
 layout: page
 hide: true
 rss: true
-vars: "blog-category.html"
 ---
 
 {% assign posts = site.categories[page.category] %}
diff --git a/ralf/_layouts/default.html b/ralf/_layouts/default.html
new file mode 100644 (file)
index 0000000..ca29f47
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+
+  <head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width">
+
+    <title>{{ page.title }}</title>
+    {% if page.excerpt %}<meta name="description" content="{{ page.excerpt | newline_to_br | replace:'<br />',' ' | strip_html | strip_newlines | truncate: 192 }}">{% endif %}
+
+    <link rel="stylesheet" href="{{ site.baseurl }}/style.css">
+    <link rel="canonical" href="{{ site.url }}{{ site.baseurl }}{{ page.url }}">
+    {% if page.rss %}
+        <link rel="alternate" type="application/atom+xml" title="{{ site.blog.title }}" href="{{ site.baseurl }}/blog/feed.xml" />
+        {% if page.category %}<link rel="alternate" type="application/atom+xml" title="{{ page.title }}" href="{{ site.baseurl }}{{ page.url | replace: '.html','.xml' }}" />{% endif %}
+    {% endif %}
+  </head>
+
+  <body><div id="-frame">
+
+    <nav id="-navi">
+      {% assign menu = site.pages | menu: page.url %}
+      {% include menu-level.html menu=menu %}
+    </nav>
+  
+    <article id="-content">
+      {{ content }}
+    </article>
+
+  </div></body>
+
+</html>
index 863393436ce778ff3e89af7f80c3923eb8d9c030..a700828a6ee86caadd2ec34001418f2ce2b23bb7 100644 (file)
@@ -1,9 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <feed xmlns="http://www.w3.org/2005/Atom">
-    {% assign title = page.title %}
-    {% assign pretitle = page.pretitle %}
-    {% if page.vars %}{% include {{ page.vars | prepend: "vars/" }} %}{% endif %}
-    <title>{% if pretitle %}{{ pretitle | xml_escape }} • {% endif %}{{ title | xml_escape }}</title>
     <id>{{ page.url | prepend: site.baseurl | prepend: site.url }}</id>
     <link href="{{ page.url | prepend: site.baseurl | prepend: site.url }}" rel="self" type="application/atom+xml"/>
     {% if page.category %}
index 420891973ef71bfddf24e26d3cb052566c9876e0..911a35af54869ebf297b72094e006f1178dd7e30 100644 (file)
@@ -1,54 +1,9 @@
-<!DOCTYPE html>
-<html>
+---
+layout: default
+---
 
-  <head>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width">
+<header class="title">
+<h1>{{ page.title }}</h1>
+</header>
 
-    {% assign title = page.title %}
-    {% assign pretitle = page.pretitle %}
-    {% if page.vars %}{% include {{ page.vars | prepend: "vars/" }} %}{% endif %}
-
-    <title>{% if pretitle %}{{ pretitle }} • {% endif %}{{ title }}</title>
-    {% if page.excerpt %}<meta name="description" content="{{ page.excerpt | newline_to_br | replace:'<br />',' ' | strip_html | strip_newlines | truncate: 192 }}">{% endif %}
-
-    <link rel="stylesheet" href="{{ site.baseurl }}/style.css">
-    <link rel="canonical" href="{{ site.url }}{{ site.baseurl }}{{ page.url }}">
-    {% if page.rss %}
-        <link rel="alternate" type="application/atom+xml" title="{{ site.blog.title }}" href="{{ site.baseurl }}/blog/feed.xml" />
-        {% if page.category %}<link rel="alternate" type="application/atom+xml" title="{{ site.blog.title }} • {{ title }}" href="{{ site.baseurl }}{{ page.url | replace: '.html','.xml' }}" />{% endif %}
-    {% endif %}
-  </head>
-
-  <body><div id="-frame">
-
-    <nav id="-navi">
-      {% assign menu = site.pages | menu: page.url %}
-      {% include menu-level.html menu=menu %}
-    </nav>
-  
-    <article id="-content">
-      {% comment %} Unfortunately, the variables we set above are not preserved for sub-layouts. So, we have to have all the layout here. {% endcomment %}
-      {% if pretitle %}
-        <header class="pretitle">
-          {% if page.post %}
-            {% include post-header.html item=page %}
-          {% endif %}
-          <h1>{{ pretitle }}</h1>
-        </header>
-      {% endif %}
-
-      <header class="title">
-        <h1>{{ title }}</h1>
-      </header>
-
-      {{ content }}
-
-      {% if page.post %}
-        <p class="comment">Comments? <a href="mailto:post-AT-ralfj-DOT-de">Drop me a mail</a>{% if page.reddit %} or <a href="https://www.reddit.com/r{{ page.reddit }}">leave a note on reddit</a>{% endif %}!</p>
-      {% endif %}
-    </article>
-
-  </div></body>
-
-</html>
+{{ content }}
diff --git a/ralf/_layouts/post.html b/ralf/_layouts/post.html
new file mode 100644 (file)
index 0000000..8865214
--- /dev/null
@@ -0,0 +1,12 @@
+---
+layout: default
+---
+
+<header class="title">
+    {% include post-header.html item=page %}
+    <h1>{{ page.title }}</h1>
+</header>
+
+{{ content }}
+
+<p class="comment">Comments? <a href="mailto:post-AT-ralfj-DOT-de">Drop me a mail</a>{% if page.reddit %} or <a href="https://www.reddit.com/r{{ page.reddit }}">leave a note on reddit</a>{% endif %}!</p>
index 4d08693c9ef574150d198c2f395ff834252ac660..83fef6e3625fef4227a2bd832da23c1349aa5776 100644 (file)
@@ -11,7 +11,7 @@ module Jekyll
       self.read_yaml(File.join(base, '_layouts'), layout)
       self.data['category'] = category # this tells the site template to add a link to the RSS feed
 
-      category_title_prefix = site.config['blog']['category_title_prefix'] || 'Category: '
+      category_title_prefix = site.config['blog']['title'] + ": "
       self.data['title'] = "#{category_title_prefix}#{category.capitalize}"
     end
   end
index e867f3fe7a4f3171923cffeb346d34c68f18625e..0c89c9f1eaa17a9c682696edb3c05fa3374b47df 100644 (file)
@@ -1,10 +1,15 @@
 ---
 title: Archive
-vars: blog-page.html
+layout: default
 rss: true
 sort: 1
 hide: true
 ---
+
+<header class="title">
+<h1>{{ site.blog.title }}</h1>
+</header>
+
 <p>Here you can find direct links to all my blog posts.</p>
 
   <ul class="post-list">
index 17b789de51ff6e998df69668d9e8d9b13cf4a62c..61f5b476011d0177bac0fc12d3f01b35ae914dfa 100644 (file)
@@ -4,4 +4,5 @@ slug: Subscribe
 vars: blog-index.html
 ---
 
+<title>{{ site.blog.title | xml_escape }}</title>
 {% include post-feed.html posts=site.posts %}
index f85ed560a05fb5ccd2ab389936acb4c31e12747d..eb4e08234e20fbee2b61ccebfb2727930292f725 100644 (file)
@@ -1,8 +1,12 @@
 ---
-vars: blog-index.html
+layout: default
 slug: Blog
 rss: true
 sort: 10
 ---
 
+<header class="title">
+<h1>{{ site.blog.title }}</h1>
+</header>
+
 {% include post-list.html posts=site.posts %}