-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Algolia DocSearch Integration #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
a010d64
feat: algolia search - basically migrated
ulivz 330d6f0
fix: enhance style
ulivz 8621a6c
chore: remove debug option
ulivz 0758918
chore: add some comments
ulivz 55826c5
Merge branch 'master' into algolia-docsearch
ulivz b1d2d26
Merge branch 'master' into algolia-docsearch
ulivz 4769b7b
chore: clean up css
ulivz e1d6e88
chore: clean up
ulivz 8177fc6
chore: clean up doc
ulivz 7da0c2a
chore: clean up
ulivz 2dffc4c
Update config.js
yyx990803 ed09b5f
style: limit the max width at mobile side
ulivz 5c3ae19
Merge branch 'algolia-docsearch' of https://github.com/ulivz/vuepress…
ulivz 702d676
feat: support algolia search per locale
ulivz ea8aa21
docs: document algolia option
ulivz a95aa89
docs: update i18n
ulivz 88f7435
chore: address comments
ulivz c150f22
Update README.md
yyx990803 44adcd0
Update config.js
yyx990803 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
</span> | ||
</router-link> | ||
<div class="links"> | ||
<AlgoliaSearchBox v-if="isAlgoliaSearch" :options="$site.themeConfig.algolia"/> | ||
<AlgoliaSearchBox v-if="isAlgoliaSearch" :options="algolia"/> | ||
<SearchBox v-if="isSearch"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 可以用 |
||
<NavLinks class="can-hide"/> | ||
</div> | ||
|
@@ -28,8 +28,11 @@ import NavLinks from './NavLinks.vue' | |
export default { | ||
components: { SidebarButton, NavLinks, SearchBox, AlgoliaSearchBox }, | ||
computed: { | ||
algolia () { | ||
return this.$themeLocaleConfig.algolia || this.$site.themeConfig.algolia || {} | ||
}, | ||
isAlgoliaSearch () { | ||
const { algolia } = this.$site.themeConfig | ||
const algolia = this.algolia | ||
return algolia && algolia.appId && algolia.apiKey && algolia.indexName | ||
}, | ||
isSearch() { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在的 webpack 配置会把所有 css 都抽取出来,即使用 dynamic import 也没用。这样的话不论用不用 algolia 都会加载这些 css。有一个办法是在 createBaseConfig 的时候如果用户没有使用 algolia 则直接把 AlgoliaSearchBox alias 到一个空 module, 这样可以彻底避免把这个组件打包进去。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
厉害了,我还没注意这个
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
哈哈哈哈哈,突然说中文 XD
莫名的可爱(●'◡'●)