mirror of
https://github.com/13hannes11/hugo-coder-timeline.git
synced 2024-09-04 00:50:58 +02:00
Modularize <head> and baseof templates (#639)
* Add extension points for template customization Today, if you use the hugo-coder template, you can't modify <head> without having to write the entire template from scratch. This makes small point modifications or adjustments impractical and means that downstream consumers will quickly be out of sync with upstream changes. To remedy this, we split up the template into more modular extension points. This commit adds one extension point to <body> for arbitrary scripting and several more to <head> for different existing touchpoints. * Add John Feminella to CONTRIBUTORS.md * Modularize home.html template Co-authored-by: Luiz F. A. de Prá <luizdepra@users.noreply.github.com>
This commit is contained in:
21
layouts/partials/head/custom-styles.html
Normal file
21
layouts/partials/head/custom-styles.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{{ range .Site.Params.customCSS }}
|
||||
{{ if $.Site.IsServer }}
|
||||
{{ $styles := resources.Get . }}
|
||||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" media="screen">
|
||||
{{ else }}
|
||||
{{ $styles := resources.Get . | minify | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" crossorigin="anonymous" media="screen" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ range .Site.Params.customSCSS }}
|
||||
{{/* We don't change the targetPath to because it's transparent to users */}}
|
||||
{{ if $.Site.IsServer }}
|
||||
{{ $cssOpts := (dict "enableSourceMap" true ) }}
|
||||
{{ $styles := resources.Get . | toCSS $cssOpts }}
|
||||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" media="screen">
|
||||
{{ else }}
|
||||
{{ $styles := resources.Get . | toCSS | minify | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" crossorigin="anonymous" media="screen" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user