1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-27 05:18:28 -04:00

allow page-specific CSS to be set via shortcode and appear in <head>

TODO: Potential bug report w/ live server -- .Page.Scratch is only detected on first run, breaks after any changes trigger rebuild. Might be flaky on real builds too, will investigate.
This commit is contained in:
Jake Jarvis 2020-03-27 14:19:55 -04:00
parent 91ecc58889
commit 146b1047e1
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
4 changed files with 17 additions and 2 deletions

View File

@ -14,7 +14,7 @@ draft: false
<!-- markdownlint-disable MD033 -->
<style>
{{< page-css >}}
/* override link underlines */
h2 a {
background-image: none !important;
@ -27,7 +27,7 @@ h2 img {
margin: 0 !important;
vertical-align: text-bottom;
}
</style>
{{< /page-css >}}
We're all quickly learning that worldwide pandemics can bring out both [the best](https://www.vox.com/culture/2020/3/13/21179293/coronavirus-italy-covid19-music-balconies-sing) and [the worst](https://twitter.com/9NewsAUS/status/1236088663093608448) of humanity. But one thing has become readily apparent to me — outside of the large teams of medical professionals risking their lives right this minute, the open source community stands alone in its ability to rapidly organize in the midst of chaos to give back to the world and, in this case, make it safer for all of us.

View File

@ -216,6 +216,11 @@
div.highlight span.ge { font-style: italic; }
div.highlight span.gs { font-weight: bold; }
div.highlight span.lnt { color: #999999; }
{{/* Page-specific styles set via page-css shortcode */}}
{{- with .Page.Scratch.Get "css" }}
{{- . | safeCSS -}}
{{ end -}}
</style>
{{ partialCached "head/favicons" (dict "pngSizes" "192 48 32 16" "icoSizes" "16 32 48") }}

View File

@ -19,3 +19,10 @@
{{ else }}
{{ partial "head/schema-person" . }}
{{ end -}}
{{/* Page-specific styles set via page-css shortcode */}}
{{- with .Page.Scratch.Get "css" }}
<style>
{{- . | safeCSS -}}
</style>
{{ end -}}

View File

@ -0,0 +1,3 @@
{{/* Allow page-specific CSS to be set from within its Markdown content and appear in <head> (see partials/head/head.html) */}}
{{- .Page.Scratch.Set "css" .Inner -}}