Бесплатно
Загрузите дополнение из админки вашего сайта.
Как загрузить?
Как загрузить?
Простой плагин AMP для переключение и автоматическое формирование в AMP контент. Для автоматический изменения контента, была внедрена Библиотека: AMP PHP Library.
Системные настройки
googleAmpModx_cache — Кэширование для AMP контента;
[по умолчанию: Да ]
googleAmpModx_get — Имя запроса;
[по умолчанию: amp ]
googleAmpModx_template — AMP шаблон по умолчанию, если не указан id в запросе;
[по умолчанию: 0 ]
googleAmpModx_warnings — Вывести результат в Журнале ошибок.
[по умолчанию: Нет ]
Инструкция
1. Создаем шаблон AMP Страницы:
<!DOCTYPE html>
<html amp lang="ru">
<head>
<meta charset="utf-8">
<title>[[*pagetitle]]</title>
<link rel="canonical" href="/">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp-boilerplate>
body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{ visibility:hidden}to{ visibility:visible}}@-moz-keyframes -amp-start{ from{ visibility:hidden}to{ visibility:visible}}@-ms-keyframes -amp-start{from{ visibility:hidden}to{ visibility:visible}}@-o-keyframes -amp-start{ from{ visibility:hidden}to{ visibility:visible}}@keyframes -amp-start{ from{visibility:hidden}to{visibility:visible}}
</style>
<noscript><style amp-boilerplate>body{ -webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js"></script>
<script async custom-element="amp-iframe" src="https://cdn.ampproject.org/v0/amp-iframe-0.1.js"></script>
<script async custom-element="amp-youtube" src="https://cdn.ampproject.org/v0/amp-youtube-0.1.js"></script>
</head>
<body>
<amp-sidebar id="sidebar" layout="nodisplay">
<div role="button" on="tap:sidebar.close" tabindex="5" class="close">×</div>
<ul>
<li role="navigation" tabindex="1"><a href="/" title="Главная страница">Главная страница</a></li>
</ul>
</amp-sidebar>
<div id="header">
<a href="[[++site_url]]" title="[[*pagetitle:escape]]">
<amp-img src="[[++site_url]]logo.svg" alt="[[*pagetitle:escape]]" width="200" height="40" style="float:right"></amp-img>
</a>
<div role="button" on="tap:sidebar.toggle" tabindex="0" id="ham">☰</div>
</div>
<div style="margin: 10px;">
<h1>[[*pagetitle]]</h1>
[[*content]]
</div>
<div id="footer">
</div>
</body>
</html>2.Если у вас один шаблон, то к ссылке дописываем запрос ?amp, не забудьте поменять в Системных настройках — id AMP шаблона:
<link rel="amphtml" href="https://test.ru/test.html?amp">
<link rel="canonical" href="https://test.ru/test.html" />Или если у вас несколько шаблонов, то к ссылке дописываем запрос ?amp=14 (14 — id шаблон):
<link rel="amphtml" href="https://test.ru/test.html?amp=14">
<link rel="canonical" href="https://test.ru/test.html" />3. В файле robots.txt разрешаем индексацию AMP-страниц:
Allow: *?ampБиблиотека PHP — AMP PHP Library — https://github.com/Lullabot/amp-library
1.1.1-pl (12.10.2021)
- Небольшие правки;
1.1.0-pl (08.10.2021)
- Небольшие правки;
1.0.9-pl (06.06.2021)
- Исправлено отображение элемента с модификатором: tag;
- Плагин не формирует в AMP внутри HTML-тега: pre;
1.0.8-pl (30.12.2020)
- Добавлен параметр в Системные настройки;
- Добавлен modParser;
1.0.7-pl (30.12.2020)
- Небольшие правки;
1.0.6-pl (29.12.2020)
- Релиз;
- Добавлено 2 параметра в Системные настройки;
- Небольшие правки.


Последние обсуждения в сообществе MODX.pro