Website to Jekyll
originally published March 25, 2016 @ Wasting Gold Paper
While my research diary has stalled out because I haven't been researching (other than some administrative tasks like collecting and organizing article PDFs, and typing notes into Mendeley), I have made some progress on updating my website.
Specifically, I have switched over to using Jekyll, which is software that converts markdown/HTML and SASS/CSS to static web pages. Why do I want to do it? Because I want to have a consistent header and footer (navigation and that blurb at the bottom of every page) across the whole site, but don't want to manually edit every single file every time I update one of those, or update the site structure/design. I also didn't want to use PHP because then all my files will be .php and on top of it, it feels messier. I like static HTML a lot.
I'm just writing down my notes here for others who might want to use it too. I've only found tutorials that talk about how to publish your site to GitHub Pages. Obviously, I have my own hosting. I also already had a full static site coded in HTML and CSS, so I didn't want to start all over again with markdown. (Markdown is just a different markup language from HTML; from what I can tell, you can't get nearly the flexibility or semantic markup into your markup documents that you can with HTML, so I'm sticking with the latter.) I wondered: all these tutorials show you how to do it from scratch, but will it be difficult to convert an existing HTML/CSS site into a Jekyll-powered site?
The answer is: no. It's really really easy. Just copy and paste from your old site into some broken-up files in the Jekyll directory, serve, and go.
I recommend following the beginning of this tutorial by Tania Rascia. This will help you get Jekyll installed and set up.
Then, if you want a website -- not a blog -- what you want to do is just start making "index.html", "about.html", folders with more .html files (or .md if you prefer), etc., in your Jekyll folder. These will all be generated as regular .html pages in the _site directory when you start the server, and will be updated as long as the server is running. It'll all be structured how you set it up in the Jekyll folder. For my site, that means I have folders like "projects" and "guides" in addition to top-level pages (such as "index.html").
Finally, start your server and generate all those static pages. Put your CSS file wherever the head element wants it to be on your web server. (I have to use its full URL, starting with http://, because I have multiple folders and if I just put "mollydesjardin.css" the non-top-level files will not know where to find it.) Then upload all the files from _site into your server and voilà , you have your static website.
I do not "get" Git enough yet to follow some more complicated instructions I found for automatically pushing my site to my hosting. What I'm doing, and is probably the simplest but just a little cumbersome solution, is to just manually SFTP those files to my web server as I modify them. Obviously, I do not have to upload and overwrite every file every time; I just select the ones I created or modified from the _site directory and upload those.
Hope this is helpful for someone starting out with Jekyll, converting an existing HTML/CSS site.