Login  | Home

Janusworx: Multiple Slugs for Multiple Webpages in Nikola

Go back


Article:

(published: Oct. 17, 2019, 4:09 a.m.)

Here’s a delightful little thing I discovered, using Nikola today.

As part of a little housecleaning, I wanted to have a single page have two web urls.
As in Books I’ve Read and Books in 2020.
Don’t ask why, my nerdy brain just wants it that way.

And I was thinking of Nginx redirects and other things I could try.
Until I looked up and saw the slug section in the metadata section of my post (the section that I normally turn a blind eye to).
This is what I assume, Nikola uses to generate links.
And I thought hmm, what if?
And at the same time I remembered what Roberto Alsina, the original author of Nikola had encouraged me to do, when I had just started using it to blog.
That he wrote Nikola, so that it would mostly do the logical thing; that I wouldn’t really need to use the documentation (excellent as it is)

So that is what I did then. I put in two slugs each with the unique url I wanted, and sure enough, Nikola generated two web pages from that single source file.

It’s the little things like this, that make me so happy, I use Nikola for my writing.