2017 © Pedro Peláez
 

silverstripe-vendormodule amp

Provide AMP HTML conversion to your SilverStripe project

image

silverstripers/amp

Provide AMP HTML conversion to your SilverStripe project

  • Thursday, June 7, 2018
  • by silverstripers
  • Repository
  • 1 Watchers
  • 1 Stars
  • 20 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

SilverStripe AMP

AMP HTML⚡ Bundle - provide AMP HTML conversion to your SilverStripe website., (*1)

Requirements

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

Installation & Usage

Install with composer, (*2)

composer require silverstripers/amp dev-master

Configurations

Clearing Caches

To clear the amp caches you need to set up an RSA Key., (*3)

Follow the instructions on the AMP Cache guide on Generating Keys., (*4)

To set up the private key use the following YAML configutation, (*5)

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., (*6)

---
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., (*7)

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

EG:, (*9)

/home/ will have /home/amp.html /about-us/ will have /about-us/amp.html, (*10)

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., (*11)

The module adds cannonical URLs and amphtml links for the sites as well., (*12)

$IsAMP

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

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

Same way you can use the not as well, (*14)

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

Elemental

The module supports elemental module., (*15)

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., (*16)

Reporting Issues

Please create an issue for any bugs, or submit merge requests., (*17)

The Versions

07/06 2018

dev-master

9999999-dev

Provide AMP HTML conversion to your SilverStripe project

  Sources   Download

BSD-3-Clause

The Requires

 

by Nivanka Fonseka

silverstripe conversion amp