
详细的设置可参考dream介绍页面 。
hugo.toml基础设置
baseURL = 'https://dfgmgrr80dxf9.cloudfront.net/'
languageCode = 'zh-Hans'
defaultContentLanguage = 'zh'
title = 'Leona的田园牧歌'
theme = "dream"
[params]
zenMode = true
lightTheme = "emerald"
darkTheme = "forest"
author = "Leona & Mark"
description = "Leona的日常"
avatar = "https://d89gm6mvdsato.cloudfront.net/2024/20241010-211959-aurora.jpg"
headerTitle = "Leona的田园牧歌"
motto = "草舍茅屋有几间,行也安然,待也安然。"
siteStartYear = 2025
stickyNav = true
showTableOfContents = true
showSummaryCoverInPost = true
imageZoomableInPost = true
showPrevNextPost = true
[params.experimental]
jsDate = true
jsDateFormat = "yyyy年MM月dd日"
可爱小图标
- 下载链接
- 将xxx.ico复制到static文件夹下
- 在hugo.toml中增加
favicon = "favicon.ico" - 刷新浏览器cache
Ctrl + Shift + R
在博客页面添加“分享到长毛象”按钮
- 在
hugo.toml中添加reorderShares = ["mastodon"], 也可以选择使用所有按钮reorderShares = ["mastodon", "x", "facebook", "whatsapp"] - 在
themes/dream/layouts/partials/share.html中添加毛象的设置
<div class="flex items-center gap-2">
<!-- slot: post-share-left.html -->
{{ if fileExists "layouts/partials/post-share-left.html" }}
{{ partial "post-share-left.html" . }}
{{ end }}
{{ $shares := slice "x" "facebook" "whatsapp" "mastodon" }}
{{ $shareTitles := dict
"x" "X"
"facebook" "Facebook"
"whatsapp" "WhatsApp"
"mastodon" "Mastodon"
}}
{{ $shareLinks := dict
"x" (print "https://x.com/intent/post?text=" .Title "&url=" .Permalink)
"facebook" (print "https://facebook.com/sharer/sharer.php?u=" .Permalink)
"whatsapp" (print "https://wa.me/?text=" .Title " " .Permalink)
"mastodon" (print "https://toot.kytta.dev/?text=" .Title " " .Permalink)
}}
{{ if site.Params.reorderShares }}
{{ $shares = site.Params.reorderShares }}
{{ end }}
{{ range $shares }}
<a class="group inline-flex items-center p-2 rounded-full cursor-pointer hover:bg-primary"
href="{{ index $shareLinks . }}" target="_blank" rel="noopener noreferrer"
title="Share on {{ index $shareTitles . }}">
<ion-icon class="group-hover:text-primary-content" name="logo-{{ . }}"></ion-icon>
</a>
{{ end }}
<!-- slot: post-share-right.html -->
{{ if fileExists "layouts/partials/post-share-right.html" }}
{{ partial "post-share-right.html" . }}
{{ end }}
</div>
图片居中并添加描述文字
- 创建
./layouts/shortcodes/centered-image.html并输入如下内容
<figure style="text-align: center;">
<img src="{{ .Get "src" }}" alt="{{ .Get "alt" }}" style="display: block; margin: auto; max-width: 100%;" />
<figcaption style="color: #666; font-size: 14px; margin-top: 8px;">{{ .Get "alt" }}</figcaption>
</figure>
- 用以下代码嵌入图片
{{< centered-image src="/images/example.jpg" alt="This is an example image" >}}
hugo.toml额外设置
[services]
[services.googleAnalytics]
ID = "..."
- Social Comments
[services]
[services.disqus]
shortname = "..."