Closed Jaylin0920 closed 5 years ago
本地调试是否有相关报错信息?
无报错
请提供下相关代码或截图,方便确认问题。
主题配置文件内容:
# ---------------------------------------------------------------
# Site Information And Theme Configuration Settings
# language: zh-CN
# ---------------------------------------------------------------
## menu -- 导航菜单显示{[@page:名字,@url:地址,@icon:图标]}
menu:
- page: home
url: /JLBlog
icon:
- page: iOS
url: /JLBlog/categories/iOS
icon:
- page: 技术
url: /JLBlog/categories/技术
icon:
- page: 时间轴
url: /JLBlog/archives
icon:
## favicon -- 网站图标位置{@favicon}
favicon: /favicon.ico
## Carousel
carousel:
img: img/head-img.jpg
## rss --rss文件位置{@rss}
rss: /atom.xml
# 各个小工具的设置
## widgets -- 6个左边小工具{@widgets:[notification,category,archive,tagcloud,friends]}
widgets:
- search
- social
- tagcloud
- category
- archive
- friends
## 搜索
jsonContent:
searchLocal: true # 是否启用本地搜索
searchGoogle: false #是否启用谷歌搜索
posts:
title: true
text: true
content: true
categories: false
tags: false
## 网站公告设置
notification:
## 社交设置{@name:社交工具名字,@icon:社交工具图标,@href:设置工具链接} [参考图标](http://fontawesome.io/icons/)
social:
- name: Github
icon: github
href: xxx
- name: Coding
icon: tripadvisor
href: xxx
- name: Douban
icon: life-ring
href: xxx
## 文章分类设置{@cate_config:{@show_count:是否显示数字,@show_current: 是否高亮当前category}}
cate_config:
show_count: true
show_current: true
## 文章归档设置{@arch_config:/*参数参考:https://hexo.io/zh-cn/docs/helpers.html#list-archives*/}
arch_config:
type: 'yearly'
show_count: true
order: -1
## 标签云设置{/*参数参考:http://www.goat1000.com/tagcanvas-options.php */}
tagcloud:
tag3d: true # 是否启用3D标签云
textColour: '#444'
outlineMethod: 'block'
outlineColour: '#FFDAB9'
interval: 45
freezeActive: true
frontSelect: true
reverse: true
wheelZoom: false
## 友链设置{@链接名称:链接地址{@links:[,,,]}}
links:
# 主题自定义个性化配置
## 网站宣传语
branding: 道阻且长 行则将至
## 设置banner背景图片
banner:
img: http://7xpw2b.com1.z0.glb.clouddn.com/hexo-sinppet/img/banner.jpg
## 首页列表底部面板
homePanel: true
## 缩略图自定义随机图片
defaultImgs:
-
## 截取文章首页描述字数
excerptLength: 121
## 是否开启文章目录
toc: true
## 代码高亮配置
highlightTheme:
## bootstrap配置
bootstrap:
## ICON配置
fontAwesome:
## 文章过期提醒功能
warning:
days: 10000
text: '本文于%d天之前发表,文中内容可能已经过时。'
## 文章内声明
declaration:
enable: true
title: '转载声明'
tip: |-
商业转载请联系作者获得授权,非商业转载请注明出处 © <a href="" target="_blank">JiLinLin</a>
## 文章打赏
reward:
alipay: ''
# wepay: '../img/reward-wepay1.jpg'
wepay: http://or8jbn4mz.bkt.clouddn.com/18-9-15/33159511.jpg
tip: 赞赏是不耍流氓的鼓励
## 主题评论
### gitment
gitment:
enable: false
owner:
repo:
client_id:
client_secret:
perPage: 8
### 来必力
livere:
enable: false
livere_uid: MTAyMC8zMzA1MS85NjEz
### 友言评论(服务不稳定)
uyan:
enable: false
uyan_id: 1966422
### Disqus评论
disqus:
enable: false
shortname: JiLinLin
count: false
### 畅言评论(需要ICP备案)
changyan:
enable: false
appid:
conf:
## Valine评论
valine:
enable: true
appId: rdBJsbBWe0emAD9xiQg4DTRL-gzGzoHsz
appKey: Kmtn7tod8xtCnkYPADfzkBSs
placeholder: 说点什么吧
notify: false
verify: false
avatar: mm
meta: nick,mail
pageSize: 8
## 网站访客统计
visit_counter:
site: true
page: true
## 网站访问统计分析
### 网盟CNZZ统计
cnzz_analytics: 1263868967
### 百度统计
baidu_analytics:
### 谷歌统计
google_analytics:
### 腾讯分析
tencent_analytics:
### 百度站点认证
baidu_site_verification:
### 百度自动推送
baidu_push: true
#网站主题配置
since: 2016
robot: 'all' ### 控制搜索引擎的抓取和索引编制行为,默认为all
version: 1.2.1
站点配置文件如下:
# Hexo Configuration
# Site
title: JiLinLin'Blog
subtitle: Amazing code and coder
description: "道阻且长 行则将至"
# keywords:
author: JiLinLin
language: zh-CN
timezone:
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://jilinlin.coding.me/JLBlog
root: /JLBlog/
permalink: :year/:month/:day/:title/
permalink_defaults:
# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:
# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
enable: true
line_number: true
auto_detect: false
tab_replace:
# Home page setting
index_generator:
path: ''
per_page: 10
order_by: -date
## Local search(本地搜索)
search:
path: search.xml
field: post
format: html
limit: 10000
# Category & Tag
default_category: uncategorized
category_map:
tag_map:
# Date / Time format
date_format: YYYY-MM-DD
time_format: HH:mm:ss
# Pagination
## Set per_page to 0 to disable pagination
per_page: 8
pagination_dir: page
# Extensions
theme: hexo-theme-snippet
# Deployment
deploy:
type: git
repo: xxx
branch: master
站点配置文件,和主题配置文件我都上传了,辛苦楼主了
确认hexo-generator-json-content是否安装在项目根目录下,建议拷贝主题下的package.json文件到项目根目录下,重新 npm i 一下。
楼主方便加个Q咨询下么,感觉这样聊的效率太低了,我只想让搜索的功能好使,就很完美了,平时不会打扰到楼主的,QQ:983442994。
@JiBaoBao 首先确认下,是否正确安装了hexo
,能够正常启动。然后在hexo
的目录路径下,执行npm i hexo-generator-json-content@2.2.0 -S
,然后在对应的node_modules
目录下,查看是否安装成功了。之后,修改配置,执行hexo clean && hexo server
来启动本地服务。
验证,搜索功能是否可用,谷歌搜索需要科学上网。本地搜索如果博客数量大的话,是有搜索延迟的,所以你搜索的时候,多等下。我这里是可以使用的。祝好运!
@EscapeLife 感谢EscapeLife细心解答,上述问题由于楼主的目录结构造成,已线下沟通解决。
楼主您好, 今天刚使用您的hexo主题,在配置的时候,发现站内搜索功能无法使用,想请问下原因。
【现有情况】 1、已安装安装hexo-generator-json-content插件 已经按照楼主的提示,安装了插件,安装命令如下
npm i hexo-generator-json-content@2.2.0 -S
2、安装插件后也将主题配置文件中的相应位置作了修改## 搜索 jsonContent: searchLocal: true # 是否启用本地搜索 searchGoogle: false #是否启用谷歌搜索 posts: title: true text: true content: true categories: false tags: false
【结果】 站内搜索还是无法使用