Comments and previews in Ghost

Published on 19 February 2016

If you just want to see how to disable comments on preview-linked posts in Ghost, jump to the second section.

Some history

In the past I've had many sites and blogs. I've built my own systems and I've also powered sites using feature-rich software like WordPress. With my own systems, I found myself too busy building and designing to actually get the energy to write and publishing anything meaningful. With WordPress I discovered that I was never able to find a theme or set of features that I felt comfortable with — that's not to mention trying to build my own theme from scratch that could support what was possible with WordPress.

Now we enter Ghost. Ghost is an open source blogging platform powered by Node.js. It's simple and focused on publishing — a perfect candidate for powering websites exactly like this one. Despite its relatively early days, I found Ghost to be very powerful software. And even better, the themes were very easy to build using the Handlebars templating language. So around a year ago, I started building the theme you see on this blog today.

After the popularity of my first post about Ubuntu Phone, I decided to add the Disqus commenting system to the site. Because Ghost does not have any built-in support for comments, a system like Disqus was necessary to have the functionality. In a recent release of Ghost, the ability to create a preview link made it possible to share drafts with friends before publishing. (Awesome!)

The problem

Unfortunately, sharing a draft had the side effect of "creating" a new discussion on Disqus that was tied to the preview URL. This same URL gets used by the comment widget when promoting other discussion topics (posts) on the site. In practice, this is not a problem given that once a post is published, the preview URL automatically redirects to the published post. However, this left open the possibility that an unpublished post was a) commented on by a friend and b) becoming promoted in the widget before being published. Additionally, the wrong URL would then appear in the Disqus discussions list.

After checking the GitHub issue for the preview feature, I could not find any information related to determining within the template whether or not a post was being rendered as a preview. I did, however, find a comment from a fellow user who was experiencing a similar problem. Further exploration of the issues list and Google left me with no hints so I went to the theme docs for the post context.

