breadcrumbs.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <nav class="flex my-6" aria-label="Breadcrumb">
  2. <ol class="flex flex-wrap items-center breadcrumbs">
  3. {{ template "breadcrumb" dict "currentPage" .Page "id" .UniqueID }}
  4. </ol>
  5. </nav>
  6. <!-- templates -->
  7. {{ define "breadcrumb" }} {{ if .currentPage.Parent }} {{ template "breadcrumb" dict "currentPage"
  8. .currentPage.Parent }} {{ else }}
  9. <li class="list-none">
  10. <a href="/" class="block md:mr-3">
  11. <svg
  12. xmlns="http://www.w3.org/2000/svg"
  13. fill="none"
  14. viewBox="0 0 24 24"
  15. stroke-width="1.5"
  16. stroke="currentColor"
  17. class="w-4 h-4"
  18. >
  19. <path
  20. stroke-linecap="round"
  21. stroke-linejoin="round"
  22. d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25"
  23. />
  24. </svg>
  25. </a>
  26. </li>
  27. {{ end }} {{ $title := cond (eq .currentPage.RelPermalink "/docs/" ) "Docs" (title .currentPage.Title) }} {{
  28. if (ne .currentPage.Parent .IsHome) }}
  29. <li class="list-none">
  30. <div class="flex items-center md:space-x-3 md:mr-3">
  31. {{ if ne $title "Docs" }}
  32. <svg
  33. class="flex-shrink-0 h-5 w-5 text-gray-400"
  34. xmlns="http://www.w3.org/2000/svg"
  35. viewBox="0 0 20 20"
  36. fill="currentColor"
  37. aria-hidden="true"
  38. >
  39. <path
  40. fill-rule="evenodd"
  41. d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
  42. clip-rule="evenodd"
  43. />
  44. </svg>
  45. {{ end }} {{ if eq .id .currentPage.UniqueID }}
  46. <span class="text-sm font-medium text-gray-500 hover:text-gray-700">{{ $title }}</span>
  47. {{ else }}
  48. <a
  49. href="{{ .currentPage.RelPermalink }}"
  50. class="text-sm font-medium text-gray-500 hover:text-gray-700"
  51. >{{ $title }}</a
  52. >
  53. {{ end }}
  54. </div>
  55. </li>
  56. {{ end }} {{ end }}