Skip to content

mkp-textpattern/mkp_if_amp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

mkp_if_amp

This conditional tag examines the url of the current page and determines if the url ends in ‘amp.’ This allows for a custom page to be rendered using the standards for Google’s Accelerated Mobile Pages Project.

Acknowledgements

There was an earlier version of this plugin called mkp_archives that I lost when the Textdrive hosting service went down. But I think this one is actually an improvement anyway. Also thanks to adi_gps and smd_if for some definite inspiration.

Links

mkp_if_amp

Just use <txp:mkp_url_parameters /> at the top of a page or form where you need to capture URL information. For a better explanation, you will want to visit the Demo Site.

Attributes

None

Examples

You will want some code similar to this in your individual article template header so that the amp page can be properly detected.


<txp:if_individual_article>
 <link rel="canonical" href="<txp:permlink />">
  <link rel="amphtml" href="<txp:permlink />/amp/">
</txp:if_individual_article>

You will want something similar to this in your individual article template to display the alternative formatting.


<txp:mkp_if_amp>
<txp:output_form form="layout_archives_amp" />
<txp:else />
<txp:output_form form="layout_archives_standard" />

Release History

Version x.x: March xxx, 2016

About

A Textpattern Conditional Plugin for Google's Accelerated Mobile Pages Project (AMP)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages