From 7399c4f7a14332df2fd01741f3ecdcadad66e2c3 Mon Sep 17 00:00:00 2001 From: geekifan Date: Sat, 26 Apr 2025 12:40:11 +0800 Subject: [PATCH] wip(search): add index.json --- hugo.toml | 22 ++++++++++++++++++++++ layouts/_default/index.json | 5 +++++ 2 files changed, 27 insertions(+) create mode 100644 layouts/_default/index.json diff --git a/hugo.toml b/hugo.toml index 737d689..73bda92 100644 --- a/hugo.toml +++ b/hugo.toml @@ -4,6 +4,28 @@ title = 'Chirpy' enableGitInfo = true paginate = 5 # 每页显示的文章数量 +[outputs] + home = ["HTML", "RSS", "JSON"] + +[markup.highlight] + anchorLineNos = false + codeFences = true + guessSyntax = true + hl_Lines = '' + hl_inline = false + lineAnchors = '' + lineNoStart = 1 + lineNos = true + lineNumbersInTable = true + noClasses = false + tabWidth = 4 + wrapperClass = 'highlight' +[markup.goldmark.parser.attribute] + block = true + title = true +[markup.goldmark.renderer] + unsafe = true + [taxonomies] category = "categories" tag = "tags" diff --git a/layouts/_default/index.json b/layouts/_default/index.json new file mode 100644 index 0000000..c93f805 --- /dev/null +++ b/layouts/_default/index.json @@ -0,0 +1,5 @@ +{{- $.Scratch.Add "index" slice -}} +{{- range .Site.RegularPages -}} + {{- $.Scratch.Add "index" (dict "title" .Title "tags" .Params.tags "categories" .Params.categories "contents" .Plain "permalink" .Permalink) -}} +{{- end -}} +{{- $.Scratch.Get "index" | jsonify -}}