prepare things for a blog
authorRalf Jung <post@ralfj.de>
Thu, 8 Oct 2015 15:23:32 +0000 (17:23 +0200)
committerRalf Jung <post@ralfj.de>
Thu, 8 Oct 2015 15:23:32 +0000 (17:23 +0200)
_config.yml
_layouts/default.html
_layouts/post.html
_plugins/menu.rb
blog/archive.html [new file with mode: 0644]
blog/feed.xml [moved from feed.xml with 98% similarity]
blog/index.html
style.scss

index 7d12ba3aa4941b666a843e4e924fb766ffa03366..37bb42d023b8bbde1b05f363852c951ef2716bef 100644 (file)
@@ -1,5 +1,7 @@
 # Site settings
 url: "https://www.ralfj.de"
 # Site settings
 url: "https://www.ralfj.de"
+permalink: "/blog/:year/:month/:day/:title.html"
+timezone: "Europe/Berlin"
 
 blog:
     title: "Ralf's Ramblings"
 
 blog:
     title: "Ralf's Ramblings"
@@ -22,6 +24,11 @@ defaults:
         path: "" # all files in the project
     values:
         layout: "default"
         path: "" # all files in the project
     values:
         layout: "default"
+  - scope:
+        path: ""
+        type: "posts"
+    values:
+        layout: "post"
 
 # Build settings
 markdown: kramdown
 
 # Build settings
 markdown: kramdown
index cff4389b9f615936a127fae8423131098fcee3a3..bd9f1f65cebec5fb577168a7fa65a6870b0d0c90 100644 (file)
@@ -5,13 +5,13 @@
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width">
 
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width">
 
-    <title>{{ page.title }}</title>
+    <title>{{ page.title }}{% if page.subtitle %} - {{ page.subtitle }}{% endif %}</title>
     {% if page.excerpt %}<meta name="description" content="{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}">{% endif %}
 
     <link rel="stylesheet" href="/style.css">
     {% capture canonicalurl %}{{ page.url | replace:'index.html','' }}{% endcapture %}
     <link rel="canonical" href="{{ canonicalurl | prepend: site.url }}">
     {% if page.excerpt %}<meta name="description" content="{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}">{% endif %}
 
     <link rel="stylesheet" href="/style.css">
     {% capture canonicalurl %}{{ page.url | replace:'index.html','' }}{% endcapture %}
     <link rel="canonical" href="{{ canonicalurl | prepend: site.url }}">
-    {% if page.rss or page.layout == 'post' %}<link rel="alternate" type="application/rss+xml" title="{{ site.blog.title }}" href="/feed.xml" />{% endif %}
+    {% if page.rss %}<link rel="alternate" type="application/rss+xml" title="{{ site.blog.title }}" href="/blog/feed.xml" />{% endif %}
   </head>
 
 
   </head>
 
 
@@ -22,7 +22,7 @@
     </header>
 
     <nav id="-navi">
     </header>
 
     <nav id="-navi">
-      {% assign menu = site.html_pages | menu: page.url %}
+      {% assign menu = site.pages | menu: page.url %}
       {% include menu-level.html menu=menu %}
     </nav>
 
       {% include menu-level.html menu=menu %}
     </nav>
 
index a2b4e52fefe1eae18257e3417f57826ceea5068c..5ed4c6891e77ee2d116bc5bcf23d8f3a856a7315 100644 (file)
@@ -1,15 +1,12 @@
 ---
 layout: default
 ---
 layout: default
+title: "Ralf's Ramblings"
+rss: true
 ---
 ---
