Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

menu-filetree.html 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <!-- Put configured sections list to .Scratch -->
  2. {{ template "book-get-root-section" . }}
  3. {{- range .Scratch.Get "BookSections" -}}
  4. {{ template "book-section" (dict "Section" . "CurrentPage" $.Permalink) }}
  5. {{- end -}}
  6. {{ define "book-section" }} <!-- Single section of menu (recursive) -->
  7. <ul>
  8. {{ range .Section.Sections }}
  9. <li {{- if .Params.bookflatsection}} class="flat-section" {{ end }}>
  10. {{- if .Content -}}
  11. {{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
  12. {{- else -}}
  13. {{- template "title" . -}}
  14. {{- end -}}
  15. {{ template "book-section" (dict "Section" . "CurrentPage" $.CurrentPage) }}
  16. </li>
  17. {{ end }}
  18. {{ range .Section.Pages }}
  19. <li>
  20. {{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
  21. </li>
  22. {{ end }}
  23. </ul>
  24. {{ end }}
  25. {{ define "book-page-link" }}
  26. {{- with .Page -}}
  27. <a href="{{ .RelPermalink }}" {{- if eq $.CurrentPage .Permalink }} class="active"{{ end }}>
  28. {{- template "title" . -}}
  29. </a>
  30. {{- end -}}
  31. {{ end }}
  32. {{ define "book-get-root-section" }}
  33. <!-- Complex logic to guess page title without .Title specified -->
  34. {{ $bookSection := default "docs" .Site.Params.BookSection }}
  35. {{ if eq $bookSection "*" }}
  36. {{ .Scratch.Set "BookSections" .Site.Sections }}
  37. {{ else }}
  38. {{ $bookSections := where .Site.Sections "Section" $bookSection }}
  39. {{ .Scratch.Set "BookSections" $bookSections }}
  40. {{ end }}
  41. {{ end }}