Browse Source

Update gallery section

Track3 1 year ago
parent
commit
d507cb35b4

+ 37 - 0
assets/scss/partials/_gallery.scss

@@ -0,0 +1,37 @@
+.album {
+  margin-top: 2rem;
+
+  h2 {
+    margin-bottom: .25em;
+  }
+}
+
+.album-row {
+  display: flex;
+  flex-wrap: wrap;
+  gap: .5em;
+  border: none !important;
+}
+
+.img-tile {
+  height: 100px;
+
+  &>img {
+    max-height: 100%;
+    min-width: 100%;
+    object-fit: cover;
+    vertical-align: bottom;
+  }
+}
+
+.album-header {
+  font-size: 90%;
+
+  .feather {
+    margin-right: .5em;
+  }
+}
+
+.album-desc {
+  margin-block: .5em;
+}

+ 6 - 2
assets/scss/style.scss

@@ -77,6 +77,7 @@ textarea {
 h1 {
   margin-top: .5rem;
   margin-bottom: 2rem;
+  line-height: normal;
 }
 
 #home-social a {
@@ -344,9 +345,11 @@ textarea {
 }
 
 .post-info {
-  margin-top: -2rem;
+  margin-top: -1.5rem;
+  line-height: normal;
   font-size: 90%;
   font-style: italic;
+  color: var(--c-txt-alt);
 }
 
 .footnotes {
@@ -402,6 +405,7 @@ a.footnote-ref {
   margin-bottom: .5rem;
   line-height: normal;
   font-size: 150%;
+  font-family: $serif-fonts;
 }
 
 .post-list {
@@ -418,7 +422,7 @@ a.footnote-ref {
   min-width: 4.5em;
 }
 
-@import "partials/comments.scss";
+@import "partials/comments", "partials/gallery";
 
 @media all and (min-width: 550px) {
   .post-group {

+ 1 - 1
layouts/_default/baseof.html

@@ -19,7 +19,7 @@
 	<link rel="manifest" href="/site.webmanifest">
 	<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#54bab9">
 	<link rel="shortcut icon" href="/favicon.ico">
-	<title>{{.Title}}</title>
+	<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} - {{ end }}{{ .Site.Title }}{{ end }}</title>
 	<link rel="dns-prefetch" href="//pb.zak.ee">
 	<link rel="dns-prefetch" href="//cravatar.cn">
 	{{ range .AlternativeOutputFormats -}}

+ 1 - 1
layouts/_default/list.html

@@ -9,7 +9,7 @@
 
 		{{ range .Pages.GroupByDate "2006" -}}
 		<div class="post-group">
-			<div class="dim post-year" id="{{ .Key }}">{{ .Key }}</div>
+			<div class="post-year" id="{{ .Key }}">{{ .Key }}</div>
 			<ul class="lsn post-list">
 				{{ range .Pages -}}
 				<li class="post-item">

+ 23 - 0
layouts/gallery/list.html

@@ -0,0 +1,23 @@
+{{ define "main" }}
+	<main class="wrapper">
+		<h1><a href="/" class="home">{{.Title}}</a></h1>
+		{{ if .Content -}}
+		<div class="content">
+			{{ .Content }}
+		</div>
+		{{- end }}
+
+		{{- range (.Pages.ByParam "shot_date").Reverse}}
+		<div class="album">
+			{{ $abulmLink := .RelPermalink -}}
+			<h2><a href="{{ $abulmLink }}" class="tdln">{{.Title}}</a></h2>
+			<a href="{{ $abulmLink }}" class="album-row">
+				{{- range .Params.images -}}
+				<div class="img-tile"><img src="{{. | relURL}}" loading="lazy"></div>
+				{{- end -}}
+			</a>
+		</div>
+		{{- end }}
+	</main>
+	<hr>
+{{- end }}

+ 37 - 0
layouts/gallery/single.html

@@ -0,0 +1,37 @@
+{{ define "main" }}
+	<main class="wrapper">
+		<h1><a href="/" class="home">{{.Title}}</a></h1>
+		<ul class="lsn dim album-header">
+			{{ with .Params.location -}}
+			<li><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-map-pin"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path><circle cx="12" cy="10" r="3"></circle></svg>{{ . }}</li>
+			{{ end -}}
+			<li><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-calendar"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>{{ dateFormat ":date_long" .Date.Local }}</li>
+			{{ with .Params.shot_with -}}
+			<li><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-camera"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"></path><circle cx="12" cy="13" r="4"></circle></svg>{{ . }}</li>
+			{{ end -}}
+			{{ with .Params.description -}}
+			<li class="album-desc">{{ . }}</li>
+			{{ end -}}
+		</ul>
+		{{ if .Content -}}
+		<div class="content">
+			{{ .Content }}
+		</div>
+		{{- end }}
+		<ul class="lsn dim post-footer">
+			<li>发布于{{ dateFormat "2006-01-02 15:04 MST" .Date.UTC }},最后更新于{{ dateFormat "2006-01-02 15:04 MST" .Lastmod.UTC }}</li>
+			{{- with .Params.tags }}
+			<li>&emsp;签:{{- range . -}}<a href="{{ "tags/" | relURL }}{{ . | urlize }}" class="post-tag">{{.}}</a>{{ end }}</li>
+			{{- end }}
+			<li></li>
+			{{- with .PrevInSection }}
+			<li>上一篇:<a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
+			{{- end }}
+			{{- with .NextInSection }}
+			<li>下一篇:<a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
+			{{- end }}
+		</ul>
+		{{ partialCached "comments.html" . }}
+	</main>
+	<hr>
+{{- end }}