📂
SEI 1019
  • Introduction
  • About These Notes
  • Syllabus
  • Development Workflow
    • Command Line
      • The Terminal
      • Filesystem Navigation
      • File Manipulation
      • Additional Topics
    • Intro to Git
      • Version Control
      • Local Git
      • Remote Git
      • Git Recipes
    • Group Collaboration
      • Git Workflows
      • Project Roles and Tools
    • VS Code Tips & Tricks
  • HTML/CSS
    • HTML
    • CSS Selectors
    • CSS Box Model and Positioning
      • Box Model
      • Display and Positioning
      • Flexbox
      • Grid
      • Flexbox & Grid Games
      • Floats and Clears
      • Additional Topics
    • Advanced CSS
      • Responsive Design
      • Pseudo-Classes/Elements
      • Vendor Prefixes
      • Custom Properties
      • Additional Topics
    • Bootstrap
    • CSS Frameworks
    • Accessibility
  • JavaScript
    • Primitives
    • Arrays
    • Objects
    • Control Flow
      • Boolean Expressions
      • Conditionals
      • Loops
      • Promises
    • Functions
      • Callbacks
      • Timing Functions
      • Iterators
    • DOM and Events
    • DOM Manipulation
    • HTML5 Canvas
    • How To Reduce Redundancy
    • (2019) JavaScript OOP
    • (2016) OOP with Classes
    • (1995) OOP with Prototypes
      • Constructors
      • Prototypes
    • Intro to TDD
    • Scoping
    • Inheritance
      • Prototypal Inheritance
      • Call, Apply, and other Functions
      • ES6 Inheritance
      • Resources
    • Custom Node Modules
    • Additional Topics
      • AJAX, Fetch, and Async/Await
      • AJAX w/JSON and Localstorage
        • AJAX w/JSON
        • Local Storage
      • Async module
      • Data Scraping
  • jQuery
    • Intro
      • DOM Manipulation
      • Reddit Practice
      • Styling
      • Events
    • Plugins
    • AJAX
  • APIs
    • Fetch
    • AJAX w/jQuery
    • AJAX w/Fetch
  • Databases
    • Intro to SQL
    • Advanced SQL
    • MongoDB
      • Intro to NoSQL
      • CRUD in MongoDB
      • Data Modeling
      • Intermediate Mongo
  • Node/Express
    • Node
      • Intro to Node
      • Node Modules
      • Node Package Manager (NPM)
    • Express
      • Intro to Express
        • Routes
        • Views
        • Templates
        • Layouts and Controllers
        • CRUD & REST
          • Get and Post
          • Put and Delete
      • APIs with Express (request)
      • APIs with Express (axios)
    • Sequelize
      • Terminology
      • Setup
      • Using Models
      • Seeding Data
      • Validations and Migrations
      • Resources
      • 1:M Relationships
      • N:M Relationships
    • Express Authentication
      • Research Components
      • Code Components
      • Auth in Theory
        • Sessions
        • Passwords
        • Middleware
        • Hooks
      • Auth in Practice
        • Create the User
        • User Signup
        • Sessions
        • User Login
        • Authorization and Flash messages
    • Testing with Mocha and Chai
    • Mongoose
      • Mongoose Associations
    • JSON Web Tokens
      • Codealong
    • Additional Topics
      • oAuth
      • Geocoding with Mapbox
      • Geocoding and Google Maps
      • Cloudinary
      • Websockets with Socket.io
      • SASS
  • Ruby
    • Intro to Ruby
    • Ruby Exercises
    • Ruby Classes
    • Ruby Testing with Rspec
    • Ruby Inheritance
    • Ruby Data Scraping
  • Ruby on Rails
    • Intro to Rails
    • APIs with Rails
    • Asset Pipeline
    • Rails Auth and 1-M
      • Auth Components
    • Rails N:M
    • ActiveRecord Polymorphism
    • Additional Topics
      • oAuth
      • SASS
      • Rails Mailers
      • Cloudinary
      • Jekyll
  • React (Updated 2019)
    • ES6+/ESNext
      • Const and Let
      • Arrow Functions
      • Object Literals and String Interpolation
      • ES6 Recap
      • ES6 Activity
    • Intro to React
      • Create React App
      • Components and JSX
      • Virtual DOM
      • Props
      • Dino Blog Activity
      • Nested Components
      • Lab: LotR
    • React State
      • Code-Along: Mood Points
      • Code-Along: Edit Dino Blog
      • Lab: Simple Calc
      • Lifting State
    • React Router
      • Browser History/SPAs
      • React Router (lesson and full codealong)
      • Router Lab
    • Fetch and APIs
      • APIs with Fetch and Axios
      • Fetch the Weather
    • React Hooks
    • React LifeCycle
      • Lab: Component LifeCycle
    • React Deployment
    • Additional Topics
      • React Frameworks
        • Material UI Theming
      • Typescript
        • More Types and Syntax
        • Tsconfig and Declaration Files
        • Generics with Linked List
      • Redux
      • TypeScript
      • Context API
      • React Native
  • Meteor
  • Deployment and Config
    • Installfest
      • Mac OSX
      • Linux
      • Git Configuration
      • Sublime Packages
    • Deploy - Github Pages
    • Deploy - Node/Sequelize
    • Deploy - Node/MongoDB
    • Deploy React
    • Deploy - Rails
      • Foreman (Environment Variables)
    • Deploy - AWS Elastic Beanstalk
    • Deploy - S3 Static Sites
    • Deploy - Django
    • Deploy - Flask
  • Data Structures and Algorithms
    • Recursion
    • Problem Solving - Array Flatten
    • Binary Search
    • Algorithm Complexity
    • Stacks and Queues
    • Bracket Matching
    • Ruby Linked Lists
      • Sample Code
      • Beginner Exercises
      • Advanced Exercises
    • JS Linked Lists
      • Sample Code
      • Beginner Exercises
      • Beginner Solutions
    • Hash Tables
    • Intro to Sorting
    • Insertion Sort
    • Bucket Sort
    • Bubble Sort
    • Merge Sort
    • Quick Sort
    • Heap Sort
    • Sorting Wrapup
    • Hashmaps
    • Trees and Other Topics
  • Python
    • Python Installation
    • Intro to Python
    • Python Lists
    • Python Loops
    • Python Dictionaries
    • Python Sets and Tuples
    • Python Cheatsheet
    • Python Functions
    • Python Classes
    • Python Class Inheritance
    • Intro to Flask
    • Intro to SQLAlchemy
      • Flask and SQLAlchemy
    • Using PyMongo
    • Intro to Django
    • CatCollector CodeAlong
      • URLs, Views, Templates
      • Models, Migrations
      • Model Form CRUD
      • One-to-Many Relations
      • Many-to-Many Relations
      • Django Auth
    • Django Cheatsheet
    • Django Auth
    • Django Polls App Tutorial
    • Django School Tool Tutorial
    • Django 1:M Relationships
    • Custom Admin Views
    • Data Structures and Algorithms
      • Recursion
      • Binary Search
      • Stacks and Queues
      • Linked Lists
      • Binary Trees
      • Bubble Sort
      • TensorFlow & Neural Networks
    • Adjacent Topics
      • Raspberry Pi
      • Scripting
  • Assorted Topics
    • History of Computer Science
    • Regular Expressions
    • Intro to WDI (Course Info)
    • Being Successful in WDI
    • Internet Fundamentals
      • Internet Lab
    • User Stories and Wireframing
      • Wireframing Exercise: Build an Idea
    • Post WDI
      • Learning Resources
      • Deliverables -> Portfolio
      • FAQ
  • Projects
    • Project 1
    • Project 2
    • Project 3
      • Project 3 Pitch Guidelines
    • Project 4
    • Past Projects
      • Project 1
      • Project 2
      • Project 3
      • Project 4
      • Portfolios
    • Post Project 2
    • MEAN Hackathon
      • Part 1: APIs
      • Part 2: Angular
    • Portfolio
  • Web Development Trends
  • Resources
    • APIs and Data
    • Tech Websites
    • PostgreSQL Cheat Sheet
    • Sequelize Cheat Sheet
    • Database Administration
  • Archived Section
    • (Archived) ReactJS
      • Intro to React
        • Todo List Codealong
        • Additional Topics
      • Deploy React
      • React with Gulp and Browserify
        • Setting up Gulp
        • Additional Gulp Tasks
      • React Router
        • OMDB Router
        • OMDB Search
        • Additional Resources
      • React Animations
        • CSS Animations
    • AngularJS
      • Intro to AngularJS
        • Components and SPA
        • Create an Angular App
      • Angular Directives and Filters
      • Angular Animation
      • Angular Bootstrap Directives
        • Bootstrap Modals
      • Angular $http
      • Angular Services
        • Service Recipes
        • ngResource
        • Star Wars Codealong
      • Angular Routing
      • Angular + Express
      • Angular Authentication
        • Additional Topics
      • Angular Components
      • Angular Custom Filters
      • Angular Custom Directives
