This repository contains a minimal script that I needed when moving my blog from a Jekyll setup on Github pages over to Ghost.
Besides converting the posts themselves, I also needed to keep supporting the old links, and redirect to the new link format. I decided to not go the NGINX route, and instead use this nice feature from Ghost itself.
The script in this repository will take all the posts in your posts folder, and create a redirects.json
file in output. There is an example output in the repository.
posts_directory
variable of the script, if needed.A redirects.json
file will be created that you can upload in your ghost instance (in the labs area).
You will only need Python 3.X
to run the script.
The script takes every markdown file in the list, and creates a relation between :
/yyyy/mm/filename_without_date
/title_of_article_in_yaml
The point of this script for me was to save 90% of the manual conversion. Your mileage may vary
Known limitations :
Once the file is generated, I hunted for discrepancies and changed a few links manually.
Next to fixing limitations, it would be amazing to have the script check for each link and see if it is valid by pinging the URL. It would allow to find discrepancies very quickly.
Julien Lengrand-Lambert - @jlengrand
See LICENSE for full text, but the license is Creative Commons Attribution NonCommercial ShareAlike (CC-NC-SA).