description: "Extending Quartz's single.html to link between posts."
showFullContent: false
keywords:
- quartz
- webdev
- hugo
tags:
- quartz
- webdev
- hugo
---
## What am I Doing?
As I write more posts, I realize I'm writing groups of posts that are narratively linked, to speak. The best example is this series, Blogging with Quartz. There are others, but I'm still working on a system for cross-linking between posts. More on that later.
I also realized that there's simply no way to view anything but the most recent N posts on the index page. I've forgotten what the current value of N is but that's neither here nor there.
Users can't navigate free. The closest they can get is walking the tag graph and hoping that gets them somewhere.
## Why does it work?
Quartz is great, looks awesome and uses Hugo which means its super configurable. The templates are powerful and very polarizing.
## Why doesn't it work?
Quart's layout seems to be build around organize discovery of notes through hand crafted landing pages. For the blog, I'm not interested in that. I want users to be able to page through my posts backwards and forwards chronologically like any actual blog site.
Quartz has tags but it lacks a way of saying "These posts aren't chronologically adjacent but they form a sequence". It looks like most tools call this a "series" of posts, so that's what I went with.
## Making it happen
### Chronological Adjacency
Hugo helps us here by providing [page variables](https://gohugo.io/variables/page/) specifically for this: `Next` and `NextInSection`. This partial ends up being really straightforward. It's also got a style, `pagination` that I'm going to leverage.
Just a few `if` statements and calling `.Permalink` to get a URL. I chose to use the `*InSection` variants because I probably will be introducing more content types over time and I may as well fix this beforehand. Below is `layouts/partials/prev-next.html`
There's also a small block of custom CSS, necessary to reset some padding and make the links flow horizontally with a bit of a margin to keep them legible. Shown is a portion of `asset/styles/custom.scss`.
{{<figuresrc="prev-next-links-example.png"alt="Two links pointing to a post published before this one titled 'Ashes to Ashes, Buffs to Buffs', and one published later titled 'Never forget is_alert_recovery'"caption="Pretty snazzy, right?">}}
{{<figuresrc="series-insert-example.png"alt="Screenshot of text on a website describing an article and its membership in a series called 'blogging-with-qurtz' "caption="You can even click the name to take you to a list of the rest of the posts in the series">}}
I'd love to be able to test this locally. It only takes approximately thirty seconds from pushing a change to having a fresh build of the site, but that's still hella slow when you're trying to rapidly iterate on CSS and stuff.
I'm really happy with how this looks, though, and I'm excited to keep tweaking things. I've got 30 tabs open with Hugo templates and toolkits that I'm gonna rifle through and try to find inspiration in.