-
Notifications
You must be signed in to change notification settings - Fork 191
/
Copy patharticle.html
291 lines (278 loc) · 11.6 KB
/
article.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<!doctype html>
<html ⚡>
<head>
<meta charset="utf-8">
<title>AMP Times</title>
<link rel="canonical" href="<% id %>" >
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<!--
Configures the AMP Access endpoints. These must be provided by the publisher.
When configuring the URLs for various endpoints, these substitution
variables are available:
* READER_ID: The AMP Reader ID.
* AMPDOC_URL: The URL of this AMP Document.
* CANONICAL_URL: The canonical URL of this AMP Document.
* DOCUMENT_REFERRER: The Referrer URL.
* VIEWER: The origin of the AMP Viewer.
* RANDOM: A random number. Helpful to avoid browser cache.
-->
<script id="amp-access" type="application/json">
<%#serverMode%>
{
"type": "server",
"jwt": true,
"publicKeyUrl": "<% host %>/public.pem",
"authorization": "<% host %>/amp-access/api/amp-authorization.json?type=server&rid=READER_ID&url=CANONICAL_URL&ref=DOCUMENT_REFERRER&_=RANDOM",
"pingback": "<% host %>/amp-access/api/amp-pingback?rid=READER_ID&ref=DOCUMENT_REFERRER&url=CANONICAL_URL",
"login": "<% host %>/amp-access/login/?rid=READER_ID&url=CANONICAL_URL",
"authorizationFallbackResponse": {
"error": true,
"access": false
}
}
<%/serverMode%>
<%^serverMode%>
{
"type": "client",
"authorization": "<% host %>/amp-access/api/amp-authorization.json?type=client&rid=READER_ID&url=CANONICAL_URL&ref=DOCUMENT_REFERRER&_=RANDOM",
"pingback": "<% host %>/amp-access/api/amp-pingback?rid=READER_ID&ref=DOCUMENT_REFERRER&url=CANONICAL_URL",
"login": "<% host %>/amp-access/login/?rid=READER_ID&url=CANONICAL_URL",
"authorizationFallbackResponse": {
"error": true,
"access": false
}
}
<%/serverMode%>
</script>
<%> styles %>
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<script async custom-element="amp-access" src="https://cdn.ampproject.org/v0/amp-access-0.1.js"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.1.js"></script>
<style>body {opacity: 0}</style><noscript><style>body {opacity: 1}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css">
</head>
<body>
<amp-analytics type="googleanalytics" id="analytics">
<script type="application/json">
{
"vars": {
"account": "UA-72665224-1"
},
"requests": {
"host": "<% host %>"
},
"triggers": {
"default pageview": {
"on": "visible",
"request": "pageview",
"vars": {
"title": "AMP Access Demo Pageview"
}
},
"accessAuthorizationReceived": {
"on": "access-authorization-received",
"request": "event",
"vars": {
"eventCategory": "amp-access",
"eventAction": "auth-received",
"eventLabel" : "access",
"eventValue" : "AUTHDATA(access)"
}
},
"accessAuthorizationFailed": {
"on": "access-authorization-failed",
"request": "event",
"vars": {
"eventCategory": "amp-access",
"eventAction": "auth-failed"
}
},
"accessViewed": {
"on": "access-viewed",
"request": "event",
"vars": {
"eventCategory": "amp-access",
"eventAction": "article-viewed"
}
},
"accessPingbackSent": {
"on": "access-pingback-sent",
"request": "event",
"vars": {
"eventCategory": "amp-access",
"eventAction": "pingback-sent"
}
},
"accessPingbackFailed": {
"on": "access-pingback-failed",
"request": "event",
"vars": {
"eventCategory": "amp-access",
"eventAction": "pingback-failed"
}
},
"accessLoginStarted": {
"on": "access-login-started",
"request": "event",
"vars": {
"eventCategory": "amp-access",
"eventAction": "login-started"
}
},
"accessLoginSuccess": {
"on": "access-login-success",
"request": "event",
"vars": {
"eventCategory": "amp-access",
"eventAction": "login-success"
}
},
"accessLoginRejected": {
"on": "access-login-rejected",
"request": "event",
"vars": {
"eventCategory": "amp-access",
"eventAction": "login-rejected"
}
},
"accessLoginFailed": {
"on": "access-login-failed",
"request": "event",
"vars": {
"eventCategory": "amp-access",
"eventAction": "login-failed"
}
}
}
}
</script>
</amp-analytics>
<div class="main-body">
<header>
<div class="brand-logo" data-z-depth="2"><a href="/">⚡ AMP Times</a>
<span amp-access="subscriber" amp-access-hide>
<a href="<% host %>/amp-access/login/logout" class="logout">Logout</a>
</span>
<span amp-access="NOT subscriber" amp-access-hide role="button" tabindex="0">
<a on="tap:amp-access.login" class="logout">Login</a>
</span>
</div>
<div class="navigation" data-z-depth="2">
<%#prev%>
<div class="prev">
<a href="<% prev %>">Previous</a>
</div>
<%/prev%>
<%#next%>
<div class="next">
<a href="<% next %>">Next</a>
</div>
<%/next%>
</div>
</header>
<main role="main">
<article>
<section id="meter-notif" amp-access="access OR error" class="meter-section" data-z-depth="2" amp-access-hide>
<!--
This section is only visible by subscribers. The subscriber variable is
defined in the authentification response data.
-->
<div amp-access="access AND subscriber" amp-access-hide>
Thanks for being a subscriber. You rock!
</div>
<div amp-access="access AND views" amp-access-hide>
<template amp-access-template type="amp-mustache">
You are viewing article {{views}} of {{maxViews}} free articles this month!
</template>
</div>
<div amp-access="access AND return" amp-access-hide>
Welcome back! You've read this article already.
</div>
<div amp-access="access AND fcs" amp-access-hide>
Yay! The first click is free.
</div>
<div amp-access="error" amp-access-hide>
Ooops, something went wrong on the authorization endpoint!
</div>
<a on="tap:meter-notif.hide" role="button" tabindex="1">Dismiss</a>
</section>
<!--
This section is visible to all users.
-->
<section>
<h3><% title %></h3>
<amp-img
src="/img/[email protected]"
srcset="/img/[email protected] 1x, /img/[email protected] 2x"
role="button"
tabindex="0"
layout="responsive" width="360" placeholder
alt="Curabitur convallis, urna quis pulvinar feugiat, purus diam posuere turpis, sit amet tincidunt purus justo et mi."
height="216" on="tap:headline-img-lightbox"
role="button" tabindex="2">
</amp-img>
<p>
This text is part of the article preview and visible to all users.
This text is part of the article preview and visible to all users.
This text is part of the article preview and visible to all users.
This text is part of the article preview and visible to all users.
This text is part of the article preview and visible to all users.
This text is part of the article preview and visible to all users.
</p>
</section>
<!--
This section will only be shown to users who do not have access to the article and
have reached the maximum number of articles for that month.
-->
<section amp-access="NOT access AND maxViews" amp-access-hide>
<div class="meter-section" data-z-depth="2">
<template amp-access-template type="amp-mustache">
You have reached your {{maxViews}} free articles this month!
</template>
</div>
<div on="tap:amp-access.login" class="button raised center" data-z-depth="2" role="button" tabindex="3">
<div class="center"><a class="center" >Login to read more!</a>
</div>
</div>
</section>
<!--
This section will be shown to users who have access to the article.
Either because it follows First Click Free rules, the user is a subscriber
or has not yet reached the maximum number of free articles.
-->
<div amp-access="access" >
<figure>
<amp-img class="full-bleed" placeholder
src="img/[email protected]"
srcset="/img/[email protected] 1x, /img/[email protected] 2x"
layout="responsive" width="360"
alt="Fusce pretium tempor justo, vitae consequat dolor maximus eget."
height="216">
</amp-img>
</figure>
<p>
This text is part of the article that is only visible to users with access to the entire page contents.
This text is part of the article that is only visible to users with access to the entire page contents.
This text is part of the article that is only visible to users with access to the entire page contents.
This text is part of the article that is only visible to users with access to the entire page contents.
This text is part of the article that is only visible to users with access to the entire page contents.
This text is part of the article that is only visible to users with access to the entire page contents.
This text is part of the article that is only visible to users with access to the entire page contents.
This text is part of the article that is only visible to users with access to the entire page contents.
</p>
</div>
</article>
</main>
<footer>
<section amp-access="TRUE" class="reset-section">
<template amp-access-template type="amp-mustache">
<div role="button" tabindex="2">
<a href="/reset?rid={{readerId}}">Reset Access State</a>
</div>
</template>
</section>
</footer>
</div>
</body>
</html>