amp-html 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/issue_template.md +16 -0
- data/.github/pull_request_template.md +21 -0
- data/.gitignore +13 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.md +302 -0
- data/CONTRIBUTING.md +1 -0
- data/DEPRECATIONS.md +9 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +162 -0
- data/INSTALL.md +1 -0
- data/LICENSE +21 -0
- data/OWNERS.yaml +1 -0
- data/README.md +192 -0
- data/Rakefile +6 -0
- data/amp-html.gemspec +29 -0
- data/bin/amp-html +4 -0
- data/lib/amp_html.rb +27 -0
- data/lib/amp_html/cli.rb +113 -0
- data/lib/amp_html/components/docs/README.md +101 -0
- data/lib/amp_html/components/docs/ad.md +83 -0
- data/lib/amp_html/components/docs/analytics.md +131 -0
- data/lib/amp_html/components/docs/anim.md +66 -0
- data/lib/amp_html/components/docs/fonts.md +63 -0
- data/lib/amp_html/components/docs/forms.md +79 -0
- data/lib/amp_html/components/docs/iframe.md +62 -0
- data/lib/amp_html/components/docs/javascript.md +71 -0
- data/lib/amp_html/components/docs/lists.md +168 -0
- data/lib/amp_html/components/docs/media.md +52 -0
- data/lib/amp_html/components/docs/mustache.md +46 -0
- data/lib/amp_html/components/docs/notifications.md +0 -0
- data/lib/amp_html/components/docs/schema.md +80 -0
- data/lib/amp_html/components/docs/service_worker.md +60 -0
- data/lib/amp_html/components/docs/social.md +130 -0
- data/lib/amp_html/components/docs/stylesheets.md +50 -0
- data/lib/amp_html/components/help.rb +19 -0
- data/lib/amp_html/components/install.rb +34 -0
- data/lib/amp_html/components/templates/ERROR.md +5 -0
- data/lib/amp_html/components/templates/README.md +12 -0
- data/lib/amp_html/configuration.rb +170 -0
- data/lib/amp_html/configuration/docs/README.md +0 -0
- data/lib/amp_html/configuration/help.rb +11 -0
- data/lib/amp_html/helpers/docs/README.md +98 -0
- data/lib/amp_html/helpers/docs/amp.md +0 -0
- data/lib/amp_html/helpers/docs/amp_ad.md +86 -0
- data/lib/amp_html/helpers/docs/amp_analytics.md +76 -0
- data/lib/amp_html/helpers/docs/amp_anim.md +68 -0
- data/lib/amp_html/helpers/docs/amp_audio.md +54 -0
- data/lib/amp_html/helpers/docs/amp_auto_ads.md +43 -0
- data/lib/amp_html/helpers/docs/amp_close_user_notification_button.md +0 -0
- data/lib/amp_html/helpers/docs/amp_css.md +37 -0
- data/lib/amp_html/helpers/docs/amp_css_link.md +0 -0
- data/lib/amp_html/helpers/docs/amp_custom_ad.md +0 -0
- data/lib/amp_html/helpers/docs/amp_document_link.md +0 -0
- data/lib/amp_html/helpers/docs/amp_embed.md +86 -0
- data/lib/amp_html/helpers/docs/amp_facebook.md +70 -0
- data/lib/amp_html/helpers/docs/amp_fallback.md +47 -0
- data/lib/amp_html/helpers/docs/amp_font.md +0 -0
- data/lib/amp_html/helpers/docs/amp_font_link.md +0 -0
- data/lib/amp_html/helpers/docs/amp_form.md +0 -0
- data/lib/amp_html/helpers/docs/amp_form_response.md +0 -0
- data/lib/amp_html/helpers/docs/amp_gfycat.md +0 -0
- data/lib/amp_html/helpers/docs/amp_global_css.md +0 -0
- data/lib/amp_html/helpers/docs/amp_google_analytics.md +0 -0
- data/lib/amp_html/helpers/docs/amp_google_font.md +0 -0
- data/lib/amp_html/helpers/docs/amp_head.md +0 -0
- data/lib/amp_html/helpers/docs/amp_html_doctype.md +0 -0
- data/lib/amp_html/helpers/docs/amp_iframe.md +0 -0
- data/lib/amp_html/helpers/docs/amp_image.md +0 -0
- data/lib/amp_html/helpers/docs/amp_input.md +0 -0
- data/lib/amp_html/helpers/docs/amp_instagram.md +0 -0
- data/lib/amp_html/helpers/docs/amp_js.md +0 -0
- data/lib/amp_html/helpers/docs/amp_link.md +0 -0
- data/lib/amp_html/helpers/docs/amp_list.md +0 -0
- data/lib/amp_html/helpers/docs/amp_live_list.md +0 -0
- data/lib/amp_html/helpers/docs/amp_live_list_items.md +0 -0
- data/lib/amp_html/helpers/docs/amp_live_list_pagination.md +0 -0
- data/lib/amp_html/helpers/docs/amp_live_list_update.md +0 -0
- data/lib/amp_html/helpers/docs/amp_mustache.md +0 -0
- data/lib/amp_html/helpers/docs/amp_pin_it.md +0 -0
- data/lib/amp_html/helpers/docs/amp_pin_widget.md +0 -0
- data/lib/amp_html/helpers/docs/amp_pinterest_follow.md +0 -0
- data/lib/amp_html/helpers/docs/amp_pixel.md +0 -0
- data/lib/amp_html/helpers/docs/amp_placeholder.md +0 -0
- data/lib/amp_html/helpers/docs/amp_reddit.md +0 -0
- data/lib/amp_html/helpers/docs/amp_resources.md +0 -0
- data/lib/amp_html/helpers/docs/amp_selector.md +0 -0
- data/lib/amp_html/helpers/docs/amp_serviceworker.md +0 -0
- data/lib/amp_html/helpers/docs/amp_social_share.md +0 -0
- data/lib/amp_html/helpers/docs/amp_soundcloud.md +0 -0
- data/lib/amp_html/helpers/docs/amp_twitter.md +0 -0
- data/lib/amp_html/helpers/docs/amp_user_notification.md +0 -0
- data/lib/amp_html/helpers/docs/amp_video.md +0 -0
- data/lib/amp_html/helpers/docs/amp_video_ad.md +0 -0
- data/lib/amp_html/helpers/docs/amp_vine.md +0 -0
- data/lib/amp_html/helpers/docs/amp_youtube.md +0 -0
- data/lib/amp_html/helpers/docs/audio_tag.md +0 -0
- data/lib/amp_html/helpers/docs/canonical_document_link.md +0 -0
- data/lib/amp_html/helpers/docs/form_tag.md +0 -0
- data/lib/amp_html/helpers/docs/image_tag.md +0 -0
- data/lib/amp_html/helpers/docs/input_tag.md +0 -0
- data/lib/amp_html/helpers/docs/javascript_include_tag.md +0 -0
- data/lib/amp_html/helpers/docs/noscript_tag.md +0 -0
- data/lib/amp_html/helpers/docs/schema_tag.md +0 -0
- data/lib/amp_html/helpers/docs/stylesheet_link_tag.md +0 -0
- data/lib/amp_html/helpers/docs/video_tag.md +0 -0
- data/lib/amp_html/helpers/help.rb +23 -0
- data/lib/amp_html/root.rb +7 -0
- data/lib/amp_html/test.rb +169 -0
- data/lib/amp_html/test/help.rb +11 -0
- data/lib/amp_html/test/templates/README.md +43 -0
- data/lib/amp_html/test/templates/css/!important.md +1 -0
- data/lib/amp_html/test/templates/css/-amp-.md +1 -0
- data/lib/amp_html/test/templates/css/-moz-binding.md +1 -0
- data/lib/amp_html/test/templates/css/@import.md +1 -0
- data/lib/amp_html/test/templates/css/behavior.md +1 -0
- data/lib/amp_html/test/templates/css/filter.md +1 -0
- data/lib/amp_html/test/templates/css/i-amp-.md +1 -0
- data/lib/amp_html/test/templates/css/overflow.md +1 -0
- data/lib/amp_html/test/templates/html/applet.md +1 -0
- data/lib/amp_html/test/templates/html/audio.md +1 -0
- data/lib/amp_html/test/templates/html/base.md +1 -0
- data/lib/amp_html/test/templates/html/embed.md +1 -0
- data/lib/amp_html/test/templates/html/frame.md +1 -0
- data/lib/amp_html/test/templates/html/frameset.md +1 -0
- data/lib/amp_html/test/templates/html/http-equiv.md +1 -0
- data/lib/amp_html/test/templates/html/iframe.md +1 -0
- data/lib/amp_html/test/templates/html/img.md +1 -0
- data/lib/amp_html/test/templates/html/javascript_include_tag.md +1 -0
- data/lib/amp_html/test/templates/html/object.md +1 -0
- data/lib/amp_html/test/templates/html/onclick.md +1 -0
- data/lib/amp_html/test/templates/html/onmousehover.md +1 -0
- data/lib/amp_html/test/templates/html/param.md +1 -0
- data/lib/amp_html/test/templates/html/stylesheet_link_tag.md +1 -0
- data/lib/amp_html/test/templates/html/video.md +1 -0
- data/lib/amp_html/test/templates/markup/!doctype.md +1 -0
- data/lib/amp_html/test/templates/markup/amp_document_link.md +1 -0
- data/lib/amp_html/test/templates/markup/amp_head.md +1 -0
- data/lib/amp_html/test/templates/markup/amp_html_doctype.md +1 -0
- data/lib/amp_html/test/templates/markup/canonical_document_link.md +1 -0
- data/lib/amp_html/test/templates/markup/head_body.md +1 -0
- data/lib/amp_html/test/templates/markup/html.md +1 -0
- data/lib/amp_html/test/templates/markup/meta_viewport.md +1 -0
- data/lib/amp_html/validate.rb +46 -0
- data/lib/amp_html/validate/help.rb +11 -0
- data/lib/amp_html/validate/templates/README.md +32 -0
- data/lib/amp_html/version.rb +13 -0
- data/lib/generators/amphtml/assets_generator.rb +31 -0
- data/lib/generators/amphtml/bundle_generator.rb +50 -0
- data/lib/generators/amphtml/components_generator.rb +84 -0
- data/lib/generators/amphtml/helpers_generator.rb +32 -0
- data/lib/generators/amphtml/install_generator.rb +53 -0
- data/lib/generators/amphtml/views_generator.rb +62 -0
- data/lib/generators/templates/assets/README.md +0 -0
- data/lib/generators/templates/assets/stylesheets/application.scss +15 -0
- data/lib/generators/templates/components/README.md +0 -0
- data/lib/generators/templates/components/assets/javascripts/application.js +15 -0
- data/lib/generators/templates/components/helpers/ad_tag_helper.rb +83 -0
- data/lib/generators/templates/components/helpers/analytics_tag_helper.rb +30 -0
- data/lib/generators/templates/components/helpers/anim_tag_helper.rb +42 -0
- data/lib/generators/templates/components/helpers/iframe_tag_helper.rb +27 -0
- data/lib/generators/templates/components/helpers/javascript_tag_helper.rb +12 -0
- data/lib/generators/templates/components/helpers/lists_tag_helper.rb +82 -0
- data/lib/generators/templates/components/helpers/notification_tag_helper.rb +16 -0
- data/lib/generators/templates/components/helpers/serviceworker_tag_helper.rb +15 -0
- data/lib/generators/templates/components/helpers/social_tag_helper.rb +228 -0
- data/lib/generators/templates/components/public/remote.html +28 -0
- data/lib/generators/templates/components/views/_components.html.erb +141 -0
- data/lib/generators/templates/components/views/_google_analytics.html.erb +23 -0
- data/lib/generators/templates/helpers/README.md +1 -0
- data/lib/generators/templates/helpers/amp/fallback_tag_helper.rb +16 -0
- data/lib/generators/templates/helpers/amp/font_tag_helper.rb +37 -0
- data/lib/generators/templates/helpers/amp/link_tag_helper.rb +11 -0
- data/lib/generators/templates/helpers/amp/mustache_tag_helper.rb +13 -0
- data/lib/generators/templates/helpers/amp/noscript_tag_helper.rb +13 -0
- data/lib/generators/templates/helpers/amp/placeholder_tag_helper.rb +16 -0
- data/lib/generators/templates/helpers/amp/schema_tag_helper.rb +16 -0
- data/lib/generators/templates/helpers/amp/stylesheets_tag_helper.rb +21 -0
- data/lib/generators/templates/helpers/amp_tag_helper.rb.erb +65 -0
- data/lib/generators/templates/helpers/asset_tag_helper.rb.erb +119 -0
- data/lib/generators/templates/helpers/form_tag_helper.rb.erb +79 -0
- data/lib/generators/templates/install/README.md +1 -0
- data/lib/generators/templates/install/amphtml.rb.erb +19 -0
- data/lib/generators/templates/install/amphtml.yml.erb +189 -0
- data/lib/generators/templates/views/README.md +1 -0
- data/lib/generators/templates/views/application.html.erb +71 -0
- data/lib/generators/templates/views/application/_head.html.erb +47 -0
- data/lib/generators/templates/views/application/_resources.html.erb +16 -0
- data/lib/generators/templates/views/application/_schema.html.erb +6 -0
- data/lib/generators/templates/views/config/mime_types.rb +8 -0
- metadata +294 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
# [Components](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs) / Advertisements BETA
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Information
|
|
6
|
+
|
|
7
|
+
The AMP-HTML Advertisement Component allows to easily embed ads with AMP, not hurting performance.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
### Quick info
|
|
12
|
+
|
|
13
|
+
#### Latest component release: 0.6.2 (Pre-release) - 2017-03-20
|
|
14
|
+
|
|
15
|
+
[**Changelog for version 0.6.2**](https://github.com/slooob/amp-html/blob/master/CHANGELOG.md#062-pre-release---2017-03-20)
|
|
16
|
+
|
|
17
|
+
#### Requirements
|
|
18
|
+
|
|
19
|
+
The Advertisement Component does not depend on any other components.
|
|
20
|
+
|
|
21
|
+
#### Dependents
|
|
22
|
+
|
|
23
|
+
No other components depend on the Advertisement Component.
|
|
24
|
+
|
|
25
|
+
#### [DeepIntegration](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs#deepintegration-components): Enabled
|
|
26
|
+
|
|
27
|
+
#### [Availability](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs#availability-of-components): Installable
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Run in the command line:
|
|
34
|
+
|
|
35
|
+
amp-html install ad
|
|
36
|
+
|
|
37
|
+
Now you are ready to use the Advertisement Component.
|
|
38
|
+
|
|
39
|
+
To learn more about this component, without opening the documentation, run:
|
|
40
|
+
|
|
41
|
+
amp-html component ad
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## Configuration
|
|
45
|
+
|
|
46
|
+
The Advertisement Component allows you to specify a default advertisement network for your app.
|
|
47
|
+
|
|
48
|
+
In your AMP-HTML configuration (`config/amp-html.yml`) search for the section of the Advertisement Component.
|
|
49
|
+
|
|
50
|
+
There you can set your default network like so:
|
|
51
|
+
|
|
52
|
+
default_network: mywidget
|
|
53
|
+
|
|
54
|
+
You can always override this network default by passing a different network to your advertisement integration in your view.
|
|
55
|
+
|
|
56
|
+
A list of all by AMP supported advertisement networks: https://www.ampproject.org/docs/reference/components/ads/amp-ad#supported-ad-networks
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
In your views you can add an advertisement as follows:
|
|
62
|
+
|
|
63
|
+
<%= amp_ad(network) %>
|
|
64
|
+
<%= amp_ad("mywidget", width: 300, height: 250, data: { aax_size: "300x250", aax_pubname: "test123", aax_src: "302" }) %>
|
|
65
|
+
|
|
66
|
+
Learn more about the `amp_ad` helper in the dedicated reference linked below.
|
|
67
|
+
|
|
68
|
+
### Auto Ads
|
|
69
|
+
|
|
70
|
+
To dynamically inject ads via a remotely-served configuration file use:
|
|
71
|
+
|
|
72
|
+
<%= amp_auto_ads(type) %>
|
|
73
|
+
<%= amp_auto_ads("adsense", data: { ad: { client: "ca-pub-5439573510495356" } }) %>
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Helpers
|
|
77
|
+
|
|
78
|
+
The following helpers are usable with the Advertisement Component of AMP-HTML
|
|
79
|
+
|
|
80
|
+
* [`amp_ad`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_ad.md)
|
|
81
|
+
* [`amp_embed`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_embed.md)
|
|
82
|
+
* [`amp_auto_ads`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_auto_ads.md)
|
|
83
|
+
* [`amp_custom_ad`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_custom_ad.md)
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
|
|
2
|
+
# [Components](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs) / Analytics BETA
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Information
|
|
6
|
+
|
|
7
|
+
The AMP-HTML Analytics Component allows to integrate with venders to measure activity on AMP documents.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
### Quick info
|
|
12
|
+
|
|
13
|
+
#### Latest component release: 0.6.2 (Pre-release) - 2017-03-20
|
|
14
|
+
|
|
15
|
+
[**Changelog for version 0.6.2**](https://github.com/slooob/amp-html/blob/master/CHANGELOG.md#062-pre-release---2017-03-20)
|
|
16
|
+
|
|
17
|
+
#### Requirements
|
|
18
|
+
|
|
19
|
+
The Analytics Component does not depend on any other components.
|
|
20
|
+
|
|
21
|
+
#### Dependents
|
|
22
|
+
|
|
23
|
+
The [AMP-HTML Notifications Component](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs/notifications.md) depends on the Analytics Component.
|
|
24
|
+
|
|
25
|
+
#### [DeepIntegration](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs#deepintegration-components): Enabled
|
|
26
|
+
|
|
27
|
+
#### [Availability](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs#availability-of-components): Installable
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Run in the command line:
|
|
34
|
+
|
|
35
|
+
amp-html install analytics
|
|
36
|
+
|
|
37
|
+
Now you are ready to use the Analytics Component.
|
|
38
|
+
|
|
39
|
+
To learn more about this component, without opening the documentation, run:
|
|
40
|
+
|
|
41
|
+
amp-html component analytics
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## Configuration
|
|
45
|
+
|
|
46
|
+
The Analytics Component allows you to specify a default analytics vendor for your app.
|
|
47
|
+
|
|
48
|
+
In your AMP-HTML configuration (`config/amp-html.yml`) search for the section of the Analytics Component.
|
|
49
|
+
|
|
50
|
+
There you can set your default network like so:
|
|
51
|
+
|
|
52
|
+
default_vendor: parsely
|
|
53
|
+
|
|
54
|
+
You can always override this vendor default by passing a different vendor to your analytics integration in your view.
|
|
55
|
+
|
|
56
|
+
A list of all by AMP supported analytics vendors: https://www.ampproject.org/docs/reference/components/ads/amp-analytics#analytics-vendors
|
|
57
|
+
|
|
58
|
+
### Google Analytics
|
|
59
|
+
|
|
60
|
+
With DeepIntegration you can also easily setup your **Google Analytics** account.
|
|
61
|
+
|
|
62
|
+
Therefore configure your Google Analytics id in your AMP-HTML configuration:
|
|
63
|
+
|
|
64
|
+
google_analytics:
|
|
65
|
+
account: UA-*****-*
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
## Usage
|
|
69
|
+
|
|
70
|
+
In your views you can setup analytics as follows:
|
|
71
|
+
|
|
72
|
+
<%= amp_analytics(vendor) %>
|
|
73
|
+
<%= amp_analytics do %>
|
|
74
|
+
<script type="application/json">
|
|
75
|
+
{
|
|
76
|
+
"requests": {
|
|
77
|
+
"pageview": "https://example.com/analytics?url=${canonicalUrl}&title=${title}&acct=${account}",
|
|
78
|
+
"event": "https://example.com/analytics?eid=${eventId}&elab=${eventLabel}&acct=${account}"
|
|
79
|
+
},
|
|
80
|
+
"vars": {
|
|
81
|
+
"account": "ABC123"
|
|
82
|
+
},
|
|
83
|
+
"triggers": {
|
|
84
|
+
"trackPageview": {
|
|
85
|
+
"on": "visible",
|
|
86
|
+
"request": "pageview"
|
|
87
|
+
},
|
|
88
|
+
"trackAnchorClicks": {
|
|
89
|
+
"on": "click",
|
|
90
|
+
"selector": "a",
|
|
91
|
+
"request": "event",
|
|
92
|
+
"vars": {
|
|
93
|
+
"eventId": "42",
|
|
94
|
+
"eventLabel": "clicked on a link"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
</script>
|
|
100
|
+
<% end %>
|
|
101
|
+
|
|
102
|
+
To learn how to setup analytics for a specific vendor, reference the AMP documentation: https://www.ampproject.org/docs/reference/components/ads/amp-analytics#analytics-vendors
|
|
103
|
+
|
|
104
|
+
Learn more about the `amp_analytics` helper in the dedicated reference linked below.
|
|
105
|
+
|
|
106
|
+
### Google Analytics
|
|
107
|
+
|
|
108
|
+
To setup Google Analytics, you need to first set your account in the AMP-HTML configuration. Then add to your view:
|
|
109
|
+
|
|
110
|
+
<%= amp_google_analytics %>
|
|
111
|
+
|
|
112
|
+
By default the component just listens for pageviews. You can also set complex triggers:
|
|
113
|
+
|
|
114
|
+
<%= amp_google_analytics(triggers: { "trackPageviewWithCustomUrl": { on: "visible", request: "pageview", vars: { title: "My page", document_location: "https://www.examplepetstore.com/pets.html" } } }) %>
|
|
115
|
+
|
|
116
|
+
Learn more about creating triggers for Google Analytics: https://developers.google.com/analytics/devguides/collection/amp-analytics/
|
|
117
|
+
|
|
118
|
+
### AMP Pixel
|
|
119
|
+
|
|
120
|
+
You can use the `amp_pixel` helper to track user behavior on your site:
|
|
121
|
+
|
|
122
|
+
<%= amp_pixel("https://foo.com/pixel?RANDOM") %>
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
### Helpers
|
|
126
|
+
|
|
127
|
+
The following helpers are usable with the Analytics Component of AMP-HTML
|
|
128
|
+
|
|
129
|
+
* [`amp_analytics`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_analytics.md)
|
|
130
|
+
* [`amp_google_analytics`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_google_analytics.md)
|
|
131
|
+
* [`amp_pixel`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_pixel.md)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
|
|
2
|
+
# [Components](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs) / Animated Images BETA
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Information
|
|
6
|
+
|
|
7
|
+
The AMP-HTML Animated Images Component allows to use runtime-managed animated images, typically GIF's, in AMP documents.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
### Quick info
|
|
12
|
+
|
|
13
|
+
#### Latest component release: 0.6.1 (Pre-release) - 2017-03-19
|
|
14
|
+
|
|
15
|
+
[**Changelog for version 0.6.1**](https://github.com/slooob/amp-html/blob/master/CHANGELOG.md#061-pre-release---2017-03-19)
|
|
16
|
+
|
|
17
|
+
#### Requirements
|
|
18
|
+
|
|
19
|
+
The Animated Images Component does not depend on any other components.
|
|
20
|
+
|
|
21
|
+
#### Dependents
|
|
22
|
+
|
|
23
|
+
No other components depend on the Animated Images Component.
|
|
24
|
+
|
|
25
|
+
#### [DeepIntegration](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs#deepintegration-components): Disabled
|
|
26
|
+
|
|
27
|
+
#### [Availability](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs#availability-of-components): Installable
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Run in the command line:
|
|
34
|
+
|
|
35
|
+
amp-html install anim
|
|
36
|
+
|
|
37
|
+
Now you are ready to use the Animated Images Component.
|
|
38
|
+
|
|
39
|
+
To learn more about this component, without opening the documentation, run:
|
|
40
|
+
|
|
41
|
+
amp-html component anim
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
In your views you can implement an animated image as follows:
|
|
47
|
+
|
|
48
|
+
<%= amp_anim(source) %>
|
|
49
|
+
<%= amp_anim("my-gif.gif", width: 400, height: 300, placeholder: "my-gif-screencap.jpg") %>
|
|
50
|
+
|
|
51
|
+
It also takes a block. For example, you could use the built-in `amp_placeholder` helper to achieve the same:
|
|
52
|
+
|
|
53
|
+
<%= amp_anim("my-gif.gif", width: 400, height: 300) do %>
|
|
54
|
+
<%= amp_placeholder("amp-anim", width: 400, height: 300, src: "my-gif-screencap.jpg") %>
|
|
55
|
+
<% end %>
|
|
56
|
+
|
|
57
|
+
Learn more about the `amp_anim` helper in the dedicated reference linked below.
|
|
58
|
+
|
|
59
|
+
**References:** [`amp_placeholder`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_placeholder.md)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Helpers
|
|
63
|
+
|
|
64
|
+
The following helpers are usable with the Animated Images Component of AMP-HTML
|
|
65
|
+
|
|
66
|
+
* [`amp_anim`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_anim.md)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
|
|
2
|
+
# [Components](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs) / Fonts BETA
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Information
|
|
6
|
+
|
|
7
|
+
The AMP-HTML Fonts Component allows to include stylesheets for custom fonts without using `@font-face`.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
### Quick info
|
|
12
|
+
|
|
13
|
+
#### Latest component release: 0.6.1 (Pre-release) - 2017-03-19
|
|
14
|
+
|
|
15
|
+
[**Changelog for version 0.6.1**](https://github.com/slooob/amp-html/blob/master/CHANGELOG.md#061-pre-release---2017-03-19)
|
|
16
|
+
|
|
17
|
+
#### Requirements
|
|
18
|
+
|
|
19
|
+
The Fonts Component does not depend on any other components.
|
|
20
|
+
|
|
21
|
+
#### Dependents
|
|
22
|
+
|
|
23
|
+
No other components depend on the Fonts Component.
|
|
24
|
+
|
|
25
|
+
#### [DeepIntegration](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs#deepintegration-components): Disabled
|
|
26
|
+
|
|
27
|
+
#### [Availability](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs#availability-of-components): Build-in
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
In your views you include a custom font as follows:
|
|
34
|
+
|
|
35
|
+
<%= amp_font_link(href) %>
|
|
36
|
+
<%= amp_font_link("https://fonts.googleapis.com/css?family=Roboto") %>
|
|
37
|
+
|
|
38
|
+
**Note:** Font providers need to be whitelisted. All whitelisted font providers: https://github.com/ampproject/amp-html/blob/master/spec/amp-html-format.md#custom-fonts
|
|
39
|
+
|
|
40
|
+
Learn more about the `amp_font_link` helper in the dedicated reference linked below.
|
|
41
|
+
|
|
42
|
+
### Google Fonts
|
|
43
|
+
|
|
44
|
+
AMP-HTML offers an easy-to-use integration of Google Fonts.
|
|
45
|
+
|
|
46
|
+
You can include any font of https://fonts.google.com as follows:
|
|
47
|
+
|
|
48
|
+
<%= amp_google_font(family) %>
|
|
49
|
+
<%= amp_google_font("Roboto") %>
|
|
50
|
+
|
|
51
|
+
This will only serve the default width and style. You can be more specific:
|
|
52
|
+
|
|
53
|
+
<%= amp_google_font("Roboto", [100i,400,900]) %>
|
|
54
|
+
|
|
55
|
+
Learn more about the `amp_google_font` helper in the dedicated reference linked below.
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Helpers
|
|
59
|
+
|
|
60
|
+
The following helpers are usable with the Fonts Component of AMP-HTML
|
|
61
|
+
|
|
62
|
+
* [`amp_font_link`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_font_link.md)
|
|
63
|
+
* [`amp_google_font`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_google_font.md)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
|
|
2
|
+
# [Components](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs) / Forms BETA
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Information
|
|
6
|
+
|
|
7
|
+
The AMP-HTML Forms Component allows the use of forms and input tags in AMP documents.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
### Quick info
|
|
12
|
+
|
|
13
|
+
#### Latest component release: 0.7.1 (Pre-release) - 2017-03-21
|
|
14
|
+
|
|
15
|
+
[**Changelog for version 0.7.1**](https://github.com/slooob/amp-html/blob/master/CHANGELOG.md#071-pre-release---2017-03-21)
|
|
16
|
+
|
|
17
|
+
#### Requirements
|
|
18
|
+
|
|
19
|
+
The Forms Component depends on the [AMP-HTML Mustache.js Component](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs/mustache.md).
|
|
20
|
+
|
|
21
|
+
#### Dependents
|
|
22
|
+
|
|
23
|
+
No other components depend on the Forms Component.
|
|
24
|
+
|
|
25
|
+
#### [DeepIntegration](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs#deepintegration-components): Enabled
|
|
26
|
+
|
|
27
|
+
#### [Availability](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs#availability-of-components): Build-in
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Configuration
|
|
32
|
+
|
|
33
|
+
The Forms Component allows you to specify a whether you want to use [`amp_selector`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_selector.md) or not.
|
|
34
|
+
|
|
35
|
+
In your AMP-HTML configuration (`config/amp-html.yml`) search for the section of the Forms Component.
|
|
36
|
+
|
|
37
|
+
There you can enable the helper like so:
|
|
38
|
+
|
|
39
|
+
amp_selector: true
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
**Important note:** In AMP documents you can neither use the default `font_tag` helper, nor a helper provided by `simple_form` or similar.
|
|
46
|
+
|
|
47
|
+
You can create forms in your views as follows:
|
|
48
|
+
|
|
49
|
+
<%= amp_form("https://example.com/subscribe", "post", id: "myform") do %>
|
|
50
|
+
<fieldset>
|
|
51
|
+
<label>
|
|
52
|
+
<span>Your name</span>
|
|
53
|
+
<%= amp_input("text", "type your name", "name", "myform.submit") %>
|
|
54
|
+
</label>
|
|
55
|
+
<label>
|
|
56
|
+
<span>Your email</span>
|
|
57
|
+
<%= amp_input("email", "type your email", "email", "myform.submit") %>
|
|
58
|
+
</label>
|
|
59
|
+
<%= amp_input("submit", value: "Subscribe") %>
|
|
60
|
+
</fieldset>
|
|
61
|
+
<%= amp_form_response("error") %>Subscription failed!<% end %>
|
|
62
|
+
<%= amp_form_response %>Subscription successful!<% end %>
|
|
63
|
+
<% end %>
|
|
64
|
+
|
|
65
|
+
**Note:** `POST` forms are submitted via AJAX by default. To submit `GET` forms via AJAX pass `ajax: true` to `amp_form` as parameter.
|
|
66
|
+
|
|
67
|
+
For a detailed reference on the `amp_form`, `amp_input` and `amp_form_response` helpers, follow the links below.
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Helpers
|
|
71
|
+
|
|
72
|
+
The following helpers are usable with the Forms Component of AMP-HTML
|
|
73
|
+
|
|
74
|
+
* [`amp_form`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_form.md)
|
|
75
|
+
* [`amp_input`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_input.md)
|
|
76
|
+
* [`amp_selector`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_selector.md)
|
|
77
|
+
* [`amp_form_response`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_form_response.md)
|
|
78
|
+
* [`form_tag`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/form_tag.md)
|
|
79
|
+
* [`input_tag`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/input_tag.md)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
# [Components](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs) / Iframe BETA
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Information
|
|
6
|
+
|
|
7
|
+
The AMP-HTML Iframe Component allows to use iframes similar to the HTML `<iframe>` tag in AMP documents.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
### Quick info
|
|
12
|
+
|
|
13
|
+
#### Latest component release: 0.4.1 (Pre-release) - 2017-03-16
|
|
14
|
+
|
|
15
|
+
[**Changelog for version 0.4.1**](https://github.com/slooob/amp-html/blob/master/CHANGELOG.md#041-pre-release---2017-03-16)
|
|
16
|
+
|
|
17
|
+
#### Requirements
|
|
18
|
+
|
|
19
|
+
The Iframe Component does not depend on any other components.
|
|
20
|
+
|
|
21
|
+
#### Dependents
|
|
22
|
+
|
|
23
|
+
The [AMP-HTML Javascript Component](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs/javascript.md) depends on the Iframe Component.
|
|
24
|
+
|
|
25
|
+
The [AMP-HTML Service Worker Component](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs/service_worker.md) depends on the Iframe Component.
|
|
26
|
+
|
|
27
|
+
#### [DeepIntegration](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs#deepintegration-components): Disabled
|
|
28
|
+
|
|
29
|
+
#### [Availability](https://github.com/slooob/amp-html/tree/master/lib/amp-html/components/docs#availability-of-components): Installable
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
Run in the command line:
|
|
36
|
+
|
|
37
|
+
amp-html install iframe
|
|
38
|
+
|
|
39
|
+
Now you are ready to use the Iframe Component.
|
|
40
|
+
|
|
41
|
+
To learn more about this component, without opening the documentation, run:
|
|
42
|
+
|
|
43
|
+
amp-html component iframe
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
In your views you can create an iframe as follows:
|
|
49
|
+
|
|
50
|
+
<%= amp_iframe(source) %>
|
|
51
|
+
<%= amp_iframe("https://railsamp.com", width: 300, height: 300, sandbox: "allow-scripts allow-same-origin") %>
|
|
52
|
+
|
|
53
|
+
**Note:** `amp_iframe` must only request resources via HTTPS or from a data-URI or via the `srcdoc` attribute.
|
|
54
|
+
|
|
55
|
+
Learn more about the `amp_iframe` helper in the dedicated reference linked below.
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Helpers
|
|
59
|
+
|
|
60
|
+
The following helpers are usable with the Iframe Component of AMP-HTML
|
|
61
|
+
|
|
62
|
+
* [`amp_iframe`](https://github.com/slooob/amp-html/blob/master/lib/amp-html/helpers/docs/amp_iframe.md)
|