LinuxCommandLibrary

jekyll

Generate static websites from templates

TLDR

Generate a development server that will run at http://localhost:4000/

$ jekyll serve
copy

Enable incremental regeneration
$ jekyll serve --incremental
copy

Enable verbose output
$ jekyll serve --verbose
copy

Generate the current directory into ./_site
$ jekyll build
copy

Clean the site (removes site output and cache directory) without building
$ jekyll clean
copy

SYNOPSIS

jekyll <subcommand> [options]

PARAMETERS

build
    Compiles the source files into a static website, typically outputting to the <_site> directory. Common options include:
--source : Specify source directory.
--destination : Specify output directory.
--config : Specify configuration file(s).
--drafts: Render posts in the <_drafts> folder.
--future: Render posts with a future date.
--incremental: Enable incremental regeneration.

serve
    Builds the site and serves it locally using a built-in web server. It also watches for file changes and rebuilds automatically. Common options include:
--host

: Specify host to bind to.
--port : Specify port to listen on.
--open-url: Open site in browser.
--detach: Detach the server process.

new
    Creates a new Jekyll site scaffold at the specified path.
--blank: Create a blank site without theme.
--skip-bundle: Don't run <bundle install>.

doctor
    Checks your Jekyll site for potential compatibility issues or common configuration problems in your environment.

clean
    Deletes the generated <_site> directory and the <.jekyll-cache> directory, effectively cleaning the build output.

help
    Displays help information about Jekyll subcommands or global options. Use <jekyll help > for specific help.

DESCRIPTION

Jekyll is a static site generator written in Ruby. It takes content authored in Markdown, Liquid, HTML, and CSS, processes it through a set of rules (like converting Markdown to HTML, applying layouts, rendering Liquid templates), and outputs a complete, ready-to-deploy static website. It's often used for blogs, portfolios, and documentation sites due to its simplicity, speed, and security (no database or server-side scripting needed at runtime). Jekyll builds the site once, and the resulting files (HTML, CSS, JS, images) can be served directly by any web server. It integrates well with version control systems like Git and hosting platforms like GitHub Pages, making it a popular choice for developers and content creators seeking a robust and maintainable web presence.

CAVEATS

Ruby Dependency: Jekyll is built with Ruby, requiring a Ruby environment and <Bundler> for dependency management, which can be a setup hurdle for some users.
Static Nature: As a static site generator, Jekyll cannot handle dynamic server-side logic (e.g., user authentication, database queries) directly. For such features, integration with external services or client-side JavaScript is necessary.
Build Times: For very large sites with thousands of pages, Jekyll build times can become significant, though incremental builds help mitigate this.
No Built-in Admin UI: Unlike traditional CMS platforms, Jekyll does not provide a graphical user interface for content management; content is typically managed via text files and Markdown.

GITHUB PAGES INTEGRATION

Jekyll is the engine behind GitHub Pages, allowing users to host their Jekyll sites for free directly from a GitHub repository. This seamless integration simplifies deployment, version control, and collaboration for web projects.

THEMING AND PLUGINS

Jekyll supports themes for easy site styling and layout, enabling quick setup and consistent design. It also has a powerful plugin system (RubyGems) for extending functionality, though GitHub Pages has limitations on which plugins can be used for security reasons.

LIQUID TEMPLATING LANGUAGE

Jekyll leverages the Liquid templating language (created by Shopify) for dynamic content generation during the build process. Liquid allows for reusable layouts, includes, conditional logic, and data manipulation, enabling sophisticated static sites from plain text files.

HISTORY

Jekyll was created by Tom Preston-Werner, co-founder of GitHub, and first released in 2008. It quickly gained significant popularity due to its adoption by GitHub Pages, which provides free hosting for Jekyll sites directly from Git repositories. Its design promoted a workflow centered around Git, Markdown, and static content, influencing the rise of the 'Jamstack' architecture and numerous other static site generators.

SEE ALSO

bundle(1), git(1), markdown(7)

Copied to clipboard