Most of my blog posts are in Markdown…however, there are cases where plotting and code are very important, and nothing beats a Jupyter Notebook for that.
This blog was based on fastpages
, a static blog generator by fast.ai
. Unfortunately they are discontinuing it and they recommended to migrate to Quarto, so here we are.
Hamel Husain wrote a great tutorial on how to migrate from Fastpages to Quarto (and saved me so much work):
https://nbdev.fast.ai/tutorials/blogging.html#migrating-from-fastpages
Following I describe a couple of tips that were useful for my migration.
Preserve git history
I wanted to keep the commit history of my blog, so I replaced this step:
cp -r ../blog/_notebooks/* posts
cp -r ../blog/_posts/* posts
with a more complicated procedure based on git filter-branch
. git
expertise recommended, continue at your own risk.
I was inspired by this tutorial about git
, even if I simplified a bit the procedure.
After we initialize the website/blog based on quarto, we commit it to the main
branch of the repository (for the new blog).
- In the same repository we create another branch which points to the old fastpages-powered blog:
git remote add old git@github.com:you/yourfastpagesrepo.git
git fetch old
git checkout -b oldposts old/master
Then we only keep the history of the
_posts
foldergit filter-branch –subdirectory-filter _posts – –all
Finally we move it into a folder
mkdir oldposts mv * oldposts git add . git commit -m “move posts into folder”
Now we can merge it back into the
main
branch
git checkout main
git merge oldposts --allow-unrelated-histories
git mv oldposts/* posts/
- If necessary, repeat this step with the
_notebooks
folder
No categories in URL
In my old blog I didn’t have categories in my URL, so the aliases generated by nbdev_migrate
were wrong.
I modified migrate.py
in my nbdev
install.
In _fp_convert
, I modified the line about aliases into:
fm['aliases'] = [f'{fs'}]
Screenshots of the old blog
Sometimes I get nostalgic.