Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

搜索框有问题 #12

Open
Jas0n0ss opened this issue Aug 11, 2024 · 8 comments
Open

搜索框有问题 #12

Jas0n0ss opened this issue Aug 11, 2024 · 8 comments

Comments

@Jas0n0ss
Copy link

Note

hello 大佬, 看了这个主题非常喜欢这个简约的风格,非常适合简单只写博客的方案,已经部署在服务器上了,但是有一点小遗憾就是搜索有点问题

image
image
打开搜索框就是这样,也搜不出内容
您这样的怎么实现的,可以详细说下吗
image

@Jas0n0ss
Copy link
Author

在线的 https://vim.azureapp.org/ 大佬可以看下问题

@wlh320
Copy link
Owner

wlh320 commented Aug 11, 2024

如果你有按照 #11 里面提的步骤操作过,那我猜是因为 content 里面缺文件。

search 是个特殊页面,就像 archives 一样需要在 content 里面新建一个文件,类似

---
title: 搜索
description: "Search"
type: search
---

你可以参考一下 https://github.com/wlh320/hugo-theme-hulga/tree/main/exampleSite 的文件结构

@Jas0n0ss
Copy link
Author

那我猜是因为 content 里面缺文件

确实我按照那个运行过,现在的目录结构,按照你的提示目录里面加了index,还是没效果,不知道问题出在哪里
image
image
搜索框显示的也很别扭,也不出结果,大佬指点一下

@wlh320
Copy link
Owner

wlh320 commented Aug 15, 2024

我看你生成的页面源码里有 lunr.min.js,目前我这个主题只支持 pagefind,代码里不会出现 lunr.min.js,说明生成页面时用的应该不是这个主题的模板。

应该你 hugo 哪里配置的有问题

@Jas0n0ss
Copy link
Author

Jas0n0ss commented Aug 19, 2024

我看你生成的页面源码里有 lunr.min.js,目前我这个主题只支持 pagefind,代码里不会出现 lunr.min.js,说明生成页面时用的应该不是这个主题的模板。

应该你 hugo 哪里配置的有问题

以下是我的配置,麻烦大佬帮我我看下,非常感谢了

# cat hugo.toml
baseURL = "https://vim.azureapp.org"
languageCode = "zh-cn"
DefaultContentLanguage = "zh-cn"
title = "Jas0n0ss"
paginate = 10
theme = "hulga"

[params]
author = "Jas0n0ss"
keywords = "HTML, hugo, CSS"
description = "Jas0n0ss's blog, Happy Coding..."
primaryColor = "#454883"

#use primary color everywhere, default true
primaryEverywhere = true

#change bulma's link color (secondary color in this theme)
linkColor = "#3a1864"

#subtitle = "Stay hungry, stay foolish"
copyright = "Copyright © 2024 Jas0n0ss, All rights reserved."
#favicon = "static/favicon.ico"

#enable katex rendering on every post page, default false
math = true

#enable postcss, mainly for css purge (746kB->56kB->9kB gzipped, but this makes build slower), default false
postcss = true

#enable showing content summary below post title in home page, default false
#showSummary = true

#set paginate on taxonomy term page (tags or categories), default 10
termPaginate = 10

#enable toc on every post page, default false
toc = true

#enable TOC auto collapse, default false
autoCollapseToc = true

#enable prefers-color-scheme:dark, default false
darkMedia = true

#enable user to toggle dark mode with a menu, default false
darkToggle = true

#enable hero section's is-bold effect, default false
heroBold = true

#enable hero section that looks like steam deck's home page, default false
heroSteamDeck = true

#enable PWA, prepare your icons and DON'T forget to modify manifest.json, default false
#pwa = true

#disable jsdelivr cdn, default false
noCDN = false

#for postcss-purgecss
#see https://purgecss.com/guides/hugo.html

[build]
writeStats = true
#to enable different highlight themes in light/dark mode
[markup]
  [markup.highlight]
    noClasses = true

[menu]
  [[menu.main]]
  identifier = "index"
  name = "Home"
  url = "/"
  weight = 1

  [[menu.main]]
  identifier = "categories"
  name = "Categories"
  url = "/categories/"
  weight = 2

  [[menu.main]]
  identifier = "tags"
  name = "Tags"
  url = "/tags/"
  weight = 3

  # [[menu.main]]
  # identifier = "music"
  # name = "Music"
  # url = "/music/"
  # weight = 4


  # [[menu.main]]
  # identifier = "video"
  # name = "Video"
  # url = "/video/"
  # weight = 5

  
[[menu.main]]
  identifier = "archives"
  name = "Archives"
  url = "/archives/"
  weight = 4

  [[menu.main]]
  identifier = "search"
  name = "Search"
  url = "/search/"
  weight = 5

[taxonomies]
  #archives = "archives"
  category = "categories"
  tag = "tags"

@wlh320
Copy link
Owner

wlh320 commented Aug 19, 2024

我觉得跟我主题这边没关系,你在你网站的目录下搜一下 lunr 看看从哪引入进去的吧

@Jas0n0ss
Copy link
Author

我觉得跟我主题这边没关系,你在你网站的目录下搜一下 lunr 看看从哪引入进去的吧

感谢大佬,重新构建了一遍,都好了,感谢感谢。

Note

请问后期有没有优化一下菜单栏,比如搞个菜单栏图标,还有菜单栏下面的那块是否可以自定义图片,只能是一个单独的颜色感觉有点单调,个人感觉,哈哈

@wlh320
Copy link
Owner

wlh320 commented Aug 21, 2024

不用谢。我觉得找个现成的主题自己小改是搞静态博客的正常做法。你可以 fork 了按自己想法随意改,主题很少能做到所有人都满意的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants