jnordberg / wintersmith

A flexible static site generator
http://wintersmith.io/
MIT License
3.5k stars 332 forks source link

Wintersmith preview/build fails when upgrading from 2.4.1 to 2.5.0 #339

Open Eevoo opened 5 years ago

Eevoo commented 5 years ago

I probably missed some communication but it seems updating Wintersmith from 2.4.1 to 2.5.0 breaks builds/previews for existing articles. For example, I have an article that begins with the following sample text:

---
title: An article title
author: Eevoo
date: 2018-07-12
template: article.jade
---

Hey hey hey sportsfans, I'm opening a Github issue in hopes of getting help. Be nice to the maintainer since supporting open source software is hard and mostly thankless!

When I attempt to preview the site with articles like that, the local server starts and runs, but when I attempt to view one of the pages, I get the following error:

err_message

error articles\1-the-real-hello-world\index.html: page 'articles\1-the-real-he
llo-world\index.html' specifies unknown template 'article.jade'articles\1-the-re
al-hello-world\index.html: page 'articles\1-the-real-hello-world\index.html' spe
cifies unknown template 'article.jade'

My searching the internet failed, along with my spot checking of some github issues. Any suggestions on changes to make to the markdown files and/or wintersmith config that can make this happy?

Thanks for any advice you can provide!

VaelynPhi commented 5 years ago

Wintersmith has adopted the jade-->pug name change; in some cases IIRC it looks for .jade and .pug extensions and treats them the same, but I have not recently looked through the source.

However, I can tell you that changing 'article.jade' to 'article.pug' on your test article (in the line specifying the template) fixed this issue for me, and AFAIK all future templates should use .pug as the file extension.

If you have a bash-like terminal, you can quickly change this in your contents folder using find and sed like so:

find contents -type f -exec sed -i '/template:/s/\.jade/.pug/' {} \;

You can also take care of any remaining .jade extensions in your templates with:

find templates/ -type f -iname "*.jade" | sed 's|\([^ ]\+\).jade|\1.jade \1.pug|g' | xargs -n2 mv

I recommend keeping your work in git and branching before making these changes, just in case something unsupported in these commands in your CLI borks your work, so you can undo them easily if necessary.

If you have a small site, doing it by hand is of course easy enough.