QR Code contains TinyURL of this article.A Few Tweaks

I have spent the weekend making a couple of minor tweaks to the website in order to fix bugs, improve typography and generally tighten things up. These are the sort of incremental revisions that are, in themselves, barely noticeable yet, hopefully, they make the site a little more usable.


I’ve changed the way I load fonts. I was previously using the JavaScript-based Google Web Font Loader. I am now using their “special stylesheet link” as I prefer it’s behaviours. I am also using an additional typeface, the ubiquitous Open Sans, because it renders so nicely on most devices and handles scaling well. Open Sans is now the default typeface for my body text.

The rendering of <h1> content has also changed. Before this update, I used JavaScript to compute the font sizes of page titles so as to keep them on a single line (ie: I used a smaller font for longer titles). This worked really well but with a couple of caveats: there was a delay on each page load while JavaScript performed the calculations and titles were not rendered at all if the client browser had JavaScript disabled.

I am now calculating the font-sizes of page titles on the server and hard-coding them in the page prior to delivery. Best practice dictates that we not use inline styles but this really is the best way to handle this particular task. With this modification there are now no longer any delays in rendering page titles and, more importantly, they are no longer dependent on the availability of JavaScript.

Another small tweak is the addition of a “fuzzy search” suggestion on search queries that yield no results. These are often due to misspelled words in the search query. For example, if a user searches for aple makbook when she really means apple macbook.

With the new code, a search for aple makbook will still return no matches but now the search engine will ask, “Did you mean: apple macbook” — with the suggestion linked back to the search engine — which is pretty cool. (Except it won’t now: because those two misspelled words are in this page the search engine will find a match. Thus, if you want to try it out, you’ll have to use other misspellings!)

I should point out this only works if it can find similar words to the query in the content I’ve published: so, at this time, it has a limited word corpus. But it gets better every time I write a new article. It’s also worth noting that this is my first attempt at this. Sometimes the suggestions don’t make sense. But, more often than not, it works well enough and I will continue to improve it.

Updated: 16th February, 2014.

I no longer use The “Fuzzy Search” functionality on this website as there is no longer an internal search engine. The code for “Fuzzy Search” will remain available on GitHub.

I no longer user Google Fonts on this website. I no longer calculate variable-height page titles.