-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update layout for algolia search (#203)
# Description Update layout for algolia search crawler
- Loading branch information
1 parent
e07eb99
commit 4dfaf87
Showing
8 changed files
with
68 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const defaultCategory = 'ZKsync Docs'; | ||
|
||
// Order by most specific to least specific. | ||
// e.g. `/js/ethers/api/v5` before `/js/ethers` | ||
const categories = [ | ||
['/build/start-coding/quick-start', 'Quick Start ZKsync'], | ||
['/build/start-coding/zksync-101', 'ZKsync 101 Tutorial'], | ||
['/build/zksync-cli', 'ZKsync CLI'], | ||
['/build/tooling/hardhat', 'Hardhat'], | ||
['/build/tooling/foundry', 'Foundry'], | ||
['/build/developer-reference', 'Developer Reference'], | ||
['/build/api-reference', 'ZKsync API'], | ||
['/build/resources', 'Resources'], | ||
['/build', 'Build'], | ||
['/zk-stack/running-a-zk-chain', 'Running a ZK Chain'], | ||
['/zk-stack', 'ZK Stack'], | ||
['/zksync-node', 'ZKsync Node'], | ||
['/ecosystem', 'Ecosystem'], | ||
] as const; | ||
|
||
/** | ||
* Returns the category of the current route. | ||
* Primarily this is for the algolia docsearch | ||
*/ | ||
export const useCategory = () => { | ||
const route = useRoute(); | ||
const category = ref(defaultCategory); | ||
// for if we ever have i18n routes, remove the language prefix | ||
// const langAgnosticPath = route.path.replace(/\/\w\w(-\w\w)?\//, ''); | ||
for (const [path, label] of categories) { | ||
if (route.path.startsWith(path)) { | ||
category.value = label; | ||
break; | ||
} | ||
} | ||
return category; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters