Replace document.write with document.head.insertAdjacentHTML

This commit is contained in:
Guillaume Gomez 2024-04-11 11:56:18 +02:00
parent 5974fe87c4
commit 510bfc2db9

View File

@ -7,8 +7,7 @@
<meta name="description" content="{{page.description}}"> {# #}
<title>{{page.title}}</title> {# #}
<script>if(window.location.protocol!=="file:") {# Hack to skip preloading fonts locally - see #98769 #}
for(f of "{{files.source_serif_4_regular}},{{files.fira_sans_regular}},{{files.fira_sans_medium}},{{files.source_code_pro_regular}},{{files.source_code_pro_semibold}}".split(",")) {# #}
document.write(`<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path|safe}}${f}">`) {# #}
document.head.insertAdjacentHTML("beforeend","{{files.source_serif_4_regular}},{{files.fira_sans_regular}},{{files.fira_sans_medium}},{{files.source_code_pro_regular}},{{files.source_code_pro_semibold}}".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path|safe}}${f}">`).join("")) {# #}
</script> {# #}
<link rel="stylesheet" {#+ #}
href="{{static_root_path|safe}}{{files.normalize_css}}"> {# #}