Skip to content

Commit 27348ac

Browse files
committed
img
1 parent f888011 commit 27348ac

File tree

3 files changed

+111
-0
lines changed

3 files changed

+111
-0
lines changed

assets/dahai.png

154 KB
Loading

layouts/index.html

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{{- define "main" }}
2+
3+
{{- $headerImage := resources.Get "dahai.png" }}
4+
{{- if $headerImage }}
5+
<div class="home-header">
6+
<img src="{{ $headerImage.RelPermalink }}" alt="Header image">
7+
</div>
8+
{{- end }}
9+
10+
{{- if site.Params.profileMode.enabled }}
11+
{{- partial "index_profile.html" . }}
12+
{{- else }}
13+
14+
{{- if .Content }}
15+
<div class="post-content">
16+
{{- if not (.Param "disableAnchoredHeadings") }}
17+
{{- partial "anchored_headings.html" .Content -}}
18+
{{- else }}{{ .Content }}{{ end }}
19+
</div>
20+
{{- end }}
21+
22+
{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
23+
{{- $pages = where $pages "Params.hiddenInHomeList" "!=" "true" }}
24+
25+
{{- $paginator := .Paginate $pages }}
26+
27+
{{- if and site.Params.homeInfoParams (eq $paginator.PageNumber 1) }}
28+
{{- partial "home_info.html" . }}
29+
{{- end }}
30+
31+
{{- $term := .Data.Term }}
32+
{{- range $index, $page := $paginator.Pages }}
33+
34+
{{- $class := "post-entry" }}
35+
36+
{{- $user_preferred := or site.Params.disableSpecial1stPost site.Params.homeInfoParams }}
37+
{{- if (and (eq $paginator.PageNumber 1) (eq $index 0) (not $user_preferred)) }}
38+
{{- $class = "first-entry" }}
39+
{{- else if $term }}
40+
{{- $class = "post-entry tag-entry" }}
41+
{{- end }}
42+
43+
<article class="{{ $class }}">
44+
{{- $isHidden := (.Param "cover.hiddenInList") | default (.Param "cover.hidden") | default false }}
45+
{{- partial "cover.html" (dict "cxt" . "IsSingle" false "isHidden" $isHidden) }}
46+
<header class="entry-header">
47+
<h2 class="entry-hint-parent">
48+
{{- .Title }}
49+
{{- if .Draft }}
50+
<span class="entry-hint" title="Draft">
51+
<svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" fill="currentColor">
52+
<path d="M160-410v-60h300v60H160Zm0-165v-60h470v60H160Zm0-165v-60h470v60H160Zm360 580v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q9 9 13 20t4 22q0 11-4.5 22.5T862.09-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z" />
53+
</svg>
54+
</span>
55+
{{- end }}
56+
</h2>
57+
</header>
58+
{{- if (ne (.Param "hideSummary") true) }}
59+
<div class="entry-content">
60+
<p>{{ .Summary | plainify | htmlUnescape }}{{ if .Truncated }}...{{ end }}</p>
61+
</div>
62+
{{- end }}
63+
{{- if not (.Param "hideMeta") }}
64+
<footer class="entry-footer">
65+
{{- partial "post_meta.html" . -}}
66+
</footer>
67+
{{- end }}
68+
<a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}"></a>
69+
</article>
70+
{{- end }}
71+
72+
{{- if gt $paginator.TotalPages 1 }}
73+
<footer class="page-footer">
74+
<nav class="pagination">
75+
{{- if $paginator.HasPrev }}
76+
<a class="prev" href="{{ $paginator.Prev.URL | absURL }}">
77+
«&nbsp;{{ i18n "prev_page" }}&nbsp;
78+
{{- if (.Param "ShowPageNums") }}
79+
{{- sub $paginator.PageNumber 1 }}/{{ $paginator.TotalPages }}
80+
{{- end }}
81+
</a>
82+
{{- end }}
83+
{{- if $paginator.HasNext }}
84+
<a class="next" href="{{ $paginator.Next.URL | absURL }}">
85+
{{- i18n "next_page" }}&nbsp;
86+
{{- if (.Param "ShowPageNums") }}
87+
{{- add 1 $paginator.PageNumber }}/{{ $paginator.TotalPages }}
88+
{{- end }}&nbsp;»
89+
</a>
90+
{{- end }}
91+
</nav>
92+
</footer>
93+
{{- end }}
94+
95+
{{- end }}{{/* end profileMode */}}
96+
97+
{{- end }}{{- /* end main */ -}}

layouts/partials/extend-head.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
<style>
2+
.home-header {
3+
width: 100%;
4+
max-height: 400px;
5+
overflow: hidden;
6+
margin-bottom: 2rem;
7+
}
8+
.home-header img {
9+
width: 100%;
10+
height: auto;
11+
object-fit: cover;
12+
display: block;
13+
}
14+
</style>
115
<script type="text/javascript">
216
(function(c,l,a,r,i,t,y){
317
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};

0 commit comments

Comments
 (0)