Lanyon
Lanyon serves your Jekyll site as a Rack application.
Lanyon is a good friend of Jekyll, the static site generator, and transforms your website into a Rack application.
Getting Started
Assuming you already have a Jekyll project that can be built and
served using the jekyll
command line tool, then converting it
to a Rack application is very simple.
-
Add the Lanyon gem and one of the web servers supported by Rack (e.g. Puma) to your project's
Gemfile
:gem "lanyon" gem "puma"
Then install the gems by running the following in the terminal:
bundle install
For possible other choices for web servers see Rack's README.
-
Add a
config.ru
file in your project's root directory, with the following content:require "lanyon" run Lanyon.application
You can specify additional Rack middleware in this file.
-
Build the site and start the web server with the following command:
bundle exec rackup config.ru
You can find an example site in the demo
directory.
Note that Lanyon does not watch for site changes.
Auto-regeneration similar to Jekyll's serve
command is
not supported, and there are no plans to add this feature.
Lanyon applications can be served with WEBrick, Puma, Thin, and many other web servers, and they can be deployed to services like e.g. Heroku.
Configuration
Options
Jekyll configuration options can be specified in a _config.yml
file
or as Lanyon initialization options in config.ru
.
Example:
run Lanyon.application(destination: "mysite")
This will set a custom destination path, overriding the default (_site
)
and settings from a config file.
See Jekyll's documentation for more settings.
Additional Lanyon initialization options:
:config - use given config file (default: "_config.yml")
:skip_build - whether to skip site generation at startup
(default: false)
Note that on read-only filesystems a site build will fail,
so you must set skip_build: true
in these cases.
Custum 404 Page
You can provide a custom 404.html
file in your site's root directory.
This can also be a file generated by Jekyll from e.g. Markdown sources.
Requirements
-
Ruby 3.1 or higher
-
Gem dependencies (runtime):
jekyll
,rack
How URLs are resolved
Lanyon maps URLs to corresponding files as follows:
- a
path/
with a trailing slash is changed topath/index.html
, - then, Lanyon checks for an exactly corresponding file,
- when
path
does not exist butpath/index.html
does, the response will be a redirect topath/
, - when neither 2. nor 3. apply, +path.html+ is tried.
To avoid confusion, it's probably a good idea to have only one
of resource
, resource/index.html
, and resource.html
present
as file in your site.
Reporting Bugs
Report bugs on the Lanyon home page: https://github.com/stomar/lanyon/
Credits
Lanyon was inspired by rack-jekyll and written as a replacement.
License
Copyright © 2015-2024 Marcus Stollsteimer
Lanyon is licensed under the MIT License.
See also the included LICENSE
file for more information.