getnikola / nikola

A static website and blog generator
https://getnikola.com/
MIT License
2.6k stars 444 forks source link

Treat slug='' as if there is no slug #3705

Closed ralsina closed 1 year ago

ralsina commented 1 year ago

When switching post metadata to YAML and having Nikola save it, it will look like this:

---
category: ''
date: Mon, 01 Oct 2012 19:03:42 -0700
description: ''
link: ''
slug: ''
tags: books, goodreads
title: '1633'
type: text
---

But when reading it back, it will only use the title as the slug if the slug key is missing. That means it will consider the slug to be an empty string and try to generate whatever/.html which is bad.

This tiny PR fixes that.