-
Notifications
You must be signed in to change notification settings - Fork 0
/
prismic-configuration.js
45 lines (40 loc) · 1.08 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
35
36
37
38
39
40
41
42
43
44
45
// -- Prismic API endpoint
// Determines which repository to query and fetch data from
// Configure your site's access point here
const repoName = 'hki-decompression';
const repoUrl = `https://${repoName}.cdn.prismic.io`;
const apiEndpoint = `${repoUrl}/api/v2`;
const graphqlEndpoint = `${repoUrl}/graphql`;
// -- Access Token if the repository is not public
// Generate a token in your dashboard and configure it here if your repository is private
const accessToken = '';
// -- Link resolution rules
// Manages the url links to internal Prismic documents
const linkResolver = (doc) => {
if (doc.type === 'page') {
return `/${doc.lang}/${doc.uid}`;
}
if (doc.type === 'homepage') {
return `/${doc.lang}`;
}
return '/';
};
// Additional helper function for Next/Link components
const hrefResolver = (doc) => {
if (doc.type === 'page') {
return `/${doc.lang}/${doc.uid}`;
}
if (doc.type === 'homepage') {
return `/${doc.lang}`;
}
return '/';
};
module.exports = {
repoName,
repoUrl,
apiEndpoint,
graphqlEndpoint,
accessToken,
linkResolver,
hrefResolver,
};