From fb07ed42a2f2cae6dffefc8a6686c480bd8f92e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannik=20R=C3=B6del?= Date: Mon, 20 Sep 2021 16:47:06 +0200 Subject: [PATCH] Preload CSS where applicable --- _includes/layouts/base.njk | 28 +++++++++++++++++++++++----- _includes/layouts/home.njk | 8 ++------ _includes/layouts/page.njk | 12 ++++-------- styles/base.scss | 1 + styles/home.scss | 1 - 5 files changed, 30 insertions(+), 20 deletions(-) diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index 19823cf..4d87b57 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -2,17 +2,33 @@ + {{ title or metadata.title }} + + + {# We only bother with preloading the variable font here because chances are + that if a browser doesn't support variable fonts it won't support + preloading either: + https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload#browser_compatibility + #} + + {% for name in (extraStylesheets or []) %} + + {% endfor %} + {% block headStart %}{% endblock %} + - {{ title or metadata.title }} - - - {% block extraHead %}{% endblock %} + + {% for name in (extraStylesheets or []) %} + + {% endfor %} + + {% block headEnd %}{% endblock %}
- {{ content | safe }} + {% block content %} + {{ content | safe }} + {% endblock %}