sidebar.html 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. {{ $s := .Site.Params }}
  2. <aside class="sidebar">
  3. <section class="sidebar_inner">
  4. <div class="intro">
  5. <h2>{{ .Site.Title }}</h2>
  6. <p>{{ $s.IntroDescription }}</p>
  7. <a href='{{ absLangURL "about/" }}' class="button mt-1" role="button">About This Site</a>
  8. </div>
  9. {{ partial "subscriber-form" . }}
  10. {{- $posts := where (where .Site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" $s.mainSections }}
  11. {{- $featured := default 8 $s.numberOfFeaturedPosts }}
  12. {{- with first $featured (where $posts "Params.featured" true)}}
  13. <h2 class="widget-title mt-4" style="font-size: 1.4rem;">{{ i18n "featured_posts" }}</h2>
  14. <ul>
  15. {{- range . }}
  16. <li>
  17. <a href="{{ .Permalink }}" class="nav-link">{{ .Title }}</a>
  18. </li>
  19. {{- end }}
  20. </ul>
  21. {{- end }}
  22. <!-- <h2 class="widget-title mt-4">{{ i18n "recent_posts" }}</h2>
  23. <ul class="flex-column">
  24. {{- $recent := default 8 $s.numberOfRecentPosts }}
  25. {{- range first $recent $posts }}
  26. <li>
  27. <a href="{{ .Permalink }}" class="nav-link">{{ .Title }}</a>
  28. </li>
  29. {{- end }}
  30. </ul> -->
  31. {{- $tagsLimit := $s.numberOfTagsShown }}
  32. {{- range $key, $value := .Site.Taxonomies }}
  33. {{- if gt $value 0 }}
  34. <div>
  35. <h2 class="widget-title mt-4 taxonomy" id="{{ $key }}-section">{{ i18n $key }}</h2>
  36. <nav class="tags_nav">
  37. {{- $onPageTags := $.Page.Params.tags }}
  38. {{- $slicedTags := ($value.ByCount | first $tagsLimit) }}
  39. {{- range $slicedTags }}
  40. <a href='{{ absLangURL $key }}/{{ (replace .Name "#" "%23") | urlize }}/' class="post_tag button button_translucent">
  41. {{ upper .Name }}
  42. <span class="button_tally">{{ .Count }}</span>
  43. </a>
  44. {{ end }}
  45. {{ if gt (len $value.ByCount) $tagsLimit }}
  46. <br>
  47. <div class="post_tags_toggle button">{{ printf "all_%s" $key | i18n }}</div>
  48. {{- $tagsInfo := newScratch }}
  49. <div class="post_tags">
  50. <div class="tags_list">
  51. {{- range $value.Alphabetical }}
  52. {{ $tagsInfo.Add "tagsInfo" (slice .Name .Count)}}
  53. <a href='{{ absLangURL $key }}/{{ (replace .Name "#" "%23") | urlize }}/' class=" post_tag button button_translucent" data-position={{ .Count }}>
  54. {{- upper .Name -}}
  55. <span class="button_tally">{{ .Count }}</span>
  56. </a>
  57. {{ end }}
  58. <div class="tags_sort"><span title="sort alphabetically">[A~Z]</span><span title="sort by count">[0~9]</span>
  59. </div>
  60. <span class="tags_hide"><svg class="icon">
  61. <use xlink:href="#closeme"></use>
  62. </svg></span>
  63. </div>
  64. </div>
  65. {{- end }}
  66. </nav>
  67. </div>
  68. {{- end }}
  69. {{- end }}
  70. </section>
  71. </aside>