Templatize font import
This commit is contained in:
@@ -4,6 +4,9 @@ title: Hugo Fresh Theme
|
|||||||
theme: hugo-fresh
|
theme: hugo-fresh
|
||||||
|
|
||||||
params:
|
params:
|
||||||
|
font:
|
||||||
|
name: "Open Sans"
|
||||||
|
sizes: [400,600]
|
||||||
hero:
|
hero:
|
||||||
# Main hero title
|
# Main hero title
|
||||||
title: Manage. Deploy.
|
title: Manage. Deploy.
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
{{- $inServerMode := .Site.IsServer }}
|
{{- $inServerMode := .Site.IsServer }}
|
||||||
{{- $sass := "style.sass" }}
|
{{- $sass := "style.sass" }}
|
||||||
{{- $cssTarget := "css/style.css" }}
|
{{- $cssTarget := "css/style.css" }}
|
||||||
{{- $cssOpts := cond ($inServerMode) (dict "targetPath" $cssTarget "enableSourceMap" true) (dict "targetPath" $cssTarget "outputStyle" "compressed") }}
|
{{- $cssOpts := cond ($inServerMode) (dict "targetPath" $cssTarget "enableSourceMap" true) (dict "targetPath" $cssTarget "outputStyle" "compressed") }}
|
||||||
|
{{- $fontFace := replace .Site.Params.font.name " " "+" }}
|
||||||
|
{{- $fontSizes := delimit .Site.Params.font.sizes "," }}
|
||||||
|
{{- $fontUrl := printf "https://fonts.googleapis.com/css?family=%s:%s" $fontFace $fontSizes }}
|
||||||
<link rel="icon" type="image/png" href="{{ "/images/favicon.png" | absURL }}" />
|
<link rel="icon" type="image/png" href="{{ "/images/favicon.png" | absURL }}" />
|
||||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600" rel="stylesheet">
|
<link href="{{ $fontUrl }}" rel="stylesheet">
|
||||||
{{- if $inServerMode }}
|
{{- if $inServerMode }}
|
||||||
{{- $css := resources.Get $sass | toCSS $cssOpts }}
|
{{- $css := resources.Get $sass | toCSS $cssOpts }}
|
||||||
<link rel="stylesheet" type="text/css" href="{{ $css.Permalink }}">
|
<link rel="stylesheet" type="text/css" href="{{ $css.Permalink }}">
|
||||||
|
|||||||
Reference in New Issue
Block a user