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:
parent
91ecc58889
commit
146b1047e1
@ -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.
|
||||
|
||||
|
@ -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") }}
|
||||
|
@ -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 -}}
|
||||
|
3
layouts/shortcodes/page-css.html
Normal file
3
layouts/shortcodes/page-css.html
Normal 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 -}}
|
Loading…
x
Reference in New Issue
Block a user