Hugo

Hugo Theme Modification Practices

You’re probably familiar with the fact that Hugo has a wonderfully intricate and seemingly endless set of lookup order rules for figuring how to construct your website. This applies to layout files, themes, and all sorts of things in Hugo. Each type of resource has its own lookup order, and you could probably spend several years reading about it all if you wanted to.

However, it is fairly simple to understand some basic intended practices with regards to themes and theme modification in Hugo. The basic rule is, let the theme do its job unobstructed unless something actually needs to be overridden to be modified. Or, put another way, don’t just install a theme, copy the layout and style file folders into your Hugo files directory, and start chopping them up. This basically negates the entire purpose of having changeable themes in the themes directory. …

(Read More)

Hugo “in slice” versus union queries

As you may remember, I use Hugo sections to structure my site content, and that affects my queries for things like site comprehensive RSS feed and my “Things I’ve written” section, which shows all posts from every section.

The way I have my site set up is that I have several blog sections, starting with Blog, which currently has 3 posts in it that don’t fall under other sections, and then under Blog I have subsections for iOS, Mac, Hugo, and Apple history. Finally, I have a Podcasts section at the same level as Blog.

Podcasts is mostly unused at the moment as it’s where I’m going to make repositories of past (inactive) podcasts, as well as descriptions and links to current and (and future current) podcasts. However, I’ll also post in that section about different episodes of things I’m in.

Anyway, it …

(Read More)

Summary .Render

Having decided that I needed a custom summary rendering solution, I started whipping up a shortcode before realizing that wouldn’t work since I was calling it from a partial. So I started creating a partial, but an interesting conversation with Vic Hudson convinced me to create an alternate layout to call with .Render instead.

More on that conversation later. First, my summary.html layout file:

<article>
    <header>
        <div class="post-title">
            <a href="{{ .Params.linkurl | default .RelPermalink }}">
                <h1 class="title">{{- if .Params.linkurl -}}<i
                        class="fas fa-link fa-sm"></i>&ensp;{{- end -}}{{ .Title }}{{- if .Params.linkurl -}}&emsp;<i
                        class="fas fa-external-link-alt fa-xs"></i>{{- end -}}</h1>
            </a>
        </div>
        <div class="post-meta">
            <div class="date">
                <span class="posted-on">
                    <i class="fas fa-calendar"></i>
                    <time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
                        <a
                            href="{{ .RelPermalink }}">{{ . …

(Read More)

Summarizing Hugo Content Summaries

Hugo content summaries and I have a complicated relationship. Rather, the design decisions behind the Hugo .Summary page variable intrigue me.

I’m going to tell you how I render my post summaries on my site front page, main blog page, and many of my various section pages, but not today. Today I’m going to write many words about why I had to come up with my own way of rendering Hugo post summaries. I apologize, but it has to be done.

By design, using .Summary to display a post summary strips out all the HTML formatting. The summary will appear as one block of text, regardless of paragraphs and line breaks in the original text. In addition, any images or footnotes or any other non-plaintext will be removed.

This is … an interesting choice. And not, I suspect, what most people want. …

(Read More)

Hugo .Summary Customization

In my article on supporting link posts in Hugo, I went on a short tangent about the Hugo .Summary function and the fact that I wasn’t using it, but was instead piping .Content to the truncate function.

Mainly I wasn’t using .Summary because it basically strips out the html paragraph tags and makes a big block of text. I find this an interesting choice, because who does this? No one, that’s who. Everyone who uses summaries wants legible summaries, including paragraph breaks. Hugo summaries make the assumption that a handful of words will be enough to draw your readers in, and that that’s the look you want in the first place.

Hugo does provide for overriding this by putting a summary in front matter, but that seems like a major kludge considering how easy it would be for .Summary to take a few option parameters. …

(Read More)