Hugo 主题代码以包含自定义 CSS 文件
你可以在 Hugo 主题中使用以下代码来包含一系列自定义 CSS 文件。
你需要将其包含在 HTML <head> 中的某处。在我的 tailbliss 主题中,可以将其添加到 layouts/partials/head.html 的末尾:
include_custom_css.html
{{ range .Site.Params.custom_css -}}
<link rel="stylesheet" href="{{ (resources.Get . | postCSS).RelPermalink }}">
{{- end }}现在你可以在 hugo.yaml 中配置自定义 CSS 文件列表:
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