Update font preloading

pull/1/head
mat ess 2022-10-16 21:26:11 -04:00
parent e9ec3881ae
commit a49bc8888f
2 changed files with 12 additions and 17 deletions

View File

@ -28,14 +28,10 @@ external_links_no_referrer = true
favicon = "/image/favicon.svg"
stylesheets = []
use_cdn = false
cdns = [
# { url = "https://cdn.jsdelivr.net/npm/firacode@6.2.0/distr/fira_code.min.css", hash = "sWIpcFPnJFfPqQU7FWn8H9+Xax/h5ihI8hVjQTBa5WmUde6CZZLw9DUAaIyA6j5u" },
# { url = "https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.5/dist/web/static/pretendard-std-dynamic-subset.min.css", hash = "UzN3sOqBetZN9G2CDFfxg1PNJ+Qrv8/HZIoBp6XsCD+2DOehpvXGqkj2WFCNge5Q" },
# { url = "https://cdn.jsdelivr.net/gh/codex-src/iA-Fonts@master/iA%20Writer%20Quattro/Webfonts/index.min.css", hash = "Vx6OU3QBwm96rTUebUtdfD/AW3d3uzT896pixaUYg9Nb87zqHuXmjmv9aGwBmFjP" },
# Disabling variable fonts to bring site weight down
# { url = "https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.5/dist/web/variable/pretendardvariable-std.min.css", hash = "3OYJp8uUv2MJWyKGgrZOrSjf+WP+nD7ifpJ04kAsI02PYi+nghC4TF37YkN/2Qxt" },
# { url = "https://cdn.jsdelivr.net/gh/codex-src/iA-Fonts@master/iA%20Writer%20Quattro/Variable/index.min.css", hash = "sFJyxW2UhZcJ0SAweDcoU6dBgqox5PbLK5nZStQSQitBeRHigPu7OPWDvoIHEXeo" },
fonts = [
{ path = "ia-writer-quattro", name = "iAWriterQuattroS" },
{ path = "ibm-plex-mono", name = "IBMPlexMono" },
{ path = "inria-sans", name = "InriaSans" }
]
menu = [

View File

@ -12,14 +12,13 @@
<link rel="icon" type="image/{{ favicon_ext }}" href="{{ get_url(path=config.extra.favicon, cachebust=true) }}" />
{% endif %}
{# Font from cdn or disk #}
{% if config.extra.use_cdn | default(value=false) %}
{% for cdn in config.extra.cdns %}
<link href="{{ cdn.url }}" rel="stylesheet" integrity="sha384-{{ cdn.hash }}" crossorigin="anonymous">
{% for font in config.extra.fonts %}
{% for style in ["Bold", "BoldItalic", "Italic", "Regular"] %}
{% set font_path = 'font/' ~ font.path ~ '/' ~ font.name ~ '-' ~ style ~ '.woff2' %}
<link rel="preload" href="{{ get_url(path=font_path) }}" as="font" type="font/woff2" crossorigin>
{% endfor %}
{% else %}
<link href="{{ get_url(path='style/fonts.css', cachebust=true) }}" rel="stylesheet" />
{% endif %}
{% endfor %}
<link href="{{ get_url(path='style/fonts.css', cachebust=true) }}" rel="stylesheet preload" as="style" />
{# RSS #}
<link rel="alternate" type="application/atom+xml" title="{{ config.title }}"
@ -59,7 +58,7 @@
<meta property="og:title" content="{{ current_title }}">
<meta property="og:description" content="{{ current_description }}">
{% if hero %}
<meta property="og:image" content="{{ get_url(path=current_path) }}/hero.png">
<meta property="og:image" content="{{ get_url(path=current_path) }}/hero.webp">
{% endif %}
{# Twitter #}
@ -67,6 +66,6 @@
<meta property="twitter:title" content="{{ current_title }}">
<meta property="twitter:description" content="{{ current_description }}">
{% if hero %}
<meta property="twitter:image" content="{{ get_url(path=current_path) }}/hero.png">
<meta property="twitter:image" content="{{ get_url(path=current_path) }}/hero.webp">
{% endif %}
</head>