Skip to content

Commit e8fc1d6

Browse files
committed
feat: add Algolia DocSearch to documentation site
The `apiKey`, `appId` and `indexName` parameters specified in `MainPage.js` should be updated in order for the search to work
1 parent bd4e971 commit e8fc1d6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

index.html

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<link rel="stylesheet" href="style/app.css">
1616
<link rel="stylesheet" href="style/prism.css">
1717
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
18+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@3" />
1819
<link rel="apple-touch-icon" sizes="180x180" href="image/favicon/apple-touch-icon.png">
1920
<link rel="icon" type="image/png" sizes="32x32" href="image/favicon/favicon-32x32.png">
2021
<link rel="icon" type="image/png" sizes="16x16" href="image/favicon/favicon-16x16.png">
@@ -45,6 +46,7 @@
4546
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.8.1/components/prism-json.min.js"></script> <!--node_modules/prismjs/components/prism-typescript.js-->
4647
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.8.1/components/prism-sql.min.js"></script> <!--node_modules/prismjs/components/prism-typescript.js-->
4748
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/2.0.3/fetch.min.js"></script>
49+
<script src="https://cdn.jsdelivr.net/npm/@docsearch/js@3"></script> <!-- Algolia DocSearch -->
4850

4951
<script src="script/constant/Links.js"></script>
5052
<script src="locale/en.js"></script>

script/component/MainPage.js

+10
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ const MainPage = {
2525
</svg>
2626
</a>
2727
</li>-->
28+
<li class="nav-item" style="margin-inline-end: 16px">
29+
<div id="docsearch"></div>
30+
</li>
2831
<li class="nav-item">
2932
<a class="nav-link" href="https://join.slack.com/t/typeorm/shared_invite/zt-uu12ljeb-OH_0086I379fUDApYJHNuw" title="Slack">
3033
<svg aria-labelledby="simpleicons-slack-icon" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="#FF0064">
@@ -102,6 +105,13 @@ const MainPage = {
102105
scriptEl.setAttribute('id', '_carbonads_js');
103106
scriptEl.setAttribute('async', null);
104107
this.$refs.carbon.appendChild(scriptEl);
108+
109+
docsearch({
110+
container: '#docsearch',
111+
appId: 'YOUR_APP_ID', // TODO: replace with `appId` from https://docsearch.algolia.com/apply/
112+
indexName: 'YOUR_INDEX_NAME', // TODO: replace with `indexName` from https://docsearch.algolia.com/apply/
113+
apiKey: 'YOUR_SEARCH_API_KEY' // TODO: replace with `apiKey` from https://docsearch.algolia.com/apply/
114+
});
105115
},
106116
methods: {
107117
goToLink: function () {

0 commit comments

Comments
 (0)