aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOscar Najera <hi@oscarnajera.com>2025-01-17 02:33:06 +0100
committerOscar Najera <hi@oscarnajera.com>2025-01-17 02:33:06 +0100
commit74bb8aaf6f0bddc866d0341d347f0d92ddf94a2b (patch)
tree5a0c8c6d466b58c667065ff4661f641651126797
parentde099f27f293ad1d482303644e02fb458f3f3502 (diff)
downloadhugo-minimalist-theme-74bb8aaf6f0bddc866d0341d347f0d92ddf94a2b.tar.gz
hugo-minimalist-theme-74bb8aaf6f0bddc866d0341d347f0d92ddf94a2b.tar.bz2
hugo-minimalist-theme-74bb8aaf6f0bddc866d0341d347f0d92ddf94a2b.zip
load icons css with delay
-rw-r--r--assets/js/loads.js14
-rw-r--r--layouts/partials/head.html13
2 files changed, 12 insertions, 15 deletions
diff --git a/assets/js/loads.js b/assets/js/loads.js
index 71e0173..c8a03a7 100644
--- a/assets/js/loads.js
+++ b/assets/js/loads.js
@@ -1,4 +1,4 @@
-function load_js(url) {
+function load_css(url) {
let link = document.createElement("link");
link.rel = "stylesheet";
link.type = "text/css";
@@ -9,6 +9,16 @@ function load_js(url) {
addEventListener("load", function () {
if (document.querySelector(".highlight .chroma")) {
- load_js("/css/syntax.css");
+ load_css("/css/syntax.css");
}
+
+ if (document.querySelector(".ai")) {
+ load_css(
+ "https://cdn.jsdelivr.net/gh/jpswalsh/academicons@1/css/academicons.min.css",
+ );
+ }
+ if (document.querySelectorAll(".fa,.fab,.fas,.far"))
+ load_css(
+ "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css",
+ );
});
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 638972b..f3919c4 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -12,19 +12,6 @@
/>
{{ end }}
-
- <link
- rel="stylesheet"
- href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"
- integrity="sha512-9usAa10IRO0HhonpyAIVpjrylPvoDwiPUiKdWk5t3PyolY1cOd4DSE0Ga+ri4AuTroPR5aQvXU9xC6qOPnzFeg=="
- crossorigin="anonymous"
- referrerpolicy="no-referrer"
- />
- <link
- rel="stylesheet"
- href="https://cdn.jsdelivr.net/gh/jpswalsh/academicons@1/css/academicons.min.css"
- />
-
{{ with resources.Get .Site.Params.favicon }}
<link rel="icon" href="{{ .RelPermalink }}" />
{{ end }}