main
html 92 lines 4.18 KB
Raw
1 {{- define "main" -}}
2 {{- $weeklyPages := (where site.RegularPages "Type" "weekly").ByDate.Reverse -}}
3 {{- $latest := cond (gt (len $weeklyPages) 0) (index $weeklyPages 0) nil -}}
4 {{- $topTags := first 6 site.Taxonomies.tags.ByCount -}}
5
6 <div class="home-shell">
7 <section class="home-hero home-hero--minimal" aria-labelledby="home-title">
8 <p class="home-eyebrow">{{ .Params.description | default site.Params.homeInfoParams.Title | default "Weekly tech signal from GitHub" }}</p>
9 <h1 id="home-title">{{ .Title }}</h1>
10 </section>
11
12 {{- if $latest -}}
13 <article class="home-latest home-latest--feature" aria-labelledby="latest-report-heading">
14 <div class="home-latest-kicker">
15 <span class="section-topline">This week&rsquo;s analysis</span>
16 {{- with $latest.Params.week }}<span>{{ . }}</span>{{- end }}
17 <time datetime="{{ $latest.Date.Format "2006-01-02" }}">{{ $latest.Date.Format "Jan 2, 2006" }}</time>
18 </div>
19 <h2 id="latest-report-heading"><a href="{{ $latest.RelPermalink }}">{{ $latest.Title }}</a></h2>
20 <p class="home-latest-hook">{{ $latest.Params.summary | default $latest.Summary }}</p>
21 {{ partial "report-metrics.html" $latest }}
22 <div class="home-actions">
23 <a class="home-action-primary" href="{{ $latest.RelPermalink }}">Read full analysis</a>
24 <a class="home-action-secondary" href="{{ `weekly/` | absLangURL }}">View all weeks</a>
25 </div>
26 </article>
27 {{- else -}}
28 <section class="home-empty-state" aria-labelledby="latest-report-heading">
29 <div class="section-topline">This week&rsquo;s analysis</div>
30 <h2 id="latest-report-heading">No weekly report published yet</h2>
31 <p>The homepage will feature the newest report as soon as the first weekly summary lands in <code>content/weekly/</code>.</p>
32 </section>
33 {{- end -}}
34
35 <div class="home-content-grid">
36 {{- if gt (len $weeklyPages) 0 -}}
37 <section class="home-recent" aria-labelledby="recent-reports-heading">
38 <div class="section-heading-row">
39 <div>
40 <div class="section-topline">Recent issues</div>
41 <h2 id="recent-reports-heading">Weekly archive</h2>
42 </div>
43 <a href="{{ `weekly/` | absLangURL }}">View all weeks</a>
44 </div>
45 <div class="home-report-list">
46 {{- range first 6 $weeklyPages -}}
47 <article class="home-report-card">
48 <a class="home-report-title" href="{{ .RelPermalink }}">
49 <span class="home-report-week">{{ .Params.week | default (.Date.Format "2006-01-02") }}</span>
50 <span>{{ .Title }}</span>
51 </a>
52 <p>{{ .Params.summary | default .Summary }}</p>
53 <div class="home-report-meta">
54 <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "Jan 2, 2006" }}</time>
55 {{- with .Params.repos_featured }}<span>{{ . }} repos featured</span>{{- end }}
56 </div>
57 </article>
58 {{- end -}}
59 </div>
60 </section>
61 {{- end -}}
62
63 <aside class="home-rail" aria-labelledby="home-rail-heading">
64 {{- if $topTags -}}
65 <section class="home-topic-rail" aria-labelledby="home-rail-heading">
66 <div class="section-topline">Topics to follow</div>
67 <h2 id="home-rail-heading">Active storylines</h2>
68 <div class="home-topic-list">
69 {{- range $topTags -}}
70 <a class="home-topic-card" href="{{ printf "tags/%s/" (.Name | urlize) | absLangURL }}">
71 <span>{{ .Name | humanize }}</span>
72 <small>{{ .Count }} issue{{ if ne .Count 1 }}s{{ end }}</small>
73 </a>
74 {{- end -}}
75 </div>
76 </section>
77 {{- end -}}
78
79 <nav class="home-quick-links" aria-labelledby="quick-links-heading">
80 <div class="section-topline">Quick links</div>
81 <h2 id="quick-links-heading">Move through the report</h2>
82 <a href="{{ `weekly/` | absLangURL }}">All weeks</a>
83 <a href="{{ `topics/` | absLangURL }}">Topic index</a>
84 <a href="{{ `monthly/` | absLangURL }}">Monthly rollups</a>
85 <a href="{{ `yearly/` | absLangURL }}">Yearly rollups</a>
86 <a href="{{ `search/` | absLangURL }}">Search</a>
87 <a href="{{ `index.xml` | absLangURL }}">RSS feed</a>
88 </nav>
89 </aside>
90 </div>
91 </div>
92 {{- end -}}