With some experimentation, I figured out that using the {{#if}} helper in combination with the published_at attribute is effective in detecting the published state of a post.

{{!-- render post up here using title and content helpers --}}
{{#if published_at}}
{{> comments}}
<div class="comments-disabled">  
    <p>This post is a work in progress.</p> 
    <p>Comments are not available until this post is published.</p>

In this example post.hbs, if published_at has a value, I use a "Partial Expression" to include my comments.hbs partial template from my theme's /partials/ directory. Otherwise ({{else}}), I drop in some HTML with a message explaining the absence of the comment box.

Now if I shoot drafts over to my friends or colleagues for review, Disqus will not have any unpublished discussions created. Likewise, if I had a script to create a topic on some other discussion forum (Facebook, Discourse, et cetera), it would not be rendered into the page and would be unable to run or cause any damage.


When editing unpublished posts in Ghost, expanding the Post Settings popover (cogwheel) will display a Publish Date. This date is set to the date and time you began editing the unpublished post, but it does not save unless you edit it. If you edit this time and save your draft, your post will have a published_at date and the above template logic will fail. You can erase a published date by focusing the Publish Date field and pressing backspace or delete.


While the problem above is a minor annoyance for me, it can be particularly troublesome for those implementing other solutions. I certainly hope this helps — and hope you haven’t gone so far as to hack at the source just yet.

Personal, professional goals

Published on 08 February 2016

When was the last time you set a goal? Was it a personal goal? Or was it professional? Did you succeed?

Now think about the last time your employer helped you define an explicit goal for yourself and subsequently helped you achieve it.

The fact is, many companies -- particularly startups -- don't find it "cool" to invest time into doing certain kinds of things for their employees. The kinds of things larger, more advanced, well-established organizations do. The same things that keep their employees growing, engaged and retained. One of these in particular is goal-setting.

So in these smaller (often startup) companies, the responsibility for setting attainable yearly goals, seeking out the pathways to success and celebrating these successes often falls squarely on the shoulders of the employee. It seems awfully corporate to some, and a little bit useless to the naive, but without a meaningful target to aim for, success is impossible to measure.

And while I know the post is a bit delayed (it's February!), I have taken some extra time to think about what I want out of 2016 and lay out a small recap of 2015. It is my hope that you'll find some impetus within this post to build goals into your work life. I know that far too few people think about it, and even fewer implement this basic growth process in their lives.

My goals for 2015

For at least as long as I've worked in this industry, I've had some variety of professional goals set out each year. I'll give you some examples:

  • Attain the highest peer rating on all my projects for the year.
  • Learn to evaluate and rate my own performance accurately and dispassionately.
  • Become more capable in a technology by utilizing it in a project. (Python powers my app portfolio)
  • Utilize other non-technical skills I possess to help other teams in the organization. (i.e. being a native, educated English-speaker helps a lot with marketing)

I generally keep such goals secret until they are met, but for 2015, I'll speak of couple:

  1. Bring an app to market on a competing platform, with feature parity.
  2. Become less religious about competing platforms.

Most of my professional year 2015 was spent fulfilling these goals. Which meant I spent the better part of the year overseeing design and building out an Android app counterpart to our iOS app. In less than 10 months, I achieved full feature parity, high user adoption and support for eight major versions of Android. All of that while also maintaining our iOS app. Goal #1 achieved.

As for Goal #2, the things I learned in 2015 refreshed my understanding and challenged what I considered to be good service from an API vendor. Over the years, many of Apple's APIs were broken or performed in unexpected ways that required developers to make their own workarounds independently for several major versions. The same is of course true in many instances with Google's APIs, but then I learned how much time Google has really invested in the toolchain for Android. That investment has many rewards for developers. So my ability to better appreciate both platforms has come strictly from experience, and I expect that to have a positive impact on the decisions I'll make in the future. Goal #2 achieved.

While I had employed other goals for 2015, these two were the most relevant to my work and overall career target. Setting and achieving both of them set the tone for my 2016 while also providing proof to myself that my next set of goals are realistic and attainable options for the coming year.

Often not easy

Every new year, billions of people set out goals in the form of resolutions. Many of these are unmet each year for any number of reasons. Some are simply unrealistic while others are not taken seriously enough.

Your professional goals should be attainable, and you should plan a clear path to success. If it means roping your super/advisor/mentor in to talk about what you want to accomplish and how it will benefit the organization, do it.

Having someone to talk with about your goals will make it more likely for you to set high-quality goals that result in growth for both parties involved.

Steam theme for Slack

Published on 04 October 2015

For the most part, we office-working keyboard monkeys don't get to play many games while we're at work. If you work in a so-called 'modern' workplace with nap rooms and masseuses, you may have access to a PlayStation or Xbox, but us computer gamers are left out in the cold until 5:00 PM rolls around. (PC master race proven to be more productive during work hours?)

So, in order to provide just a tiny bit of solace to my fellow PC gamers, I've created a sidebar theme for Slack that imitates the Steam friends list color scheme.

To try out my theme, when you're in Slack, go to Preferences, and choose the Sidebar Theme option. Click the link that says customize your theme and share it with others and paste the following hex codes into the bottommost text box.

#161616, #5F5F5F, #292A2E, #B6EB4B, #1F2933, #FFFFFF, #68CBF2, #F13C32

Your sidebar colors will change and look something like this:

Steam Theme for Slack

Now your colleagues look a lot more fraggable.

See you in-game?

Wearing Apple Watch

Published on 27 July 2015
One month with Apple Watch

You've been there before.

Dinner. A restaurant. Friends.

For every person that sits at the table, there's one smartphone face down next to their plate. At opportune lulls in conversation (you know them), people look down and flip those babies over to "see what's happening." This whole process takes some time and then the conversation resumes. Rinse, repeat.

Smartphones are good at keeping us notified, but their depth can be distracting. So what if we replaced checking the phone's lock screen with a quick and simple glance at our wrists? Is it possible that changing how we approach notifications could improve our lives?

One month of Apple Watch

Last month, before I went to the United States for a week, I priced myself an Apple Watch. While the general tone (including my own) in the office had been negative toward the watch, I was naturally drawn to it in the same way I was drawn to Ubuntu Phone – curiosity. When possible, I prefer to make observations personally instead of borrowing from others, and being a mobile engineer specialized in iOS development is plenty of justification to make the purchase. The watch was not available in Denmark at the time, and I had given up on the idea when I found out it was also currently unavailable in Apple Stores. I flew to the United States.

Halfway through my stay, fate intervened, and I got an email happily notifying me the watch was available in Apple Stores. The next day, I drove into the city to make the purchase.



After briefly shopping through the models I could actually afford, I settled on a 42mm Space Grey Apple Watch Sport. After 7% sales tax, the price came to $426.93 (≈ 2902 DKK). While it seems like a lot of money (and it is), getting an Apple Watch in Denmark would have cost much more as it is currently only available secondhand at inflated prices reaching almost double this amount.

I got in my car and started unboxing and setting up the watch. I wasn't going directly home, and I wanted to get the experiment moving before I met a friend for coffee. After a brief setup process that went off without any problems, I suddenly had an expensive gadget that I had no idea what to do with. I was missing that "life-changing feeling" one gets after unboxing a brand new camera, phone, or other gadget. There was no way to immediately and actively use it beyond customizing a few settings and the watch face. It just sat on my wrist and told me the time and temperature.

It was, indeed, a watch.

"That guy who bought an Apple Watch"

My girlfriend, still in Denmark, soon received the news via a Siri-dictated text. "You're that guy who bought an Apple Watch," she condescended. I laughed it off with the idea to test it out anyway. She, of course, did not have to wait in line while others bought watches for twice what I paid. I resolved to wear it and use it regularly without actively revealing its presence to even my most tech-savvy friends.

I went the rest of the week with no one noticing its presence on my wrist unless I was actively faffing around on it. Like a normal watch, checking the Apple Watch is roughly the same wrist motion despite the need to actually move your wrist to illuminate it. Each day, I whittled away at the notifications the watch would deliver to me until I had reduced them to only the most relevant or particularly interesting ones.

Delta app

Soon after, I was headed back to Copenhagen and finding myself wandering airports with various bags and items hanging off of my person. At the same time, I started noticing the watch was getting more useful. I was easily glancing at my upcoming departure and the time without digging my phone out of my pocket. Messages would filter through naturally, and I could answer them later or reply to the "Have a nice trip!" messages with a quick reply "Thanks!" Otherwise, only the most interesting notifications were coming through, and not every pocket vibration was grounds to go after the phone.

It was also then that a few people began to notice the watch. A flight attendant noticed it during beverage service and complimented me on it. A colleague noticed it on my first day back at work, and a friend noticed it straight-away over coffee. I didn't really need to check it for them to notice either, and luckily, the reactions were not 100% visibly the "this guy" kind.


The watch face I quickly stuck to was the less than traditional-style digital face called Modular. It has five complications which I set to the date, the weather, battery-level, alarm indicator, and remote time zone.

I love the time zone complication because I really feel like I live in two of them. There's Central US and Central European time which are typically seven hours apart. And while it isn't particularly hard to add or subtract seven hours from the current time, it is a two step process that involves finding the time first and then math second. Now I just look at the watch.

The Modular Face

7:40 PM in Copenhagen, 12:40 PM in New Orleans

The same is true of the weather. Anyone who lives in Denmark will talk your ear off about the weather. Knowing the weather situation is key here. Previously, I would have to dig my phone out and hit up Yahoo Weather. Now it's just there. That is something, at least.

Having the watch has definitely uncoupled me more and more from my phone. I am much more likely to leave my phone in another room or at my desk while wandering around nearby instead of always placing it in my pocket.


Time, notifications, calendar alerts and the like are my primary uses for the watch. However, there are a few nice apps I regularly use. Instagram is pretty nice. I can scroll through the latest posts and "like" the good ones. I also use the Lumy watch app now and then. The massive difference in the length of the day between parts of the year here makes it a nice tool. The airline apps I use range from terrible (Delta) to OK (SAS) to great (United). Incidentally, the ranking of those respective airlines' apps for iPhone is actually opposite to the quality of their watch apps.

Uber   Arriving now

The requesting of and arrival of an Uber car.

I think the most useful non-social watch app I have is from Uber. I can request a car straight from the watch, and when it arrives a few minutes later, the watch tells me and I walk outside.

So far it's impossible to view or send Snapchats from the watch. Sometimes I wish I could at least watch them.

Moving forward

I'm aware of the fact that some people view wearables as simply one more gadget that has the capability to further remove us from our "here-and-now" social interactions. That most certainly could be the case, but that doesn't have to happen. I've made considerable efforts to keep my phone in my pocket when sitting down to eat or converse with others. The watch is there to tell me the time and to tell me if an important message actually does come in. Used properly, a timepiece wearable can be a valuable piece of technology.

I don't necessarily believe everyone should go out and buy an Apple Watch, but I think it's possible to find good ways to use new technology – ways that are well-grounded and not annoying to the rest of the dinner party.

The means to an end

Published on 03 June 2015

I got my first computer when I was 11 years old. That was 1998.

I thought it was a bit late -- most of my friends already had their own computers. When I got the thing, I didn't know what I would even do with it except play some games and access this fabled thing called the Internet. Of course, I soon found a lot to do and took to it very quickly. First was my humble home at Geocities' Cape Canaveral, Cockpit #7628; then a truly wtf moment/domain with; then finally the glory of building dynamic webpages using open source technologies -- something I would rely on heavily during my time as a student.

An early CMS

(Above) Redacted rendering of earlier works.

For the next seven years, I would self-publish several websites that, for the most part, were heavy on my own brand of written content. I had learned how to build basic content management systems so that my friends and I could publish our work easily. The range of content varied greatly, but much of it was rooted in the naivety of teenage ideals about politics, authority and all the kinds of things I'm glad were lost (or at least inaccessible via the Wayback Machine).

For seven years, programming, scripting, and designing were just the tools for publishing. Technology was how I would find a voice and make it heard in a unique way. Some kids were writing posts on services like Xanga, but for me, these were always too generic and felt less like publishing and more like, well, journaling. For me and my most loyal cohort (a friend named Glen), our ideas were much bigger than that. That is, if you can excuse the brief side-project involving me starting a school gossip website that I was promptly pressured to shut down. (I hear that, these days, Facebook is carrying that ugly torch forward.)

At 18, I wanted to go to university and study journalism. But the perceived difficulties in obtaining respectable employment in that field, the possibility of an uncertain economic environment after graduation and the rate of growth of tech drew me instead into Computer Science. I had decided to secure my future the best way I knew how. I did this alongside the knowledge that I could always publish on my own. After all, I'd been doing it for years already.

Four years of intense studying and partying took their toll, and I neglected what I had enjoyed so much for many years. I made many attempts to return to writing regularly, but time after time I found myself dead in the water. I was far too busy with side projects and even a startup to do much in the way of publishing anything.

After university I wanted to do a code blog while consulting, but I was soon feeling suffocated by the lack of interesting pieces I could actually write -- the nature of my work was secret, and the time leftover after the long hours didn't leave me much time or even creative bandwidth to work with.

At 25, I left the United States to live in Denmark. The life of an expatriate can often feel like an endless working vacation, and it was here I thought I could begin writing about travel exclusively. Working for a travel-oriented company, it seemed interesting, but even when you live within a two hours' flight of some amazing destinations, it doesn't make money materialize like magic. Dead in the water again.

I feel like people often start out with an "intro" post and never end up writing another post. They come back to their blogs, read the least interesting post possible, get discouraged and decide to come back later. The next time they return, a week will have passed; the next time, a month; then a year will pass, and they never get around to creating anything new. I've certainly done it a few times myself.

I turned 28 recently. My ten year high school reunion is coming up, and in the run up to this event on the other side of the earth, I'm forced to think back about what I did when I was younger that worked for me. I didn't have any set themes, really -- I just wrote. And that's how I want to do it this time around.