[fastpages] GitHub Pages Blog Using Nbdev

Thanks for this great new tool! Perfect timing especially when Medium started getting people including me annoyed with “You’ve reached your limit” kind of fremium marketing strategy. I started building my own repo today and currently testing it locally.

However, there is one issue I am facing related to this. I tried putting quotes around my title however still converted .md doesn’t include the colon. Is it part of nbdev parsing strategy? How can we include colon to title?

Reference: NB source

Local testing and created front matter:

keywords: fastai
description: This is an introductory post for my personal blog PixelShuffle.
title: "PixelShuffle Yet Another Machine Learning Blog"
toc: true 
badges: true
comments: true
categories: [intro]
image: 
nb_path: _notebooks/2020-02-23-introduction.ipynb
layout: n```

This has been fixed in https://github.com/fastai/fastpages/pull/110

2 Likes

Hello all!

Great to see this work and it looks awesome.

I thought I would give this a try. It wasn’t very hard to set up but I came across one “bug” that might be worth sharing for other users.

When I set the blog up, it originally did not show up under [USERNAME].github.io/[REPONAME]. Instead it showed up under [USERNAME].github.io/[REPONAME]/index.html. It’s supposed to redirect and show the index.html file but it didn’t. I later learned that it turns out sometimes the deployment doesn’t go through properly, and this issue can be solved with another deployment (which can only be triggered by a commit).

So I decided to change the _config.yml file and change the Twitter username to mine and commit to the main branch. This deployed the website on [USERNAME].github.io/[REPONAME] but with the previous commit of the Twitter username, while the index.html had the current commit with the updated Twitter username. So then I created an “empty commit” (space in the comments of the _config.yml file) and GitHub and apparently it is now synced up (I then changed the title and it updated under [USERNAME].github.io/[REPONAME]). Apparently, there’s also an empty commit command in git so if you are working on your blog locally, you can try this as well.

This is definitely a weird bug but I am glad I was able to fix this. I hope this helps anyone who has a similar issue.

@ilovescience could it be that it just takes time for the deploy to actually happen and you were checking too soon? Right now there isn’t a way to cleanly show an “in progress” screen but there is an additional step in GitHub actions called “GitHub Pages” that must clear for the SHA of your commit before you can be confident your change took place, it can take 5-7 minutes for each commit to be reflected. Just curious if this could be the issue

We could do things to speed this up, this is a future optimization.

Thanks! Looks great to me. With the latest master I saw the home.html is introduced, so I guess if I want to change the layout (a small image on the left of text instead, as I prefer it take a bit less space), it should be straight forward to do so.

I had checked all the actions were completed, and wait ~15 minutes even after that. The GitHub Pages Status was successful both on the badge and under settings. The website was definitely already deployed, but there was this weird bug.

You can run your blog locally without installing all the python + ruby stacks! Assuming you have Docker installed, though.

  1. Update to the latest fastpages (I know it’s a pain, Hamel is working on making that easier).
  2. In the repository root, run docker-compose up.
  3. The console will give you links to your Jupyter editor, and to the blog, running locally. It’ll watch for notebook updates and update posts automatically.
3 Likes

Please DM me your repo’s link if it is public. I will take a look, thanks for reporting the bug.

@hamelsmu Just DM’ed you! The “bug” doesn’t seem to be there anymore but if you find something let us know. Thanks for your help!

I created a new repo to incorporate latest changes in fastpages. When I tried local dev feature myblog_watcher_1 container failed to launch with the following error:

myblog_jupyter_1 is up-to-date
myblog_jekyll_1 is up-to-date
Starting myblog_watcher_1   ... error
Starting myblog_fastpages_1 ... done
Starting myblog_converter_1 ... done

ERROR: for myblog_watcher_1  Cannot start service watcher: OCI runtime create failed: container_linux.go:346: starting container pro
cess caused "exec: \"watchmedo\": executable file not found in $PATH": unknown

ERROR: for watcher  Cannot start service watcher: OCI runtime create failed: container_linux.go:346: starting container process caus
ed "exec: \"watchmedo\": executable file not found in $PATH": unknown
ERROR: Encountered errors while bringing up the project.

Also jupyter server requires token to access it through http://0.0.0.0:8888 which can be obtained by (might be helpful to have in DEVELOPMENT.md):

1) docker-compose exec jupyter /bin/bash
2) jupyter notebook list

ERROR: for myblog_watcher_1 Cannot start service watcher: OCI runtime create failed: container_linux.go:346: starting container pro
cess caused “exec: “watchmedo”: executable file not found in $PATH”: unknown

It seems like the image for converter / watcher / jupyter haven’t been rebuilt correctly. Try docker-compose build --no-cache --force-rm. This will take a minute or two as it’ll rebuild the images it uses from scratch.

Also jupyter server requires token to access it through http://0.0.0.0:8888 which can be obtained by (might be helpful to have in DEVELOPMENT.md ):

1) docker-compose exec jupyter /bin/bash
2) jupyter notebook list

Ha, thank you for that comment! We’ve had a chat with @hamelsmu about the token.

The easiest way to get a link with the token already in the link is to just click the link in the terminal log output. When you run docker-compose up with rebuilt images, it’ll spit out the link to localhost:8888 with the token in it.

The way you just mentioned also works:

# Assuming you've started docker-compose with -d
docker-compose up -d

# shell into the jupyter container
docker-compose exec jupyter /bin/bash

# grab the notebook list with the token in the jupyter container shell
jupyter notebook list

# OR, just do it in one command (haven't tried it, but should work):
docker-compose exec jupyter jupyter notebook list

There’s a way to disable token at all, if we launch Jupyter with cmd: jupyter notebook {{all other flags}} --NotebookApp.token=''. But I would not recommend doing that as this is a security risk, and even considering you’re just editing a blog, this is not a useful practice to remember and use.

1 Like

cc: @xnutsive

Did you execute docker-compose build first?
You can find the token in your logs that are printed out

@xnutsive I anticipate that folks may be confused by this token thing, perhaps we hardcode the password or something and put that in the docs?

EDIT: I see that @xnutsive has replied at the exact same time as me. My apologies if I created duplicate responses etc.

I ran docker-compose up

1 Like

Perhaps we should have a makefile that will shorten the command to

make rebuild or something incase people get this error?

Also I am still facing colon missing in the converted .md file issue. What is the proper way to have colon in the title? I created a new repo after the fix_colon was merged. Maybe I am missing something? Thanks :slight_smile:

This fixed the problem. Thanks.

See https://github.com/fastai/fastpages/blob/master/README.md#front-matter-related-options

So it’s not possible within notebook but only through markdown?

No its the same in a notebook

1 Like

Its too bad I can’t think of a way to make this clearer? Perhaps in the documentation?

I also am not sure how to throw a warning message from this situation.

Anybody know if they have any thoughts, I’ll add more examples in the README