Ver código fonte

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

* Require Hugo 0.30.2+
George Cushen 7 anos atrás
pai
commit
3b76068360
2 arquivos alterados com 3 adições e 4 exclusões
  1. 2 3
      layouts/partials/publication_links.html
  2. 1 1
      theme.toml

+ 2 - 3
layouts/partials/publication_links.html

@@ -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
theme.toml

@@ -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",