Failure to migrate from fastpages to quarto

Hi, I have a fastpages blog hosted on Github and with a custom domain. I’m currently trying to migrate it.

I’m unable to install the video extension (as currently being discussed on a thread in Discord), and when I try the nbdev_migrate --path posts command, I get the following error:

Traceback (most recent call last):
  File "/Users/strickvl/.pyenv/versions/mlops-blog/bin/nbdev_migrate", line 8, in <module>
    sys.exit(nbdev_migrate())
  File "/Users/strickvl/.pyenv/versions/3.10.4/envs/mlops-blog/lib/python3.10/site-packages/fastcore/script.py", line 119, in _f
    return tfunc(**merge(args, args_from_prog(func, xtra)))
  File "/Users/strickvl/.pyenv/versions/3.10.4/envs/mlops-blog/lib/python3.10/site-packages/nbdev/migrate.py", line 177, in nbdev_migrate
    if f.name.endswith('.md'): migrate_md(f)
  File "/Users/strickvl/.pyenv/versions/3.10.4/envs/mlops-blog/lib/python3.10/site-packages/nbdev/migrate.py", line 162, in migrate_md
    txt = fp_md_fm(path)
  File "/Users/strickvl/.pyenv/versions/3.10.4/envs/mlops-blog/lib/python3.10/site-packages/nbdev/migrate.py", line 97, in fp_md_fm
    fm = _fp_convert(fm, path)
  File "/Users/strickvl/.pyenv/versions/3.10.4/envs/mlops-blog/lib/python3.10/site-packages/nbdev/migrate.py", line 78, in _fp_convert
    if k in fm: fm[k] = _rm_quote(fm[k])
  File "/Users/strickvl/.pyenv/versions/3.10.4/envs/mlops-blog/lib/python3.10/site-packages/nbdev/migrate.py", line 57, in _rm_quote
    title = re.search('''"(.*?)"''', s)
  File "/Users/strickvl/.pyenv/versions/3.10.4/lib/python3.10/re.py", line 200, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object

Not really sure what’s going on. Could someone help out with this? I’m assuming others have successfully used this script?

It’s also unclear to me how I should get the new site (once successfully migrated) hosted and running etc from the migration docs, but I’ll ask all those questions once I get the migration fixed.

Can you please share information we could use to reproduce the error?

  1. Your github repo to your original blog (you only included the website)
  2. The github repo for your new blog after you have followed the steps

Also, can you try to isolate which blog post is causing the issue?

  1. GitHub - strickvl/ml-blog this is the original blog
  2. I haven’t pushed or created a new GitHub repo yet since the instructions haven’t told me to do so far.

Do you have a tip for how I can trace back which blog is causing the error? The error message from the nbdev_migrate command (pasted above) doesn’t really give many clues. Thanks!

Yes you can try to remove blog posts to narrow down which one is causing an error. (We can also try to improve the error messages, but for right now this is what I suggest)

1 Like

The video extension has been moved into quarto core for 1.2, which is currently in the process of being released.

1 Like

@strickvl I have added better error logging via add filename in error message to migrate utility by hamelsmu · Pull Request #1178 · fastai/nbdev · GitHub

Once this is merged, we can see which file is causing the error, in your case:

posts/2021-12-11-redaction-progress-week-one.md → the description is blank

The other thing about unicode strings is a user warning concerning migrating front matter that you can ignore for now

2 Likes

Thank you so much. I fixed that along with a couple of other places where I was referring to branch: master for some reason in the front matter.

The migration command now works without error, and I’m able to move forward in the process.

2 Likes

I’m now continuing on in the process and I went to try quarto preview as instructed in the fastpages migration guide.

I get the following output:

$ quarto preview
Preparing to preview
[1/3] posts/2022-04-06-synthetic-data-results.md
ERROR: URIError: URI malformed

I’m assuming that here Quarto is trying to create a preview for a generated .md markdown file which was originally a notebook.

But when I go into the markdown file listed above, I find just a TON of HTML etc and it’s really hard (for me to imagine what URI might be malformed, or even why Quarto is trying to parse URIs.

My migrated quarto repository is here in case that’s of some use, and the old (original) blog / repository is here.

Are there any best practices on how to debug this error? No specifics are given.

I’m currently dealing with the error by removing the file in question from my blog. A bit of a blunt tool, but it seems to allow Quarto to keep rumbling onwards.

I then found that anything using the {{ site.baseurl }}/images pattern (as suggested in the fastpages sample pages) seems to be broken, so I’m going through and bulk renaming those.

I’m also noticing that any blogs that were auto-generated by fastpages from notebooks are now missing their cover images. Somehow that doesn’t seem to have made it over during the migration?

Hi Alex, the migration brought cover images for me. Sharing a minimally reproducible example might help to troubleshoot

This commit shows what I did to fix the images that weren’t working (following my use of the migration script 21 days ago).

Got my migrated blog up now here. Now going to figure out how I can switch things so that my new blog now uses my custom domain instead of the old one.

Also have to figure out the URIError that prevents one of my notebooks from being deployed / published.

I’m now up and running with my old domain, but I notice that old URLs (i.e. from fastpages blogs) are no longer working. The problem seems to be with the order of categories.

For example, this is the URL of a blog that used to work: https://mlops.systems/tools/redactionmodel/computervision/mlops/2022/05/24/data-versioning-dvc.html. You can see that the categories are embedded into the URL as was the way previously with fastpages. The order of those categories was not alphabetical, but rather it is the same order it took in the .md file front matter: i.e. categories: [tools, redactionmodel, computervision, mlops].

The problem is that in the version of the blog that Quarto or the migration script presents, the order of those categories in the alias is alphabetised, like so:

aliases:
- /computervision/mlops/redactionmodel/tools/2022/05/24/data-versioning-dvc

This means that the original URLs will all have to be amended so that the categories are in their original order. I imagine other people will run into this issue, unless I’ve somehow done something wrong in how I followed the instructions for migrating from fastpages.

Can you provide a link to your old blog repo, before you made any changes? The aliases work for me correctly. It does look like we are alphabatizing them nbdev/migrate.py at master · fastai/nbdev · GitHub I thought we were doing this for a reason, but cannot remember why anymore!

1 Like

I started a new repo for the quarto-migrated version, so actually the old blog is all preserved intact here. The new one is at https://github.com/strickvl/mlops-dot-systems.

1 Like

It seems that when notebooks are converted, the category tags aren’t brought over into the alias URL at all. So this url: https://mlops.systems/fastai/computervision/pytorch/2022/05/11/fashion-mnist-pixel-similarity.html in the alias of the converted notebook becomes:

aliases:
- /2022/05/11/fashion-mnist-pixel-similarity

I’m fixing the category sort thing here: fix order of categories for migration by hamelsmu · Pull Request #1221 · fastai/nbdev · GitHub

1 Like

I’m not able to repro your issue with categories not coming over. Perhaps you are running an older version of nbdev? (I get a warning message but you can ignore that) I would suggest installing from git

1 Like

One other issue with aliases that I seem to be noticing is that the exported aliases are missing .html on the end. The fastpages pages all end in .html, but in order to access the alias + the redirect to the new Quarto URL, you have to remove the .html.