-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprismic-configuration.js
34 lines (31 loc) · 1.01 KB
/
prismic-configuration.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
module.exports = {
// -- Prismic API endpoint
// Determines which repository to query and fetch data from
// Configure your site's access point here
apiEndpoint: 'https://vuejs-multi-page-example.cdn.prismic.io/api/v2',
// -- Access Token if the repository is not public
// Generate a token in your dashboard and configure it here if your repository is private
//accessToken: '########',
// -- Link resolution rules
// Manages links to internal Prismic documents
// Modify as your project grows to handle any new routes you've made
linkResolver: function(doc) {
if (doc.type === 'page') {
return `/${doc.lang}/${doc.uid}`;
}
if (doc.type === 'homepage') {
return `/${doc.lang}`;
}
return '/';
},
// Additional helper function for Next/Link component
hrefResolver: function(doc) {
if (doc.type === 'page') {
return `/locale=${doc.lang}&page?uid=${doc.uid}`;
}
if (doc.type === 'homepage') {
return `/locale=${doc.lang}`;
}
return '/'
}
};