Skip to content

Commit 0370f28

Browse files
imporve thumbnail look in posts;
1 parent 488e3ff commit 0370f28

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

themes/math-gallery-theme/archetypes/default.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ draft = true
44
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
55
description = ''
66
thumbnail = ''
7+
# showThumbnail = false
78
tags = []
89
# coauthors = [
910
# { name = 'Jane Doe', link = 'mailto:jane@example.com' },

themes/math-gallery-theme/assets/css/main.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,15 @@ a.page-btn:hover {
532532
max-width: 800px;
533533
}
534534

535+
.post-hero {
536+
display: flex;
537+
justify-content: center;
538+
margin-bottom: 1.5rem;
539+
}
540+
535541
.post-hero img {
536-
width: 100%;
542+
width: 50%;
537543
border-radius: 0.5rem;
538-
margin-bottom: 1.5rem;
539544
}
540545

541546
.post-header {

themes/math-gallery-theme/layouts/page.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
{{ define "main" }}
22
<article class="post-single">
3-
<!-- Thumbnail -->
4-
{{ with .Params.thumbnail }}
5-
<div class="post-hero">
6-
<img src="{{ site.Home.RelPermalink }}{{ . | strings.TrimPrefix "/" }}" alt="{{ $.Title }}" />
7-
</div>
8-
{{ end }}
9-
103
<header class="post-header">
114
<h1>{{ .Title }}</h1>
125

@@ -37,6 +30,15 @@ <h1>{{ .Title }}</h1>
3730
{{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
3831
</header>
3932

33+
<!-- Thumbnail (shown after title unless showThumbnail = false) -->
34+
{{ if ne .Params.showThumbnail false }}
35+
{{ with .Params.thumbnail }}
36+
<div class="post-hero">
37+
<img src="{{ site.Home.RelPermalink }}{{ . | strings.TrimPrefix "/" }}" alt="{{ $.Title }}" />
38+
</div>
39+
{{ end }}
40+
{{ end }}
41+
4042
<div class="post-content">
4143
{{ .Content }}
4244
</div>

0 commit comments

Comments
 (0)