categories.html 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <div class="panel panel-default sidebar-menu">
  2. <div class="panel-heading">
  3. <h3 class="panel-title">{{ i18n "categoriesTitle" }}</h3>
  4. </div>
  5. {{ $blogFolder := .Site.GetPage "section" "blog" }}
  6. {{ $current := . }}
  7. {{ with $blogFolder }}
  8. {{ $blogPages := .Pages }}
  9. <div class="panel-body">
  10. <ul class="nav nav-pills nav-stacked">
  11. {{ $uniqueCategories := slice }}
  12. {{ range $blogPages }}
  13. {{ with .Params.categories }}
  14. {{ range . }}
  15. {{ $categoryName := . }}
  16. {{ if not (in $uniqueCategories $categoryName) }}
  17. {{ $uniqueCategories = $uniqueCategories | append $categoryName }}
  18. <li{{ if eq $current.RelPermalink (printf "/categories/%s/" $categoryName | urlize | lower) }} class="active"{{ end }}>
  19. <a href="{{ "categories/" | relURL }}{{ $categoryName | urlize | lower }}">{{ $categoryName | title }}</a>
  20. </li>
  21. {{ end }}
  22. {{ end }}
  23. {{ end }}
  24. {{ end }}
  25. </ul>
  26. </div>
  27. {{ end }}
  28. </div>
  29. <!-- {{ if .Site.Params.widgets.categories }}
  30. {{ if isset .Site.Taxonomies "categories" }}
  31. {{ if not (eq (len .Site.Taxonomies.categories) 0) }}
  32. <div class="panel panel-default sidebar-menu">
  33. <div class="panel-heading">
  34. <h3 class="panel-title">{{ i18n "categoriesTitle" }}</h3>
  35. </div>
  36. <div class="panel-body">
  37. <ul class="nav nav-pills nav-stacked">
  38. {{ $current := . }}
  39. {{ range $name, $items := .Site.Taxonomies.categories }}
  40. <li{{ if eq $current.RelPermalink ($name | urlize | lower | printf "/categories/%s/") }} class="active"{{ end }}>
  41. <a href="{{ "categories/" | relURL }}{{ $name | urlize | lower }}">{{ $name }} ({{ len $items }})</a>
  42. </li>
  43. {{ end }}
  44. </ul>
  45. </div>
  46. </div>
  47. {{ end }}
  48. {{ end }}
  49. {{ end }} -->