Download the PHP package cara-tm/pat_if_amp without Composer
On this page you can find all versions of the php package cara-tm/pat_if_amp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cara-tm/pat_if_amp
More information about cara-tm/pat_if_amp
Files in cara-tm/pat_if_amp
Package pat_if_amp
Short Description Google AMP for Textpattern CMS.
License GPL-2.0
Homepage https://github.com/cara-tm/pat_if_amp
Informations about the package pat_if_amp
h1. pat_if_amp
"Download":https://github.com/cara-tm/pat_if_amp/releases | "Packagist":https://packagist.org/packages/cara-tm/pat_if_amp
AMP pages for "Textpattern CMS":http://textpattern.io/.
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 (AMP) project.
h2. Links
- "GitHub Code Repository":https://github.com/cara-tm/pat_if_amp
- "Download":https://github.com/cara-tm/mkp_if_amp/blob/master/pat_if_amp_v3.5_zip.txt
- "Demo Site for initial plugin":http://ampdemo.cmsstyles.com/
Don't forget to check out my other plugin that's also Google AMP compatible: "pat_article_social":https://github.com/cara-tm/pat_article_social
h2. Note
Since TXP 4.7+ and its new features, you can choose to use build-in tags solution instead of this plugin. Read more about from "this forum post by Oleg":https://forum.textpattern.com/viewtopic.php?pid=320549#p320549 (don't forget to add a TXP variable on the fly for further usages within you website):
bc..
regular page
</txp:evaluate>
h2. Installing
Using "Composer":https://getcomposer.org:
bc. $ composer require cara-tm/pat_if_amp:*
Or download the latest version of the plugin from "the GitHub project page":https://github.com/cara-tm/pat_if_amp/releases, paste the code into the Textpattern Plugins administration panel, install and enable the plugin.
h2. pat_if_amp
h3. Attributes
- @url@ string (optional): The location (URL) of the website. Default: @hu@ (website URL as set in the Textpattern preferences panel).
- @subdomain@ string (optional): Sets the subdomain name of where to redirect to. Default: @amp@.
- @permlink@ boolean (optional): if set to @0@ (false) the redirection for the same article's URL mode within the subdomain will be not made. Default: @1@ (true).
h3. Example
Place code similar to below within your individual article template header, so that the AMP page can be properly detected:
bc.
<link rel="amphtml" href="<txp:permlink />/amp/">
</txp:if_individual_article>
Place something similar to below within your individual article template to display the alternative formatting:
bc.
<txp:output_form form="standard_page" />
</txp:mkp_if_amp>
h2. Textpattern variable usage
A @
h3. Usage
bc.
Normal context
</txp:if_variable>
h3. Example
bc.
...Do some normal (non-AMP) things...
</txp:if_variable>
This example concerns categories, use kind of the same model for @pages@ and/or @archives@.
h2. pat_amp_sanitize
A tag to render article text content without any inline styles. To use as a drop-in replacement of the standard Textpattern @
h3. Attributes
- @content@ string (optional): choose either @body@ or @excerpt@ article content to sanitize. Default: @body@.
h3. Usage
In an article Form context:
bc.
h2. pat_amp_redirect
A simple tag for web redirection to a subdomain name. Same behaviour as used in The Guardian website. Must be used with a mobiles detection script (i.e. adi_mobile plugin). Some web designers could choose to use a subdomain for their mobiles websites (may be not recommended, but the official AMP Blog is located in a subdomain, see: "https://amphtml.wordpress.com":https://amphtml.wordpress.com). In this case, the Textpattern multi-sites capacities makes things easier.
Note: Doesn't work on local server installations, only on live servers.
h3. Usage
bc.
Good advice: Copy the @config.php@ file of the main site into the subdomain configuration folder in order to share the same database. So, all articles written by the Copy Editors will be sent automatically to the 'AMP powered website' from only one Textpattern administration interface attached to the 'normal' website. But designers have a separate and cleaner space to build their AMP pages.
h3. Attributes
- @url@ string (optional): The location (URL) of the website. Default: @hu@ (website URL as set in the Textpattern preferences panel).
- @subdomain@ string (optional): Sets the subdomain name of where to redirect to. Default: @amp@.
- @permlink@ boolean (optional): Choose to redirect the same individual article's title URL within the subdomain. Default: @0@ (false).
h3. Example
bc.
In this case, if your main domain is @example.com@, it redirects to the @amp.example.com@ subdomain and uses the same individual article's URL from the main domain.
h3. Acknowledgments
Many thanks to "Phil Wareham":http://www.designhive.com/contact/phil-wareham who tidied up this plugin code and its help file. Thank you to "Michael K. Pate":https://github.com/michaelkpate, for its original idea, who accepted to distribute my entire rewriting code as a 'pat' prefixed plugin.
!https://raw.githubusercontent.com/cara-tm/pat_if_amp/master/amp-project-textpattern-cms-mention.png!