diff --git a/layouts/partials/publication_links.html b/layouts/partials/publication_links.html index 186f3142..623e772a 100644 --- a/layouts/partials/publication_links.html +++ b/layouts/partials/publication_links.html @@ -6,8 +6,21 @@ {{ i18n "btn_preprint" }} {{ end }} -{{ with $.Params.url_pdf }} - +{{ $pdf := "" }} +{{ $slug := "" }} +{{ if eq $.File.TranslationBaseName "index" }}{{/* Check if using dir-based page bundles. */}} + {{ $slug = delimit (last 1 (split (substr $.Dir 0 -1) "/")) "" }} +{{ end }} +{{ $resource := $.Resources.GetMatch (printf "%s.pdf" $slug) }} +{{ with $resource }} + {{ $pdf = .RelPermalink }} +{{ else }} + {{ if $.Params.url_pdf }} + {{ $pdf = $.Params.url_pdf | relURL }} + {{ end }} +{{ end }} +{{ with $pdf }} + {{ i18n "btn_pdf" }} {{ end }}