-<div class="post">
+<header class="subtitle">
+  <div class="side"><a href="{{ page.url }}">Permalink</a> • {{ page.date | date: "%b %-d, %Y" }}{% if page.author %} • {{ page.author }}{% endif %}{% if page.meta %} • {{ page.meta }}{% endif %}</div>
+  <h1>{{ page.subtitle }}</h1>
+</header>
 
 
-  <header class="post-header">
-    <h1 class="post-title">{{ page.title }}</h1>
-    <p class="post-meta">{{ page.date | date: "%b %-d, %Y" }}{% if page.author %} • {{ page.author }}{% endif %}{% if page.meta %} • {{ page.meta }}{% endif %}</p>
-  </header>
+{{ content }}
 
 
-  <article class="post-content">
-    {{ content }}
-  </article>
-
-</div>
index befe357a3e318861f34f641398618791afa2a973..37c0851f960ac78385e2c5c5f48c4473182cd8c1 100644 (file)
@@ -1,41 +1,46 @@
 module Jekyll
 module Jekyll
-    module MenuFilter
-        def menu(input, displayurl)
-            def create_menu(pages, base, displayurl)
-                result = Array.new
-                for page in pages
-                    cururl = page['url'].sub('/index.html', '')
-                    if cururl.start_with?(base) and cururl.count('/') == base.count('/')
-                        # figure out CSS class
-                        if cururl == displayurl
-                            css_class = 'current'
-                        elsif cururl.start_with?(displayurl)
-                            css_class = 'child'
-                        elsif displayurl.start_with?(cururl)
-                            css_class = 'parent'
-                        else
-                            css_class = 'sibling'
-                        end
-                        # create menu node
-                        menu_node = { 'url' => page['url'], 'title' => page['slug'] ? page['slug'] : (page['title'] ? page['title'] : page['url']), 'class' => css_class, 'sort' => page['sort'] }
-                        # potentially recurse
-                        if (css_class == 'parent' or css_class == 'current')
-                            sub_nodes = create_menu(pages, cururl + "/", displayurl)
-                            if sub_nodes.size > 0
-                                menu_node['sub'] = sub_nodes
-                            end
-                        end
-                        # store menu node
-                        result.push(menu_node)
-                    end
-                end
-                # sort the result before returning it
-                result.sort_by { |a| [a['sort'], a['url']] }
+  module MenuFilter
+    def menu(input, displayurl)
+      def create_menu(pages, base, displayurl)
+        result = Array.new
+        for page in pages
+          cururl = page['url'].sub('/index.html', '')
+          if cururl.start_with?(base) and cururl.count('/') == base.count('/') and (not page['hide'])
+            # figure out CSS class
+            if cururl == displayurl
+              css_class = 'current'
+            elsif cururl.start_with?(displayurl)
+              css_class = 'child'
+            elsif displayurl.start_with?(cururl)
+              css_class = 'parent'
+            else
+              css_class = 'sibling'
             end
             end
-            
-            create_menu(input, "", displayurl.sub('/index.html', ''))
+            # create menu node
+            menu_node = { 'url' => page['url'], 'title' => page['slug'] ? page['slug'] : (page['title'] ? page['title'] : page['url']), 'class' => css_class, 'sort' => page['sort'] ? page['sort'] : 0 }
+            # potentially recurse
+            if (css_class == 'parent' or css_class == 'current')
+              sub_nodes = create_menu(pages, cururl + "/", displayurl)
+              if sub_nodes.size > 0
+                menu_node['sub'] = sub_nodes
+              end
+              if css_class == 'parent' and sub_nodes.all? { |page| page['class'] == 'sibling' }
+                # we won't get closer to this URL, it doesn't exist in our page list
+                menu_node['class'] = 'current'
+                sub_nodes.each { |page| page['class'] = 'child' }
+              end
+            end
+            # store menu node
+            result.push(menu_node)
+          end
         end
         end
+        # sort the result before returning it
+        result.sort_by { |page| [page['sort'], page['url']] }
+      end
+      
+      create_menu(input, "", displayurl.sub('/index.html', ''))
     end
     end
+  end
 end
 
 Liquid::Template.register_filter(Jekyll::MenuFilter)
 end
 
 Liquid::Template.register_filter(Jekyll::MenuFilter)
