Menu

Colophon

Attention conservation notice: This describes my idiosyncratic setup for blog. It is a document for my own sake which I wrote in case I ever need to re-do anything. Your time would be better spent making your own website.

This website is made with Hugo and themed by accessible minimalism.

Self-Referential QR Codes #

Often, if I’m sharing my website, I want to share a page with someone while we’re together in person. Reading aloud the website address or describing how to navigate to a particular page is awkward. And so, I added QR codes to pages which decode to the address of the page that they are on. For example, Advice for Students.

This bit in /layouts/_default/single.html toggles QR codes.

 {{ if .Params.qrcode }}
 	{{ partial "qrcode.html" . }}
 {{ end }}

The actual partial for generating a self-referential QR code is here.

 {{ $text := .Permalink }}
 
 {{ with images.QR $text }}
   <img style="float: right;" class="qr-code" src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
 {{ end }}

Styled RSS Feeds #

I really like RSS. I wanted to get a nicely styled RSS feed for my site. Rach Smith has a lovely styled feed, for example. After scratching my head over it for a good long while, I went and asked how to do this on the Hugo Support forum. The details are there if you want to check them out.

Images #

The favicons for this site were generated from this icon over at icon-icons.com using Real FavIcon Generator. A local copy of the SVG is here:

An open compass

I used LunaPic’s in-browswer circle-crop tool to make the circle-cropped headshot photo.

Generally, I like to shrink photos to 800x800 using:

 convert -quality 80 -geometry 800x800 image.jpg image-small.jpg

I also scrub meta-data on all my images using a handy script.

for image in *.jpg *.png ; do
  [[ $image == small-* ]] && continue

  echo "Clearing meta-data: $image";
  exiftool -overwrite_original -all= "$image"
  convert -strip "$image" "$image"

  echo "Making small-$image";
  convert -quality 100 -geometry 800x800 "$image" "small-$image"
done

Mathematics #

To get KaTeX to do both inline and display equations, I modified ./layout/partials/katex.md according to Kevin Cazelle’s suggestions here: https://kevcaz.github.io/notes/hugo/katex_and_goldmark/.

And now math looks like this: Inline: $\pi$ Display style: $$\int x\ dx = \frac{1}{2}x^2 + C$$

PageFind #

After getting a request to add search, I added an instance of PageFind. It was really slick to setup. To minimize the Javascript footprint of my website, I only added search functionality to the Archive.

The Deploy Script #

I use the following script to deploy the website. It builds the website to a special directory, does a bit of sanity checking, builds the PageFind index, and deploys the site using rsync.

#!/bin/bash

DEST="/home/pgadey/public_html/pgadey-PRODUCTION/"

hugo build --destination $DEST

# Check for syncthing conflicts.
if find $DEST -type f -name '*sync-conflict*' | grep -q .; then
    echo "Error: sync-conflict files detected."
    exit 1
fi

# Check to see if any private information leaked.
if grep "FATAL ERROR" $DEST/index.html; then
    echo "Error: FATAL ERROR found in index.html"
    exit 1
fi

# Build the Pagefind index.
npx -y pagefind --site $DEST

rsync -avz $DEST cloudbox:/home/pgadey/public_html/pgadey

Archive #

The Archive is setup using the following.

 content/archive.md 
 themes/accessible-minimalism/layouts/partials/archive.html
 themes/accessible-minimalism/layouts/_default/archive.html

The special _default/archive.html makes the calendar happen.

Markdown Attributes #

One can modify markdown blocks with Markdown attributes. This open up a lot of CSS possibilities.

paragraph
{class="foo"}

![test](img.png "opt title")
{class="display-image"}

![test](img.png "opt title")
{.display-image}

External Links #

I added a link render hook to parse out URLs. It is exactly this example layouts/_markup/render-link.html from the docs.

 {{- $u := urls.Parse .Destination -}}
 <a href="{{ .Destination | safeURL }}"
   {{- with .Title }} title="{{ . }}"{{ end -}}
   {{- if $u.IsAbs }} rel="external"{{ end -}}
 >
   {{- with .Text }}{{ . }}{{ end -}}
 </a>
 {{- /* chomp trailing newline */ -}}

This adds a rel="external" to any external links. And then we style those external links with the following CSS.

a[rel="external"] {
    text-decoration-style: dotted;
}

And we get little dots under external links like this: now versus Google.

Shortcodes #

Hugo supports the ability to add shortcodes, or macros, to do all sorts of things. I’ve added a couple shortcodes, but I always seem to forget how they work. And so, I’m putting some reminders to myself here.

Static #

The shortcode static makes accessing static resources easier.

  {{< static "share/some-document.pdf" >}}

  ![foo]({{< static "img/foo.png" >}})

Private #

The shortcode private allows me to put material here which is shown locally via hugo server but doesn’t get published.

 {{< private >}}

 	This material is private.

 {{< /private >}}

On my end, the example above renders as the following.

✒️ This material is private.

The shortcode private which works like this:

 {{ if eq hugo.Environment "development" }}
 		 <div style="border: dotted; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px;">
 		 ✒️ 
 		 {{ .Inner | markdownify }}
 		 </div>
 {{ end }}
 
 {{ if eq hugo.Environment "production" }}
 	<!-- gobble -->
 {{ end }}

Hidden Pages #

The logic of the hidden pages is controlled by keeping them as drafts in Hugo. To do so, I add draft: true to the frontmatter of a page. This makes a whole page get rendered locally, but not publish to the actual website. This allows me to include private content in a public page.

Gobble #

The shortcode gobble just consumes whatever it is given. It is occassionally helpful for keeping post-level to-do lists which are only visible while editing the original source of a post.

{{< gobble >}}

    This vanishes!

{{< /gobble >}}

Gather and Dump #

This website supports a simple form of transclusion which allows me to gather snippets from multiple places and dump them in one spot. For example, the bookmarks page is populated with material wrapped in the following.

 {{< gather dest="bookmarks" >}}
 
 	Links to things!
 
 {{< /gather >}}

All that material gets dumped on the bookmarks page using:

 {{< dump source="bookmarks" >}}

The gather and dump mechanism was introduced here Week Notes 15.

Statistics and Recently Modified #

These ones do exactly what they say on the tin.

 {{< recently_modified >}}

 {{< stats >}}

You can see them in action on the home page.

Keyboard Navigation #

This website has some keyboard drived navigation features inspired by vim. Typing \ and then a letter will lead to the variety places.

 const shortcuts = {
     a: '/archive/',
     b: '/bookmarks/',
     c: '/office-camera/',
     d: '/drafts/',
     q: '/quick-launch/',
     g: 'https://gmail.com/',
     h: '/',
     m: '#nav-menu',
     n: '#nav-menu',
     o: '/office-camera/',
     t: '/tags/'
 };

Link Not Found #

There is a link not found page. The backlinks on this page are especially interesting. They point to every page that has a missing link.

This page is enable using the following setting in config.toml.

 refLinksNotFoundURL="https://pgadey.ca/link-not-found/"

Directory Structure #

Change Log #


Published: May 17, 2021 @ 22:30.
Last Modified: Jun 15, 2026 @ 22:16.

Tags

#meta

Backlinks

Navigation Menu

Home / Now / Archive / Office Camera / Bookmarks / Tags / Feeds / Top of Page

Thanks for reading! If you have any comments or questions about the content, please let me know. Anyone can contact me by email.