summaryrefslogtreecommitdiff
path: root/layouts/_partials/home/selected-works.html
blob: c1281d44518e2b8d4e8b016df127fe2dbed174c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!-- Selected Works -->
<section>
    <h3 class="font-mono text-secondary text-size-base font-normal">Selected works</h3>
    {{ $selectedTags := (slice "精选") }}
    {{ range first 3 (shuffle (where site.RegularPages "Params.tags" "intersect" $selectedTags)) }}
    <div class="md:flex md:justify-between mt-4 mb-6">
        <h4 class="text-lg m-0">
            <a class="xerox noline" href="{{ .Permalink }}">{{ .LinkTitle }}</a>
        </h4>
        <span>
            {{ $tags := first 3 (complement $selectedTags .Params.tags) }}
            {{ $context := dict "Params" (dict "tags" $tags) }}
            {{ partial "components/tags" $context }}
        </span>
    </div>
    {{ end }}
    <a class="small-button" href="/tags/精选">全部精选 →</a>
</section>

<hr />

<section>
    <div class="md:flex md:flex-wrap">
        {{ $articles := where site.RegularPages "Section" "eq" "article" }}
        <div class="md:w-1/2">
            <h3 class="font-mono text-secondary text-size-base font-normal">Tech Stuff</h3>
            {{ $techCategories := (slice "代码炼金术" "软件杂谈" "茶歇蔻芥")}}
            {{ $tech := where $articles "Params.categories" "in" $techCategories }}
            <ol class="home-section-posts" style="list-style-type: lower-greek;"> 
            {{ range first 6 $tech }}
                <li><a class="noline" href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
            {{ end }}
            <ol>
        </div>
        <div class="md:w-1/2">
            <h3 class="font-mono text-secondary text-size-base font-normal">General Posts</h3>
            {{ $general := where $articles "Params.categories" "not in" $techCategories }}
            <ol class="home-section-posts" style="list-style-type: lower-roman;"> 
            {{ range first 6 $general }}
                <li><a class="noline" href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
            {{ end }}
            <ol>
        </div>
        {{ $weekly := where site.RegularPages "Section" "eq" "weekly" }}
        <div class="md:w-1/2">
            <h3 class="font-mono text-size-base font-normal">
                <a class="text-secondary" href="/weekly">Weekly</a> 
                <span>*</span>
            </h3>
            <ol class="home-section-posts" style="list-style-type: disc;"> 
            {{ range first 6 $weekly }}
                <li {{ if intersect .Params.tags (slice "小报") }}style="list-style-type: circle"{{ end }}>
                    <a class="noline" href="{{ .Permalink }}">{{ .LinkTitle }}</a>
                </li>
            {{ end }}
            <ol>
        </div>
        {{ $fiction := where site.Pages "Section" "eq" "fiction" }}
        <div class="md:w-1/2">
            <h3 class="font-mono text-size-base font-normal">
                <a class="text-secondary" href="/fiction">Fictions</a> 
            </h3>
            <ol class="home-section-posts" style="list-style-type: hebrew;"> 
            {{ range first 6 $fiction }}
                <li>
                    <a class="noline" href="{{ .Permalink }}">{{ .LinkTitle }}</a>
                </li>
            {{ end }}
            <ol>
        </div>
        
        <p class="text-secondary text-sm">
            <span class="font-mono">*</span> 
            实心圆表示正刊,空心圆表示小报。
        </p>
    </div>
  {{ partial "home/more-links" . }}
</section>


<hr /> 

<section>
    <h3 class="font-mono text-secondary text-size-base font-normal">Bookshelf</h3>
    <div class="grid grid-cols-4 md:grid-cols-6 items-center gap-4 my-8">
    {{ $library := where site.Pages "Section" "eq" "library" }}
    {{ $books := where $library "Params.authors" "ne" nil }}
    {{ range first 6 $books }}
      <div data-tooltip="{{ .Title }}">
        {{ partial "components/book" (dict "ctx" .) }}
      </div>
    {{ end }}
    </div>
    <a class="small-button" href="{{ if eq .Site.Language.Lang "zh" }}/library{{ else }}{{ .Site.LanguagePrefix }}/library{{ end }}">
        图书馆 →
    </a>
</section>

<style>
ol.home-section-posts {
    padding-inline-start: 1rem;
    font-size: 1.1rem;
    line-height: 2;
    color: #999;
    li {
        filter: url(#x)
    }
}

a.noline { transition: opacity 0.3s }
a.noline:hover {
    text-decoration: none;
    opacity: 0.65;
}
</style>