mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-27 14:12:09 +00:00
Only load syntax highlighting CSS if necessary..
Pages without highlighted code blocks don't need to load syntax.css; for those that do, simply declare "highlight: true" in the front matter to load the stylesheet separately.
This commit is contained in:
parent
6fba7dbc9a
commit
1e44855647
2 changed files with 5 additions and 10 deletions
|
@ -14,7 +14,7 @@ description = "Seirdy's personal website"
|
|||
src = "https://sr.ht/~seirdy/seirdy.one"
|
||||
copyright = "Copyright © 2020 Rohan Kumar"
|
||||
dark = "auto"
|
||||
highlight = true
|
||||
highlight = false
|
||||
|
||||
[author]
|
||||
name = "Rohan Kumar"
|
||||
|
|
|
@ -10,24 +10,19 @@
|
|||
<meta name="robots" content="noindex">
|
||||
{{ end -}}
|
||||
<link rel="canonical" href="https://seirdy.one{{ .RelPermalink }}"/>
|
||||
|
||||
{{ $resources := slice -}}
|
||||
|
||||
{{ $resources = $resources | append (resources.Get "/css/main.css") -}}
|
||||
|
||||
{{ $resources = $resources | append (resources.Get "/css/narrow.css") -}}
|
||||
|
||||
{{ $dark := .Site.Params.dark | default "auto" -}}
|
||||
{{ if not (eq $dark "off") -}}
|
||||
{{ $resources = $resources | append (resources.Get "css/dark.css" | resources.ExecuteAsTemplate "dark.css" .) -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if .Site.Params.highlight -}}
|
||||
{{ $resources = $resources | append (resources.Get "css/syntax.css") -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ $css := $resources | resources.Concat "css/style.css" | minify }}
|
||||
{{ printf `<link rel="stylesheet" href="%s">` $css.RelPermalink | safeHTML }}
|
||||
{{ if .Params.highlight -}}
|
||||
{{ printf `<link rel="stylesheet" href="/css/syntax.css">` | safeHTML }}
|
||||
{{ end -}}
|
||||
|
||||
|
||||
<title>{{ .Title }}</title>
|
||||
</head>
|
||||
|
|
Loading…
Reference in a new issue