|
1 | 1 | {{ define "main" }} |
2 | | - <div id="main-content" tabindex="-1"> |
3 | | - {{ range .Paginator.Pages.ByTitle }} |
4 | | - <article class="gdoc-post"> |
5 | | - <header class="gdoc-post__header"> |
6 | | - <h1 class="gdoc-post__title"> |
7 | | - <a href="{{ .RelPermalink }}">{{ partial "utils/title" . }}</a> |
8 | | - </h1> |
9 | | - </header> |
| 2 | + <div id="main-content" tabindex="-1" class="taxonomy-terms-page"> |
| 3 | + {{- /* Page Header Section */ -}} |
| 4 | + <header class="taxonomy-terms-header"> |
| 5 | + <h1 class="taxonomy-terms-title">{{ partial "utils/title" . }}</h1> |
| 6 | + {{- if .Description -}} |
| 7 | + <p class="taxonomy-terms-description">{{ .Description }}</p> |
| 8 | + {{- end -}} |
| 9 | + {{- if gt (len .Pages) 0 -}} |
| 10 | + <p class="taxonomy-terms-count" aria-live="polite"> |
| 11 | + {{- $total := len .Pages -}} |
| 12 | + {{- i18n "taxonomy_terms_count" $total -}} |
| 13 | + </p> |
| 14 | + {{- end -}} |
| 15 | + </header> |
10 | 16 |
|
11 | | - <footer class="gdoc-post__meta flex align-center"> |
12 | | - <span class="flex align-center no-wrap"> |
13 | | - {{ $pageCount := len .Pages }} |
14 | | - <svg class="gdoc-icon gdoc_tag"><use xlink:href="#gdoc_tag"></use></svg> |
15 | | - <span class="gdoc-post__tag"> |
16 | | - {{ i18n "posts_count" $pageCount }} |
17 | | - </span> |
18 | | - </span> |
| 17 | + {{- /* Main Content Grid */ -}} |
| 18 | + {{- if gt (len .Paginator.Pages) 0 -}} |
| 19 | + <div class="taxonomy-terms-grid" role="list"> |
| 20 | + {{- range .Paginator.Pages.ByTitle -}} |
| 21 | + {{- $pageCount := len .Pages -}} |
| 22 | + {{- $latest := index (.Pages.ByDate.Reverse) 0 -}} |
| 23 | + <article |
| 24 | + class="taxonomy-term-card" |
| 25 | + role="listitem" |
| 26 | + aria-labelledby="term-{{ .Slug }}" |
| 27 | + > |
| 28 | + {{- /* Clickable Card Link - Entire card is clickable */ -}} |
| 29 | + <a |
| 30 | + href="{{ .RelPermalink }}" |
| 31 | + class="taxonomy-term-card__link" |
| 32 | + aria-label="{{ i18n "taxonomy_terms_view_all_pages" (partial "utils/title" .) }}" |
| 33 | + > |
| 34 | + <header class="taxonomy-term-card__header"> |
| 35 | + <h2 class="taxonomy-term-card__title" id="term-{{ .Slug }}"> |
| 36 | + {{- partial "utils/title" . -}} |
| 37 | + </h2> |
| 38 | + </header> |
19 | 39 |
|
20 | | - <span class="flex align-center no-wrap"> |
21 | | - <svg class="gdoc-icon gdoc_star"><use xlink:href="#gdoc_star"></use></svg> |
22 | | - <span> |
23 | | - {{ $latest := index .Pages.ByDate 0 }} |
24 | | - {{ with $latest }} |
25 | | - <a href="{{ .RelPermalink }}">{{ partial "utils/title" . }}</a> |
26 | | - {{ end }} |
27 | | - </span> |
28 | | - </span> |
29 | | - </footer> |
30 | | - </article> |
31 | | - {{ end }} |
| 40 | + <div class="taxonomy-term-card__body"> |
| 41 | + {{- if .Description -}} |
| 42 | + <p class="taxonomy-term-card__description">{{ .Description | truncate 120 }}</p> |
| 43 | + {{- else if $latest -}} |
| 44 | + <p class="taxonomy-term-card__description">{{ $latest.Summary | plainify | truncate 120 }}</p> |
| 45 | + {{- else -}} |
| 46 | + <p class="taxonomy-term-card__description taxonomy-term-card__description--empty"> |
| 47 | + {{ i18n "taxonomy_terms_no_description" }} |
| 48 | + </p> |
| 49 | + {{- end -}} |
| 50 | + </div> |
| 51 | + |
| 52 | + <footer class="taxonomy-term-card__footer"> |
| 53 | + <div class="taxonomy-term-card__meta"> |
| 54 | + <span |
| 55 | + class="taxonomy-term-card__count" |
| 56 | + aria-label="{{ i18n "taxonomy_terms_page_count" $pageCount }}" |
| 57 | + > |
| 58 | + <svg class="gdoc-icon gdoc_tag" aria-hidden="true"> |
| 59 | + <use xlink:href="#gdoc_tag"></use> |
| 60 | + </svg> |
| 61 | + <span class="taxonomy-term-card__count-text"> |
| 62 | + {{- i18n "taxonomy_terms_page_count" $pageCount -}} |
| 63 | + </span> |
| 64 | + </span> |
| 65 | + |
| 66 | + {{- if $latest -}} |
| 67 | + <span class="taxonomy-term-card__latest"> |
| 68 | + <svg class="gdoc-icon gdoc_star" aria-hidden="true"> |
| 69 | + <use xlink:href="#gdoc_star"></use> |
| 70 | + </svg> |
| 71 | + <span class="taxonomy-term-card__latest-text"> |
| 72 | + {{ i18n "taxonomy_terms_latest_prefix" }} |
| 73 | + <span class="taxonomy-term-card__latest-title"> |
| 74 | + {{- partial "utils/title" $latest | truncate 40 -}} |
| 75 | + </span> |
| 76 | + </span> |
| 77 | + </span> |
| 78 | + {{- end -}} |
| 79 | + </div> |
| 80 | + </footer> |
| 81 | + </a> |
| 82 | + </article> |
| 83 | + {{- end -}} |
| 84 | + </div> |
| 85 | + |
| 86 | + {{- /* Pagination */ -}} |
| 87 | + {{- if gt .Paginator.TotalPages 1 -}} |
| 88 | + {{- partial "pagination.html" . -}} |
| 89 | + {{- end -}} |
| 90 | + {{- else -}} |
| 91 | + {{- /* Empty State */ -}} |
| 92 | + <div class="taxonomy-terms-empty" role="status" aria-live="polite"> |
| 93 | + <svg class="taxonomy-terms-empty__icon" aria-hidden="true"> |
| 94 | + <use xlink:href="#gdoc_tag"></use> |
| 95 | + </svg> |
| 96 | + <h2 class="taxonomy-terms-empty__title">{{ i18n "taxonomy_terms_empty_title" }}</h2> |
| 97 | + <p class="taxonomy-terms-empty__description"> |
| 98 | + {{ i18n "taxonomy_terms_empty_description" .Data.Plural }} |
| 99 | + </p> |
| 100 | + </div> |
| 101 | + {{- end -}} |
32 | 102 | </div> |
33 | | - {{ partial "pagination.html" . }} |
34 | 103 | {{ end }} |
0 commit comments