This project offers an AMP-ready Jekyll theme for your blogs and websites.
remote_theme
<amp-img>
with <figure>
and <figcaption>
wrapperv2.x.x
_config.yml
rel
and target
attributes to outbound links without plugins or dependencies_config.yml
_config.yml
v2.7
) Show/hide the GitHub Sponsors button in the navigation barv2.7
) Add support of social buttons for Twitter and Linkedinv2.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:
_config.yml
file as per your requirements._posts
directory.Read the procedures in the Config Guide ā.
Read Google Services in the Config Guide ā. For the following:
amp_disqus_url
in _config.yml.amp_disqus_height
to configure the height of <amp-iframe>
if needed (default is 140
).Make a new folder named blog
in 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 category
and tag
, respectively.
New a file and name it to index.html
in your category
and/or tag
folder(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
---
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
template to insert an image in the AMP format for automatically serving the image in the WebP format.
The template 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: true
To embed a single video, use the following tag to include the youtube.html
template.
{% include youtube.html id="<YOUTUBE_VIDEO_UID>" title="Welcome to Watch this Video" %}
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: true
A shortcode for creating a colored box, e.g. tips/memo.
{% capture label %}
PUT YOUR MARKDOWN CONTENT HERE...
{% endcapture %}
{% include callout.html content=label %}
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.
Run the following command to install Gulp, AMP Optimizer, and other node packages in the root directory of your project:
npm install
Build Jekyll locally and run the Gulp pipeline with the following command:
npm run build
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:
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 -
Would you like to buy me a coffee? I would really appreciate it if you could support me for the theme development.
This project is developed based on the MIT-licensed Affiliates ā Jekyll theme designed by Sal, WowThemes.net ā.
This theme is available as open-source under the terms of the MIT License ā under the same upstream license.