next-theme / hexo-generator-searchdb

🔍 Seach data generator plugin for Hexo.
https://www.npmjs.com/package/hexo-generator-searchdb
MIT License
63 stars 5 forks source link

CONFIG应该有哪些参数 #9

Closed ghost closed 3 years ago

ghost commented 3 years ago

使用报错

Uncaught ReferenceError: CONFIG is not defined
    at HTMLDocument.<anonymous> (local-search.js:2)
stevenjoezhang commented 3 years ago

能提供一下你的网页链接么?

ghost commented 3 years ago

Page Link,我没有声明CONFIG,还需要哪些配置呢。

stevenjoezhang commented 3 years ago

如果用的是这个脚本 https://github.com/next-theme/hexo-theme-next/blob/master/source/js/local-search.js

那么这个 CONFIG 是 NexT 主题的,大概长这样

var CONFIG = {"hostname":"theme-next.js.org","root":"/","images":"/images","scheme":"Gemini","version":"8.2.1","exturl":true,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":true,"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":true,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":true,"nav":null},"motion":{"enable":true,"async":true,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"Searching...","empty":"We didn't find any results for the search: ${query}","hits_time":"${hits} results found in ${time} ms","hits":"${hits} results found"},"path":"/search.json","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}};

如果是其他主题,可能需要自行修改 local-search.js 才能使用。这个 hexo-generator-searchdb 插件只负责生成搜索的索引,不包含前端脚本。