Skip to content

Commit 0f357e0

Browse files
committed
fix: foft trying
1 parent ea5e3d7 commit 0f357e0

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

src/layouts/base.njk

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,29 @@
1919
if (sessionStorage.fontsLoadedCriticalFoftPreload) {
2020
document.documentElement.className += " fonts-loaded-2";
2121
return;
22-
}
23-
document.fonts.load("1em 'Inter Subset'").then(function () {
24-
document.documentElement.className += " fonts-loaded-1";
25-
Promise.all([
26-
document.fonts.load("400 1em 'Inter'"),
27-
document.fonts.load("400 italic 1em 'Inter'"),
28-
document.fonts.load("500 1em 'Inter'"),
29-
document.fonts.load("600 1em 'Inter'"),
30-
document.fonts.load("700 1em 'Inter'"),
31-
document.fonts.load("900 1em 'Inter'"),
32-
]).then(function () {
33-
document.documentElement.className += " fonts-loaded-2";
34-
// Optimization for Repeat Views
35-
sessionStorage.fontsLoadedCriticalFoftPreload = true;
22+
} else {
23+
document.fonts.load("1em 'Inter Subset'").then(function () {
24+
document.documentElement.className += " fonts-loaded-1";
25+
Promise.all([
26+
document.fonts.load("400 1em 'Inter'"),
27+
document.fonts.load("400 italic 1em 'Inter'"),
28+
document.fonts.load("500 1em 'Inter'"),
29+
document.fonts.load("600 1em 'Inter'"),
30+
document.fonts.load("700 1em 'Inter'"),
31+
document.fonts.load("900 1em 'Inter'"),
32+
]).then(function () {
33+
document.documentElement.className += " fonts-loaded-2";
34+
// Optimization for Repeat Views
35+
sessionStorage.fontsLoadedCriticalFoftPreload = true;
36+
});
3637
});
37-
});
38+
}
3839
}
3940
})();
4041
</script>
4142
<link rel="stylesheet" href="/assets/css/main.scss">
4243
</head>
44+
4345
<body>
4446
<a href="#main" class="skiplink">{%- if page.lang == 'it' %}Salta al contenuto{% else %}Skip to content{% endif
4547
%}</a>
@@ -58,4 +60,5 @@
5860
<script type="module" src="/assets/js/modules/photoswipe.js"></script>
5961
{% endif %}
6062
</body>
63+
6164
</html>

0 commit comments

Comments
 (0)