This project offers an AMP-ready Jekyll theme for your blogs and websites.
π Demo Site β
- π» π± Preview the look of the responsive design for smartphone, tablet, and laptop β
- π·π Preview media blocks (for images, videos and audio) in AMP β
- π₯οΈβ¨ Preview code blocks and snippet highlighting β
- πβ¨ Preview available Markdown styles β
- AMP-ready
- Easily installable using
remote_theme - Easily Customisable
- Responsive Web Design
- Sticky Navigation Menu with Submenu on Hover
- Left/Right Sidebar β
- Pagination
- Category and Tag Archives
- Featured Box/List β
- Set Cover/Featured Image on Post Pages β
- Syntax Highlighting for Code
- Multiple Authors
- Include
<amp-img>with<figure>and<figcaption>wrapper - Support WebP Image Format
- Lightbox (AMP)
- Include YouTube (AMP) with GA video tracking
- Disqus Comments in AMP
- Site Search via Google Custom Search Engine
- Auto-Suggestion Search Bar
- Tracking with Google Analytics and Google Tag Manager (AMP)
- Monetize via Google Adsense and Buy Me A Coffee
- Support deploying to Github Pages via Github Action
- Advanced Consent Management: Granular, geo-targeted cookie consent support via
amp-consentandamp-geo, with seamless iubenda integration. πͺ - Enhanced Analytics: Deep Google Analytics 4 (GA4) integration with outbound link and video engagement tracking. π
- Customizable Footer: Easily configure footer columns directly from
_config.yml. π - Improved UX & Styling: A custom 404 page, refined typography, and enhanced styling for ToC and callouts. π¨
- Modernized Build & Styling: Migrated to the modern Sass module system (
@use). The build process features a fully integrated asset pipeline wherenpm run buildhandles everything from SCSS compilation and minification to Jekyll site generation and final HTML optimization. The Gulp-based system is refactored for robustness, uses ES modules, provides better logging, and conditionally generates sourcemaps. Separated theme variables into a dedicated partial (_theme-vars.scss) to prevent CSS duplication. π¨ - Better Developer Experience: Live reload for local development and deep VS Code integration with Front Matter CMS. π¨βπ»
- Support building Jekyll with β‘ AMP Optimizer using Gulp π₯€
- Support minifying HTML and inline CSS using Gulp π₯€
- Improve accessibility π©βπ¦½
- Improve the support for IE11
- Support installing Jekyll-Scholar Plugin to format bibliographies
- Set the sorting of post tags and categories in
_config.yml - New block for including Table of Contents to a page/post
- New post-processing for adding anchor links next to H2, H3, and H4 headings inside post content
- New post-processing for inserting
relandtargetattributes to outbound links without plugins or dependencies - Support on-page sidebar options
- Allow configuring Resources Widget globally in
_config.yml - Support creating multiple Download buttons in the sidebar widget
- Allow fully customizing copyright notice in
_config.yml - (
v2.7) Show/hide the GitHub Sponsors button in the navigation bar - (
v2.7) Add support of social buttons for Twitter and Linkedin - (
v2.8.0) Add AMP Optimizer logs to the Gulp task π₯€
AMP stands for Accelerated Mobile Pages β, a Google-backed project designed as an open standard for any publisher to have pages load quickly on mobile devices.
There are various ways to install the theme:
- Fork this repository and clone the forked repository.
- Update the
_config.ymlfile as per your requirements. - Add your posts to the
_postsdirectory. - Deploy to your server or Github Pages (read Deploying to GitHub Pages with GitHub Actions ).
Read the procedures in the Config Guide β.
-
Read Google Services in the Config Guide β. For the following:
- Google Analytics 4
- Google Adsense
- Google Tag Manager
- Google Custom Search Engine
- Download this HTML file β
and deploy it to another domain or subdomain.
- Copy the external URL link as the value of
amp_disqus_urlin _config.yml. - Use
amp_disqus_heightto configure the height of<amp-iframe>if needed (default is140).
-
Make a new folder named
blogin your root directory. -
Create an empty HTML file in the new folder and name it
index.html. -
Copy the following front matter to the HTML file:
--- layout: blog-pagination ---
-
In your root directory, create a folder named
categoryandtag, respectively. -
New a file and name it to
index.htmlin yourcategoryand/ortagfolder(s). -
Copy the following front matters to the corresponding
index.html:-
For
category/index.html,--- layout: category-list title: List of Categories ---
-
For
tag/index.html--- layout: tag-list title: List of Tags ---
-
- Enable showing FEATURED and RECENT POSTS widgets on your sidebar β
- Show GitHub Metadata Widget in Sidebar (v2.0) β
You can write posts just as you would in Jekyll, the only difference being that AMP has some strict guidelines on including external content.
You cannot use Markdown format or normal HTML tags. AMP provides its own custom tags for images, videos, etc. For examples,
Use the picture.html include to insert an image in the AMP format for automatically serving the image in the WebP format.
This include also wraps the image with a <figure> tag with an optional caption element.
{% include picture.html img="welcome.jpg" height="400" width="800" %}
OPTIONS β
You need to include the following front-matter variable to enable YouTube embeds.
amp:
youtube: trueTo embed a single video, use the following tag to insert the youtube.html include. It supports title, description, and upload_date parameters for generating VideoObject schema markup, which is beneficial for SEO. You can also specify the thumbnail quality using the thumb_quality parameter (e.g., mq, hq, sd, maxres).
{% include youtube.html id="<YOUTUBE_VIDEO_UID>" title="Welcome to Watch this Video" description="A short description of the video." upload_date="YYYY-MM-DDThh:mm:ssZ" thumb_quality="hq" %}
To embed a playlist, you need to set both the playlist ID and the ID of the first video within the playlist.
{% include youtube.html id="<YOUTUBE_VIDEO_UID>" playlist="<YOUTUBE_PLAYLIST_UID>" title="Welcome to Watch this Video" %}
This theme supports syntax highlighting based on Rouge, which is the default highlighter in Jekyll 3 and above. All CSS styles for syntax highlighting are located in the amp-syntax-highlight.css under the _includes/css/ directory.
By default, this theme excludes the CSS styles for syntax highlighting. The AMP framework limits the total CSS styles up to 75,000 bytes per AMP page. This keeps lightweight and rendering fast.
To include the stylesheet on-demand, you need to add the following to your post's front matter:
css:
syntax: trueA shortcode for creating a colored box, e.g. tips/memo.
{% capture label %}
PUT YOUR MARKDOWN CONTENT HERE...
{% endcapture %}
{% include callout.html content=label %}
For detailed guidance on front matter variables for posts and pages, please refer to the official Front Matter Guide β.
Some AMP components require you to specify external scripts before using them.
You can specify these scripts in the head.html file in the includes directory after the already imported scripts and then use these components in any post.
See Full AMP Documentation β to learn more.
AMP provides a built-in validator to validate your pages. You can access this validator by opening the Developer Console in your browser and appending #development=1 to the end of any URL of your site, e.g. http://localhost:4000/#development=1.
If you have errors on your page, AMP will list those for you in the console. If no errors are on your page, you'll get a message "AMP Validation Successful" on the DevTools console.
This theme uses npm to manage development dependencies and Gulp.js to automate parts of the build process, including AMP optimization and asset minification.
First, install all the required Node.js and Ruby dependencies. From the root of the project, run:
npm installThis command will also automatically run bundle install to install the necessary Ruby gems.
npm run serve: The primary command for local development. It starts a Jekyll server with live reload, so you can see your changes instantly.npm run build: Creates a complete, production-ready build. This script compiles SCSS, minifies CSS, builds the site with Jekyll (JEKYLL_ENV=production), and finally optimizes and minifies the HTML output.npm run build:dev: Creates a complete development build. It performs the same steps asnpm run buildbut without the production-specific optimizations.npm run test: Runs the Gulpvalidatetask to check the generated_sitefor AMP compliance, ignoring a default set of files. This is the command used for CI checks.npm run test:dev: Runs a full AMP validation on all generated files without ignoring any.npm run css:build: A utility script that compiles SCSS and optimizes/minifies the resulting CSS using PostCSS. This is automatically run as part of thebuildandbuild:devscripts.npm run watch:all: A convenient script for developers that watches all SCSS and CSS files and recompiles them automatically on change.
This theme includes Jekyll plugins that are not in the whitelist of Github Pages. Therefore, to deploy it to your Github Pages, you need to use a custom Github Actions workflow to publish your site. The Action workflow is configured in the /.github/workflows/jekyll-build.yml. The workflow is triggered on pushes to the master branch and leverages GitHub Actions to:
- Build the Jekyll Site: Installs Ruby and Jekyll to build the site.
- Optimize AMP and Minify HTML: Runs AMP Optimizer and HTML minifier with gulp.js.
- Deploy to GitHub Pages: Publishs the built site to GitHub Pages.
Bug reports and pull requests are welcome on GitHub at https://github.com/chriskyfung/amp-affiliately-jekyll-theme/ β. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant β code of conduct.
To submit a pull request -
- Fork/clone the repository.
- Develop.
- Create a new branch from the master branch.
- Open a pull request on Github describing what was fixed or added.
Would you like to buy me a coffee? I would really appreciate it if you could support me for the theme development.
This theme is available as open-source under the terms of the MIT License β under the same upstream license.

