diff options
| author | xAlpharax <42233094+xAlpharax@users.noreply.github.com> | 2025-08-12 06:50:12 +0300 |
|---|---|---|
| committer | xAlpharax <42233094+xAlpharax@users.noreply.github.com> | 2025-08-12 06:50:12 +0300 |
| commit | 93fd472f353d004ae399eb1d5619539a7efe30c5 (patch) | |
| tree | fde421d05e580cd8143be95699c8c7a7c81d040a /templates/index.html | |
| parent | 37b2ee0eeaeeb4e3de1029556538b7a4e0c775e2 (diff) | |
Major changes and the start of my post on a rust week.
Changes to be committed:
modified: .gitignore
modified: config.toml
modified: content/posts/rust.md
modified: templates/404.html
modified: templates/index.html
new file: templates/shortcodes/image.html
new file: static/css/critical.css
deleted: rsync_to_testing
Diffstat (limited to 'templates/index.html')
| -rw-r--r-- | templates/index.html | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/templates/index.html b/templates/index.html index a14a2d0..c968941 100644 --- a/templates/index.html +++ b/templates/index.html @@ -61,7 +61,23 @@ <link rel="shortcut icon" href="{{ get_url(path="favicon.ico") }}"/> <!-- Stylesheets --> - <link rel="stylesheet" href="{{ get_url(path="style.css") }}"/> + <!--<link rel="stylesheet" href="{{ get_url(path="style.css") }}"/> old way of doing this, inefficient --> + + + {# 1. Load our single combined critical CSS file. #} + {% set critical_css = load_data(path="static/css/critical.css", required=false) %} + + {# 2. If it was found, inline it. #} + {% if critical_css %} + <style>{{ critical_css | safe }}</style> + {% endif %} + + {# 3. Load the full stylesheet asynchronously (this part is the same). #} + <link rel="stylesheet" href="{{ get_url(path='style.css') }}" media="print" onload="this.media='all'"> + + {# 4. Provide a fallback for browsers without JavaScript. #} + <noscript><link rel="stylesheet" href="{{ get_url(path='style.css') }}"></noscript> + <!-- Stylesheets End --> {% if page.extra.math %} <!-- Math rendering with KaTeX --> |
