Blog

Time to Start Blogging Again

Time to read: less than one minute

After a very long hiatus (life and stuff) it’s time to start blogging again. I have a few projects that I’m working on and I’m following some interesting topics, too.

One project I’m working on is updating this site to use Jekyll 3. I’m currently testing the upgrade and it’s going quite well.

I’m also learning Ruby and Ruby on Rails.

One of the topics I’m following with great interest is Decentralizing the Web.

The Web opened with an explosion of DIY openness, but over the last few years more and more of us have turned to centralized services for our needs. We still center much of our work on web technologies, but much of the “everyone their own publisher” joy has faded.

Simon St. Laurent

I’ll have more to say about all this in future posts.

By the Riverside

Time to read: less than one minute

Overlooking Pleasure Bay in New Jersey.

By the Riverside

Reading List - Sept

Time to read: two minutes

It’s been quite a while since the last one, so a list with a variety of topics this time.

  • The End of the Internet Dream - Noted attorney and educator, Jennifer S. Granick, Director of Civil Liberties at the Stanford University Law School Center for Internet and Society, argues that “In 20 years, the Web might complete its shift from liberator to oppressor.” And further that “It’s up to us to prevent that.”
  • The ethics of modern web ad-blocking - Programmer, writer, podcaster, and self-described geek, Marco Arment, believes that because “web ad quality and tolerability have plummeted, and annoyance, abuse, misdirection, and tracking have skyrocketed,” the use of ad-blocking software is now completely justified.
  • Publishing Versus Performance: Our Struggle for the Soul of the Web - Famed web designer, author, and entrepreneur, Jeffery Zeldman, whom many regard as the ‘Godfather of Web Standards’, says he’s torn between the dichotomy that “either you can have a performant website or you have a business model based on advertising.” There needs to be a way, not yet fully realized, to provide both.
  • Modern CSS Layout, power and responsibility - UK web developer, Rachel Andrew, believes that with the use of powerful new layout tools like CSS Grids and Flexbox, developers may stop creating semantic, well structured documents. She adds, “Worse, I believe there will be a strong temptation, especially with Grid, to flatten out document structure in order that all elements become a child of the element with the Grid declared. Making layout simple, but at what cost?”
  • EU’s new VAT rules forcing thousands out of business - In order to prevent big businesses from unfairly profiting by locating in lower-VAT (Value Added Tax) regimes, the European Commission created the new EU Digital VAT rules, which moved the place of supply, where the tax rate is to be computed, for VAT on digitally-delivered services to the customer’s location. As is often the case with overblown, clueless bureaucracies, this has created a clusterfuck of unintended consequences.

Blogging Features Pt. 1

Time to read: four minutes

Jekyll has a number of built-in capabilities that can add useful features to a blog site. In addition, Jekyll and Octopress have a plugin system, with many available Plugins, that enables the creation of custom generated content for the site. Here we’ll take a look at some of the built-in features:

Built-in Features

Archive listing

You can create an Archive listing of all the posts on the site, in reverse chronological order, by using code similar to this:

<h1>Archives</h1>
{% for post in paginator.posts %}
<article class="posts">
  <header>
    <h1><a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></h1>
    <time datetime="{{ post.date | datetime | date_to_xmlschema }}"
      >{{ post.date | date: "%b %-d, %Y" }}
    </time>
    <div class="readtime">Time to read: {{ post.content | reading_time_as_s }}</div>
  </header>
  {{ post.content }}
</article>
{% endfor %}

Check out the Archives page to view a listing of all the posts on this site.

Code syntax highlighting

Jekyll also offers built-in support for code snippets in many different programming languages:

SCSS

/*  main.scss  */
body {
  font-family: $base-font-family;
  font-size: 1em;
  font-weight: 400;
  color: $body-font-color;
  margin: 0 auto;
  max-width: 1290px;
  width: 96%;

  p {
    margin: 0 0 1.618em 0;
  }
}

Ruby

# date_to_string.rb
# Outputs the post.date as formatted html,
# with hooks for CSS styling.
#
#  +date+ is the date object to format as HTML.
#
# Returns string
def date_to_html_string(date)
  result = '<span class="month">' + date.strftime('%b').upcase + '</span> '
  result += date.strftime('<span class="day">%d</span> ')
  result += date.strftime('<span class="year">%Y</span> ')
  result
