HUGO Version
# hugo version
hugo v0.118.2-da7983ac4b94d97d776d7c2405040de97e95c03d+extended darwin/amd64 BuildDate=2023-08-31T11:23:51Z VendorInfo=brew
theme選び直しの方針
robustを使っていたが気分転換
- サムネイル画像いらない
- 記事リストは一覧で
theme案
mini
https://nodejh.com/hugo-theme-mini/posts/
- アーカイブ、タグ、disqus、アナリティクスあり
- 検索なし
papermod
https://adityatelange.github.io/hugo-PaperMod/
- 検索あり
- disqusあり
- 更新頻度高
hobor
https://themes.gohugo.io/themes/harbor/
- 検索あり
- 日本人作成
- 更新滞り
- アイコンがまる
stack
https://themes.gohugo.io/themes/hugo-theme-stack/
良い感じ
papermodにした
参考 : Installation · adityatelange/hugo-PaperMod Wiki
method1(git clone)にした
netlifyでデプロイ
参考 : [hugo] HugoとGitHubとNetlifyで静的サイトを簡単に作成
netlifyでgitのリポジトリを追加する(認証)
netlify設定
- build command : hugo
- publish directry : public
- netlify.toml をルートに追加
- 内容はrobustでの設定そのまま
- themeはgit cloneなので上記サイトを参考にする .gitmodulesをルートに。
lastmod の表示
Add “Last Edited” to posts · adityatelange/hugo-PaperMod · Discussion #775
config.ymlに追加
enableGitInfo: true
frontmatter:
lastmod:
- lastmod
- :git
- date
- publishDate
layouts/partials/post_meta.html を新規作成
以下の spam titleの表示不具合 も合わせて参照
logoアイコンの表示
Using SVG icon instead of text for site logo · adityatelange/hugo-PaperMod · Discussion #621
static/logo.png に配置
label:
#text: "Home🏠"
text: " "
#icon: /apple-touch-icon.png
icon: logo.png
iconHeight: 45
SVG
これはデフォルトであり
Allow adding SVG in place of logo image (#976) · adityatelange/hugo-PaperMod@77ffb30
表示サイズがおかしいため、未適用
add label.iconSVG key by icy-comet · Pull Request #976 · adityatelange/hugo-PaperMod
toc
Tocはシャープ2つから表示される
spam titleの表示不具合
hugoとpapermodを更新した
更新後、ページトップのspan titleがうまく表示されなくなった
↓こんな感じ
バージョンアプデ
hugo 0.92 extended → 0.143.1 extended
papermod Release ? → 8.0
対応
\papermod\layouts\partials\post_meta.html
を用意しているが、記述が悪かった
新規サイトを作ってdiffをとって探ってみた
治ったsafeHTML
が必要だったみたい
悪かった部分抜粋
変更前
{{- with ($scratch.Get "meta") }}
{{- delimit . " · " -}}
{{- end -}}
変更後
{{- with ($scratch.Get "meta") }}
{{- delimit . " · " | safeHTML -}}
{{- end -}}
↓治った
その他
アプデついでにフォルダ構成を最新と同じにした(i18nとかdataとかなかったので追加。中身は空だけど)
また、コンフィグファイル名が変わったので変更config.yml → hugo.yaml