Enpower Nbdev-based Repo with Fastpages features

Hi there! I have already built several repositories based on the awesome nbdev, and since everything in those repos are written in jupyter notebooks as well as it did in fastpages, I wonder how we can utilize all the great features built in fastpages like:

  • Interactive Charts With Altair
  • Colab link

I can’t find related guides yet, but I’m sure as nbdev and fastpages becoming super popular, the will become FAQ :smiley:

What are you looking for in terms of related guides? https://fastpages.fast.ai/ has lots of examples

Thanks for the fast response and the link!

I think my question is:

“Can we use fastpages features for notebooks created in pure nbdev-based repo, like adding colab link?”

I am not sure I understand the question, my apologies - can you provide more details or an example?

1 Like

Thanks for the kind response. I figured out how to do what I want.

Basically I can copy the fastpages’ template files to my own nbdev repo to enhance the rendered documentation like adding colab links etc:

Thanks for the great work! :smiley:

@menglee let us know what things in fastpages you’d like to see in nbdev. We might be able to migrate to the functionality to nbdev, and then have fastpages utilize that.

@hamelsmu does that seem reasonable?

Of course! I love that approach, makes everything stay in sync more

@menglee Is it only the badges you are looking for? Are you looking for other functionality as well?

What other functionality is currently in fastpages that isn’t in nbdev, other than blog-specific stuff? What might be useful to migrate?

I’m particularly interested in this now because I’d like to set up a website for our book soon, so want to take advantage of whatever fastpages goodness I can, within a plain nbdev site! :slight_smile:

@hamelsmu @jeremy this is the most exciting discussion I have recently!

Based on my nbdev experience so far, the fastpages features that would benefit a plain nbdev site are:

  1. Define metadata other than title, description via a special markdown cells for each notebook (module)

This feature will make nbdev site highly customizable for each page. Perhaps it’s just me but I can’t make additional metadata (like badges) for nbdev notebooks :thinking:

  1. Colab link. Readers of the new fastai book will definitely want to make their hand dirty, and a colab link linked to latest version of the code would make world bright.

  2. Embed social media support like Twitter cards and YouTube videos.

already reading the notebooks of the book, can’t wait for the site anymore! :smiley:

@menglee I believe ( I could be wrong, so tagging @sgugger here to check my answers) that this functionality is already available in nbdev.

  1. Define metadata:

This is something I am borrowing from nbdev! This is not not something unique to fastpages, so if you do this in nbdev it should already work.

  1. Colab, Twitter, YouTube

The path to make that work is two steps

  • nbdev supports a jekyll_styles configuration (see this example, so we could add the keywords colab, twitter, youtube to the settings file.

  • next step is to add colab.html, twitter.html, youtube.html in the _includes folder of your docs site. Which we could copy over from fastpages.

Happy to make a PR if folks think this could be a good idea