-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.js
166 lines (148 loc) · 4.88 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
const createSitemapRoutes = async () => {
let routes = [];
const { $content } = require('@nuxt/content')
const articles = await $content('articles', {deep: true}).fetch();
for (const post of articles) {
routes.push(`${post.path.replace("articles/", "")}`);
}
return routes;
}
export default {
// Target: https://go.nuxtjs.dev/config-target
target: "static",
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: "nuxt-blog",
htmlAttrs: {
lang: "fr",
},
meta: [
{ charset: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{ hid: "description", name: "description", content: "Yaptığım şeyler, çalışmak, üretmek ve her gün daha fazla öğrenmek..." },
{ name: "format-detection", content: "telephone=no" },
{ hid: "og:type", name: "og:type", content: "website" },
{ hid: "og:title", name: "og:title", content: "Skorsky Blog" },
{ hid: "og:description", name: "og:description", content: "Yaptığım şeyler, çalışmak, üretmek ve her gün daha fazla öğrenmek..." },
{ hid: "og:url", name: "og:url", content: "https://skorskyblog.netlify.app/" },
{ name: "og:site_name", content: "Skorsky Blog" },
{ name: "og:locale", content: "tr_TR" },
],
link: [
{ rel: "alternate", type: "application/rss+xml", href: "https://skorskyblog.netlify.app/" },
{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }
],
},
router: {
trailingSlash: false,
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: ["@/assets/css/main.css", "@/assets/scss/main.scss"],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: ["@nuxt/postcss8", "@nuxt/image"],
vite: {
/* options for vite */
// ssr: true // enable unstable server-side rendering for development (false by default)
// experimentWarning: false // hide experimental warning message (disabled by default for tests)
vue: {
/* options for vite-plugin-vue2 */
},
},
// Modules: https://go.nuxtjs.dev/config-modules
modules: ["@nuxt/content", "@nuxtjs/svg", "@nuxt/image", '@nuxtjs/redirect-module',
'@nuxtjs/feed',
'@nuxtjs/sitemap'],
sitemap: {
hostname: 'https://skorskyblog.netlify.app/',
gzip: true,
routes: createSitemapRoutes,
exclude: ["/blog"]
},
feed: [
// A default feed configuration object
{
path: 'rss.xml', // The route to your feed.
// eslint-disable-next-line require-await
async create(feed) {
const baseUrlArticles = 'https://skorskyblog.netlify.app/';
const baseLinkFeedArticles = '/feed/'
feed.options = {
title: 'Skorsky Blog',
description: "Yaptığım şeyler, çalışmak, üretmek ve her gün daha fazla öğrenmek...",
link: baseUrlArticles,
}
const { $content } = require('@nuxt/content');
const articles = await $content('articles', {deep: true}).sortBy("date", 'desc').fetch()
articles.forEach((article) => {
const url = `${baseUrlArticles}${article.path.replace("articles/", "")}`
feed.addItem({
title: article.title,
id: url,
link: url,
date: new Date(article.date),
description: article.description,
author: 'H Hüseyin Alav'
})
})
}, // The create function (see below)
cacheTime: 1000 * 60 * 15, // How long should the feed be cached
type: 'rss2', // Can be: rss2, atom1, json1
data: []
},
],
redirect: [
{
from: '(?!^\/$|^\/[?].*$)(.*\/[?](.*)$|.*\/$)',
to: (from, req) => {
const base = req._parsedUrl.pathname.replace(/\/$/, '');
const search = req._parsedUrl.search;
return base + (search != null ? search : '');
}
}
],
svg: {
vueSvgLoader: {
// vue-svg-loader options
},
svgSpriteLoader: {
// svg-sprite-loader options
},
fileLoader: {
// file-loader options
},
},
content: {
liveEdit: false,
markdown: {
prism: {
theme: "prism-themes/themes/prism-dracula.css",
},
},
},
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
transpile: [
"three"
],
postcss: {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
},
hooks: {
'content:file:beforeInsert': (document) => {
const removeMd = require('remove-markdown');
const stats = require('reading-time')(document.text);
if (document.extension === '.md') {
document.bodyPlainText = removeMd(document.text);
document.readTime = stats;
}
},
},
};