Hackernoon logoSetting Up Docs For An Open Source Project Doesn't Have To Be Hard by@0x0ece

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

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.
image
Emanuele Cesena Hacker Noon profile picture

Emanuele Cesena

Co-founder at Saasform, SoloKeys. Former security at Pinterest.

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.

image

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.

image

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.

image

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.

image

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.

image

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.
  3. image

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!

Tags

Join Hacker Noon

Create your free account to unlock your custom reading experience.