Powered by GitBook
On this page
  • Objectives
  • Choosing Frameworks
  • Static Site Generators
  • Setting up and Using Jekyll
  • Folders
  • Files
  • Serving the site
  • Configuring and Editing Jekyll
  • Deploying
  • Other Options

Was this helpful?

  1. Ruby on Rails
  2. Additional Topics

Jekyll

PreviousCloudinaryNextReact (Updated 2019)

Last updated 4 years ago

Was this helpful?

Objectives

  • Identify and apply different frameworks to different problems

  • Compare and contrast full-stack web applications with static site generators

  • Identify the various components that are incorporated by Jekyll

  • Use Jekyll to create a portfolio/blog

Choosing Frameworks

So far, we've utilized various different frontend and backend frameworks. Why so many? Why can't there be just one?

Each framework has its benefits and drawbacks, and it's your job as a developer to choose the framework that's right for the job.

Think about it: What are some cases where we'd want to use Rails over Express? How about something unfamiliar, like Wordpress, over Express?

Static Site Generators

Fairly often, the dynamic complexity of Rails or Express may be overkill for the project at hand. For example, most blogs and portfolios at a small scale do not need a database. In these cases, we can use static site generators.

Static site generators are frameworks that take content, usually in the form of text/markup, pass the content to a template engine, then render HTML pages for viewing.

