Skip to content

Commit 117754d

Browse files
committed
update hugo and theme
1 parent d8c64f4 commit 117754d

File tree

20 files changed

+180
-112
lines changed

20 files changed

+180
-112
lines changed

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup Hugo
1919
uses: peaceiris/actions-hugo@v3
2020
with:
21-
hugo-version: '0.143.1'
21+
hugo-version: '0.151.0'
2222
# extended: true
2323

2424
- name: Build

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ params:
2323
description: "Eddie Wang的个人博客"
2424
keywords: [Blog, Portfolio, PaperMod]
2525
author: "Eddie Wang"
26-
images: ["<link or path of image for opengraph, twitter-cards>"]
26+
# images: ["<link or path of image for opengraph, twitter-cards>"]
2727
DateFormat: "2006-01-02 15:04:05"
2828
defaultTheme: light #auto # dark, light
2929
disableThemeToggle: false

themes/PaperMod/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
**ExampleSite** can be found here: [**exampleSite**](https://github.com/adityatelange/hugo-PaperMod/tree/exampleSite). Demo is built up with [exampleSite](https://github.com/adityatelange/hugo-PaperMod/tree/exampleSite) as source.
1212

1313
[![hugo-papermod](https://img.shields.io/badge/Hugo--Themes-@PaperMod-blue)](https://themes.gohugo.io/themes/hugo-papermod/)
14-
[![Minimum Hugo Version](https://img.shields.io/static/v1?label=min-HUGO-version&message=>=v0.125.7&color=blue&logo=hugo)](https://github.com/gohugoio/hugo/releases/tag/v0.125.7)
14+
[![Minimum Hugo Version](https://img.shields.io/static/v1?label=min-HUGO-version&message=>=v0.146.0&color=blue&logo=hugo)](https://github.com/gohugoio/hugo/releases/tag/v0.146.0)
1515
[![Discord](https://img.shields.io/discord/971046860317921340?label=Discord&logo=discord)](https://discord.gg/ahpmTvhVmp)
1616
[![GitHub](https://img.shields.io/github/license/adityatelange/hugo-PaperMod)](https://github.com/adityatelange/hugo-PaperMod/blob/master/LICENSE)
1717
![code-size](https://img.shields.io/github/languages/code-size/adityatelange/hugo-PaperMod)

themes/PaperMod/assets/css/common/post-entry.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,10 @@
9797

9898
.entry-cover img {
9999
border-radius: var(--radius);
100-
pointer-events: none;
101100
width: 100%;
102101
height: auto;
103102
}
104103

105104
.entry-cover a {
106-
color: var(--secondary);
107105
box-shadow: 0 1px 0 var(--primary);
108106
}

themes/PaperMod/assets/css/common/post-single.css

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,21 @@
1717
.breadcrumbs {
1818
color: var(--secondary);
1919
font-size: 14px;
20+
}
21+
22+
.breadcrumbs {
2023
display: flex;
2124
flex-wrap: wrap;
25+
align-items: center;
2226
}
2327

24-
.post-meta .i18n_list li {
28+
.i18n_list {
2529
display: inline-flex;
30+
}
31+
32+
.post-meta .i18n_list li {
2633
list-style: none;
2734
margin: auto 3px;
28-
box-shadow: 0 1px 0 var(--secondary);
2935
}
3036

3137
.breadcrumbs a {
@@ -34,6 +40,7 @@
3440

3541
.post-content {
3642
color: var(--content);
43+
margin: 30px 0;
3744
}
3845

3946
.post-content h3,
@@ -70,6 +77,7 @@
7077
}
7178

7279
.post-content a,
80+
.post-meta .i18n_list li a,
7381
.toc a:hover {
7482
box-shadow: 0 1px 0;
7583
box-decoration-break: clone;
@@ -124,8 +132,8 @@
124132
padding-inline-start: 10px;
125133
}
126134

127-
.post-content dd ~ dd,
128-
.post-content dt ~ dt {
135+
.post-content dd~dd,
136+
.post-content dt~dt {
129137
margin-top: 10px;
130138
}
131139

@@ -160,7 +168,7 @@
160168
direction: ltr;
161169
}
162170

163-
.post-content li > .highlight {
171+
.post-content li>.highlight {
164172
margin-inline-end: 0;
165173
}
166174

@@ -239,21 +247,21 @@
239247
text-align: center;
240248
}
241249

242-
.post-content figure > figcaption {
250+
.post-content figure>figcaption {
243251
color: var(--primary);
244252
font-size: 16px;
245253
font-weight: bold;
246254
margin: 8px 0 16px;
247255
}
248256

249-
.post-content figure > figcaption > p {
257+
.post-content figure>figcaption>p {
250258
color: var(--secondary);
251259
font-size: 14px;
252260
font-weight: normal;
253261
}
254262

255263
.toc {
256-
margin: 0 2px 40px 2px;
264+
margin-bottom: var(--content-gap);
257265
border: 1px solid var(--border);
258266
background: var(--code-bg);
259267
border-radius: var(--radius);
@@ -280,7 +288,7 @@
280288
}
281289

282290
.toc .inner {
283-
margin: 5px 20px 0;
291+
margin: 5px 20px;
284292
padding: 0 10px;
285293
opacity: 0.9;
286294
}
@@ -294,7 +302,7 @@
294302
}
295303

296304
.post-footer {
297-
margin-top: 56px;
305+
margin-top: var(--content-gap);
298306
}
299307

300308
.post-footer>* {

themes/PaperMod/layouts/_default/_markup/render-codeblock-mermaid.html

Lines changed: 0 additions & 4 deletions
This file was deleted.

themes/PaperMod/layouts/_default/baseof.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{{- if lt hugo.Version "0.125.7" }}
2-
{{- errorf "=> hugo v0.125.7 or greater is required for hugo-PaperMod to build " }}
1+
{{- if lt hugo.Version "0.146.0" }}
2+
{{- errorf "=> hugo v0.146.0 or greater is required for hugo-PaperMod to build " }}
33
{{- end -}}
44

55
<!DOCTYPE html>
@@ -21,8 +21,6 @@
2121
<main class="main">
2222
{{- block "main" . }}{{ end }}
2323
</main>
24-
25-
{{- partial "mermaid.html" . }}
2624
{{ partialCached "footer.html" . .Layout .Kind (.Param "hideFooter") (.Param "ShowCodeCopyButtons") -}}
2725
</body>
2826

themes/PaperMod/layouts/partials/cover.html

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,64 @@
11
{{- with .cxt}} {{/* Apply proper context from dict */}}
22
{{- if (and .Params.cover.image (not $.isHidden)) }}
3-
{{- $alt := (.Params.cover.alt | default .Params.cover.caption | plainify) }}
4-
{{- $loading := cond $.IsSingle "eager" "lazy" }}
53
<figure class="entry-cover">
6-
{{- $responsiveImages := (.Params.cover.responsiveImages | default site.Params.cover.responsiveImages) | default true }}
4+
{{- $loading := cond $.IsSingle "eager" "lazy" }}
75
{{- $addLink := (and site.Params.cover.linkFullImages $.IsSingle) }}
8-
{{- $pageBundleCover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }}
6+
{{- $prod := (hugo.IsProduction | or (eq site.Params.env "production")) }}
7+
{{- $alt := (.Params.cover.alt | default .Params.cover.caption | plainify) }}
8+
{{- $responsiveImages := (.Params.cover.responsiveImages | default site.Params.cover.responsiveImages) | default true }}
9+
10+
{{- $pageBundleCover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }}
911
{{- $globalResourcesCover := (resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }}
1012
{{- $cover := (or $pageBundleCover $globalResourcesCover)}}
11-
{{- if $cover -}}{{/* i.e it is present in page bundle */}}
12-
{{- if $addLink }}<a href="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" target="_blank"
13-
rel="noopener noreferrer">{{ end -}}
14-
{{- $sizes := (slice "360" "480" "720" "1080" "1500") }}
15-
{{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") -}}
16-
{{- if hugo.IsExtended -}}
17-
{{- $processableFormats = $processableFormats | append "webp" -}}
18-
{{- end -}}
19-
{{- $prod := (hugo.IsProduction | or (eq site.Params.env "production")) }}
13+
{{- /* We are not using the .Param.cover.relative to decide the location of image */}}
14+
{{- /* If we have the image in pageBundle or globalResources we can process the image */}}
15+
16+
{{- $sizes := (slice "360" "480" "720" "1080" "1500") }}
17+
{{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") -}}
18+
{{- if hugo.IsExtended -}}
19+
{{- $processableFormats = $processableFormats | append "webp" -}}
20+
{{- end -}}
21+
22+
{{- $imgdl := (.Params.cover.image) | absURL }}
23+
{{- if $cover -}}
24+
{{- $imgdl = $cover.Permalink }}
25+
{{- end -}}
26+
27+
{{- if $addLink }}
28+
<a href="{{ $imgdl }}" target="_blank" rel="noopener noreferrer">
29+
{{- end }}
30+
31+
{{- if $cover -}}
32+
{{/* i.e it is present in page bundle */}}
2033
{{- if (and (in $processableFormats $cover.MediaType.SubType) ($responsiveImages) (eq $prod true)) }}
21-
<img loading="{{$loading}}" srcset="{{- range $size := $sizes -}}
22-
{{- if (ge $cover.Width $size) -}}
23-
{{ printf "%s %s" (($cover.Resize (printf "%sx" $size)).Permalink) (printf "%sw ," $size) -}}
24-
{{ end }}
25-
{{- end -}}{{$cover.Permalink }} {{printf "%dw" ($cover.Width)}}"
26-
sizes="(min-width: 768px) 720px, 100vw" src="{{ $cover.Permalink }}" alt="{{ $alt }}"
27-
width="{{ $cover.Width }}" height="{{ $cover.Height }}">
34+
<img loading="{{$loading}}"
35+
srcset='{{- range $size := $sizes -}}
36+
{{- if (ge $cover.Width $size) }}
37+
{{- printf "%s %s" (($cover.Resize (printf "%sx" $size)).Permalink) (printf "%sw," $size) }}
38+
{{- end }}
39+
{{- end }}
40+
{{- printf "%s %dw" ($cover.Permalink) ($cover.Width) }}'
41+
src="{{ $cover.Permalink }}"
42+
sizes="(min-width: 768px) 720px, 100vw"
43+
width="{{ $cover.Width }}" height="{{ $cover.Height }}"
44+
alt="{{ $alt }}">
2845
{{- else }}{{/* Unprocessable image or responsive images disabled */}}
29-
<img loading="{{$loading}}" src="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" alt="{{ $alt }}">
46+
<img loading="{{ $loading }}" src="{{ $imgdl }}" alt="{{ $alt }}">
3047
{{- end }}
31-
{{- else }}{{/* For absolute urls and external links, no img processing here */}}
32-
{{- if $addLink }}<a href="{{ (.Params.cover.image) | absURL }}" target="_blank"
33-
rel="noopener noreferrer">{{ end -}}
34-
<img loading="{{$loading}}" src="{{ (.Params.cover.image) | absURL }}" alt="{{ $alt }}">
48+
{{- else }}
49+
{{- /* For absolute urls and external links, no img processing here */}}
50+
<img loading="{{ $loading }}" src="{{ $imgdl }}" alt="{{ $alt }}">
3551
{{- end }}
36-
{{- if $addLink }}</a>{{ end -}}
37-
{{/* Display Caption */}}
52+
53+
{{- if $addLink }}
54+
</a>
55+
{{- end -}}
56+
57+
{{- /* Display Caption */}}
3858
{{- if $.IsSingle }}
39-
{{ with .Params.cover.caption }}<p>{{ . | markdownify }}</p>{{- end }}
59+
{{ with .Params.cover.caption -}}
60+
<figcaption>{{ . | markdownify }}</figcaption>
61+
{{- end }}
4062
{{- end }}
4163
</figure>
4264
{{- end }}{{/* End image */}}

themes/PaperMod/layouts/partials/edit_post.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
{{- $fileUrlPath := path.Join .File.Path }}
33

44
{{- if or .Params.author site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated }}&nbsp;|&nbsp;{{- end -}}
5-
<a href="{{ .Params.editPost.URL | default site.Params.editPost.URL }}{{ if .Params.editPost.appendFilePath | default ( site.Params.editPost.appendFilePath | default false ) }}/{{ $fileUrlPath }}{{ end }}" rel="noopener noreferrer" target="_blank">
6-
{{- .Params.editPost.Text | default (site.Params.editPost.Text | default (i18n "edit_post" | default "Edit")) -}}
7-
</a>
5+
<span>
6+
<a href="{{ .Params.editPost.URL | default site.Params.editPost.URL }}{{ if .Params.editPost.appendFilePath | default ( site.Params.editPost.appendFilePath | default false ) }}/{{ $fileUrlPath }}{{ end }}" rel="noopener noreferrer edit" target="_blank">
7+
{{- .Params.editPost.Text | default (site.Params.editPost.Text | default (i18n "edit_post" | default "Edit")) -}}
8+
</a>
9+
</span>
810
{{- end }}
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
{{- /* Footer custom content area start */ -}}
22
{{- /* Insert any custom code web-analytics, resources, etc. here */ -}}
3-
4-
{{ if .Store.Get "hasMermaid" }}
5-
<script type="module">
6-
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs';
7-
mermaid.initialize({ startOnLoad: true });
8-
</script>
9-
{{ end }}
10-
113
{{- /* Footer custom content area end */ -}}

0 commit comments

Comments
 (0)