footer.html 4.6 KB

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