publication_links.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. {{ $is_list := .is_list }}
  2. {{ $ := .content }}
  3. {{ with $.Params.url_preprint }}
  4. <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ . | relURL }}" target="_blank" rel="noopener">
  5. {{ i18n "btn_preprint" }}
  6. </a>
  7. {{ end }}
  8. {{ $pdf := "" }}
  9. {{ $slug := "" }}
  10. {{ if eq $.File.TranslationBaseName "index" }}{{/* Check if using dir-based page bundles. */}}
  11. {{ $slug = delimit (last 1 (split (substr $.Dir 0 -1) "/")) "" }}
  12. {{ end }}
  13. {{ $resource := $.Resources.GetMatch (printf "%s.pdf" $slug) }}
  14. {{ with $resource }}
  15. {{ $pdf = .RelPermalink }}
  16. {{ else }}
  17. {{ if $.Params.url_pdf }}
  18. {{ $pdf = $.Params.url_pdf | relURL }}
  19. {{ end }}
  20. {{ end }}
  21. {{ with $pdf }}
  22. <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ . }}" target="_blank" rel="noopener">
  23. {{ i18n "btn_pdf" }}
  24. </a>
  25. {{ end }}
  26. {{ $resource := $.Resources.GetMatch "*.bib" }}
  27. {{ with $resource }}
  28. <button type="button" class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}} js-cite-modal"
  29. data-filename="{{ .RelPermalink }}">
  30. {{ i18n "btn_cite" }}
  31. </button>
  32. {{ end }}
  33. {{ with $.Params.url_code }}
  34. <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ . | relURL }}" target="_blank" rel="noopener">
  35. {{ i18n "btn_code" }}
  36. </a>
  37. {{ end }}
  38. {{ with $.Params.url_dataset }}
  39. <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ . | relURL }}" target="_blank" rel="noopener">
  40. {{ i18n "btn_dataset" }}
  41. </a>
  42. {{ end }}
  43. {{ if $.Params.projects }}
  44. {{ range $.Params.projects }}
  45. {{ with ($.Site.GetPage (printf "project/%s" .)) }}
  46. <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ .RelPermalink }}">
  47. {{ i18n "btn_project" }}
  48. </a>
  49. {{ else }}
  50. {{/* errorf "The `projects` parameter in `content/%s` references a project file, `content/project/%s`, which cannot be found. Please either set `projects = []` or fix the reference." $.File.Path . */}}
  51. {{ end }}
  52. {{ end }}
  53. {{ else }}
  54. {{ with $.Params.url_project }}
  55. <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ . | relLangURL }}" target="_blank" rel="noopener">
  56. {{ i18n "btn_project" }}
  57. </a>
  58. {{ end }}
  59. {{ end }}
  60. {{ with $.Params.url_poster }}
  61. <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ . | relURL }}" target="_blank" rel="noopener">
  62. {{ i18n "btn_poster" }}
  63. </a>
  64. {{ end }}
  65. {{ with $.Params.url_slides }}
  66. <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ . | relURL }}" target="_blank" rel="noopener">
  67. {{ i18n "btn_slides" }}
  68. </a>
  69. {{ end }}
  70. {{ with $.Params.url_video }}
  71. <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ . | relURL }}" target="_blank" rel="noopener">
  72. {{ i18n "btn_video" }}
  73. </a>
  74. {{ end }}
  75. {{ with $.Params.url_source }}
  76. <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ . | relURL }}" target="_blank" rel="noopener">
  77. {{ i18n "btn_source" }}
  78. </a>
  79. {{ end }}
  80. {{ with $.Params.doi }}
  81. <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="https://doi.org/{{ . }}" target="_blank" rel="noopener">
  82. DOI
  83. </a>
  84. {{ end }}
  85. {{ range $.Params.url_custom }}
  86. <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ .url | relURL }}" target="_blank" rel="noopener">
  87. {{ .name }}
  88. </a>
  89. {{ end }}