diff --git a/blog/archive.html b/blog/archive.html
new file mode 100644 (file)
index 0000000..9f0119e
--- /dev/null
@@ -0,0 +1,19 @@
+---
+title: "Ralf's Ramblings: Archive"
+slug: Archive
+rss: true
+sort: 1
+hide: true
+---
+
+<p>Here you can find all my blog posts.</p>
+
+  <ul class="post-list">
+    {% for post in site.posts %}
+      <li>
+        <span class="post-meta">{{ post.date | date: "%b %-d, %Y" }}</span>
+        &raquo;
+        <a class="post-link" href="{{ post.url }}">{{ post.title }}</a>
+      </li>
+    {% endfor %}
+  </ul>
similarity index 98%
rename from feed.xml
rename to blog/feed.xml
index 05bc7f0e054098a3c266191931ea862066d50bf3..4e3b89ad4ec853ebe077372c681ebfd4a4577e7f 100644 (file)
--- a/feed.xml
@@ -1,5 +1,6 @@
 ---
 layout: null
 ---
 layout: null
+slug: Subscribe
 ---
 <?xml version="1.0" encoding="UTF-8"?>
 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
 ---
 <?xml version="1.0" encoding="UTF-8"?>
 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
index e02b8d20e227772197564802595cf113660f0c2d..a0d8f1afbf9dd18e29e978f69f0d102a6bb6175d 100644 (file)
@@ -5,17 +5,14 @@ slug: Blog
 rss: true
 ---
 
 rss: true
 ---
 
-
-  <ul class="post-list">
-    {% for post in site.posts %}
-      <li>
-        <span class="post-meta">{{ post.date | date: "%b %-d, %Y" }}</span>
-
-        <h2>
-          <a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
-        </h2>
-      </li>
-    {% endfor %}
-  </ul>
-
-  <p class="rss-subscribe">subscribe <a href="{{ "/feed.xml" | prepend: site.baseurl }}">via RSS</a></p>
+{% assign num_posts = 5 %}
+{% for post in site.posts %}
+    {% assign num_posts = num_posts | minus: 1 %}
+    {% if num_posts >= 0 %}
+        <header class="subtitle">
+            <div class="side"><a href="{{ post.url }}">Permalink</a> • {{ post.date | date: "%b %-d, %Y" }}{% if post.author %} • {{ post.author }}{% endif %}{% if post.meta %} • {{ post.meta }}{% endif %}</div>
+            <h1>{{ post.subtitle }}</h1>
+        </header>
+        {{ post.content }}
+    {% endif %}
+{% endfor %}
index 945f31a716ac6487962f2bdad67247774049bee2..0b509232297bdde2054749be2c28805cacdf20cc 100644 (file)
@@ -1,5 +1,5 @@
 ---
 ---
-# YAML front matter
+hide: true
 ---
 @charset "utf-8";
 
 ---
 @charset "utf-8";
 
@@ -42,6 +42,7 @@ $current-color: #ffa700;
 $outer-background-color:  #505050;
 $inner-background-color: #252525;
 $text-color:             #DDD;
 $outer-background-color:  #505050;
 $inner-background-color: #252525;
 $text-color:             #DDD;
+$light-text-color:       #888;
 $link-color: #9ed2ff;
 $link-color-visited: #bfe1ff;
 $link-color-hover: #5089ba;
 $link-color: #9ed2ff;
 $link-color-visited: #bfe1ff;
 $link-color-hover: #5089ba;
@@ -145,6 +146,7 @@ body { /* This centers us in the page, and handles the "too wide" case */
         position: static;
         background-color: $inner-background-color;
         padding: 0;
         position: static;
         background-color: $inner-background-color;
         padding: 0;
+        height: auto;
     }
     #-navi ul, #-navi ul ul, #-navi li, #-navi li a {
         margin: 0;
     }
     #-navi ul, #-navi ul ul, #-navi li, #-navi li a {
         margin: 0;
@@ -200,6 +202,11 @@ body { /* This centers us in the page, and handles the "too wide" case */
 
 /* Content styling */
 #-content {
 
 /* Content styling */
 #-content {
+    .subtitle .side {
+        float: right;
+        color: $light-text-color;
+    }
+
     code {
         padding: 0.1em 0.2em;
         background-color: $outer-background-color;
     code {
         padding: 0.1em 0.2em;
         background-color: $outer-background-color;