11const { gitDescribeSync } = require ( 'git-describe' ) ;
22
3+ import { hostPath } from './src/plugins/env' ;
4+
35process . env . APP_VERSION = require ( './package.json' ) . version ;
46process . env . GIT_DESCRIBE = JSON . stringify ( gitDescribeSync ( {
57 longSemver : true ,
@@ -8,32 +10,44 @@ process.env.GIT_DESCRIBE = JSON.stringify(gitDescribeSync({
810 match : '*' ,
911} ) ) ;
1012
13+ const publicRuntimeConfig = {
14+ siteName : 'id.kb.se' ,
15+ environment : process . env . ENV || 'local' ,
16+ defaultSite : process . env . DEFAULT_SITE || 'id.kb.se' ,
17+ siteAlias : JSON . parse ( process . env . XL_SITE_ALIAS || '{}' ) ,
18+ siteConfig : JSON . parse ( process . env . XL_SITE_CONFIG || '{}' ) ,
19+ vocab : process . env . XL_VOCAB || 'https://id.kb.se/vocab/data.jsonld' ,
20+ context : process . env . XL_CONTEXT || 'https://id.kb.se/context.jsonld' ,
21+ display : process . env . XL_DISPLAY || 'https://id.kb.se/vocab/display/data.jsonld'
22+ } ;
23+
24+ const defaultHostPath = hostPath ( publicRuntimeConfig . defaultSite , publicRuntimeConfig . siteAlias , publicRuntimeConfig . siteConfig ) ;
25+
1126export default {
1227 // Global page headers: https://go.nuxtjs.dev/config-head
13- head ( ) {
14- return {
15- title : 'id.kb.se' ,
16- htmlAttrs : {
17- lang : 'sv'
18- } ,
19- meta : [
20- { charset : 'utf-8' } ,
21- { name : 'viewport' , content : 'width=device-width, initial-scale=1' } ,
22- { hid : 'description' , name : 'description' , content : 'Grundstenar för länkade data hos Kungliga biblioteket.' } ,
23- { hid :'og:title' , property :'og:title' , content :'id.kb.se' } ,
24- { hid :'og:site_name' , property :'og:site_name' , content :'id.kb.se' } ,
25- { hid :'og:description' , property :'og:description' , content :'Grundstenar för länkade data hos Kungliga biblioteket.' } ,
26- { hid :'og:image' , property :'og:image' , content :`${ this . $defaultHostPath ( ) } /opengraph_id.png` } ,
27- { hid :'og:image:width' , property :'og:image:width' , content :'1200' } ,
28- { hid :'og:image:height' , property :'og:image:height' , content :'600' } ,
29- { hid :'twitter:image' , property :'twitter:image' , content :`${ this . $defaultHostPath ( ) } /opengraph_id.png` } ,
30- { hid :'twitter:card' , name :'twitter:card' , content :'summary_large_image' } ,
31- ] ,
32- link : [
33- { rel : 'icon' , type : 'image/svg+xml' , href : '/favicon.svg' } ,
34- { rel : 'icon' , type : 'image/x-icon' , href : '/favicon.ico' }
35- ]
36- }
28+ head : {
29+ title : 'id.kb.se' ,
30+ htmlAttrs : {
31+ lang : 'sv'
32+ } ,
33+ meta : [
34+ { charset : 'utf-8' } ,
35+ { name : 'viewport' , content : 'width=device-width, initial-scale=1' } ,
36+ { hid : 'description' , name : 'description' , content : 'Grundstenar för länkade data hos Kungliga biblioteket.' } ,
37+ { hid :'og:title' , property :'og:title' , content :'id.kb.se' } ,
38+ { hid :'og:site_name' , property :'og:site_name' , content :'id.kb.se' } ,
39+ { hid :'og:description' , property :'og:description' , content :'Grundstenar för länkade data hos Kungliga biblioteket.' } ,
40+ { hid :'og:image' , property :'og:image' , content : defaultHostPath + '/opengraph_id.png' } ,
41+ { hid :'og:image:width' , property :'og:image:width' , content :'1200' } ,
42+ { hid :'og:image:height' , property :'og:image:height' , content :'600' } ,
43+ { hid :'twitter:image' , property :'twitter:image' , content : defaultHostPath + '/opengraph_id.png' } ,
44+ { hid :'twitter:card' , name :'twitter:card' , content :'summary_large_image' } ,
45+ ] ,
46+ link : [
47+ { rel : 'icon' , type : 'image/svg+xml' , href : '/favicon.svg' } ,
48+ { rel : 'icon' , type : 'image/x-icon' , href : '/favicon.ico' }
49+ ] ,
50+ script : [ ]
3751 } ,
3852
3953 // Global CSS: https://go.nuxtjs.dev/config-css
@@ -46,6 +60,7 @@ export default {
4660 '~plugins/filters.js' ,
4761 '~mixins/lxl.js' ,
4862 '~plugins/envInjects.js' ,
63+ { src : '~/plugins/cookieConsent.js' , mode : 'client' }
4964 ] ,
5065
5166 router : {
@@ -74,6 +89,12 @@ export default {
7489
7590 // Modules: https://go.nuxtjs.dev/config-modules
7691 modules : [
92+ [ 'nuxt-matomo' , {
93+ matomoUrl : process . env . PUBLIC_MATOMO_URL ,
94+ siteId : process . env . PUBLIC_MATOMO_ID ,
95+ debug : process . env . NODE_ENV === 'development' ? true : false ,
96+ consentRequired : true
97+ } ] ,
7798 '@nuxtjs/style-resources' ,
7899 '@nuxt/http' ,
79100 '~/modules/vocab-cache'
@@ -93,16 +114,7 @@ export default {
93114 ] ,
94115 } ,
95116
96- publicRuntimeConfig : {
97- siteName : 'id.kb.se' ,
98- environment : process . env . ENV || 'local' ,
99- defaultSite : process . env . DEFAULT_SITE || 'id.kb.se' ,
100- siteAlias : JSON . parse ( process . env . XL_SITE_ALIAS || '{}' ) ,
101- siteConfig : JSON . parse ( process . env . XL_SITE_CONFIG || '{}' ) ,
102- vocab : process . env . XL_VOCAB || 'https://id.kb.se/vocab/data.jsonld' ,
103- context : process . env . XL_CONTEXT || 'https://id.kb.se/context.jsonld' ,
104- display : process . env . XL_DISPLAY || 'https://id.kb.se/vocab/display/data.jsonld'
105- } ,
117+ publicRuntimeConfig,
106118
107119 privateRuntimeConfig : {
108120 } ,
@@ -121,4 +133,4 @@ export default {
121133 }
122134 } ,
123135 srcDir : 'src/'
124- }
136+ }
0 commit comments