Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
A Jekyll layout that compresses HTML in pure Liquid, reducing file size without plugins.
Jekyll Compress HTML is a free, open-source Jekyll layout that compresses the HTML output of a Jekyll site using only Liquid, Jekyll's built-in templating language, requiring no additional plugins or Ruby gems. It was created by penibelst and is documented at jch.penibelst.de, with the source code hosted on GitHub and distributed through a releases page for download.
Jekyll Compress HTML is a layout file used in Jekyll static sites to reduce the size of generated HTML. It takes the fully rendered HTML from the Jekyll build process and applies Liquid filters to strip unnecessary whitespace, blank lines, and HTML comments, producing a minified version of the page. It runs on any standard Jekyll installation, since it is written entirely in Liquid—the same language Jekyll uses for templates—and does not depend on any external minification library.
Because it is pure Liquid, it executes during Jekyll's normal generation step and adds no extra build passes. The author maintains a documentation site at jch.penibelst.de, which explains the layout's options and usage in detail. The GitHub repository uses Travis CI for continuous integration, indicated by a build status badge, and hosts the latest release for download.
Jekyll site owners who want to reduce their site's HTML file size and improve page load performance by stripping redundant whitespace and comments. Web developers who build static sites with Jekyll and prefer a dependency-free solution that relies only on Liquid, avoiding the need to install or maintain Ruby minification gems. GitHub Pages users who cannot deploy custom Jekyll plugins and need a compression method that works within GitHub's supported feature set.
The layout wraps your site's content, and when Jekyll renders a page, Liquid processes the compress.html layout. The layout's Liquid code strips out tabs, spaces, newlines, and HTML comments from the generated markup, then outputs the compressed result. To use it, you download the layout, place it in your _layouts directory, and assign it as the layout for the pages you want compressed; the documentation explains any available tuning options.
Yes, it is open source and available for free. The source code is hosted on GitHub, and you can download the latest release from the project's releases page. No license fees or subscriptions are required.
Yes, it is compatible with GitHub Pages because the layout is written entirely in Liquid and does not rely on custom plugins, which GitHub Pages does not support. You can place the layout in your repository and use it within the standard Jekyll build that GitHub Pages runs.
Download the compress.html file from the GitHub releases page and copy it into your Jekyll site's _layouts directory. Then set the compression layout as the default layout in your _config.yml file or in individual pages' front matter to start compressing HTML output.
The layout removes unnecessary whitespace (including indentation and extra blank lines) and HTML comments from the rendered page. This reduces the file size without changing the visible content, but you should review the documentation for any specifics regarding elements like preformatted text where whitespace can be meaningful.
