From 20c32eaeb3b2dfe5359e4b303f1623970e5da04f Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Thu, 9 Apr 2020 13:59:49 -0400 Subject: [PATCH] *much* smarter way of setting page-specific CSS via front matter instead of flaky shortcode/page scratch --- .../notes/coronavirus-open-source/index.md | 24 +++++++++---------- content/notes/shodan-search-queries/index.md | 16 ++++++------- layouts/_default/single.amp.html | 4 ++-- layouts/partials/head/head.html | 9 +------ layouts/partials/head/styles.html | 7 ++++++ layouts/shortcodes/page-css.html | 3 --- 6 files changed, 28 insertions(+), 35 deletions(-) delete mode 100644 layouts/shortcodes/page-css.html diff --git a/content/notes/coronavirus-open-source/index.md b/content/notes/coronavirus-open-source/index.md index fb738156..d155fec7 100644 --- a/content/notes/coronavirus-open-source/index.md +++ b/content/notes/coronavirus-open-source/index.md @@ -9,22 +9,20 @@ tags: - Public Health - GitHub image: "covid19dashboards.png" +css: | + /* disable link underlines for octocats */ + h2 a:last-child { + background-image: none !important; + padding-bottom: 0 !important; + margin-left: 8px; + } + /* align octocat with text */ + h2 img { + vertical-align: text-bottom; + } draft: false --- -{{< page-css >}} -/* disable link underlines for octocats */ -h2 a:last-child { - background-image: none !important; - padding-bottom: 0 !important; - margin-left: 8px; -} -/* align octocat with text */ -h2 img { - vertical-align: text-bottom; -} -{{< /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. These are just a few incredible open source projects that didn't exist a few months ago, but rapidly formed teams of dozens of contributors to fill both big needs and small niches in the fight to defeat the novel coronavirus, aka [**COVID-19**](https://www.cdc.gov/coronavirus/2019-nCoV/index.html). diff --git a/content/notes/shodan-search-queries/index.md b/content/notes/shodan-search-queries/index.md index fe15797d..b344610c 100644 --- a/content/notes/shodan-search-queries/index.md +++ b/content/notes/shodan-search-queries/index.md @@ -9,18 +9,16 @@ tags: - Internet of Things - Dorking image: "shodan.png" +css: | + /* disable hover underlines for search links */ + h3 a:last-child, h4 a:last-child { + background-image: none !important; + padding-bottom: 0 !important; + margin-left: 6px; + } draft: false --- -{{< page-css >}} -/* disable hover underlines for search links */ -h3 a:last-child, h4 a:last-child { - background-image: none !important; - padding-bottom: 0 !important; - margin-left: 6px; -} -{{< /page-css >}} - {{< gh-buttons username="jakejarvis" repo="awesome-shodan-queries" >}} Over time, I've collected an assortment of interesting, funny, and depressing search queries to plug into [Shodan](https://www.shodan.io/), the ([literal](https://www.vice.com/en_uk/article/9bvxmd/shodan-exposes-the-dark-side-of-the-net)) internet search engine. Some return facepalm-inducing results, while others return serious and/or ancient vulnerabilities in the wild. diff --git a/layouts/_default/single.amp.html b/layouts/_default/single.amp.html index 2db1e247..4da05127 100644 --- a/layouts/_default/single.amp.html +++ b/layouts/_default/single.amp.html @@ -217,8 +217,8 @@ div.highlight span.gs { font-weight: bold; } div.highlight span.lnt { color: #999999; user-select: none; } - {{/* Page-specific styles set via page-css shortcode */}} - {{- with .Page.Scratch.Get "css" }} + {{/* Page-specific styles set via front matter */}} + {{- with .Params.css }} {{- . | safeCSS -}} {{ end -}} diff --git a/layouts/partials/head/head.html b/layouts/partials/head/head.html index 830a6e92..fefa8f15 100644 --- a/layouts/partials/head/head.html +++ b/layouts/partials/head/head.html @@ -3,7 +3,7 @@ {{ partial "head/open-graph" . -}} {{ partialCached "head/mobile" . -}} {{ partial "head/preload" . -}} -{{ partialCached "head/styles" . -}} +{{ partial "head/styles" . -}} {{ partialCached "head/favicons" (dict "pngSizes" "192 48 32 16" "icoSizes" "16 32 48") -}} @@ -19,10 +19,3 @@ {{ else }} {{ partial "head/schema-person" . }} {{ end -}} - -{{/* Page-specific styles set via page-css shortcode */}} -{{- with .Page.Scratch.Get "css" }} - -{{ end -}} diff --git a/layouts/partials/head/styles.html b/layouts/partials/head/styles.html index 5d80528b..30995d40 100644 --- a/layouts/partials/head/styles.html +++ b/layouts/partials/head/styles.html @@ -1,2 +1,9 @@ {{ $style := resources.Get "sass/main.scss" | resources.ExecuteAsTemplate "sass/main.scss" . | resources.ToCSS (dict "targetPath" "style.css") | resources.PostCSS (dict "config" "postcss.config.js") }} + +{{/* Page-specific styles set via front matter */}} +{{ with .Params.css }} + +{{ end }} diff --git a/layouts/shortcodes/page-css.html b/layouts/shortcodes/page-css.html deleted file mode 100644 index bddf67be..00000000 --- a/layouts/shortcodes/page-css.html +++ /dev/null @@ -1,3 +0,0 @@ -{{/* Allow page-specific CSS to be set from within its Markdown content and appear in (see partials/head/head.html) */}} - -{{- .Page.Scratch.Set "css" .Inner -}}