Fix error if static/files/citations/ folder doesn't exist (Fix #329)

* Require Hugo 0.30.2+
This commit is contained in:
George Cushen committed 2017-10-19 19:00:27 +01:00
1 parent 41d0123b54
commit 3b76068360
2 files changed
+3 -4

No files matched your search

+2 -3
View File
@@ -11,10 +11,9 @@
{{ i18n "btn_pdf" }}
</a>
{{ end }}
{{/* TODO: After Hugo v0.30 released, use fileExists function here. */}}
{{ $directory := "static/files/citations/" }}
{{ $filename := printf "%s.bib" $.File.TranslationBaseName }}
{{ if (where (readDir $directory) "Name" $filename) }}
{{ $filename := printf "%s%s.bib" $directory $.File.TranslationBaseName }}
{{ if fileExists $filename }}
<button type="button" class="btn btn-primary btn-outline{{ if $is_list }} btn-xs{{end}} js-cite-modal"
data-filename="{{ printf "files/citations/%s.bib" $.File.TranslationBaseName | relURL }}">
{{ i18n "btn_cite" }}
+1 -1
View File
@@ -3,7 +3,7 @@ license = "MIT"
licenselink = "https://github.com/gcushen/hugo-academic/blob/master/LICENSE.md"
description = "Easily create beautifully simple academic or personal sites"
homepage = "https://github.com/gcushen/hugo-academic"
min_version = 0.27
min_version = "0.30.2"
tags = ["academic",
"portfolio",
"responsive",