We'll be using Jekyll to create a static portfolio/blog. Jekyll uses Markdown and the Liquid template engine, along with HTML/CSS/JavaScript, in order to generate a static site.

Markdown -> Liquid (templating) + HTML + CSS + JS -> HTML pages

Setting up and Using Jekyll

To get started with jekyll, install it as a gem.

gem install jekyll

To create a new site, run the jekyll new command.

jekyll new my-portfolio

Note: If you happen to get an error that says uninitialized constant Psych::Nodes (NameError), run gem clean, then try creating the site again.

cd into the new directory created, and you'll see some files and folders that Jekyll pre-built for you.

Folders

  • _includes - Liquid partials, such as headers and footers

  • _layouts - page layouts that utilize partials from _includes. Jekyll can utilize many different layouts, which is handy for displaying different content

  • _posts - Jekyll is used often for blogging, so this folder provides some organization for your content. These files are written in Markdown and contain metadata at the top of each file, written in YAML, known as front matter

  • _sass - Jekyll supports SASS out-of-the-box, so add SASS files here

  • _css - Contains the main SASS file, which contains any variables and imports files from the _sass folder

Files

  • .gitignore

  • _config.yml - this configuration file is YAML markup with site-wide settings, such as the name, email, description, URL, and other data

  • about.md, index.html - by default, Jekyll provides two pages. The first one is a Markdown file, and the second one is a HTML file. Note that you can use either extension for your blog, depending on if your content is raw HTML or Markdown. Each file will contain front matter that specifies the layout and other settings.

When you serve your site, Jekyll takes all these files, parses them as necessary, and renders a bunch of pages. The layouts/includes files serve as templates, while the Markdown/HTML uses these templates and injects the content.

Serving the site

To serve the site, run

jekyll serve

Jekyll will create a new folder called _site and host your site at localhost:4000. Any file changes, with the exception of configuration files, will prompt Jekyll to regenerate the folder.

Configuring and Editing Jekyll

Jekyll contains various filters and tags that you can use to customize your site. The ones you'll find to be most handy:

Accessing posts

{% for post in site.posts %}

{{ post.title }}
{{ post.date }}
{{ post.content }}

{% endfor %}

Notice that title and date are in the front matter for the post! This means you can include other variables in the front matter (such as image paths, categories, tags, etc.)

Accessing Site Variables

{{ site.title }}

{{ site.url }}

{{ site.github_username }}

{{ site.posts }}

{{ site.pages }}

Again, notice that some of these variables have an explicit location (config.yml), and you can define your own variables.

Including partials in a layout

{% include header.html %}

{% include footer.html %}

Deploying

The benefit of having a static site is less configuration during deployment, since it's just static files (no database or other tasks).

It's even easier because Github supports Jekyll (Github was co-founded by Tom Preston-Werner, creator of Jekyll). Deploying your Jekyll site to Github will allow for instant hosting.

To host a portfolio or blog, you can name the repository yourgithubusername.github.io and push the site to the master branch.

Other Options

Out-of-the-box, Jekyll has some other fun features, like RSS feed support and built-in code highlighting! For more information on the various liquid tags and filters used in templates, check out the .

What is a Static Website?
Jekyll Home Page
documentation
Using Jekyll with Github Pages
Jekyll Themes
Other Jekyll Themes
Jekyll Bootstrap