diff --git a/site/hugo.toml b/site/hugo.toml index 200f81a0..d6ec9f1c 100644 --- a/site/hugo.toml +++ b/site/hugo.toml @@ -1,4 +1,4 @@ -baseURL = "https://alexandrev.github.io/xslt-lab/" +baseURL = "https://blog.xsltplayground.com/" languageCode = "en-us" title = "XSLT Lab" paginate = 10 @@ -9,6 +9,11 @@ enableRobotsTXT = true subtitle = "Helm and XSLT playground with a lightweight docs site." lead = "Articles, release notes, and pointers to the Helm repo all live here. Build locally or publish from the docs folder without disturbing existing chart artifacts." +[params.adsense] +# Prefer setting ADSENSE_CLIENT and ADSENSE_INARTICLE_SLOT env vars when building if you don't want the values committed. +client = "ca-pub-1549720748100858" +inArticleSlot = "" + [menu] [[menu.main]] name = "Home" diff --git a/site/layouts/_default/baseof.html b/site/layouts/_default/baseof.html index 7e537de3..f634a542 100644 --- a/site/layouts/_default/baseof.html +++ b/site/layouts/_default/baseof.html @@ -5,6 +5,7 @@ {{ block "title" . }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }} + {{ partial "adsense/head.html" . }} diff --git a/site/layouts/_default/single.html b/site/layouts/_default/single.html index a50cec58..56b474ca 100644 --- a/site/layouts/_default/single.html +++ b/site/layouts/_default/single.html @@ -4,6 +4,7 @@

{{ .Title }}

{{ .Date.Format "02 Jan 2006" }}

{{ with .Params.description }}

{{ . }}

{{ end }} + {{ partial "adsense/in-article.html" . }}
{{ .Content }}
diff --git a/site/layouts/partials/adsense/head.html b/site/layouts/partials/adsense/head.html new file mode 100644 index 00000000..6c427dbd --- /dev/null +++ b/site/layouts/partials/adsense/head.html @@ -0,0 +1,5 @@ +{{- $client := or .Site.Params.adsense.client (getenv "ADSENSE_CLIENT") -}} +{{- if and $client (ne hugo.Environment "development") -}} + + +{{- end -}} diff --git a/site/layouts/partials/adsense/in-article.html b/site/layouts/partials/adsense/in-article.html new file mode 100644 index 00000000..5d23c592 --- /dev/null +++ b/site/layouts/partials/adsense/in-article.html @@ -0,0 +1,15 @@ +{{- $client := or .Site.Params.adsense.client (getenv "ADSENSE_CLIENT") -}} +{{- $slot := or .Site.Params.adsense.inArticleSlot (getenv "ADSENSE_INARTICLE_SLOT") -}} +{{- if and $client $slot (ne hugo.Environment "development") -}} +
+ +
+ +{{- end -}} diff --git a/site/static/CNAME b/site/static/CNAME new file mode 100644 index 00000000..04ed1458 --- /dev/null +++ b/site/static/CNAME @@ -0,0 +1 @@ +blog.xsltplayground.com diff --git a/site/static/css/main.css b/site/static/css/main.css index 7c68ce99..d19e6bc4 100644 --- a/site/static/css/main.css +++ b/site/static/css/main.css @@ -183,6 +183,17 @@ h1, h2, h3, h4 { margin-top: 24px; } +.ad { + margin: 26px 0; + padding: 14px 0; + border-top: 1px solid var(--border); + border-bottom: 1px solid var(--border); +} + +.ad-in-article { + text-align: center; +} + .post .content p { margin: 14px 0; }