Posts for: #Html

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.

[]

Getting @font-face to Work on all Browsers

I’ve tried probably about ten suggestions found all over the web, and this is the only method I’ve found to function universally, across every browser I’ve tested it with.

@font-face {
    font-family: 'NameOfFontFamily';
    src: url('/font/file.eot?') format('eot'),
    url('/font/file.woff') format('woff'),
    url('/font/file.ttf') format('truetype');
}

You can use online font converters to convert an OpenType or TrueType font to *.eot and *.woff as needed. For whatever reason, the “?” appears to be important as well. Not sure about that, I’ll have to look into it further.

[]