Skip to content

Commit

Permalink
update docsearch category
Browse files Browse the repository at this point in the history
  • Loading branch information
damonc-top committed Oct 25, 2024
1 parent 7c125be commit eaec143
Show file tree
Hide file tree
Showing 40 changed files with 117 additions and 2,131 deletions.
59 changes: 3 additions & 56 deletions docs/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -447,68 +447,15 @@ <h1>404</h1>

<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>
<script type="text/javascript">
// 定义通用配置
const searchConfig = {
docsearch({
appId: "NCUJ5WJECO",
apiKey: "b625a4b91a45af033cbdb526694e9e65",
indexName: "damonc",
lang: " ", // 显式设置语言
insights: true,
debug: false,
// 添加搜索配置
searchParameters: {
attributesToRetrieve: [
'hierarchy.lvl0',
'hierarchy.lvl1',
'hierarchy.lvl2',
'hierarchy.lvl3',
'hierarchy.lvl4',
'hierarchy.lvl5',
'hierarchy.lvl6',
'content',
'type',
'url'
]
},
// 添加转换器处理可能的未定义值
transformItems(items) {
return items.map(item => ({
...item,
// 确保 hierarchy 存在
hierarchy: item.hierarchy || {
lvl0: item.lvl0 || '文档',
lvl1: item.lvl1 || '',
lvl2: item.lvl2 || '',
lvl3: item.lvl3 || '',
},
}));
},
// 自定义搜索结果模板
hitComponent: ({ hit, children }) => {
return {
...hit,
title: hit.hierarchy?.lvl0 || hit.lvl0 || '未命名',
content: hit.content || ''
};
}
};

// 初始化搜索实例
try {
// 第一个搜索框
docsearch({
...searchConfig,
container: 'li#search',
});

// 第二个搜索框
docsearch({
...searchConfig,
container: '#search-toggle',
});
} catch (error) {
console.error('DocSearch initialization error:', error);
}
container: 'li#search',
});
</script>

</body>
Expand Down
59 changes: 3 additions & 56 deletions docs/CG_Function_Library.html
Original file line number Diff line number Diff line change
Expand Up @@ -1206,68 +1206,15 @@ <h2 id="调试函数debugging-function">调试函数(Debugging Function)</h2

<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>
<script type="text/javascript">
// 定义通用配置
const searchConfig = {
docsearch({
appId: "NCUJ5WJECO",
apiKey: "b625a4b91a45af033cbdb526694e9e65",
indexName: "damonc",
lang: " ", // 显式设置语言
insights: true,
debug: false,
// 添加搜索配置
searchParameters: {
attributesToRetrieve: [
'hierarchy.lvl0',
'hierarchy.lvl1',
'hierarchy.lvl2',
'hierarchy.lvl3',
'hierarchy.lvl4',
'hierarchy.lvl5',
'hierarchy.lvl6',
'content',
'type',
'url'
]
},
// 添加转换器处理可能的未定义值
transformItems(items) {
return items.map(item => ({
...item,
// 确保 hierarchy 存在
hierarchy: item.hierarchy || {
lvl0: item.lvl0 || '文档',
lvl1: item.lvl1 || '',
lvl2: item.lvl2 || '',
lvl3: item.lvl3 || '',
},
}));
},
// 自定义搜索结果模板
hitComponent: ({ hit, children }) => {
return {
...hit,
title: hit.hierarchy?.lvl0 || hit.lvl0 || '未命名',
content: hit.content || ''
};
}
};

// 初始化搜索实例
try {
// 第一个搜索框
docsearch({
...searchConfig,
container: 'li#search',
});

// 第二个搜索框
docsearch({
...searchConfig,
container: '#search-toggle',
});
} catch (error) {
console.error('DocSearch initialization error:', error);
}
container: 'li#search',
});
</script>

</body>
Expand Down
59 changes: 3 additions & 56 deletions docs/UNity_Shader_Fog.html
Original file line number Diff line number Diff line change
Expand Up @@ -1440,68 +1440,15 @@ <h3 id="no-fog">No Fog</h3>

