From f6a1568da13ede7bc6104445bb11d51939ecbbed Mon Sep 17 00:00:00 2001 From: dzello Date: Tue, 7 Aug 2018 18:02:47 +0200 Subject: [PATCH] Use $.Param and default function for cleaning config reading --- exampleSite/config.toml | 3 --- layouts/_default/baseof.reveal.html | 17 +++++++---------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index a5910a0..3c6f1c0 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -8,9 +8,6 @@ themesDir = "../" [author] name = "Josh Dzielak" -[params] -description = "Includes a handy markdown-based syntax and shortcodes to help you get presentations done fast" - [params.reveal_hugo] history = true diff --git a/layouts/_default/baseof.reveal.html b/layouts/_default/baseof.reveal.html index 6feac93..9db28a3 100644 --- a/layouts/_default/baseof.reveal.html +++ b/layouts/_default/baseof.reveal.html @@ -1,26 +1,26 @@ -{{- $reveal_cdn := or .Page.Params.reveal_hugo.reveal_cdn .Site.Params.reveal_hugo.reveal_cdn "https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0" -}} -{{- $highlight_cdn := or .Page.Params.reveal_hugo.highlight_cdn .Site.Params.reveal_hugo.highlight_cdn "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0" -}} +{{- $reveal_cdn := $.Param "reveal_hugo.reveal_cdn" | default "https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.6.0" -}} +{{- $highlight_cdn := $.Param "reveal_hugo.highlight_cdn" | default "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0" -}} {{ or .Page.Title .Site.Title }} - - + {{ with $.Param "description" }}{{ end }} + {{ with .Site.Author.name }}{{ end }} - {{- $theme := or .Page.Params.reveal_hugo.theme .Site.Params.reveal_hugo.theme .Site.Data.reveal_hugo.defaults.theme "black" -}} - {{- $custom_theme := or .Page.Params.reveal_hugo.custom_theme .Site.Params.reveal_hugo.custom_theme -}} + {{- $theme := $.Param "reveal_hugo.theme" | default "black" -}} + {{- $custom_theme := $.Param "reveal_hugo.custom_theme" -}} {{- if $custom_theme -}} {{ else -}} {{- end -}} - {{- $highlight_theme := or .Page.Params.reveal_hugo.highlight_theme .Site.Params.reveal_hugo.highlight_theme .Site.Data.reveal_hugo.defaults.highlight_theme "default" -}} + {{- $highlight_theme := $.Param "reveal_hugo.highlight_theme" | default "default" -}} - {{- partial "reveal-hugo/head" . -}}