From 2dd30bb17193990ceb3ea8a0074fc222a5b0a5a3 Mon Sep 17 00:00:00 2001 From: hyang Date: Thu, 14 Sep 2023 22:26:08 -0700 Subject: Fix searching --- .gitmodules | 2 +- hugo.toml | 15 +++++++++++++++ index.json | 7 +++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 index.json diff --git a/.gitmodules b/.gitmodules index f9d01cb..13ce86e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "themes/papermodx"] path = themes/papermodx - url = https://github.com/reorx/hugo-PaperModX/ + url = https://github.com/yanghuaxuan/hugo-PaperMod diff --git a/hugo.toml b/hugo.toml index 97d7173..bf95a28 100644 --- a/hugo.toml +++ b/hugo.toml @@ -5,10 +5,14 @@ theme = 'papermodx' enableRobotsTXT = true paginate = 5 +[outputs] +home = [ "HTML", "RSS", "JSON" ] + [params] description = "Cool blogpostings" author = "hyang" email = "hyang@hyang.xyz" + keywords = [ "Blog", "Portfolio" ] mainSections = ["posts"] TocOpen = true TocSide = "left" @@ -16,6 +20,8 @@ paginate = 5 ShowWordCount = true ShowCodeCopyButtons = true ShowPostNavLinks = true + ShowBreadCrumbs = true + env = "production" [[menu.main]] name = "Posts" @@ -46,6 +52,15 @@ paginate = 5 I'm Huaxuan Yang. On *hyang.xyz*, I self-host a bunch of services (including this blog), using the finest grade gaming hardware. Here, I mostly talk about technology stuff, like Linux, programming, etc. Maybe some other content soon... """ + [params.fuseOpts] + isCaseSensitive = false + shouldSort = true + location = 0 + distance = 1_000 + threshold = 0.4 + minMatchCharLength = 0 + keys = [ "title", "permalink", "summary", "content" ] + [languages] [languages.en.params.logo] logoText = "@hyang.xyz" diff --git a/index.json b/index.json new file mode 100644 index 0000000..feeb437 --- /dev/null +++ b/index.json @@ -0,0 +1,7 @@ +{{- $.Scratch.Add "index" slice -}} +{{- range site.RegularPages -}} + {{- if and (not .Params.searchHidden) (ne .Layout `archives`) (ne .Layout `search`) }} + {{- $.Scratch.Add "index" (dict "title" .Title "content" .Plain "permalink" .Permalink "summary" .Summary) -}} + {{- end }} +{{- end -}} +{{- $.Scratch.Get "index" | jsonify -}} -- cgit v1.2.3