DEV Community

Marc Frame
Marc Frame

Posted on


Github as a CMS for your blog?

About this blog


This blog uses Github as the CMS, meaning github hosts the markdown and media files for the blog.


Source Code


This is nifty because

  1. you don't pay for a CMS / hosting
  2. your blogs can be version tracked
  3. you can write blogs with the same workflow as you write your code


It's really dead simple

The blog uses the Github Rest API to query all the files in a repo, it then iterates through all the markdown files, building a tree view which is viewed on the /blogs page.

When a user clicks on the a blog they are linked to /blog?file=[SOME FILE IN THE REPO] where a call is made to the endpoint to fetch the content for that file.

The only complicated part of this is how images and links are handled. A custom SvelteMarkdown renderer was created for both the Image and the Link which translated the image src to be fetched from the, and translated the Link href to be relative to the currently open file, linking to the relevant /blog?file=[SOME FILE IN THE REPO] (if it was a relative link).


An individual, unauthenticated user can only make 60 requests an hour, which means the user can only refresh the page 60 times and can only view 60 blogs. The rate limiting is separate between the two domains (raw and api) which means viewing a blog, and viewing all the blogs have different rate limits.

However, this isn't much of an issue as an individual user isn't going to be reading / refreshing your blog that much - and if they are then they probably deserve to be rate limited.

Top comments (1)

jeremyforan profile image

Looking forward to more blog post in the future.

Visualizing Promises and Async/Await 🤓

async await

☝️ Check out this all-time classic DEV post on visualizing Promises and Async/Await 🤓