footer.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. {{/* variables for enabling/disabling parts of the footer */}}
  2. {{ $footerEnabled := site.Params.footer.enable | default true }}
  3. {{ $navigationEnabled := site.Params.footer.navigation.enable | default true }}
  4. {{ $contactMeEnabled := site.Params.footer.contactMe.enable | default true }}
  5. {{ $newsletterEnabled := site.Params.footer.newsletter.enable | default true }}
  6. {{ $credentialsEnabled := site.Params.footer.credentials.enable | default true }}
  7. {{ $disclaimerEnabled := site.Params.footer.disclaimer.enable | default false }}
  8. {{/* Keep backward compatibility for the newsletter function */}}
  9. {{ if site.Params.newsletter.enable }}
  10. {{ $newsletterEnabled = true }}
  11. {{ else }}
  12. {{ $newsletterEnabled = false }}
  13. {{ end }}
  14. {{ if $footerEnabled }}
  15. {{ $author:= site.Data.author }}
  16. {{ if (index site.Data site.Language.Lang).author }}
  17. {{ $author = (index site.Data site.Language.Lang).author }}
  18. {{ end }}
  19. {{ $sections:= site.Data.sections }}
  20. {{ if (index site.Data site.Language.Lang).sections }}
  21. {{ $sections = (index site.Data site.Language.Lang).sections }}
  22. {{ end }}
  23. {{ $copyrightNotice := "© 2021 Copyright."}}
  24. {{ if (index site.Data site.Language.Lang).site }}
  25. {{ $siteConfig := (index site.Data site.Language.Lang).site }}
  26. {{ if $siteConfig.copyright }}
  27. {{ $copyrightNotice = $siteConfig.copyright }}
  28. {{ end }}
  29. {{ end }}
  30. {{ $disclaimer := "" }}
  31. {{ $siteConfig := (index site.Data site.Language.Lang).site }}
  32. {{ if $siteConfig.disclaimer }}
  33. {{ $disclaimer = $siteConfig.disclaimer }}
  34. {{ end }}
  35. {{/* footer logos */}}
  36. {{ $themeLogo := "/images/theme-logo.png" }}
  37. {{ $hugoLogo := "/images/hugo-logo.svg" }}
  38. {{/* resize the logos. don't resize svg because it is not supported */}}
  39. {{ $themeLogo:= resources.Get $themeLogo}}
  40. {{ if and $themeLogo (ne $themeLogo.MediaType.SubType "svg") }}
  41. {{ $themeLogo = $themeLogo.Resize "32x" }}
  42. {{ end }}
  43. {{ $themeLogo = $themeLogo.RelPermalink}}
  44. {{ $hugoLogo:= resources.Get $hugoLogo}}
  45. {{ if and $hugoLogo (ne $hugoLogo.MediaType.SubType "svg")}}
  46. {{ $hugoLogo = $hugoLogo.Resize "32x" }}
  47. {{ end }}
  48. {{ $hugoLogo = $hugoLogo.RelPermalink}}
  49. <footer class="container-fluid text-center align-content-center footer pb-2">
  50. <div class="container pt-5">
  51. <div class="row text-left">
  52. {{ if $navigationEnabled }}
  53. <div class="col-md-4 col-sm-12">
  54. <h5>{{ i18n "navigation" }}</h5>
  55. {{ if $sections }}
  56. <ul>
  57. {{- range sort $sections "section.weight" }}
  58. {{ if and (.section.enable) (.section.showOnNavbar)}}
  59. {{ $sectionID := replace (lower .section.name) " " "-" }}
  60. {{ if .section.id }}
  61. {{ $sectionID = .section.id }}
  62. {{ end }}
  63. <li class="nav-item">
  64. <a class="smooth-scroll" href="/#{{ $sectionID }}">{{ .section.name }}</a>
  65. </li>
  66. {{ end }}
  67. {{- end }}
  68. </ul>
  69. {{ end }}
  70. </div>
  71. {{ end }}
  72. {{ if (and $contactMeEnabled $author) }}
  73. <div class="col-md-4 col-sm-12">
  74. <h5>{{ i18n "contact_me" }}</h5>
  75. <ul>
  76. {{ range $key,$value:= $author.contactInfo }}
  77. <li><span>{{ title $key }}: </span> <span>{{ $value }}</span></li>
  78. {{ end }}
  79. </ul>
  80. </div>
  81. {{ end }}
  82. {{ if $newsletterEnabled }}
  83. <div class="col-md-4 col-sm-12">
  84. <!-- <h5>Newsletter</h5> -->
  85. <p>{{ i18n "newsletter_text" }}</p>
  86. <form>
  87. <div class="form-group">
  88. <input
  89. type="email"
  90. class="form-control"
  91. id="exampleInputEmail1"
  92. aria-describedby="emailHelp"
  93. placeholder="{{ i18n "newsletter_input_placeholder" }}"
  94. />
  95. <small id="emailHelp" class="form-text text-muted"
  96. >{{ i18n "newsletter_warning" }}</small
  97. >
  98. </div>
  99. <button type="submit" class="btn btn-info">{{ i18n "submit" }}</button>
  100. </form>
  101. </div>
  102. {{ end }}
  103. </div>
  104. </div>
  105. {{ if and $disclaimerEnabled $disclaimer}}
  106. <hr />
  107. <div class="container">
  108. <p id="disclaimer"><strong>{{ i18n "disclaimer_text" }}:</strong> {{ $disclaimer }}</p>
  109. </div>
  110. {{ end }}
  111. {{ if $credentialsEnabled }}
  112. <hr />
  113. <div class="container">
  114. <div class="row text-left">
  115. <div class="col-md-4">
  116. <a id="theme" href="https://github.com/hossainemruz/toha" target="_blank" rel="noopener">
  117. <img src="{{ $themeLogo }}" alt="Toha Theme Logo">
  118. Toha
  119. </a>
  120. </div>
  121. <div class="col-md-4 text-center">{{ $copyrightNotice | markdownify }}</div>
  122. <div class="col-md-4 text-right">
  123. <a id="hugo" href="https://gohugo.io/" target="_blank" rel="noopener">{{ i18n "hugoAttributionText" }}
  124. <img
  125. src="{{ $hugoLogo }}"
  126. alt="Hugo Logo"
  127. height="18"
  128. />
  129. </a>
  130. </div>
  131. </div>
  132. </div>
  133. {{ end }}
  134. </footer>
  135. {{end}}