From 8a8ac5c408b2e2012d6c882e1f708342eec7f4be 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 --- personal/_config.yml | 3 +- personal/_includes/vars/blog-category.html | 1 - personal/_includes/vars/blog-index.html | 1 - personal/_includes/vars/blog-page.html | 1 - personal/_layouts/category_feed.html | 2 +- personal/_layouts/category_index.html | 1 - personal/_layouts/default.html | 32 ++++++++++++ personal/_layouts/feed.html | 4 -- personal/_layouts/page.html | 59 +++------------------- personal/_layouts/post.html | 12 +++++ personal/_plugins/categories.rb | 2 +- personal/blog/archive.html | 7 ++- personal/blog/feed.xml | 1 + personal/blog/index.html | 6 ++- 14 files changed, 66 insertions(+), 66 deletions(-) delete mode 100644 personal/_includes/vars/blog-category.html delete mode 100644 personal/_includes/vars/blog-index.html delete mode 100644 personal/_includes/vars/blog-page.html create mode 100644 personal/_layouts/default.html create mode 100644 personal/_layouts/post.html diff --git a/personal/_config.yml b/personal/_config.yml index 0b6ab46..d63d639 100644 --- a/personal/_config.yml +++ b/personal/_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/personal/_includes/vars/blog-category.html b/personal/_includes/vars/blog-category.html deleted file mode 100644 index a16df5a..0000000 --- a/personal/_includes/vars/blog-category.html +++ /dev/null @@ -1 +0,0 @@ -{% assign pretitle = site.blog.title %} diff --git a/personal/_includes/vars/blog-index.html b/personal/_includes/vars/blog-index.html deleted file mode 100644 index e738b23..0000000 --- a/personal/_includes/vars/blog-index.html +++ /dev/null @@ -1 +0,0 @@ -{% assign title = site.blog.title %} diff --git a/personal/_includes/vars/blog-page.html b/personal/_includes/vars/blog-page.html deleted file mode 100644 index a16df5a..0000000 --- a/personal/_includes/vars/blog-page.html +++ /dev/null @@ -1 +0,0 @@ -{% assign pretitle = site.blog.title %} diff --git a/personal/_layouts/category_feed.html b/personal/_layouts/category_feed.html index db32965..5dcab9d 100644 --- a/personal/_layouts/category_feed.html +++ b/personal/_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/personal/_layouts/category_index.html b/personal/_layouts/category_index.html index 315dd44..d3cbd2e 100644 --- a/personal/_layouts/category_index.html +++ b/personal/_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/personal/_layouts/default.html b/personal/_layouts/default.html new file mode 100644 index 0000000..ca29f47 --- /dev/null +++ b/personal/_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/personal/_layouts/feed.html b/personal/_layouts/feed.html index 8633934..a700828 100644 --- a/personal/_layouts/feed.html +++ b/personal/_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/personal/_layouts/page.html b/personal/_layouts/page.html index 4208919..911a35a 100644 --- a/personal/_layouts/page.html +++ b/personal/_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/personal/_layouts/post.html b/personal/_layouts/post.html new file mode 100644 index 0000000..8865214 --- /dev/null +++ b/personal/_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/personal/_plugins/categories.rb b/personal/_plugins/categories.rb index 4d08693..83fef6e 100644 --- a/personal/_plugins/categories.rb +++ b/personal/_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/personal/blog/archive.html b/personal/blog/archive.html index e867f3f..0c89c9f 100644 --- a/personal/blog/archive.html +++ b/personal/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.