Lanyon

Lanyon is an unassuming Jekyll theme that places content first by tucking away navigation in a hidden drawer. It's based on Poole, the Jekyll butler.

Lanyon Lanyon with open sidebar

Contents

Usage

Lanyon is a theme built on top of Poole, which provides a fully furnished Jekyll setup—just download and start the Jekyll server. See the Poole usage guidelines for how to install and use Jekyll.

Install as a gem-based theme

Jekyll encourage the use of bundler to manage themes and plugins. Themes can be packaged as Ruby gems since Jekyll 3.3. If you don't intend to modify the theme a lot, this is a nice way of focusing on your content and benefits from theme updates.

1. Install theme

  1. Create a folder that will be your Jekyll source directory, e.g blog.
  2. Create a Gemfile in your source directory to list all theme dependencies, it should looks like this:
# frozen_string_literal: true

source "https://rubygems.org"

gem "jekyll", "~> 3.7.0"
gem "jekyll-theme-lanyon", "~> 1.1"

2. Configuration

  1. Run bundle install to install all theme dependencies.
  2. Copy _config.yml, index.html, 404.html (and about.md) from this repository's example files to your source directory.
  3. Run bundle exec jekyll serve --livereload to preview your website locally.

If you list the files in your source directory, don't be surprised if you only see:

├── _posts        # your posts are here
├── _site         # default destination build directory
├── _config.yml   # jekyll configuration
├── 404.html      # default 404 page template
├── about.md      # default example page
├── Gemfile       # bundler configuration
├── Gemfile.lock  # bundler version lock
└── index.html    # list all the posts on the homepage

:bulb: When you use gem-based themes, the themes files don't appear in your source directory, they're packaged within the gem.

If you wonder where the original theme files are, bundler allows you to show a gem content:

tree $(bundle show jekyll-theme-lanyon)
├── Gemfile
├── Gemfile.lock
├── LICENSE.md
├── README.md
├── _includes
│   ├── head.html
│   └── sidebar.html
├── _layouts
│   ├── default.html
│   ├── home.html
│   ├── page.html
│   └── post.html
├── assets
│   ├── apple-touch-icon-precomposed.png
│   ├── css
│   │   ├── lanyon.css
│   │   ├── poole.css
│   │   └── syntax.css
│   └── favicon.ico

If you want to customize the theme, you'll have to copy the files you need to modify in your source directory. Report to jekyll's documentation to learn how to override a theme.

Options

Lanyon includes some customizable options, typically applied via classes on the <body> element.

Create a list of nav links in the sidebar by assigning each Jekyll page the correct layout in the page's front-matter.

---
layout: page
title: About
---

Why require a specific layout? Jekyll will return all pages, including the atom.xml, and with an alphabetical sort order. To ensure the first link is Home, we exclude the index.html page from this list by specifying the page layout.

Themes

Lanyon ships with eight optional themes based on the base16 color scheme. Apply a theme to change the color scheme (mostly applies to sidebar and links).

Lanyon with red theme Lanyon with red theme and open sidebar

There are eight themes available at this time.

Available theme classes

To use a theme, add any one of the available theme classes to the <body> element in the default.html layout, like so:

<body class="theme-base-08">
  ...
</body>

To create your own theme, look to the Themes section of included CSS file. Copy any existing theme (they're only a few lines of CSS), rename it, and change the provided colors.

Reverse layout

Lanyon with reverse layout Lanyon with reverse layout and open sidebar

Reverse the page orientation with a single class.

<body class="layout-reverse">
  ...
</body>

Make the sidebar overlap the viewport content with a single class:

<body class="sidebar-overlay">
  ...
</body>

This will keep the content stationary and slide in the sidebar over the side content. It also adds a box-shadow based outline to the toggle for contrast against backgrounds, as well as a box-shadow on the sidebar for depth.

It's also available for a reversed layout when you add both classes:

<body class="layout-reverse sidebar-overlay">
  ...
</body>

Show an open sidebar on page load by modifying the <input> tag within the sidebar.html layout to add the checked boolean attribute:

<input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox" checked>

Using Liquid you can also conditionally show the sidebar open on a per-page basis. For example, here's how you could have it open on the homepage only:

<input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox" {% if page.title =="Home" %}checked{% endif %}>

Development

Lanyon has two branches, but only one is used for active development.

  • master for development. All pull requests should be to submitted against master.
  • gh-pages for our hosted site, which includes our analytics tracking code. Please avoid using this branch.

Author

Mark Otto

License

Open sourced under the MIT license.

<3