Skip to content

Commit

Permalink
Fix error if static/files/citations/ folder doesn't exist (Fix #329)
Browse files Browse the repository at this point in the history
* Require Hugo 0.30.2+
  • Loading branch information
gcushen committed Oct 19, 2017
1 parent 41d0123 commit 3b76068
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions layouts/partials/publication_links.html
Expand Up @@ -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" }}
Expand Down
2 changes: 1 addition & 1 deletion theme.toml
Expand Up @@ -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",
Expand Down

0 comments on commit 3b76068

Please sign in to comment.