All Projects → juusaw → Amp Jekyll

juusaw / Amp Jekyll

Licence: mit
Build Accelerated Mobile Page versions of your Jekyll posts

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Amp Jekyll

Jekyll Minifier
Jekyll HTML/XML/CSS/JS Minifier utilising yui-compressor, and htmlcompressor
Stars: ✭ 215 (-22.66%)
Mutual labels:  jekyll-plugin, ruby-gem
Jekyll Minibundle
A minimalistic asset bundling plugin for Jekyll
Stars: ✭ 65 (-76.62%)
Mutual labels:  jekyll-plugin, ruby-gem
jekyll-extlinks
This Jekyll plugin adds custom attributes (rel="nofollow", target="_blank", etc.) to external links in your content.
Stars: ✭ 18 (-93.53%)
Mutual labels:  jekyll-plugin, ruby-gem
Pages Gem
A simple Ruby Gem to bootstrap dependencies for setting up and maintaining a local Jekyll environment in sync with GitHub Pages
Stars: ✭ 1,670 (+500.72%)
Mutual labels:  jekyll-plugin, ruby-gem
jekyll-gzip
Generate gzipped assets and files for your Jekyll site at build time
Stars: ✭ 34 (-87.77%)
Mutual labels:  jekyll-plugin, ruby-gem
mercadopago
A Ruby Object-oriented gem that facilitates the usage of Mercadopago's API.
Stars: ✭ 16 (-94.24%)
Mutual labels:  ruby-gem
jekyll-commonmark
CommonMark generator for Jekyll
Stars: ✭ 28 (-89.93%)
Mutual labels:  jekyll-plugin
delayed-web
A rails engine that provides a simple web interface for exposing the Delayed::Job queue.
Stars: ✭ 71 (-74.46%)
Mutual labels:  ruby-gem
japr
Jekyll Asset Pipeline Reborn - Powerful asset pipeline for Jekyll that collects, converts and compresses JavaScript and CSS assets.
Stars: ✭ 52 (-81.29%)
Mutual labels:  jekyll-plugin
Github cli
GitHub on your command line. Use your terminal, not the browser.
Stars: ✭ 263 (-5.4%)
Mutual labels:  ruby-gem
Tomo
A friendly CLI for deploying Rails apps ✨
Stars: ✭ 260 (-6.47%)
Mutual labels:  ruby-gem
tty-reader
A set of methods for processing keyboard input in character, line and multiline modes.
Stars: ✭ 73 (-73.74%)
Mutual labels:  ruby-gem
ruby-magic
Simple interface to libmagic for Ruby Programming Language
Stars: ✭ 23 (-91.73%)
Mutual labels:  ruby-gem
wp-gdpr-cookie-notice
Simple performant cookie consent notice that supports AMP, Web Stories, granular cookie control and live preview customization.
Stars: ✭ 17 (-93.88%)
Mutual labels:  amp
eventually-jekyll-theme
A Jekyll version of the "Eventually" theme by HTML5 UP.
Stars: ✭ 26 (-90.65%)
Mutual labels:  ruby-gem
Maxminddb
Pure Ruby GeoIP2 MaxMind DB reader.
Stars: ✭ 260 (-6.47%)
Mutual labels:  ruby-gem
jekyll-stickyposts
Jekyll Stickyposts - move selected posts to the top of the list
Stars: ✭ 23 (-91.73%)
Mutual labels:  jekyll-plugin
string-direction
Automatic detection of text direction (ltr, rtl or bidi) for strings in Ruby
Stars: ✭ 13 (-95.32%)
Mutual labels:  ruby-gem
Narou
Narou.rb - 小説家になろうのダウンローダ&縦書き整形&管理アプリ。Kindle(などの電子書籍端末)でなろうを読む場合に超便利です!
Stars: ✭ 256 (-7.91%)
Mutual labels:  ruby-gem
knockoff
A gem for easily using read replicas.
Stars: ✭ 19 (-93.17%)
Mutual labels:  ruby-gem

amp-jekyll

Important: This project is no longer actively maintained as I am not using Jekyll (or AMP) that much nowadays. In case you are interested in maintaining the project, I'm happy to provide support.

Jekyll plugin for creating Accelerated Mobile Page versions of posts. Supports Jekyll version 3 and 4.

Gem Version

AMP project

Usage

Using the gem

  • Add gem amp-jekyll to your Gemfile and run bundle
  • Add the gem to your _config.yml like this:
plugins:
  - amp-jekyll

NOTE: Older Jekyll versions (below 3.6.0) use the key gems instead of plugins. When building a site with such version, use the old key.

Adding the plugin manually

  • Place the Ruby files in lib/jekyll (amp_generate.rb and amp_filter.rb) in folder _plugins at the root of the project

Then perform the following

  • Place the layout file (amp.html) to the _layouts folder
  • Add amphtml-link to post heads (see page linking below) (Add CSS styles to the html template)
  • Generate your site with jekyll build

Setting things up

The AMP standard is somewhat restrictive on allowed HTML elements and requires some extra information on element placing. To make sure that your generated AMP pages are valid by the standard, you can run the AMP version of your post with #development=1 appended to the URL and check the browser's Javascript console for the validation.

Several HTML elements must be replaced with tags specified in the AMP specs to ensure compatibility with the standard. The amp_filter.rb Jekyll filter replaces the tags after converting the markdown to HTML. At the moment only replacing <img> tags is supported.

To disable image responsivity, add false to amp_images responsive parameter in amp.html. This is enabled by default for header and footer.

The AMP folder

Specify amp folder in _config.yml as ampdir: YOURDIR

Page linking

The easiest solution is adding the following conditional expression around the tag.

{% if page.path contains '_posts' %}
  <link rel="amphtml" href="{{ page.id | prepend: '/YOURDIR' | prepend: site.baseurl | prepend: site.url | append: '.html' }}">
{% endif %}

CSS

CSS rules for AMP must be included inline in the <style amp-custom> tag in the <head> element in the HTML. You can write the CSS rules by hand or use jekyll includes. Do note that the AMP specification forbids the use of some CSS selectors and attributes. Because of this, it is not a good idea to include the main stylesheet by default.

Skipping Pages

Sometimes there are pages we don't want to be turned into AMP pages, normally this is because they require HTML elements or JavaScript that would make them invalid.

In any post we want to skip simply add;

skip_amp: true

And update your amphtml block to look like;

{% if page.path contains '_posts' %}
  {% unless page.skip_amp %}
    <link rel="amphtml" href="{{ page.id | prepend: '/YOURDIR' | prepend: site.baseurl | prepend: site.url }}">
  {% endunless %}
{% endif %}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].