From f5ceeef456483033d22bee09cfad78083c122850 Mon Sep 17 00:00:00 2001 From: Alejandro Alcalde Date: Wed, 1 Aug 2018 19:11:35 +0200 Subject: [PATCH] Added author section, to document #178 --- doc/ox-hugo-manual.org | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/doc/ox-hugo-manual.org b/doc/ox-hugo-manual.org index 3f3d7a9..191e573 100644 --- a/doc/ox-hugo-manual.org +++ b/doc/ox-hugo-manual.org @@ -1681,6 +1681,42 @@ disclosure /details/ to show in blue. #+html: #+html: +*** Author + :PROPERTIES: + :EXPORT_FILE_NAME: author + :END: +The =author= front-matter parameter is designed to always be a list, +so multiple authors can be supported. + +If you already have a blog, and in your font-matter =author= is set as +a *String*, you can use the following snippet: + +#+begin_src +{{ with .Params.author }} + {{ $author_type := (printf "%T" .) }} + {{ $author_is_slice := (eq "[]string" $author_type) }} +
+ {{ if $author_is_slice }} + {{ index . 0 | safeHTML }} + {{ else }} + {{ . | safeHTML }} + {{ end }} +
+{{ end }} +#+end_src + +What the above code does: +- If the author front-matter parameter exists: + - If author is a slice (list), insert its first element, + - Else, insert it whole. + +Other workaround could be to manually set the =author= param as a +String and not a slice: + +#+begin_src org +#+hugo_custom_front_matter: :author "foo bar" +#+end_src + ** Enhancements :PROPERTIES: :EXPORT_HUGO_MENU: :menu "6.enhancements"