I’m new to Jekyll and using Github to host my site. I’ve finally figured out how get everything setup with the Git software and using the Minimal Mistakes theme. However, there appears to be two ways of doing this and I’d like some advice please.
So, as I understand it, I’ve currently uploaded the whole MM theme to Github and now one by one I upload my pages in md format, where Github does all the processing work and spits out html. Everything seems to work fine.
But, I’ve now read that you can supposedly run your own Jekyll instance locally, have it build your site from your local md files, and then upload the results (though admittedly, I’m having a rough time figuring this concept out, as when I install Jekyll it merely serves the pages locally and doesn’t seem to create an actual html repository for me).
Is there a preference as to which approach works better around here?
I would think most sites are built locally to preview and then the code is committed to GH and then GH builds the site - if you are using GH for hosting.
It is just quicker and easier to build things locally if you are changing things.
You can also either commit the source, or the actual _site. Again I would say most people commit the source rather than the _site folder, unless they are using plugins that GH doesn’t like and they want to use the GH hosting.
Jekyll itself has nothing to do with GH or Git (other than it was created by GH more or less). I personally mostly use HG/Mercurial for my version control and keep it on BitBucket rather than GH.
So for me, I have my source on my computer, when I want to add a page or edit something, I do it locally, fire up jekyll to build it, and once I like it, I commit to BitBucket - which is my code repository. Since I am not using GH hosting, I also use a thing called S3_Website to publish the contents of the _site directory to AWS S3 where it is hosted.
There are many ways to use Jekyll, combining it with GH and GH hosting is one of many.
If you already have a repo on GH, you should clone that locally, and then use it - then you commit the changes, and then push the files to GH, then GH will build the site and host it.
I made a video a while back that may help you, though it is not quite on topic to your question, but it deals with local code being committed to GH. The bit about the GH-pages branch I think is out of date - I don’t think it matters which branch you are in.
Git is confusing to say the least, but the basics are simple enough once you do it a few times, I am not very good at it, mostly made this video for myself so i could remember how to do it.
For a beginner, the current method that you’re following is the easiest.
Simply create a markdown file, preview it locally, commit and push to GH when satisfied with the preview.
The other method is rather outdated and I would not recommend it unless you need to use a third-party plugin in addition to the official plugins used by the theme.
One additional advice would be to commit related multiple files within a single commit, or learn to employ the pull request feature to push multiple commits of related files as a single merge commit to your master branch.
This is to avoid unnecessary build cycles for each small change (e.g. correcting typos)