From 2bac838a18b0a908e66e41814baba60b213a9468 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 2 Jan 2016 20:45:26 +0100 Subject: [PATCH] get rid of crazy include-vars-magic and pretitles, at the expense of more layouts --- ralf/_config.yml | 3 +- ralf/_includes/vars/blog-category.html | 1 - ralf/_includes/vars/blog-index.html | 1 - ralf/_includes/vars/blog-page.html | 1 - ralf/_layouts/category_feed.html | 2 +- ralf/_layouts/category_index.html | 1 - ralf/_layouts/default.html | 32 ++++++++++++++ ralf/_layouts/feed.html | 4 -- ralf/_layouts/page.html | 59 +++----------------------- ralf/_layouts/post.html | 12 ++++++ ralf/_plugins/categories.rb | 2 +- ralf/blog/archive.html | 7 ++- ralf/blog/feed.xml | 1 + ralf/blog/index.html | 6 ++- 14 files changed, 66 insertions(+), 66 deletions(-) delete mode 100644 ralf/_includes/vars/blog-category.html delete mode 100644 ralf/_includes/vars/blog-index.html delete mode 100644 ralf/_includes/vars/blog-page.html create mode 100644 ralf/_layouts/default.html create mode 100644 ralf/_layouts/post.html diff --git a/ralf/_config.yml b/ralf/_config.yml index 0b6ab46..d63d639 100644 --- a/ralf/_config.yml +++ b/ralf/_config.yml @@ -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 index a16df5a..0000000 --- a/ralf/_includes/vars/blog-category.html +++ /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 index e738b23..0000000 --- a/ralf/_includes/vars/blog-index.html +++ /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 index a16df5a..0000000 --- a/ralf/_includes/vars/blog-page.html +++ /dev/null @@ -1 +0,0 @@ -{% assign pretitle = site.blog.title %} diff --git a/ralf/_layouts/category_feed.html b/ralf/_layouts/category_feed.html index db32965..5dcab9d 100644 --- a/ralf/_layouts/category_feed.html +++ b/ralf/_layouts/category_feed.html @@ -1,8 +1,8 @@ --- layout: feed hide: true -vars: "blog-category.html" --- +{{ page.title | xml_escape }} {% assign posts = site.categories[page.category] %} {% include post-feed.html posts=posts %} diff --git a/ralf/_layouts/category_index.html b/ralf/_layouts/category_index.html index 315dd44..d3cbd2e 100644 --- a/ralf/_layouts/category_index.html +++ b/ralf/_layouts/category_index.html @@ -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 index 0000000..ca29f47 --- /dev/null +++ b/ralf/_layouts/default.html @@ -0,0 +1,32 @@ + + + + + + + + {{ page.title }} + {% if page.excerpt %}{% endif %} + + + + {% if page.rss %} + + {% if page.category %}{% endif %} + {% endif %} + + +
+ + + +
+ {{ content }} +
+ +
+ + diff --git a/ralf/_layouts/feed.html b/ralf/_layouts/feed.html index 8633934..a700828 100644 --- a/ralf/_layouts/feed.html +++ b/ralf/_layouts/feed.html @@ -1,9 +1,5 @@ - {% assign title = page.title %} - {% assign pretitle = page.pretitle %} - {% if page.vars %}{% include {{ page.vars | prepend: "vars/" }} %}{% endif %} - {% if pretitle %}{{ pretitle | xml_escape }} • {% endif %}{{ title | xml_escape }} {{ page.url | prepend: site.baseurl | prepend: site.url }} {% if page.category %} diff --git a/ralf/_layouts/page.html b/ralf/_layouts/page.html index 4208919..911a35a 100644 --- a/ralf/_layouts/page.html +++ b/ralf/_layouts/page.html @@ -1,54 +1,9 @@ - - +--- +layout: default +--- - - - +
+

{{ page.title }}

+
- {% assign title = page.title %} - {% assign pretitle = page.pretitle %} - {% if page.vars %}{% include {{ page.vars | prepend: "vars/" }} %}{% endif %} - - {% if pretitle %}{{ pretitle }} • {% endif %}{{ title }} - {% if page.excerpt %}{% endif %} - - - - {% if page.rss %} - - {% if page.category %}{% endif %} - {% endif %} - - -
- - - -
- {% 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 %} -
- {% if page.post %} - {% include post-header.html item=page %} - {% endif %} -

{{ pretitle }}

-
- {% endif %} - -
-

{{ title }}

-
- - {{ content }} - - {% if page.post %} -

Comments? Drop me a mail{% if page.reddit %} or leave a note on reddit{% endif %}!

- {% endif %} -
- -
- - +{{ content }} diff --git a/ralf/_layouts/post.html b/ralf/_layouts/post.html new file mode 100644 index 0000000..8865214 --- /dev/null +++ b/ralf/_layouts/post.html @@ -0,0 +1,12 @@ +--- +layout: default +--- + +
+ {% include post-header.html item=page %} +

{{ page.title }}

+
+ +{{ content }} + +

Comments? Drop me a mail{% if page.reddit %} or leave a note on reddit{% endif %}!

diff --git a/ralf/_plugins/categories.rb b/ralf/_plugins/categories.rb index 4d08693..83fef6e 100644 --- a/ralf/_plugins/categories.rb +++ b/ralf/_plugins/categories.rb @@ -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 diff --git a/ralf/blog/archive.html b/ralf/blog/archive.html index e867f3f..0c89c9f 100644 --- a/ralf/blog/archive.html +++ b/ralf/blog/archive.html @@ -1,10 +1,15 @@ --- title: Archive -vars: blog-page.html +layout: default rss: true sort: 1 hide: true --- + +
+

{{ site.blog.title }}

+
+

Here you can find direct links to all my blog posts.