Quotidian Quest

switching over to dashes

Category: tech
#blog #creative challenge

Today, I wanted to find out why urls used dash (-) instead of underscores (_). Personally, I perfer to use underscores because they are easier for me to read when looking at a long_title_that_signals_something and thought that the reason it didn't work out was because of someone thinking the opposite.

Turns out that it has more to do with how computers seperate words. Joel Atwood had a nice piece that points out that the w used in regular expressions matches up with the under score so what I view as multiple words would be counted as one.

The best example was in the comments when someone wrote:

This_is_a_single_word
but this-is-multiple-words
-- Jeff Atwood

I don't think I'll be changing my old files but going forward, I'll probably use this convention.

Opening up on the internet

Category: personal
#blog #slack

I recently spent some time chatting on the internet about some of the problems that I've been having with getting things done since my "fun-employment" the last couple of months. It is very hard for me, because I've been told that I'm smart and have potential all of my life and here I am in my mid 30's and there aren't a line of people knocking on my door to give me money.

When I did this, I felt good.

I felt like I wasn't just someone lost in the wind.

I'm going to stay involved with the community and make it my touch stone as I work towards finding more work.

Finished open graph

Category: coding
#blog #open graph

So, I spent about 3 hours working on getting Open Graph tags to work in the theme that I created. I've got mixed feeling about it because I started off by adding the tags to the base html template using an if statement and it seemed a little clunky.

{% if OPEN_GRAPH %}
<meta property="og:title" content="{{ SITENAME }}"/>
<meta property="og:type" content="website"/>
<meta property="og:description" content="{{ SITE_DESCRIPTION }}"/>
<meta property="og:url" content="{% SITE_URL %}"/>
{% endif OPEN_GRAPH %}

This worked for the site in general but doesn't translate to all the articles and this caused me to go into a some what deep dive into how Pelican and Jinja parses blocks and if statements. I started off with putting all the tags into the base and then doing individual changes to tags that need to be changed for.

BAH!!!

So, took a step back and looked into what plugins were already available. And there is was! Pelican-open_graph! I was home free! Or so I thought, until I tried to use it. The plugin has three problems.

It doesn't account for when someone does not have a modified date on their articles.

Luckily, someone had put a solution up. The change was forked about 7 months ago today and it looks like whoever created the open graph plugin has taken a break to work on other things.

It's a year old and hasn't made the changes for pelican regarding summaries of articles.

So, I had to do some debugging to find out that the code needed to be changed in the following way1.

ogtags.append(('og:description', instance.metadata.get('og_description',
                                                           instance.metadata.get('summary',
                                                                                 instance.summary))))

It also assumed that every article has some kind of tag.

I've decided to just punt this problem and add the tags to the 6 articles that don't have them, but than I took a second look at the problem because the perfectionist in me doesn't like to leave problems unsolved and I didn't want to track down what the particular articles were.

So, I just wrapped the code in a try block to make sure that I got this particular exception.

try:
        for tag in instance.tags:
            ogtags.append(('article:tag', tag.name))
    except AttributeError:
            ogtags.append(('article:tag', 'untagged'))

Results

Ultimately, I got to learn a little bit more about using pelican and knocked off a major milestone on getting this blog to where I'd like it to be.


  1. I've got to branch and push this fix. I don't know how many other people are using pelican or this plugin but if I can save them or future me some time... 

Blogging workshop

Category: blogging
#blog #writing

Today I went to a blogging workshop and I found it really interesting. At first, I was worried that it would filled with the standard novice information like how to get on the internet being taught by someone took 15 minutes to get some information off the internet and put it into a powerpoint presentation to read to use.

Creating New Website

Category: blogging
#website #blog

Despite all of my hard work on facebook, it's time that I also have some kind of static site as well.