-
Notifications
You must be signed in to change notification settings - Fork 2
/
nuxt.config.ts
132 lines (112 loc) · 3.3 KB
/
nuxt.config.ts
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
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
app: {
head: {
htmlAttrs: {
lang: "en",
},
},
},
css: ["~/assets/css/main.css"],
postcss: {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
},
vue: {},
runtimeConfig: {
public: {
strapiUrl: process.env.STRAPI_URL,
},
},
routeRules: {
"/docs": { redirect: "/docs/getting-started/introduction" },
"/docs/**": { proxy: "https://activepieces.mintlify.dev/docs/**" },
"/plans": { redirect: "/pricing" },
"/roadmap": {
redirect: "https://github.com/orgs/activepieces/projects/53",
},
"/report-issue": {
redirect: "https://community.activepieces.com/c/need-help/5",
},
"/pieces-roadmap": {
redirect: "https://community.activepieces.com/c/feature-requests/9",
},
"/request-a-piece": {
redirect: "https://community.activepieces.com/c/feature-requests/9",
},
"/request-a-feature": {
redirect: "https://community.activepieces.com/c/feature-requests/9",
},
"/school": {
redirect:
"https://community.activepieces.com/c/tutorials/automation-school/11",
},
"/subprocessors": {
redirect: "https://trust.activepieces.com/subprocessors"
},
"/security": {
redirect: "https://trust.activepieces.com"
},
"/spells": {
redirect: "https://community.activepieces.com/t/ai-spells-month-15-ai-use-case/7023"
}
},
hooks: {
"pages:extend"(pages) {
// playbook- is a functional name that we use in the code to replace and parse the paths
pages.push({
name: "playbook-embedded-ipaas",
path: "/embedded-ipaas:all(.*)",
file: "~/pages/playbook/[...all].vue",
meta: { layout: "playbook" },
});
pages.push({
name: "playbook-ai-transformation",
path: "/ai-transformation:all(.*)",
file: "~/pages/playbook/[...all].vue",
meta: { layout: "playbook" },
});
},
},
modules: ["@nuxtjs/sitemap"],
sitemap: {
urls: async () => {
return [...(await getBlogUrls()), ...(await getPieceUrls())];
},
},
});
const getBlogUrls = async function () {
const perPage = 5;
let allBlogUrls = [];
let start = 0;
let limit = perPage;
let total = null;
let blogPostsUrl = null;
let blogPostsResponse = null;
let blogPosts = null;
while (total == null || start < total) {
const blogPostsUrl = `${process.env.STRAPI_URL}/api/posts?sort=createdAt:desc&pagination[page]=${start}&pagination[pageSize]=${perPage}&populate[author][populate]=photo&populate=categories`;
blogPostsResponse = await fetch(blogPostsUrl);
blogPosts = await blogPostsResponse.json();
allBlogUrls = [
...allBlogUrls,
...blogPosts.data.map((blog) => {
return `/blog/${blog.slug}`;
}),
];
if (total == null) total = blogPosts.meta.pagination.total;
start += limit;
}
return allBlogUrls;
};
const getPieceUrls = async function () {
const piecesUrl = "https://cloud.activepieces.com/api/v1/pieces";
const piecesResponse = await fetch(piecesUrl);
const pieces = await piecesResponse.json();
return pieces.map(
(piece) => `/pieces/${piece.name.match(/(?:^@[\w-]+\/piece-)([\w-]+)$/)[1]}`
);
};