{% for metric in cwv %}
{{ _self.query(metric) }}
{% endfor %}
{{ 'Performance timing'|t }}
{% for key, value in performance.navigation %}
{{ key }}{{ value }}
{% endfor %}
{% macro query(metric) %}
{% set title = '' %}
{% set value = '' %}
{% set description = '' %}
{% set unit = '' %}
{% set color = 'green' %}
{% if metric.rating == 'needs-improvement' %}
{% set color = 'yellow' %}
{% elseif metric.name == 'poor' %}
{% set color = 'red' %}
{% endif %}
{% if metric.name == 'LCP' %}
{% set title = 'Largest Contentful Paint' %}
{% set value = (metric.value/1000)|round(3, 'floor') %}
{% set description = 'Largest Contentful Paint marks the time at which the largest text or image is painted.' %}
{% set unit = 's' %}
{% elseif metric.name == 'FID' %}
{% set title = 'First Input Delay' %}
{% set value = (metric.value/1000)|round(3, 'floor') %}
{% set description = 'First Input Delay measures the time from when a user first interacts with your site to when the browser is able to respond to that interaction' %}
{% set unit = 's' %}
{% elseif metric.name == 'CLS' %}
{% set title = 'Cumulative Layout Shift' %}
{% set value = metric.value|round(3, 'floor') %}
{% set description = 'Cumulative Layout Shift measures the movement of visible elements within the viewport.' %}
{% set unit = '' %}
{% endif %}