New Website




Welcome to my new website! This is a little project that my wife and I worked on together and we had a lot of fun doing it. My wife deserves all the credit for the fantastic artwork and logos. Read on if you are interested in how to do the rest.

Contents

Site Generator

To generate this site I use Jekyll, a static site generator written in Ruby. This is an excellent option if, like me, you like writing in markdown and want an automated tool to convert markdown to static HTML.

To get started with Jekyll I recommend following their Step by Step tutorial.

Jekyll sites generally have the following structure:

├── _config.yml
├── _data
│   └── navigation.yml
├── _includes
│   ├── footer.html
│   └── header.html
├── _layouts
│   ├── default.html
│   └── post.html
├── _posts
│   └── 2020-03-07-my-first-post.md
├── _sass
│   ├── _base.scss
│   └── _layout.scss
├── _site
├── assets
│   ├── css
│   └── images
├── Gemfile
└── index.html

Here is a very brief rundown of what each of these components do.

One of the benefits of using Jekyll is the ability to visualise your website before you deploy. All you need to do is:

bundle install
bundle exec jekyll serve

Theme

If you want to get your website up and going as quick as possible the best option is to use one of the many Jekyll themes. If, however, you want to fully customise your site then be prepared for a lot more work!

I decided to go for the latter option. Fortunately, I did not have to start from scratch. After learning the basics of Jekyll, I downloaded the Cayman theme to use as a template. I essentially dissected this theme to figure out how all the pieces work.

Getting Sassy

Most of the work of getting your site to look the way you want it to is in defining the style sheets. This means learning how to write Cascading Style Sheets (CSS). One of the most exciting things I discovered while working on this project was Syntactically Awesome Style Sheets (Sass) and Sass certainly is awesome!

To get started with SASS check of their guide.

Sass has several very cool features including nesting and mixins. Mixins allow you define reusable pieces of CSS that you can include in your Sass files (.scss).

Here is a quick example of how to add a shadow to a container (something I used extensively on my site).

@mixin shadow {
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

.post-container {
  @include shadow;
}

Once you get comfortable with Sass, the rest is just patience. You will define the layouts for each type of page (I ended up with 7 different layouts). In my opinion this is made easier by breaking your HTML into pieces (that you keep in _includes). Similarly, you can break your Sass files into pieces that can import each other.

Deployment

Finally, once your website is ready for the world to see it, you can deploy it. In principle, you can do this on any server you like, but GitHub is ideally suited for hosting static HTML sites.

You can host your site on any GitHub repository you have access to by simply creating a branch called gh-pages, but if this is going to your main website you should probably create a new repository called [Your Username].github.io. Anything you host on the master branch of this repository will be visible at https://[Your Username].github.io/.

You can add CI tests for your website on Travis CI by adding a .travis.yml file following the steps on the Jekyll website.

Note: If you have any trouble getting htmlproofer to work with arguments try the following.

install:
  - bundle install

script:
  - bundle exec jekyll build
  - bundle exec htmlproofer --disable-external --empty_alt_ignore ./_site