Hugo theme code to include custom CSS files
You can use the following code in your Hugo theme to include a range of custom CSS files.
You need to include it somewhere in the HTML <head>. In my theme tailbliss, it can be added to the end of layouts/partials/head.html:
include_custom_css.html
{{ range .Site.Params.custom_css -}}
<link rel="stylesheet" href="{{ (resources.Get . | postCSS).RelPermalink }}">
{{- end }}Now you can configure a list of custom CSS files in hugo.yaml:
hugo_params.yml
params:
custom_css:
- 'css/techoverflow.css'Check out similar posts by category:
Hugo
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow