navbar-2.html 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. {{/* default logos */}}
  2. {{ $mainLogo := "/images/main-logo.png" }}
  3. {{ $invertedLogo := "/images/inverted-logo.png" }}
  4. {{/* if custom logo has been provided in the config file, then use them */}}
  5. {{ if site.Params.logo.main }}
  6. {{ $mainLogo = site.Params.logo.main }}
  7. {{ end }}
  8. {{ if site.Params.logo.inverted }}
  9. {{ $invertedLogo = site.Params.logo.inverted }}
  10. {{ end }}
  11. {{/* resize the logos. don't resize svg because it is not supported */}}
  12. {{ $mainLogo := resources.Get $mainLogo}}
  13. {{ if and $mainLogo (ne $mainLogo.MediaType.SubType "svg") }}
  14. {{ $mainLogo = $mainLogo.Resize "42x" }}
  15. {{ end }}
  16. {{ $mainLogo = $mainLogo.RelPermalink}}
  17. {{ $invertedLogo := resources.Get $invertedLogo}}
  18. {{ if and $invertedLogo (ne $invertedLogo.MediaType.SubType "svg") }}
  19. {{ $invertedLogo = $invertedLogo.Resize "42x" }}
  20. {{ end }}
  21. {{ $invertedLogo = $invertedLogo.RelPermalink}}
  22. <nav class="navbar navbar-expand-xl top-navbar final-navbar shadow">
  23. <div class="container">
  24. <button class="navbar-toggler navbar-light" id="sidebar-toggler" type="button" onclick="toggleSidebar()">
  25. <span class="navbar-toggler-icon"></span>
  26. </button>
  27. <a class="navbar-brand" href="{{ site.BaseURL | relLangURL }}">
  28. <img src="{{ $mainLogo }}">
  29. {{- site.Title -}}
  30. </a>
  31. <button class="navbar-toggler navbar-light" id="toc-toggler" type="button" onclick="toggleTOC()">
  32. <span class="navbar-toggler-icon"></span>
  33. </button>
  34. <div class="collapse navbar-collapse lang-selector" id="top-nav-items">
  35. <ul class="navbar-nav ml-auto">
  36. {{ if .IsTranslated }}
  37. {{ partial "navigators/lang-selector-2.html" . }}
  38. {{ end }}
  39. </ul>
  40. </div>
  41. </div>
  42. <!-- Store the logo information in a hidden img for the JS -->
  43. <img src="{{ $mainLogo }}" class="d-none" id="main-logo">
  44. <img src="{{ $invertedLogo }}" class="d-none" id="inverted-logo">
  45. </nav>