-
Notifications
You must be signed in to change notification settings - Fork 16
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 (#50)
* feat: update layout for algolia search * docs: update sdk links * fix: eslint error * feat: update docs version * chore: fix eslint error
- Loading branch information
1 parent
2fbc60a
commit 99730e3
Showing
7 changed files
with
164 additions
and
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const defaultCategory = 'Community Code'; | ||
|
||
// Order by most specific to least specific. | ||
// e.g. `/js/ethers/api/v5` before `/js/ethers` | ||
const categories = [['/tutorials', 'Community Code Guides']] 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