From 216135e004ecebb31c74243a988124ab7505c237 Mon Sep 17 00:00:00 2001 From: dzello Date: Mon, 13 Aug 2018 17:41:06 +0200 Subject: [PATCH] Presentations can add their own HTML to the layout This will be the recommended way to add custom CSS and JS on a per-presentation basis. Global layout extensions remain the same. --- .../partials/home/reveal-hugo/body.html | 9 ++++++++ .../partials/home/reveal-hugo/head.html | 18 ++++++++++++++++ layouts/_default/baseof.reveal.html | 21 ++++++++++++------- 3 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 exampleSite/layouts/partials/home/reveal-hugo/body.html create mode 100644 exampleSite/layouts/partials/home/reveal-hugo/head.html diff --git a/exampleSite/layouts/partials/home/reveal-hugo/body.html b/exampleSite/layouts/partials/home/reveal-hugo/body.html new file mode 100644 index 0000000..1dba7f9 --- /dev/null +++ b/exampleSite/layouts/partials/home/reveal-hugo/body.html @@ -0,0 +1,9 @@ + + + + diff --git a/exampleSite/layouts/partials/home/reveal-hugo/head.html b/exampleSite/layouts/partials/home/reveal-hugo/head.html new file mode 100644 index 0000000..58b786e --- /dev/null +++ b/exampleSite/layouts/partials/home/reveal-hugo/head.html @@ -0,0 +1,18 @@ + + + diff --git a/layouts/_default/baseof.reveal.html b/layouts/_default/baseof.reveal.html index 9db28a3..c2713bc 100644 --- a/layouts/_default/baseof.reveal.html +++ b/layouts/_default/baseof.reveal.html @@ -30,17 +30,19 @@ link.href = window.location.search.match( /print-pdf/gi ) ? '{{ $reveal_cdn}}/css/print/pdf.css' : '{{ $reveal_cdn }}/css/print/paper.css'; document.getElementsByTagName( 'head' )[0].appendChild( link ); - + {{- partial "reveal-hugo/head" . -}} + + {{- $sectionHeadPartial := printf "%s/reveal-hugo/head" (.Page.Section | default "home") -}} + {{- if fileExists (printf "layouts/partials/%s.html" $sectionHeadPartial) -}}{{ partial $sectionHeadPartial . }}{{- end }} {{- block "main" . -}}{{- end -}} - - - {{ partial "reveal-hugo/body" . }} + + {{- partial "reveal-hugo/body" . }} + + {{- $sectionBodyPartial := printf "%s/reveal-hugo/body" (.Page.Section | default "home") -}} + {{- if fileExists (printf "layouts/partials/%s.html" $sectionBodyPartial) -}}{{ partial $sectionBodyPartial . }}{{- end }}