Permalink
Browse files

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

* Require Hugo 0.30.2+
  • Loading branch information...
gcushen committed Oct 19, 2017
1 parent 41d0123 commit 3b76068360559d12ddce6c3f5caf09b30bbece0e
Showing with 3 additions and 4 deletions.
  1. +2 −3 layouts/partials/publication_links.html
  2. +1 −1 theme.toml
@@ -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" }}
View
@@ -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",

0 comments on commit 3b76068

Please sign in to comment.