menu-filetree-np.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. {{ $current := . }}
  2. {{ $site := .Site }}
  3. {{ $current.Scratch.Set "prev" false }}
  4. {{ $current.Scratch.Set "getNext" false }}
  5. {{ $current.Scratch.Set "nextPage" false }}
  6. {{ $current.Scratch.Set "prevPage" false }}
  7. {{ template "menu-filetree-np" dict "sect" .Site.Home.Sections "current" $current "site" $site }}
  8. {{ define "menu-filetree-np" }}
  9. {{ $current := .current }}
  10. {{ $site := .site }}
  11. {{ $sortBy := (default "title" .current.Site.Params.geekdocFileTreeSortBy | lower) }}
  12. {{ range .sect.GroupBy "Weight" }}
  13. {{ $rangeBy := .ByTitle }}
  14. {{ if eq $sortBy "title" }}
  15. {{ $rangeBy = .ByTitle }}
  16. {{ else if eq $sortBy "linktitle" }}
  17. {{ $rangeBy = .ByLinkTitle }}
  18. {{ else if eq $sortBy "date" }}
  19. {{ $rangeBy = .ByDate }}
  20. {{ else if eq $sortBy "publishdate" }}
  21. {{ $rangeBy = .ByPublishDate }}
  22. {{ else if eq $sortBy "expirydate" }}
  23. {{ $rangeBy = .ByExpiryDate }}
  24. {{ else if eq $sortBy "lastmod" }}
  25. {{ $rangeBy = .ByLastmod }}
  26. {{ else if eq $sortBy "title_reverse" }}
  27. {{ $rangeBy = .ByTitle.Reverse }}
  28. {{ else if eq $sortBy "linktitle_reverse" }}
  29. {{ $rangeBy = .ByLinkTitle.Reverse }}
  30. {{ else if eq $sortBy "date_reverse" }}
  31. {{ $rangeBy = .ByDate.Reverse }}
  32. {{ else if eq $sortBy "publishdate_reverse" }}
  33. {{ $rangeBy = .ByPublishDate.Reverse }}
  34. {{ else if eq $sortBy "expirydate_reverse" }}
  35. {{ $rangeBy = .ByExpiryDate.Reverse }}
  36. {{ else if eq $sortBy "lastmod_reverse" }}
  37. {{ $rangeBy = .ByLastmod.Reverse }}
  38. {{ end }}
  39. {{ range $rangeBy }}
  40. {{ $current.Scratch.Set "current" $current }}
  41. {{ $current.Scratch.Set "site" $site }}
  42. {{ if not .Params.geekdocHidden }}
  43. {{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
  44. {{ $site := $current.Scratch.Get "site" }}
  45. {{ $this := . }}
  46. {{ $current := $current.Scratch.Get "current" }}
  47. {{ $current.Scratch.Set "refName" (partial "utils/title" .) }}
  48. {{ $name := $current.Scratch.Get "refName" }}
  49. {{ if $current.Scratch.Get "getNext" }}
  50. {{ if or $this.Content $this.Params.geekdocFlatSection }}
  51. {{ $current.Scratch.Set "nextPage" (dict "name" $name "this" $this) }}
  52. {{ $current.Scratch.Set "getNext" false }}
  53. {{ end }}
  54. {{ end }}
  55. {{ if eq $current.RelPermalink $this.RelPermalink }}
  56. {{ $current.Scratch.Set "prevPage" ($current.Scratch.Get "prev") }}
  57. {{ $current.Scratch.Set "getNext" true }}
  58. {{ end }}
  59. {{ if or $this.Content $this.Params.geekdocFlatSection }}
  60. {{ $current.Scratch.Set "prev" (dict "name" $name "this" $this) }}
  61. {{ end }}
  62. {{ $sub := and (ne $numberOfPages 0) (not .Params.geekdocFlatSection) }}
  63. {{ if $sub }}
  64. {{ template "menu-filetree-np" dict "sect" .Pages "current" $current }}
  65. {{ end }}
  66. {{ end }}
  67. {{ end }}
  68. {{ end }}
  69. {{ end }}
  70. <span class="gdoc-page__nav">
  71. {{ with ($current.Scratch.Get "prevPage") }}
  72. <a
  73. class="gdoc-page__nav--prev flex align-center"
  74. href="{{ .this.RelPermalink }}"
  75. title="{{ .name }}"
  76. >
  77. <i class="gdoc-icon">gdoc_arrow_left_alt</i>
  78. {{ .name }}
  79. </a>
  80. {{ end }}
  81. </span>
  82. <span class="gdoc-page__nav">
  83. {{ with ($current.Scratch.Get "nextPage") }}
  84. <a
  85. class="gdoc-page__nav--next flex align-center"
  86. href="{{ .this.RelPermalink }}"
  87. title="{{ .name }}"
  88. >
  89. {{ .name }}
  90. <i class="gdoc-icon">gdoc_arrow_right_alt</i>
  91. </a>
  92. {{ end }}
  93. </span>