paint-brush
Setting Up Docs For An Open Source Project Doesn't Have To Be Hardby@0x0ece
101 reads

Setting Up Docs For An Open Source Project Doesn't Have To Be Hard

by Emanuele CesenaMay 19th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

A practical guide to set up Jekyll + Github Pages for docs. This article describes how we set up docs for our open source project Saasform. It's easy to structure docs as part of the source code, so they're browsable and easy to maintain. Use a remote theme, like pmarsceill/just-the-doc, to publish the docs. Publish via Github Pages and create the docs files. Use the URL of each individual page to specify URLs of each page.

Company Mentioned

Mention Thumbnail
featured image - Setting Up Docs For An Open Source Project Doesn't Have To Be Hard
Emanuele Cesena HackerNoon profile picture

A practical guide to set up Jekyll + Github Pages for docs

This article describes how we set up docs for our open source project Saasform. Docs are part of the source code, so they're browsable and easy to maintain. Moreover, by using Jekyll + Github Pages, they're automatically deployed at docs.saasform.dev.

In short, here's how it works:

  1. Create docs with Jekyll, in a
    docs
    folder right in the repo
  2. Use a remote theme, like pmarsceill/just-the-docs
  3. Publish via Github Pages

In the rest of the article we'll detail each step.

Create Docs via Jekyll

Github has great docs to get started with Jekyll and Github Pages, mostly centered around publishing a blog. I followed this guide to create a new Jekyll project in the

docs
folder and made sure I could test it locally. Then I set the just-the-docs theme.

Next, I structured the docs. I used a Google doc to organize the content in sections and subsections. I find it very convenient to see the big picture and exchange comments with my teammates.

Then it time to create the docs files... it's just a pretty tedious task (I wish there was a better way to export from gdoc to md).

After some back and forth I decided to name all files and folders starting with a number.

  • Pro: one can consume the docs in the right order even just browsing the code on Github.
  • Con: I had to specify the URL of each individual page. A bit tedious but worth for SEO.

I recommend taking a look at a few examples to see if you like this structure.

Use a Remote Theme

At this point I committed my changes and published to Github Pages. Soon after I received an automated email "Page build warning" from Github as the theme I chose isn't supported.

The solution turns out to be incredibly simple: instead of "theme: just-the-docs", specify

remote_theme: pmarsceill/just-the-docs
. That's it.

I went through all the themes supported by Github Pages and they all look for blogs. If anyone at Github is reading this, perhaps you can consider adding a few themes for docs too.

Publish via Github Pages

To publish the docs:

  1. Set the domain docs.<domain> as a CNAME to
    <org-name>.github.io, e.g. in my case
    docs.saasform.dev -> CNAME saasform.github.io
    .
  2. Enable Github Pages in the repo settings.

It may take a few minutes before the pages are built and the HTTPS certificate is created. After that, anytime you commit to your repo the docs will get automatically updated.

We've seen how to structure docs as part of the source code, so they're browsable, easy to maintain and automatically deployed.

If you end up using this structure, please let me know. Happy to take a look at what you made!