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" favicon = "/image/favicon.svg"
stylesheets = [] stylesheets = []
use_cdn = false fonts = [
cdns = [ { path = "ia-writer-quattro", name = "iAWriterQuattroS" },
# { url = "https://cdn.jsdelivr.net/npm/firacode@6.2.0/distr/fira_code.min.css", hash = "sWIpcFPnJFfPqQU7FWn8H9+Xax/h5ihI8hVjQTBa5WmUde6CZZLw9DUAaIyA6j5u" }, { path = "ibm-plex-mono", name = "IBMPlexMono" },
# { 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" }, { path = "inria-sans", name = "InriaSans" }
# { 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" },
] ]
menu = [ menu = [

View File

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