-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.njk
181 lines (150 loc) · 5.17 KB
/
index.njk
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
---
layout: layout.njk
permalink:
dynamic: "/"
---
<p>
Read the <a href="https://www.11ty.dev/docs/api-services/">Eleventy API Services documentation</a>.
Built with <a href="https://www.11ty.dev/docs/plugins/serverless/">Eleventy Serverless</a>.
Save a bookmarklet to the <a href="javascript: (function(t){window.location.href=`https://api-explorer.11ty.dev/?url=${encodeURIComponent(window.location.href)}`;})();">Eleventy API Explorer</a>.
</p>
<form action="/">
<label>
Url:
<input type="url" name="url" required value="{% if eleventy.serverless.query.url %}{{ eleventy.serverless.query.url | forceescape }}{% else %}https://{% endif %}">
</label>
<button type="submit">Go</button>
<a href="/?url={{ "https://www.zachleat.com/web/lighthouse-deception/" | urlencode }}">Sample demo</a>
{% if eleventy.serverless.query.url %}
<p>
Navigate to <a href="{{ eleventy.serverless.query.url | forceescape }}"><code>{{ eleventy.serverless.query.url | forceescape }}</code></a>
</p>
{% endif %}
</form>
<h2>IndieWeb Avatar <a href="https://github.com/11ty/api-indieweb-avatar"><code>11ty/api-indieweb-avatar</code></a></h2>
{% if eleventy.serverless.query.url %}
{% set html %}
<img src="https://v1.indieweb-avatar.11ty.dev/{{ eleventy.serverless.query.url | urlencode | forceescape }}/"
alt="IndieWeb avatar for {{ eleventy.serverless.query.url | forceescape }}"
width="60"
height="60"
decoding="async"
loading="lazy">
{% endset %}
<div class="demo">
{{ html | safe }}
</div>
{% highlight "html" %}
{{ html | safe }}
{% endhighlight %}
{% endif %}
<h2>OpenGraph Image <a href="https://github.com/11ty/api-opengraph-image"><code>11ty/api-opengraph-image</code></a></h2>
{% if eleventy.serverless.query.url %}
<p>This is using <code><picture></code> with multiple formats and image sizes. Make sure you set the <code>sizes</code> attribute correctly so the browser loads the correct one!</p>
{% set html %}
{% opengraphHtml eleventy.serverless.query.url %}
{% endset %}
<div class="demo">
{{ html | safe }}
</div>
{% highlight "html" %}
{{ html | safe }}
{% endhighlight %}
{% endif %}
<h2>Screenshot <a href="https://github.com/11ty/api-screenshot"><code>11ty/api-screenshot</code></a></h2>
{% if eleventy.serverless.query.url %}
<details open>
<summary>Small viewport (default)</summary>
{% set html %}
<img src="https://v1.screenshot.11ty.dev/{{ eleventy.serverless.query.url | urlencode | forceescape }}/small/"
alt="Screenshot of {{ eleventy.serverless.query.url | forceescape }}"
decoding="async"
width="375"
height="375"
decoding="async"
loading="lazy">
{% endset %}
<div class="demo">
{{ html | safe }}
</div>
{% highlight "html" %}
{{ html | safe }}
{% endhighlight %}
</details>
<details>
<summary>Medium viewport</summary>
{% set html %}
<img src="https://v1.screenshot.11ty.dev/{{ eleventy.serverless.query.url | urlencode | forceescape }}/medium/"
alt="Screenshot of {{ eleventy.serverless.query.url | forceescape }}"
width="650"
height="650"
decoding="async"
loading="lazy">
{% endset %}
<div class="demo">
{{ html | safe }}
</div>
{% highlight "html" %}
{{ html | safe }}
{% endhighlight %}
</details>
<details>
<summary>Large viewport</summary>
{% set html %}
<img src="https://v1.screenshot.11ty.dev/{{ eleventy.serverless.query.url | urlencode | forceescape }}/large/"
alt="Screenshot of {{ eleventy.serverless.query.url | forceescape }}"
width="1024"
height="1024"
decoding="async"
loading="lazy">
{% endset %}
<div class="demo">
{{ html | safe }}
</div>
{% highlight "html" %}
{{ html | safe }}
{% endhighlight %}
</details>
<details>
<summary>OpenGraph viewport</summary>
{% set html %}
<img src="https://v1.screenshot.11ty.dev/{{ eleventy.serverless.query.url | urlencode | forceescape }}/opengraph/"
alt="OpenGraph image sized Screenshot of {{ eleventy.serverless.query.url | forceescape }}"
width="1200"
height="630"
decoding="async"
loading="lazy">
{% endset %}
<div class="demo">
{{ html | safe }}
</div>
{% highlight "html" %}
{{ html | safe }}
{% endhighlight %}
</details>
{% endif %}
<form action="/">
<label>
Comma-separated numbers:
<input type="text" name="sparkline" required value="{{ eleventy.serverless.query.sparkline | forceescape }}">
</label>
<button type="submit">Go</button>
<a href="/?sparkline=41,25,9,12,10,6,12,14,19,17,23,30,36,21,25">Sample demo</a>
</form>
<h2>Sparkline <a href="https://github.com/11ty/api-sparkline"><code>11ty/api-sparkline</code></a></h2>
{% if eleventy.serverless.query.sparkline %}
{% set html %}
<img src="https://v1.sparkline.11ty.dev/120x30/{{ eleventy.serverless.query.sparkline | forceescape }}/"
alt="Sparkline with values: {{ eleventy.serverless.query.sparkline | forceescape }}"
width="120"
height="30"
decoding="async"
loading="lazy">
{% endset %}
<div class="demo">
{{ html | safe }}
</div>
{% highlight "html" %}
{{ html | safe }}
{% endhighlight %}
{% endif %}