nav copy.html 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <header class="navbar-affixed-top" data-spy="affix" data-offset-top="62">
  2. <div class="navbar navbar-default yamm {{ if .Site.Params.dropdown_mouse_over }}mouseover{{ end }}" role="navigation"
  3. id="navbar">
  4. <div class="container">
  5. <div class="navbar-header">
  6. <a class="navbar-brand home" href="{{ " /" | relLangURL }}">
  7. {{ if default false .Site.Params.disabled_logo }}
  8. <h4>{{ .Site.Params.logo_text }}</h4>
  9. {{ else }}
  10. <img src="{{ .Site.Params.logo | relURL }}" alt="{{ .Title }} logo" class="hidden-xs hidden-sm" />
  11. <img src="{{ .Site.Params.logo_small | relURL }}" alt="{{ .Title }} logo" class="visible-xs visible-sm" />
  12. {{ end }}
  13. <span class="sr-only">{{ .Title }} - {{ i18n "navHome" }}</span>
  14. </a>
  15. <div class="navbar-buttons">
  16. <button type="button" class="navbar-toggle btn-template-main" data-toggle="collapse"
  17. data-target="#navigation">
  18. <span class="sr-only">{{ i18n "navToggle" }}</span>
  19. <i class="fas fa-align-justify"></i>
  20. </button>
  21. </div>
  22. </div>
  23. <!--/.navbar-header -->
  24. <div class="navbar-collapse collapse" id="navigation">
  25. <ul class="nav navbar-nav navbar-right">
  26. {{ $current := . }}
  27. {{ range .Site.Menus.main.ByWeight }}
  28. {{ $topLevel := replace .URL "/" "" }}
  29. {{ $active := "" }}
  30. {{ if eq $current.RelPermalink .URL }}
  31. {{ $active = "active" }}
  32. {{ end }}
  33. {{ if eq $current.Type $topLevel }}
  34. {{ $active = "active" }}
  35. {{ end }}
  36. {{ if and (or (eq $current.RelPermalink .URL) (eq "term" $current.Kind)) (in (slice "page" "term")
  37. $current.Kind) }}
  38. {{ range (split .URL "/") }}
  39. {{ if eq "blog" . }}
  40. {{ $active = "active" }}
  41. {{ end }}
  42. {{ end }}
  43. {{ end }}
  44. {{ if .HasChildren }}
  45. <!-- Check if the first child marks a menu section identifier -->
  46. {{ $hasSections := (hasPrefix (index .Children 0).Identifier "section.") }}
  47. <li class="dropdown{{ if $hasSections }} use-yamm yamm-fw{{end}} {{ $active }}">
  48. <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
  49. aria-expanded="false">{{ .Name }} <span class="caret"></span></a>
  50. {{ if $hasSections }}
  51. <ul class="dropdown-menu">
  52. <li>
  53. <div class="yamm-content">
  54. <div class="row">
  55. {{ if ne .URL "" }}
  56. <div class="col-sm-6">
  57. <img src="{{ .URL }}" class="img-responsive hidden-xs" />
  58. </div>
  59. {{ end }}
  60. <div class="col-sm-3">
  61. {{ range .Children.ByWeight }}
  62. {{ $column := printf "%s" .Post }}
  63. {{ if eq $column "1" }}
  64. <h5>{{ .Name }}</h5>
  65. {{ if .HasChildren }}
  66. <ul>
  67. {{ range .Children.ByWeight }}
  68. <li><a href="{{ .URL }}">{{ .Name }}</a></li>
  69. {{- end }}
  70. </ul>
  71. {{ end }}
  72. {{ end }}
  73. {{ end }}
  74. </div>
  75. <div class="col-sm-3">
  76. {{ range .Children.ByWeight }}
  77. {{ $column := printf "%s" .Post }}
  78. {{ if eq $column "2" }}
  79. <h5>{{ .Name }}</code></h5>
  80. {{ if .HasChildren }}
  81. <ul>
  82. {{ range .Children.ByWeight }}
  83. <li><a href="{{ .URL }}">{{ .Name }}</a></li>
  84. {{ end }}
  85. </ul>
  86. {{ end }}
  87. {{ end }}
  88. {{ end }}
  89. </div>
  90. {{ if eq .URL "" }}
  91. <div class="col-sm-3">
  92. {{ range .Children }}
  93. {{ $column := printf "%s" .Post }}
  94. {{ if eq $column "3" }}
  95. <h5>{{ .Name }}</code></h5>
  96. {{ if .HasChildren }}
  97. <ul>
  98. {{ range .Children.ByWeight }}
  99. <li><a href="{{ .URL }}">{{ .Name }}</a></li>
  100. {{ end }}
  101. </ul>
  102. {{ end }}
  103. {{ end }}
  104. {{ end }}
  105. </div>
  106. <div class="col-sm-3">
  107. {{ range .Children }}
  108. {{ $column := printf "%s" .Post }}
  109. {{ if eq $column "4" }}
  110. <h5>{{ .Name }}</code></h5>
  111. {{ if .HasChildren }}
  112. <ul>
  113. {{ range .Children.ByWeight }}
  114. <li><a href="{{ .URL }}">{{ .Name }}</a></li>
  115. {{ end }}
  116. </ul>
  117. {{ end }}
  118. {{ end }}
  119. {{ end }}
  120. </div>
  121. {{ end }}
  122. </div>
  123. </div>
  124. </li>
  125. </ul>
  126. {{ else }}
  127. <ul class="dropdown-menu">
  128. {{ range .Children.ByWeight }}
  129. <li><a href="{{ .URL }}">{{ .Name }}</a></li>
  130. {{ end }}
  131. </ul>
  132. {{ end }}
  133. </li>
  134. {{ else }}
  135. <li class="dropdown {{ $active }}">
  136. <a href="{{ .URL }}">{{ .Name }}</a>
  137. </li>
  138. {{ end }}
  139. {{ end }}
  140. </ul>
  141. </div>
  142. <!--/.nav-collapse -->
  143. <div class="collapse clearfix" id="search">
  144. <form class="navbar-form" role="search">
  145. <div class="input-group">
  146. <input type="text" class="form-control" placeholder="Search">
  147. <span class="input-group-btn">
  148. <button type="submit" class="btn btn-template-main"><i class="fas fa-search"></i></button>
  149. </span>
  150. </div>
  151. </form>
  152. </div>
  153. <!--/.nav-collapse -->
  154. </div>
  155. </div>
  156. </header>
  157. <!-- *** NAVBAR END ***-->
  158. <header>
  159. <nav class="navbar navbar-expand-lg navbar-dark p-0">
  160. <div class="container-fluid p-0">
  161. <div class="mx-auto">
  162. <a class="navbar-brand home" href="{{ " /" | relLangURL }}">
  163. {{ if default false .Site.Params.disabled_logo }}
  164. <h4>{{ .Site.Params.logo_text }}</h4>
  165. {{ else }}
  166. <img src="{{ .Site.Params.logo | relURL }}" alt="{{ .Title }} logo" class="hidden-xs hidden-sm" />
  167. <img src="{{ .Site.Params.logo_small | relURL }}" alt="{{ .Title }} logo" class="visible-xs visible-sm" />
  168. {{ end }}
  169. <span class="sr-only">{{ .Title }} - {{ i18n "navHome" }}</span>
  170. </a>
  171. </div>
  172. <button onclick="changeIcon(this)" class="navbar-toggler" type="button" data-bs-toggle="collapse"
  173. data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
  174. aria-label="Toggle navigation">
  175. <span data-toggle-class="icon" class="navbar-toggler-icon"></span>
  176. </button>
  177. <div class="collapse navbar-collapse" id="navbarSupportedContent">
  178. <ul class="navbar-nav align-items-lg-center mx-auto mb-2 mb-lg-0">
  179. <li class="navbar-logo">
  180. <a class="navbar-brand home" href="{{ " /" | relLangURL }}">
  181. {{ if default false .Site.Params.disabled_logo }}
  182. <h4>{{ .Site.Params.logo_text }}</h4>
  183. {{ else }}
  184. <img src="{{ .Site.Params.logo | relURL }}" alt="{{ .Title }} logo" class="hidden-xs hidden-sm" />
  185. <img src="{{ .Site.Params.logo_small | relURL }}" alt="{{ .Title }} logo" class="visible-xs visible-sm" />
  186. {{ end }}
  187. <span class="sr-only">{{ .Title }} - {{ i18n "navHome" }}</span>
  188. </a>
  189. </li>
  190. {{ $current := . }}
  191. {{ range .Site.Menus.main.ByWeight }}
  192. {{ $topLevel := replace .URL "/" "" }}
  193. {{ $active := "" }}
  194. {{ if eq $current.RelPermalink .URL }}
  195. {{ $active = "active" }}
  196. {{ end }}
  197. {{ if eq $current.Type $topLevel }}
  198. {{ $active = "active" }}
  199. {{ end }}
  200. {{ if and (or (eq $current.RelPermalink .URL) (eq "term" $current.Kind)) (in (slice "page" "term")
  201. $current.Kind) }}
  202. {{ range (split .URL "/") }}
  203. {{ if eq "blog" . }}
  204. {{ $active = "active" }}
  205. {{ end }}
  206. {{ end }}
  207. {{ end }}
  208. <li class="dropdown {{ $active }}">
  209. <a href="{{ .URL }}">{{ .Name }}</a>
  210. </li>
  211. {{ end }}
  212. <!-- <li class="">
  213. <a class="navbar-link" href="/collection.html">室內設計作品</a>
  214. </li>
  215. <li class="nav-item">
  216. <a class="navbar-link" href="/room_planner.html">成家設計服務</a>
  217. </li>
  218. <li class="nav-item">
  219. <a class="navbar-link" href="/frequently_asked_questions.html">服務常見QA</a>
  220. </li>
  221. <li class="nav-item">
  222. <a class="navbar-link" href="/categories.html">成家知識專欄</a>
  223. </li>
  224. <li class="nav-item">
  225. <a class="navbar-link" href="/furniture_design.html">小寶設計單品</a>
  226. </li>
  227. <li class="nav-item">
  228. <a class="navbar-link" href="/store.html">小寶優居門市</a>
  229. </li> -->
  230. </ul>
  231. </div>
  232. </div>
  233. </nav>
  234. </header>