Rothberg Writes

Reminiscences of an Option Operator.

Octopress Paper Cuts

Now that I have started writing a few blog posts, I have come across a few “paper cuts” with the (current) Octopress framework. Some quick background on Octopress: I am currently running the v2.0 version of Octopress which appears to have been released in July 2011. According to this blog, the v2.1 version was scrapped in favor of a more significant v3.0. From the Twitter feed and the GitHub page, v3.0 seems to be in active development but not yet released. That leaves me with using v2.0 for the time being.

Social Button Alignment

The first issue that I came across was the vertical alignment of the “social buttons” on the bottom of each post. You can see the Facebook “Like” and “Share” buttons are lower than the Twitter and Google+ buttons:

which was fixed by following this comment.

Embedded Gist Rendering

The next issue was rendering of embedded Gists. The rendered Gist look pretty crappy:

There are a number of people talking about the issue: here and here. The solution I ended up using was a combination of these plus some of my own CSS.

Meta Keywords and Description on Site Pages

Currently meta tags for keywords and description are only generated on post pages not on site level pages. A solution is offered here and a Pull Request.

Blog in URL Path with Subdomain

I addressed this issue in a previous post.

post_url plugin

In order to use post_url to allow intelligent linking between posts, I had to follow this post.

Then I ran into this error message:

1
Liquid Exception: Tag '{%%20post_url%202014-05-13-hello-world%20%}' was not properly terminated with regexp: /\%}/ in atom.xml

Following this comment fixed that issue.

Since I wanted the ability to use named anchors, I made the following change to the post_url.rb file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--- plugins/post_url.rb.orig    2014-05-14 13:33:36.938495170 -0400
+++ plugins/post_url.rb  2014-05-14 13:30:26.162496398 -0400
@@ -25,8 +25,10 @@
   class PostUrl < Liquid::Tag
     def initialize(tag_name, post, tokens)
       super
+      post, anchor = post.strip.split
       @orig_post = post.strip
       @post = PostComparer.new(@orig_post)
+      @anchor = anchor
     end

     def render(context)
@@ -34,7 +36,11 @@

       site.posts.each do |p|
         if @post == p
-          return p.url
+          if @anchor.nil?
+             return p.url
+          else
+             return p.url + "#" + @anchor
+          end
         end
       end

I doubt these will be the last of the paper cuts that I uncover, so stay tuned for more fixes. I am starting to think this applies to Octopress, but I still enjoy the challenge and the learning experience.

Comments