forked from zachleat/speedlify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.njk
163 lines (159 loc) Β· 8.94 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
---
maxResults: 14
layout: layout.njk
pagination:
data: "sites"
size: 1
alias: vertical
permalink: "/{{ vertical }}/"
---
<table class="leaderboard">
<thead data-sr-only>
<tr>
<th>Rank</th>
<th>Trophy</th>
<th>URL</th>
<th class="leaderboard-hide-sm" colspan="2">Lighthouse</th>
</tr>
</thead>
<tbody>
{%- for site in results | filterToUrls(sites[vertical].urls) | sort([':lastkey', 'ranks', 'hundos']) | reverse %}
{%- set key = site | getObjectKey(":newest") %}
{%- set hundos = site[key] | hundoCount %}
<tr>
<td class="leaderboard-data-right">#{{ loop.index }}</td>
<td>{% if loop.index0 === 0 %}π{% elseif loop.index0 === 1 %}π₯{% elseif loop.index0 === 2 %}π₯{% endif %}</td>
<td><a href="#{{ site[key].url | shortHash }}"><code class="url">{{ site[key].url | displayUrl }}</code></a></td>
<td class="leaderboard-hide-sm leaderboard-data-right"><span class="count"><span class="leaderboard-hide-md">Lighthouse: </span>{{ site[key] | lighthouseTotal }}</span></td>
<td class="leaderboard-hide-sm"><span class="count">{{ "π―" | repeat(hundos) }}{% if hundos === 4 %}<span class="leaderboard-hide-md"><br>FOUR HUNDOS π</span>{% endif %}</span></td>
</tr>
{%- endfor %}
</tbody>
</table>
{%- for site in results | filterToUrls(sites[vertical].urls) | sort([':lastkey', 'ranks', 'hundos']) | reverse %}
{%- set key = site | getObjectKey %}
<details open>
<summary id="{{ site[key].url | shortHash }}"><code class="url">{{ site[key].url | displayUrl }}</code> <a href="{{ site[key].url }}" class="external">Go β</a></summary>
<div class="layout color--lighthouse">
<div class="tablewrap">
<table data-make-chart class="results">
<thead>
<tr>
<th rowspan="2" class="results-date">Date</th>
<th rowspan="2" colspan="2">Rank</th>
<th colspan="9">Lighthouse</th>
<th colspan="2">Axe</th>
</tr>
<tr>
<th class="results-series-a" colspan="3"><abbr title="Performance">Perf</abbr></th>
<th class="results-series-b" colspan="2"><abbr title="Accessibility">A11Y</abbr></th>
<th class="results-series-c" colspan="2">Best Practices</th>
<th class="results-series-d" colspan="2">SEO</th>
<th colspan="2">Violations</th>
</tr>
</thead>
<tbody>
{%- for entry in site | sort | headAndLast(maxResults) %}
<tr>
<td><code class="date">{{ entry.timestamp | displayDate }}</code></td>
<td class="results-bool">{% if entry.ranks.hundos %}{% if entry.ranks.hundos === 1 %}π{% endif %}{% endif %}</td>
<td>{% if entry.ranks.hundos %}#{{ entry.ranks.hundos }}{% endif %}</td>
<td class="results-bool">{% if entry.lighthouse.performance === 1 %}β
{% else %}π«{% endif %}</td>
<td data-numeric-value="{{ (entry.lighthouse.performance * 100) | round }}">{{ (entry.lighthouse.performance * 100) | round }}</td>
<td class="results-calc"><a href="https://googlechrome.github.io/lighthouse/scorecalc/#FCP={{ entry.firstContentfulPaint }}&SI={{ entry.speedIndex }}&LCP={{ entry.largestContentfulPaint }}&TTI={{ entry.timeToInteractive }}&TBT={{ entry.totalBlockingTime }}&CLS={{ entry.cumulativeLayoutShift }}&FCI=&FMP=&device={{ entry.lighthouse.type or "mobile" }}&version={{ entry.lighthouse.version or "6.0.0" }}" target="_blank" rel="noopener noreferrer">Calculator</a></td>
<td class="results-bool">{% if entry.lighthouse.accessibility === 1 %}β
{% else %}π«{% endif %}</td>
<td data-numeric-value="{{ (entry.lighthouse.accessibility * 100) | round }}">{{ (entry.lighthouse.accessibility * 100) | round }}</td>
<td class="results-bool">{% if entry.lighthouse.bestPractices === 1 %}β
{% else %}π«{% endif %}</td>
<td data-numeric-value="{{ (entry.lighthouse.bestPractices * 100) | round }}">{{ (entry.lighthouse.bestPractices * 100) | round }}</td>
<td class="results-bool">{% if entry.lighthouse.seo === 1 %}β
{% else %}π«{% endif %}</td>
<td data-numeric-value="{{ (entry.lighthouse.seo * 100) | round }}">{{ (entry.lighthouse.seo * 100) | round }}</td>
<td class="results-bool">{% if entry.axe.violations == 0 %}β
{% else %}π«{% endif %}</td>
<td>{{ entry.axe.violations }}</td>
</tr>
{%- endfor %}
</tbody>
</table>
</div>
<div class="ct-chart ct-double-octave"></div>
</div>
<div class="layout color--vitals">
<div class="tablewrap">
<table data-make-chart class="results">
<thead>
<tr>
<th rowspan="2" class="results-date">Date</th>
<th colspan="8">Core Web Vitals</th>
<th colspan="6">Web Vitals</th>
</tr>
<tr>
<th class="results-series-a" colspan="2"><abbr title="Largest Contentful Paint">LCP</abbr></th>
<th class="results-series-b" colspan="2">Max Potential <abbr title="First Input Delay">FID</abbr></th>
<th class="results-series-c" colspan="2"><abbr title="Total Blocking Time">TBT</abbr></th>
<th colspan="2"><abbr title="Cumulative Layout Shift">CLS</abbr></th>
<th class="results-series-d" colspan="2"><abbr title="First Contentful Paint">FCP</abbr></th>
<th class="results-series-e" colspan="2"><abbr title="Speed Index">SI</abbr></th>
<th class="results-series-f" colspan="2"><abbr title="Time to Interactive">TTI</abbr></th>
</tr>
</thead>
<tbody>
{%- for entry in site | sort | headAndLast(maxResults) %}
<tr>
<td><code class="date">{{ entry.timestamp | displayDate }}</code></td>
<td class="results-bool">{% if entry.largestContentfulPaint <= 1550 %}β
{% endif %}</td>
<td data-numeric-value="{{ entry.largestContentfulPaint }}">{{ entry.largestContentfulPaint | displayTime }}</td>
{# https://web.dev/lighthouse-max-potential-fid/#how-lighthouse-determines-your-max-potential-fid-score #}
<td class="results-bool">{% if entry.maxPotentialFirstInputDelay <= 130 %}β
{% endif %}</td>
<td data-numeric-value="{{ entry.maxPotentialFirstInputDelay }}">{{ entry.maxPotentialFirstInputDelay | displayTime }}</td>
<td class="results-bool">{% if entry.totalBlockingTime <= 130 %}β
{% endif %}</td>
<td data-numeric-value="{{ entry.totalBlockingTime }}">{{ entry.totalBlockingTime | displayTime }}</td>
<td class="results-bool">{% if entry.cumulativeLayoutShift <= 0.03 %}β
{% endif %}</td>
<td>{{ entry.cumulativeLayoutShift.toFixed(2) }}</td>
<td class="results-bool">{% if entry.firstContentfulPaint <= 1350 %}β
{% endif %}</td>
<td data-numeric-value="{{ entry.firstContentfulPaint }}">{{ entry.firstContentfulPaint | displayTime }}</td>
<td class="results-bool">{% if entry.speedIndex <= 1960 %}β
{% endif %}</td>
<td data-numeric-value="{{ entry.speedIndex }}">{{ entry.speedIndex | displayTime }}</td>
<td class="results-bool">{% if entry.timeToInteractive <= 1940 %}β
{% endif %}</td>
<td data-numeric-value="{{ entry.timeToInteractive }}">{{ entry.timeToInteractive | displayTime }}</td>
</tr>
{%- endfor %}
</tbody>
</table>
</div>
<div class="ct-chart ct-double-octave"></div>
</div>
<div class="layout color--weight">
<div class="tablewrap">
<table data-make-chart class="results">
<thead>
<tr>
<th rowspan="2" class="results-date">Date</th>
<th colspan="6">Weight</th>
</tr>
<tr>
<th class="results-series-a">Total</th>
<th class="results-series-b">HTML</th>
<th class="results-series-c"><abbr title="Cascading Style Sheets">CSS</abbr></th>
<th class="results-series-d"><abbr title="JavaScript">JS</abbr></th>
<th class="results-series-e">Images</th>
<th class="results-series-f">Fonts</th>
</tr>
</thead>
<tbody>
{%- for entry in site | sort | headAndLast(maxResults) %}
<tr>
<td><code class="date">{{ entry.timestamp | displayDate }}</code></td>
<td data-numeric-value="{{ entry.weight.total / 1024 }}">{{ entry.weight.total | displayFilesize }}</td>
<td data-numeric-value="{{ entry.weight.document / 1024 }}">{{ entry.weight.document | displayFilesize }}</td>
<td data-numeric-value="{{ entry.weight.stylesheet / 1024 }}">{% if entry.weight.stylesheet or entry.weight.stylesheet === 0 %}{{ entry.weight.stylesheet | displayFilesize }} <span class="count">Γ{{ entry.weight.stylesheetCount }}</span>{% else %}β{% endif %}</td>
<td data-numeric-value="{{ entry.weight.script / 1024 }}">{{ entry.weight.script | displayFilesize }} <span class="count">Γ{{ entry.weight.scriptCount }}</span></td>
<td data-numeric-value="{{ entry.weight.image / 1024 }}">{{ entry.weight.image | displayFilesize }} <span class="count">Γ{{ entry.weight.imageCount }}</span></td>
<td data-numeric-value="{{ entry.weight.font / 1024 }}">{{ entry.weight.font | displayFilesize }} <span class="count">Γ{{ entry.weight.fontCount }}</span></td>
</tr>
{%- endfor %}
</tbody>
</table>
</div>
<div class="ct-chart ct-double-octave"></div>
</div>
</details>
{%- endfor %}