{
  "$type": "site.standard.document",
  "content": "---\ntitle: \"Hosting a self-built jekyll site on GH pages\"\ndescription: \"A simple Makefile for building Jekyll locally with custom plugins and pushing\n  the output to GitHub Pages.\"\ntags:\n  - dev\n---\n\nThis blog is built from [markdown](https://commonmark.org/help/) files using\n[Jekyll](https://jekyllrb.com/) hosted on\n[GitHub pages](https://pages.github.com/), which saves a lot of hassle involved\nwith DIY hosting[^hassle]. There are a bunch of\n[useful tutorials](https://blog.teamtreehouse.com/using-github-pages-to-host-your-website)\non how to set all this up.\n\nHowever, I like to have control over which plugins are used, etc. which GitHub\npages doesn't let you do. What it (GH pages) _does_ let you do, though, is dump\na bunch of files (html, js, css) in a repo and just serve them as-is. These\nfiles represent the \"built\" version of your site, not the source, so you'll\nprobably want a separate repo for your content (e.g. your markdown files) and\nthe built site. Handling this stuff can be a hassle, so here's the `Makefile` I\nuse to make it easy.\n\nThe basic process is:\n\n1. create a git repo where you keep your jekyll site (or not, but it's so nice\n   to have your blog content under version control)\n\n2. create a separate project on GitLab called\n   `$(GH_USERNAME)/$(GH_USERNAME).github.io.git`, but don't create anything in\n   there yet\n\n3. `make init` will turn the local jekyll build directory into a git repo\n\n4. `make push` target will build your site (locally) and push it up to GitHub,\n   where it'll be served by GitHub pages\n\nAfter that, you can work on, commit & push your blog wherever you like (I\nactually keep the content in the\n[same GH repo](https://github.com/benswift/benswift.github.io), but in a\n`source` branch) but you can push the built site to the master branch so GH\npages will serve it up for you.\n\n[^hassle]:\n    I know that it's not actually _that_ much hassle, especially if you've\n    already got a webserver set up for other reasons, but zero hassle still\n    beats ε hassle ∀ε>0, especially when there's other work to be done.\n\n```make\nBASE_HTML_DIR=_site\nGH_USERNAME=benswift # change this to your GH username\n\nall: push\n\ninit:\n\tmkdir -p $(BASE_HTML_DIR) && cd $(BASE_HTML_DIR) && git init . && git remote add origin git@github.com:$(GH_USERNAME)/$(GH_USERNAME).github.io.git\n\ngenerate-blog:\n\tbundle exec jekyll build\n\ncommit-all: generate-blog\n\tcd $(BASE_HTML_DIR) && git add . && git commit -m \"update blog\"\n\npush: commit-all\n\tcd $(BASE_HTML_DIR) && git push origin master\n```\n",
  "createdAt": "2026-05-13T23:15:05.842Z",
  "description": "A simple Makefile for building Jekyll locally with custom plugins and pushing the output to GitHub Pages.",
  "path": "/blog/2018/06/22/hosting-a-self-built-jekyll-site-on-gh-pages",
  "publishedAt": "2018-06-22T00:00:00.000Z",
  "site": "at://did:plc:tevykrhi4kibtsipzci76d76/site.standard.publication/self",
  "tags": [
    "dev"
  ],
  "textContent": "A simple Makefile for building Jekyll locally with custom plugins and pushing the output to GitHub Pages.",
  "title": "Hosting a self-built jekyll site on GH pages"
}