完成したもの まずは動いているものは以下になります。 https://icck.github.io/search/ 作業手順 手順を順に記載していきます。以下の記事を参考にさせていただきました。 http://rs.luminousspice.com/hugo-site-search/ https://snap.textgh.org/post/full-text-search-in-hugo/ インデックスファイルのテンプレート $ mkdir ./layouts/js $ touch ./layouts/js/single.html var data = [{{ range $index, $page := where .Site.Pages "Section" "posts"}} {{ if ne $index 0 }},{{ end }}{ url: "{{ $page.Permalink }}", title: "{{ $page.Title }}", content: "{{ .PlainWords }}" }{{ end }}] インデックスファイルを生成する空の投稿 $ hugo new pages/indexjs.md --- date: 2019-08-28T21:50:35+09:00 type: "js" url: "index.js" --- 検索ページの作成 検索ページテンプレートの作成 $ mkdir ./layouts/search/ $ touch .
Hugoの使い方を今後のブログ更新のために Hugoでブログを書いていく上で、運用方法をメモしていこうと思います。 インストール等は気が向いたときに。 Local環境を起動 $ hugo server --theme=hugo-theme-nix --buildDrafts --watch 記事の作成 $ hugo new post/test.md --- title: "test" date: 2019-08-26T01:14:23+09:00 draft: true --- title:記事のタイトルに修正 date:作成時刻のため、そのまま draft:trueが非公開。falseに変更し公開 Sample --- title: "test" date: 2019-08-26T01:14:23+09:00 draft: false --- ## ここにマークダウンで本文を記載 githubへpush ./deploy.sh