site-starter

site-starter

My default Jekyll/S3 website starter template

Site Starter

My standard website starter template. Jekyll build hosted on S3/Cloudfront.

Overview

Getting started

If you don't have Homebrew, Ruby, Bundler, Node.js or Gulp already – follow the starting from scratch instructions first.

Configure new site locally

  1. git clone [email protected]:robbiemanson/site-starter.git into a new directory, or download zip
  2. bundle install to install Gems
  3. brew install imagemagick && brew install graphicsmagick for Gulp-powered image resizing
  4. npm install to install NPM packages
  5. Restart terminal

You can now start local development

Find + replace important elements

  1. Replace all instances of examplesite.com with URL of new site
  2. Replace instances of Site Owner
  3. Replace instances of http://stagingAssetURL.com with staging asset URL (e.g. Cloudfront distribution URL)
  4. Replace favicon.png

Configure hosting

  • Configure domain on Route 53 including assets. and staging. subdomains (see one of the other examples e.g. mademountain.com)
  • Create new whatthedomainis.com S3 bucket with website hosting enabled; follow settings of another functioning example e.g. mademountain.com
  • Create new www.whatthedomainis.com S3 bucket to function as a redirect to actual bucket just created above; see existing functioning example for settings e.g. mademountain.com
  • Add s3_id, s3_secret and s3_bucket details in both s3_website.yml files
  • Create new CloudFront distributions (see existing examples) for both production and staging URLs, add IDs to each of the relevant s3_website.yml files, then replace the Cloudfront URL in head.html
  • Depending on index/homepage name of the site, may need to update 'Home' title in head.html

Local development

Open terminal and run:

$ bundle exec jekyll serve

This will compile the site and recompile as new HTML/file structure changes are made.

Open another terminal window and run:

$ gulp

This will open a new browser tab running Browsersync and auto-reload when any HTML, SCSS, JS or media changes.

Hosting and deployment

  • Hosted on S3, with CloudFront distribution. Deployed using s3_website.
  • Deployment config files live in separate production and staging folders at root level
  • Remember to run s3_website cfg apply before pushing, if any changes are made to either config in s3_website.yml

Staging deploy (staging.examplesite.com)

  1. Ensure asset_url in _config.yml is pointing to correct CloudFront URL
  2. bundle exec jekyll serve > gulp deploy-prep > QA, especially: /pattern-library
  3. s3_website push --config-dir=config_staging --dry-run to check changes before pushing
  4. s3_website push --config-dir=config_staging

Production deploy

  1. Ensure asset_url in _config.yml is pointing to correct CloudFront URL
  2. bundle exec jekyll serve > gulp deploy-prep > QA, especially: /pattern-library
  3. s3_website push --config-dir=config_production --dry-run to check changes before pushing
  4. s3_website push --config-dir=config_production

Writing blog posts

Follow instructions at: http://jekyllrb.com/docs/drafts/

Image processing

To resize and minify full sized photos (will take at least a few mins to run):

$ gulp photos

Starting from scratch

If haven't used Site Starter on your machine before

  1. Install Homebrew
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    
  2. Install ruby-install (confirm: ruby-install -V)
    brew install ruby-install
    
  3. Install Ruby 2.3.3 (confirm: check ~/.rubies, then restart terminal)
    ruby-install ruby 2.3.3
    
  4. Install chruby (confirm: restart terminal, then chruby)
    brew install chruby
    
  5. Switch to newly installed ruby 2.3.3
    chruby 2.3.3
    
  6. Add line to ~/.bashrc or ~/.zshrc
    source /usr/local/opt/chruby/share/chruby/chruby.sh
    
  7. Enable auto-switching of Ruby version by adding these lines to ~/.bashrc or ~/.zshrc
    source /usr/local/share/chruby/chruby.sh
    source /usr/local/share/chruby/auto.sh
    
  8. Install Bundler
    gem install bundler -v '1.13.7'
    
  9. Install Node.js v6.9.4 for npm usage (must be v6.9.4)
  10. Install Gulp 1.2.2 globally
    sudo npm install [email protected] -g
    

Now follow instructions to configure a new site locally!

jekyll logo

Want a Jekyll website built?

Hire a Jekyll developer