Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2016-05-02 08:31:37

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,595
GitHub Twitter

Re: Implementing AMP pages in Textpattern


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#14 2016-05-04 08:28:44

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,595
GitHub Twitter

Re: Implementing AMP pages in Textpattern

The latest version 3.3 simulates the feature in use within “The Guardian” website which redirects to the same article’s URL onto the subdomain (default: amp): mkp_if_amp plugin


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#15 2016-12-18 09:47:08

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 305
Website GitHub Twitter

Re: Implementing AMP pages in Textpattern

Hi there,
implemented amp on my news site with the help of mkp_if_amp. Thanks a lot Michael!!

One small problem still exists. In tables I use textile commands to format them like this:

 
|^.
|_<. xyz|_>. 2002|_>. 2003|_>. 2004|_>. 2005|_>. 2006|_>. 2007|_>. 2008|_>. 2009|_>. 2010|
|-.
|<. xzy|>. 5,8|>. 9,3|>. 13,1|>. 5,1|>. 4,8|>. 10,6|>. 8,5|>. -19,6|>. 4,5|

This ends up in html code like that: th style="text-align:right;">2003</th>. And the AMP tester from Google complains The attribute 'style' may not appear in tag 'th'. for th and td about these style attributes.
Is there a quick solution not to render textile under these circumstances for table attributes or do I have to filter these attributes with something like etc_query to get a amp standard conform page?

Offline

#16 2017-01-12 17:05:38

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 305
Website GitHub Twitter

Re: Implementing AMP pages in Textpattern

I found a solution. Replace the <txp:body /> tag in your amp form for articles with something like that:

<txp:php>
   $text=preg_replace('/(<[^>]+) style=".*?"/i','$1',body());
   echo $text;
</txp:php>

Offline

#17 2017-02-10 17:02:32

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Implementing AMP pages in Textpattern

I’m building an AMP template for blog articles as part of the new Textpattern.com site – AMP mockup here (obviously should be viewed on mobile as intended) – thanks for the suggestions in this topic. I’ll eventually share the code I’m using via GitHub.

Offline

#18 2017-02-10 17:22:34

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 305
Website GitHub Twitter

Re: Implementing AMP pages in Textpattern

oh cool …
For embedding videos or other embedded stuff you have to make a test, because Google is complaining about unused amp-scripts.
For example for Youtube videos I use the following in head:

<txp:php>
   $text=preg_replace('/(<[^>]+) style=".*?"/i','$1',body());
   if (strpos($text, 'amp-youtube') !== false) {variable( array('name' => 'video-tag', 'value' => 'yes') );}
   variable(array ('name' => 'article', 'value' => $text));
</txp:php>
<txp:if_variable name="video-tag">
   <script async custom-element="amp-youtube" src="https://cdn.ampproject.org/v0/amp-youtube-0.1.js"></script>
</txp:if_variable>

And then <txp:php>echo $text;</txp:php> instead of <txp:body />. Of course your video plugin should be adapted to use amp-youtube as a tag, when used on a amp page.

Last edited by whocarez (2017-02-10 17:27:49)

Offline

#19 2017-02-10 18:43:52

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Implementing AMP pages in Textpattern

@whocares

Yes I can see that being tricky but your solution is interesting thanks – you’d think they would provide an easy way to conditionally load the video JS if the page actually has a video on it, since they are being so particular about code reduction.

Offline

#20 2017-02-10 19:22:32

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 305
Website GitHub Twitter

Re: Implementing AMP pages in Textpattern

I don’t know. At the moment Google webmasters warns you, there is a youtube/facebook/twitter script embedded, but the interpreter can’t find any of the related tags. But it says also, that the will treat it in the future as an error.

All amp tags/components are here:
https://www.ampproject.org/docs/reference/components

Actually I use amp-analytics, amp-ad, amp-social-share and under conditions amp-youtube with a modified the_video plugin and this trick above.

Last edited by whocarez (2017-02-10 19:22:53)

Offline

#21 2017-02-10 19:32:56

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Implementing AMP pages in Textpattern

Yeah I’m just using amp-sidebar on Textpattern.com AMP pages, although I may add analytics as well. amp-ad only seems to work with a select few advertisers as far as I’ve researched so far, but haven’t delved too far into ads just yet.

Offline

#22 2017-05-25 16:39:16

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,379
Website GitHub Mastodon

Re: Implementing AMP pages in Textpattern

One of the problems publishers face today in making their content more readable on mobile devices is that there are multiple, competing formats available for this purpose. Facebook has Instant Articles, Google is spearheading the AMP (Accelerated Mobile Pages) project, and the Apple News Format optimizes content for iOS devices. Facebook is today taking a crack at a solution to this problem by rolling out support for both AMP and soon Apple News as a part of its open source Instant Articles software development kit. – Facebook’s Instant Articles platform to support Google AMP, Apple News

Offline

#23 2017-05-26 00:52:34

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: Implementing AMP pages in Textpattern

@michaelkpate

on the flip side: Scott Gilbertson: Kill Google AMP before it KILLS the web (via gruber).


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#24 2017-05-26 03:01:06

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,071
Website Mastodon

Re: Implementing AMP pages in Textpattern

phiw13 wrote #305765:

@michaelkpate

on the flip side: Scott Gilbertson: Kill Google AMP before it KILLS the web (via gruber).

I don’t trust google.


…. texted postive

Offline

Board footer

Powered by FluxBB