Skip to content

Commit eda14d2

Browse files
author
JavasHub
committed
update theme
1 parent 2e73c11 commit eda14d2

File tree

3 files changed

+128
-3
lines changed

3 files changed

+128
-3
lines changed

config/爬虫.js renamed to config/爬虫_imlyk.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
new Crawler({
2-
appId: "KH7SY7AEUO",
2+
appId: "KH7SY7AEUO", // imlyk 的 Algolia App ID
33
apiKey: "c8df03a5a5e8ac753a318c6595fb6658",
44
rateLimit: 8,
55
startUrls: [

config/爬虫_javashub.js

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
new Crawler({
2+
appId: "UVSSLWQYFO",
3+
apiKey: "7e5529ef40eb7dd648a5f7bb4db76243",
4+
rateLimit: 8,
5+
startUrls: [
6+
// 这是 Algolia 开始抓取网站的初始地址
7+
// 如果你的网站被分为数个独立部分,你可能需要在此设置多个入口链接
8+
"https://javashub.cn", "https://www.javashub.cn"
9+
],
10+
sitemaps: [
11+
// 如果你在使用 Sitemap 插件 (如: @vuepress/plugin-sitemap),你可以提供 Sitemap 链接
12+
"https://javashub.cn/sitemap.xml",
13+
],
14+
ignoreCanonicalTo: false,
15+
exclusionPatterns: [
16+
// 你可以通过它阻止 Algolia 抓取某些 URL
17+
],
18+
discoveryPatterns: [
19+
// 这是 Algolia 抓取 URL 的范围
20+
"https://javashub.cn/**",
21+
],
22+
// 爬虫执行的计划时间,可根据文档更新频率设置
23+
schedule: "at 02:00 every 1 day",
24+
actions: [
25+
// 你可以拥有多个 action,特别是你在一个域名下部署多个文档时
26+
{
27+
// 使用适当的名称为索引命名
28+
indexName: "javashub",
29+
// 索引生效的路径
30+
pathsToMatch: [
31+
"https://javashub.cn/**",
32+
"https://www.javashub.cn/**"
33+
],
34+
// 控制 Algolia 如何抓取你的站点
35+
recordExtractor: ({ $, helpers }) => {
36+
// 以下是适用于 vuepress-theme-hope 的默认选项选项
37+
return helpers.docsearch({
38+
recordProps: {
39+
lvl0: {
40+
selectors: [".vp-sidebar-link.active", "[vp-content] h1"],
41+
defaultValue: "Documentation",
42+
},
43+
lvl1: "[vp-content] h1",
44+
lvl2: "[vp-content] h2",
45+
lvl3: "[vp-content] h3",
46+
lvl4: "[vp-content] h4",
47+
lvl5: "[vp-content] h5",
48+
lvl6: "[vp-content] h6",
49+
content: "[vp-content] p, [vp-content] ul, [vp-content] li",
50+
},
51+
recordVersion: "v3",
52+
});
53+
},
54+
},
55+
],
56+
initialIndexSettings: {
57+
// 控制索引如何被初始化,这仅当索引尚未生成时有效
58+
// 你可能需要在修改后手动删除并重新生成新的索引
59+
YOUR_INDEX_NAME: {
60+
attributesForFaceting: ["type", "lang"],
61+
attributesToRetrieve: ["hierarchy", "content", "anchor", "url"],
62+
attributesToHighlight: ["hierarchy", "hierarchy_camel", "content"],
63+
attributesToSnippet: ["content:10"],
64+
camelCaseAttributes: ["hierarchy", "hierarchy_radio", "content"],
65+
searchableAttributes: [
66+
"unordered(hierarchy_radio_camel.lvl0)",
67+
"unordered(hierarchy_radio.lvl0)",
68+
"unordered(hierarchy_radio_camel.lvl1)",
69+
"unordered(hierarchy_radio.lvl1)",
70+
"unordered(hierarchy_radio_camel.lvl2)",
71+
"unordered(hierarchy_radio.lvl2)",
72+
"unordered(hierarchy_radio_camel.lvl3)",
73+
"unordered(hierarchy_radio.lvl3)",
74+
"unordered(hierarchy_radio_camel.lvl4)",
75+
"unordered(hierarchy_radio.lvl4)",
76+
"unordered(hierarchy_radio_camel.lvl5)",
77+
"unordered(hierarchy_radio.lvl5)",
78+
"unordered(hierarchy_radio_camel.lvl6)",
79+
"unordered(hierarchy_radio.lvl6)",
80+
"unordered(hierarchy_camel.lvl0)",
81+
"unordered(hierarchy.lvl0)",
82+
"unordered(hierarchy_camel.lvl1)",
83+
"unordered(hierarchy.lvl1)",
84+
"unordered(hierarchy_camel.lvl2)",
85+
"unordered(hierarchy.lvl2)",
86+
"unordered(hierarchy_camel.lvl3)",
87+
"unordered(hierarchy.lvl3)",
88+
"unordered(hierarchy_camel.lvl4)",
89+
"unordered(hierarchy.lvl4)",
90+
"unordered(hierarchy_camel.lvl5)",
91+
"unordered(hierarchy.lvl5)",
92+
"unordered(hierarchy_camel.lvl6)",
93+
"unordered(hierarchy.lvl6)",
94+
"content",
95+
],
96+
distinct: true,
97+
attributeForDistinct: "url",
98+
customRanking: [
99+
"desc(weight.pageRank)",
100+
"desc(weight.level)",
101+
"asc(weight.position)",
102+
],
103+
ranking: [
104+
"words",
105+
"filters",
106+
"typo",
107+
"attribute",
108+
"proximity",
109+
"exact",
110+
"custom",
111+
],
112+
highlightPreTag:
113+
'<span class="algolia-docsearch-suggestion--highlight">',
114+
highlightPostTag: "</span>",
115+
minWordSizefor1Typo: 3,
116+
minWordSizefor2Typos: 7,
117+
allowTyposOnNumericTokens: false,
118+
minProximity: 1,
119+
ignorePlurals: true,
120+
advancedSyntax: true,
121+
attributeCriteriaComputedByMinProximity: true,
122+
removeWordsIfNoResults: "allOptional",
123+
},
124+
},
125+
});

src/.vuepress/theme.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ export default hopeTheme({
143143

144144
// docsearch 搜索插件选项
145145
docsearch: {
146-
appId: "UVSSLWQYFO", // "KH7SY7AEUO", // imlyk
147-
apiKey: "7e5529ef40eb7dd648a5f7bb4db76243", // "c8df03a5a5e8ac753a318c6595fb6658", // imlyk
146+
appId: "UVSSLWQYFO",
147+
apiKey: "7d5f58f8e1810c6ed8d0164795c7f39a",
148148
indexName: "javashub", // javashub
149149
locales: {
150150
"/": {

0 commit comments

Comments
 (0)