<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>
<script type="text/javascript">
// 定义通用配置
const searchConfig = {
docsearch({
appId: "NCUJ5WJECO",
apiKey: "b625a4b91a45af033cbdb526694e9e65",
indexName: "damonc",
lang: " ", // 显式设置语言
insights: true,
debug: false,
// 添加搜索配置
searchParameters: {
attributesToRetrieve: [
'hierarchy.lvl0',
'hierarchy.lvl1',
'hierarchy.lvl2',
'hierarchy.lvl3',
'hierarchy.lvl4',
'hierarchy.lvl5',
'hierarchy.lvl6',
'content',
'type',
'url'
]
},
// 添加转换器处理可能的未定义值
transformItems(items) {
return items.map(item => ({
...item,
// 确保 hierarchy 存在
hierarchy: item.hierarchy || {
lvl0: item.lvl0 || '文档',
lvl1: item.lvl1 || '',
lvl2: item.lvl2 || '',
lvl3: item.lvl3 || '',
},
}));
},
// 自定义搜索结果模板
hitComponent: ({ hit, children }) => {
return {
...hit,
title: hit.hierarchy?.lvl0 || hit.lvl0 || '未命名',
content: hit.content || ''
};
}
};

// 初始化搜索实例
try {
// 第一个搜索框
docsearch({
...searchConfig,
container: 'li#search',
});

// 第二个搜索框
docsearch({
...searchConfig,
container: '#search-toggle',
});
} catch (error) {
console.error('DocSearch initialization error:', error);
}
container: 'li#search',
});
</script>

</body>
Expand Down
59 changes: 3 additions & 56 deletions docs/Unity_Addressabel_Group.html
Original file line number Diff line number Diff line change
Expand Up @@ -779,68 +779,15 @@ <h2 id="assetgroup">AssetGroup</h2>

<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>
<script type="text/javascript">
// 定义通用配置
const searchConfig = {
docsearch({
appId: "NCUJ5WJECO",
apiKey: "b625a4b91a45af033cbdb526694e9e65",
indexName: "damonc",
lang: " ", // 显式设置语言
insights: true,
debug: false,
// 添加搜索配置
searchParameters: {
attributesToRetrieve: [
'hierarchy.lvl0',
'hierarchy.lvl1',
'hierarchy.lvl2',
'hierarchy.lvl3',
'hierarchy.lvl4',
'hierarchy.lvl5',
'hierarchy.lvl6',
'content',
'type',
'url'
]
},
// 添加转换器处理可能的未定义值
transformItems(items) {
return items.map(item => ({
...item,
// 确保 hierarchy 存在
hierarchy: item.hierarchy || {
lvl0: item.lvl0 || '文档',
lvl1: item.lvl1 || '',
lvl2: item.lvl2 || '',
lvl3: item.lvl3 || '',
},
}));
},
// 自定义搜索结果模板
hitComponent: ({ hit, children }) => {
return {
...hit,
title: hit.hierarchy?.lvl0 || hit.lvl0 || '未命名',
content: hit.content || ''
};
}
};

// 初始化搜索实例
try {
// 第一个搜索框
docsearch({
...searchConfig,
container: 'li#search',
});

// 第二个搜索框
docsearch({
...searchConfig,
container: '#search-toggle',
});
} catch (error) {
console.error('DocSearch initialization error:', error);
}
container: 'li#search',
});
</script>

</body>
Expand Down
59 changes: 3 additions & 56 deletions docs/Unity_Addressable_Editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -1042,68 +1042,15 @@ <h2 id="addressable-groups">Addressable Groups</h2>

<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script>
<script type="text/javascript">
// 定义通用配置
const searchConfig = {
docsearch({
appId: "NCUJ5WJECO",
apiKey: "b625a4b91a45af033cbdb526694e9e65",
indexName: "damonc",
lang: " ", // 显式设置语言
insights: true,
debug: false,
// 添加搜索配置
searchParameters: {
attributesToRetrieve: [
'hierarchy.lvl0',
'hierarchy.lvl1',
'hierarchy.lvl2',
'hierarchy.lvl3',
'hierarchy.lvl4',
'hierarchy.lvl5',
'hierarchy.lvl6',
'content',
'type',
'url'
]
},
// 添加转换器处理可能的未定义值
transformItems(items) {
return items.map(item => ({
...item,
// 确保 hierarchy 存在
hierarchy: item.hierarchy || {
lvl0: item.lvl0 || '文档',
lvl1: item.lvl1 || '',
lvl2: item.lvl2 || '',
lvl3: item.lvl3 || '',
},
}));
},
// 自定义搜索结果模板
hitComponent: ({ hit, children }) => {
return {
...hit,
title: hit.hierarchy?.lvl0 || hit.lvl0 || '未命名',
content: hit.content || ''
};
}
};

// 初始化搜索实例
try {
// 第一个搜索框
docsearch({
...searchConfig,
container: 'li#search',
});

// 第二个搜索框
docsearch({
...searchConfig,
container: '#search-toggle',
});
} catch (error) {
console.error('DocSearch initialization error:', error);
}
container: 'li#search',
});
</script>

</body>
Expand Down
Loading

0 comments on commit eaec143

Please sign in to comment.