-
Notifications
You must be signed in to change notification settings - Fork 16
/
nuxt.config.js
112 lines (95 loc) · 2.55 KB
/
nuxt.config.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import config from "./modules/config"
import { getPostRoute, getPostRoutes, getCategory } from "./modules/contenter"
import { locales } from "./lang.config.js"
module.exports = {
mode: "universal",
env: {
repoUrl: config.repoUrl,
repoBranch: config.repoBranch,
algoliaIndex: config.algoliaIndex,
algoliaApplicationId: config.algoliaApplicationId,
algoliaSearchKey: config.algoliaSearchKey
},
head: {
title: config.indexTitle,
titleTemplate: `%s » ${config.baseTitle}`,
meta: config.headMeta,
link: config.headLinks
},
loading: {
color: "#06ba77",
height: "4px",
throttle: 0,
},
css: [
"@vonagevolta/volta2/dist/css/volta.min.css",
"@vonagevolta/volta2/dist/css/volta-error-page.min.css",
"@vonagevolta/volta2/dist/css/volta-templates.min.css",
"@/assets/css/volta-prism-dark.css",
"@/assets/css/main.css",
],
plugins: [
{ src: "@/plugins/vue-moment.js" },
{ src: "@/plugins/vue-fragment.js" },
{ src: "@/plugins/filters.js" },
{ src: "@/plugins/vue-instantsearch.js" },
{ src: "@/plugins/vue-disqus.js" },
],
modules: [
"nuxt-i18n",
"@nuxt/content",
// "@nuxtjs/feed"
],
i18n: {
strategy: 'prefix_except_default',
locales: locales,
lazy: true,
langDir: 'lang/',
defaultLocale: 'en',
vueI18n: {
fallbackLocale: 'en'
},
detectBrowserLanguage: {
useCookie: true,
cookieKey: 'i18n_redirected',
onlyOnRoot: true,
}
},
// feed: async () => {
// const { $content } = require('@nuxt/content')
// const posts = await $content('blog/en')
// .only(['author', 'category', 'title', 'slug', 'description', 'route', 'raw'])
// .fetch()
// return getFeeds(posts)
// },
hooks: {
'content:file:beforeInsert': (document) => {
if (document.extension === '.md') {
const path = document.dir.replace(/^\/+|\/+$/g, '')
const [ type, locale ] = path.split('/')
document.type = type
document.locale = locale
const { time } = require('reading-time')(document.text)
document.readingTime = time
document.raw = document.text
document.categoryObject = getCategory(document.category)
document.route = getPostRoute(document)
document.routes = getPostRoutes(document)
}
}
},
generate: {
fallback: true
},
buildModules: [
'@nuxtjs/dotenv'
],
build: {
transpile: ["vue-instantsearch", "instantsearch.js/es"],
extend (config) {
config.node = {
fs: 'empty'
}
}
}
}