From 6ea2b764cd74c138b3ca545adc7b86f804815894 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 17 Nov 2023 10:38:09 +0000 Subject: [PATCH] Hermit-V2 Theme Update --- README.md | 8 ++++---- layouts/_default/baseof.html | 12 +++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ce28fc6..ffbbdbc 100644 --- a/README.md +++ b/README.md @@ -56,14 +56,14 @@ Site Configuration is done through `hugo.toml` or `hugo.yaml` file in root direc I have found that there are some requirement where custom CSS and JS should be supplied to a page to make it work. This custom files are not required for whole of the site, but is restricted to a page or few particular pages. E.g. If you make contact form. -To provision for the same, I have added custom css and js. Please add this to page frontmatter as required. +To make use of custom CSS and JS, add the below section to page frontmatter. If there is any folder structure, that should be mentioned as well. ``` -custom_css = ["css/foo.css","css/bar.css"] -custom_js = ["js/custom-about.js"] +custom_css = ["custom_css/foo.css","custom_css/bar.css"] +custom_js = ["custom_js/custom-about.js"] ``` -The files itself will reside in `static/css` for CSS files and `static/js` for JS files. Refer to [Staging Branch](https://github.com/1bl4z3r/hermit-V2/tree/staging) to have a feel on how [this](https://github.com/1bl4z3r/hermit-V2/blob/staging/content/about-hugo.md) is implemented. +The files itself will reside in `assets` directory. Refer to [Staging Branch](https://github.com/1bl4z3r/hermit-V2/tree/staging) to have a feel on how [this](https://github.com/1bl4z3r/hermit-V2/blob/staging/content/about-hugo.md) is implemented. ### Favicon diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 942c426..d388fc7 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -17,8 +17,11 @@ {{ printf `` .Rel .MediaType.Type .Permalink $.Title | safeHTML }} {{ end -}} {{ $style := resources.Get "scss/style.scss" | resources.ExecuteAsTemplate "css/style.css" . | toCSS | minify | fingerprint -}} - -{{- range .Params.custom_css -}}{{- end -}} + +{{- range .Params.custom_css -}} +{{ $c_css := resources.Get . | resources.ExecuteAsTemplate "css/style.css" . | toCSS | minify | fingerprint -}} + +{{- end -}} {{- block "head" . -}}{{- end -}} {{- if templates.Exists "partials/extra-head.html" -}}{{- partial "extra-head.html" . -}}{{- end -}} @@ -39,7 +42,10 @@ {{ $linkshare := resources.Get "js/link-share.js" | minify | fingerprint -}} {{- end -}} - {{- range .Params.custom_js -}}{{- end }} + {{- range .Params.custom_js -}} + {{ $c_js := resources.Get . | minify | fingerprint -}} + + {{- end }} {{- partial "mathjax.html" . -}} {{- if templates.Exists "partials/extra-foot.html" -}}{{- partial "extra-foot.html" . -}}{{- end }}