Giter Site home page Giter Site logo

amp's Introduction

SilverStripe AMP

AMP HTML⚡ Bundle - provide AMP HTML conversion to your SilverStripe website.

Requirements

  • lullabot/amp ^1.1.3
  • silverstripe/framework 4+

Installation & Usage

Install with composer

composer require silverstripers/amp dev-master

Configurations

Clearing Caches

To clear the amp caches you need to set up an RSA Key.

Follow the instructions on the AMP Cache guide on Generating Keys.

To set up the private key use the following YAML configutation

SilverStripers\AMP\Control\AMPCache:
	key_file: 'PATH_TO_YOUR_PRIVATE_KEY'

Setting up class names

The module allows you to set up class name of pages which are supported by AMPs.

---
Name: amps
---
SilverStripers\AMP\Control\AMPDirector:
  allowed_classes:
    - SilverStripe\Blog\Model\Blog
    - SilverStripe\Blog\Model\BlogPost

The configs above limits the amps support to Blog and BlogPost pages.

This module adds extensions on for your controllers where the pages will have an AMP based version with a URL suffix for each page.

EG:

/home/ will have /home/amp.html /about-us/ will have /about-us/amp.html

The mobile also provides a template global $IsAMP which you can use on any template to add specific HTML segments for the AMP version of the website.

The module adds cannonical URLs and amphtml links for the sites as well.

$IsAMP

In order to determine whether the current request is in AMP or not you can use $IsAMP variable.

<% if $IsAMP %>
<!-- YOUR AMP CODES HERE -->
<% end_if %>

Same way you can use the not as well

<% if not $IsAMP %>
<!-- YOUR NONE AMP CODES HERE -->
<% end_if %>

Elemental

The module supports elemental module.

If you are having to override the templates for Elemental objects you can have templates with _AMP suffix, when those templates are found the elements gets rendered using those.

Reporting Issues

Please create an issue for any bugs, or submit merge requests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.