end

Pagination

It’s quite common on Blog sites to break up the main listing of posts, either the full posts or just excerpts, into smaller lists and display them over multiple pages. Jekyll has pagination built-in, and will automatically generate the necessary files and folders needed for paginated listings.

The following code generates the Blog page listings and the paginator links at the bottom of each blog page for this site:

<div class="blog-page">
<h1 class="page-title">{{ page.title }}</h1>
{% for post in paginator.posts %}
<article class="posts">
  <header>
    <h1><a class="post-link"
           href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></h1>
    <time datetime="{{ post.date | datetime | date_to_xmlschema }}"
      >{{ post.date | date: "%b %-d, %Y" }}
    </time>
    <div class="readtime">Time to read: {{ post.content | reading_time_as_s }}</div>
  </header>
  {{ post.content }}
</article>
{% endfor %}

<div>
  <ul class="pagination">
    {% if paginator.next_page %}
    <li><a class="next" href="{{ site.baseurl }}/page{{ paginator.next_page }}">&laquo;&nbsp;Older</a></li>
    {% else %}
    <li><span class="disabled">&laquo;&nbsp;Older</span></li>
    {% endif %}
    <a href="{{ site.baseurl }}/archives">Archives</a>
    {% if paginator.previous_page %}
    {% if paginator.previous_page == 1 %}
    <li><a class="prev" href="{{ site.baseurl }}/">Newer&nbsp;&raquo;</a></li>
    {% else %}
    <li><a class="prev" href="{{ site.baseurl }}/page{{ paginator.previous_page }}">Newer&nbsp;&raquo;</a></li>
    {% endif %}
    {% else %}
    <li><span class="disabled">Newer&nbsp;&raquo;</span></li>
    {% endif %}
  </ul>
</div>
</div>

Recent post listing

The listing of Recent posts is generated in a very similar manner to the Archive listing.

<section>
  <div>
    <h2>Recent</h2>
    <ul>
      {% for post in site.posts limit: 5 %}
      <li><a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></li>
      {% endfor %}
    </ul>
  </div>
</section>

The Recent posts listing is shown in a block below the content on this site.

Part 2 will describe some of the features added by Plugins.

What Is Octopress?

Time to read: two minutes

I’ve mentioned Octopress in two recent posts. Now for a brief explanation of what it is and what it includes.

Octopress 2.0

Octopress in version 2.0 was a framework for Jekyll. Out of the box, it provided everything you needed to set up your blog: a predefined configuration, HTML5 templates, theming with Compass and Sass, mobile-first responsive layout, a collection of plugins, and an easy deployment mechanism.

While all of this was very convenient, there were a few problems, mainly:

Octopress (2.0) is basically some guy’s Jekyll blog you can fork and modify.

Brandon Mathis

In addition, some other problems are:

  • Distributing software using Git (on GitHub, in this case) can result in conflicts when you update your site.
  • The Octopress 2.0 distribution is a collection of plugins and configurations which are difficult to change or remove.
  • The theme layer is baked into Octopress and there’s no adequate system to distribute themes independently.
  • Octopress appears not to be part of the Jekyll community.

Octopress 3.0

This latest version solves all of the problems that made the previous one so difficult to update and work with by taking a new approach. Instead of being a framework based on the developer’s blog, Octopress 3.0 is now a powerful, “obsessively designed,” toolkit for creating and deploying Jekyll blogs. It consists of a collection of Ruby Gems which provide functionality for creating posts and pages, specify and use custom templates for posts, and easily deploy your site. A new system for viewing documentation is also included.

The Octopress 2.0 Rakefile has been replaced by a new Command Line Interface (CLI) which enables you to:

  • Easily create posts, pages, drafts, and collections
  • Publish or unpublish drafts
  • Use custom templates for posts and pages
  • Easily deploy your site

A new collection of Plugins is also included which provide functionality for image handling, quotes and pullquotes, a sitemap, and many others. These plugins can be used with Octopress or with any Jekyll site.

This site was converted from my Octopress 2.0 site and is, of course, now using Octopress 3.0.