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

关于本地搜索的问题 #105

Open
HiedanoAkyuu opened this issue Feb 19, 2020 · 3 comments
Open

关于本地搜索的问题 #105

HiedanoAkyuu opened this issue Feb 19, 2020 · 3 comments

Comments

@HiedanoAkyuu
Copy link

我把根目录下的root设置成我的subdirectory路径,然后发现搜索无法正常使用。控制台返回GET /content.json 404 0.149 ms - 151

@rn7s2
Copy link

rn7s2 commented Mar 18, 2020

貌似是因为作者没有考虑搜索时的子目录问题?
将/themes/BlueLake/source/js/search.json.js里的"/content.json"改成"/your subdirectory/content.json"就可以显示搜索结果,但是搜索结果的链接是不正确的,仍然缺少子目录名。

@rn7s2
Copy link

rn7s2 commented Mar 18, 2020

@HiedanoAkyuu

我有一个不是很优雅的修补方案:

  1. 将/themes/BlueLake/source/js/search.json.js里的xhr.open('GET', '/content.json', true);改成xhr.open('GET', '/YOUR SUBDIRECTORY/content.json', true);
  2. /themes/BlueLake/layout/_partial/search.jade里的a(href="/{path}",title="{title}")改成a(href="/YOUR SUBDIRECTORY/{path}",title="{title}")

这样搜索功能就正常了。

@Nana2mini
Copy link

npm install hexo-generator-json-content --save

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

3 participants