forked from statamic/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
46 lines (37 loc) · 1.11 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import Alpine from 'alpinejs';
import docsearch from '@docsearch/js';
import '@docsearch/css';
require('./anchors.js')
require('./cookies.js')
require('./external-links.js')
var dayjs = require('dayjs')
var relativeTime = require('dayjs/plugin/relativeTime')
dayjs.extend(relativeTime)
window.dayjs = dayjs;
docsearch({
container: '#docsearch',
appId: 'BH4D9OD16A',
indexName: 'statamic_3',
apiKey: 'b5e8f73c7462a6d5c8b525ef183aabec',
transformItems(items) {
return items.map((item) => {
// Transform the absolute URL into a relative URL so it works locally.
const a = document.createElement('a');
a.href = item.url;
// If the result is the h1, remove the hash
const hash = a.hash === '#content' ? '' : a.hash;
return {...item, url: `${a.pathname}${hash}`}
});
},
});
window.bodyData = function() {
let primaryKeyBind = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform) ? 'meta' : 'ctrl';
return {
showNav: false,
showSearch: false,
showEasterEgg: false,
nearTop: true,
};
}
Alpine.start();
window.Alpine = Alpine;