Posts for: #Blogging

Pinning Posts in Hugo

Alright, in this post I’m going to show you how to pin posts in Hugo. But before you keep reading, I request you review the template you’re using and ensure it’s going to allow you to pin posts in the first place.

The thing you’re looking for is the index declaration in your index.html.

Example:

{{- define "content" -}}
  <section id="posts" class="posts">
    {{/* (index .Site.Paginate) */}}
    {{- $paginator := .Paginate (where (where .Site.RegularPages "Type" "post") ".Params.hiddenfromhomepage" "!=" true) }}
    {{- range $paginator.Pages -}}
      {{ .Render "summary" }}
    {{ end -}}
  </section>

For instance, in the above snipped, line number four is where you can find the $paginator that will tell you whether you’ll be able to pin posts. If you see mine, you’re good. Most are probably going to do this. If you see anything with “sortby” then you’re probably fucked, because your template is probably forcing your shit to sort by date, rather than just paginate as Hugo does by default.

[]

Kramdown and Common Sense

Boy did I herp before I derped. All this time I could’ve been posting thumbnailed images, but I didn’t peek into the specifics of Kramdown or how to do it. Ruby seems to be a literal octopus of a language, with all these parsers and things. Ruby seems to be the new Visual Basic, reinventing spaghetti mess. At least it produces pretty results, though.

[![ImageAlt](/thumbnail.jpg)](/link/to/full/image.jpg)

Simple tip, excellent results, not sure why I didn’t think to experiment with it in the first place. Maybe because my initial impression of Kramdown was that it’s kinda touchy. Don’t know. In any case, I’m a fan now. I might use Kramdown more often, for more than just this blog. Who knows.

[]

Jekyll and Youtube Embedding

When I first began using Jekyll, I noticed that throwing in a Youtube embedded video made it go apeshit. I Googled for a bit to discover that Maruku wasn’t happy with HTML, and was taking any and all HTML and interpreting it to XHTML. Youtube doesn’t provide “Embed” data in XHTML format. Here is an example of a typical Youtube embed:

<iframe width="420" height="315" src="http://www.youtube.com/embed/dQw4w9WgXcQ" 
        frameborder="0" allowfullscreen></iframe>

That’s taken verbatim from Youtube. There are two problems here. First, XHTML doesn’t like lone attributes. The allowfullscreen attribute has to be changed to allowfullscreen="allowfullscreen" to be usable. If you even use it. I’ve heard reports of people embedding videos without it at all. Second, Jekyll devs openly admit Jekyll swallows empty end tags. Thankfully, their admission gleans a helpful hint in fixing it. Simply insert a space between <iframe> and </iframe>. The end result is as such:

[]

Jekyll (Bootstrap) is for Everyone

If you’ve seen a good number of Jekyll blogs and find yourself pretty jealous, there really aren’t any excuses anymore. Jekyll Bootstrap literally removes all difficulty from using Jekyll. It’s basically a layer over Jekyll that has built in support for theming, post creation, and more. With Jekyll Bootstrap, you really need to know very little of the command line. If you have a favorite theme that’s Jekyll based, chances are that user has made it available on the internet via Github. Hurry up and check it out.

[]