-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.ts
More file actions
249 lines (238 loc) · 7.54 KB
/
astro.config.ts
File metadata and controls
249 lines (238 loc) · 7.54 KB
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
import cloudflare from "@astrojs/cloudflare";
import mdx from "@astrojs/mdx";
import partytown from "@astrojs/partytown";
import sitemap from "@astrojs/sitemap";
import solid from "@astrojs/solid-js";
import rehypeD2 from "@beoe/rehype-d2";
import tailwindcss from "@tailwindcss/vite";
import AstroPWA from "@vite-pwa/astro";
import { defineConfig } from "astro/config";
import rehypeCopyCodeButton from "./src/lib/rehypeCopyCodeButton";
import { PERSON_NAME, SITE_URL } from "./src/lib/siteMeta";
import { getLastmodForUrl } from "./src/lib/sitemapDates";
const legacyInsightRedirects = {
"/blog/ab-testing-best-practices-improve-conversions/":
"/insights/conversion-growth/ab-testing-best-practices-conversions/",
"/blog/ab-testing-best-practices-conversions/":
"/insights/conversion-growth/ab-testing-best-practices-conversions/",
"/blog/why-astro-best-framework-marketing-sites/":
"/insights/web-development/astro-service-business-websites/",
"/blog/astro-service-business-websites/":
"/insights/web-development/astro-service-business-websites/",
"/blog/how-to-automate-lead-qualification-with-ai/":
"/insights/ai-automation/automate-lead-qualification-with-ai/",
"/blog/automate-lead-qualification-with-ai/":
"/insights/ai-automation/automate-lead-qualification-with-ai/",
"/blog/building-mvp-4-weeks-technical-guide/":
"/insights/web-development/build-saas-mvp-4-weeks/",
"/blog/build-saas-mvp-4-weeks/":
"/insights/web-development/build-saas-mvp-4-weeks/",
"/blog/openai-vs-anthropic-which-llm-for-business/":
"/insights/ai-automation/choose-right-llm-business-workflow/",
"/blog/choose-right-llm-business-workflow/":
"/insights/ai-automation/choose-right-llm-business-workflow/",
"/blog/building-custom-chatgpt-interfaces-for-business/":
"/insights/ai-automation/custom-chatgpt-interface-business/",
"/blog/custom-chatgpt-interface-business/":
"/insights/ai-automation/custom-chatgpt-interface-business/",
"/blog/how-programmatic-seo-generates-10x-traffic/":
"/insights/seo/programmatic-seo-quality-scalable-pages/",
"/blog/programmatic-seo-quality-scalable-pages/":
"/insights/seo/programmatic-seo-quality-scalable-pages/",
"/blog/complete-technical-seo-audit-checklist/":
"/insights/seo/technical-seo-audit-checklist/",
"/blog/complete-technical-seo-audit-checklist-2025/":
"/insights/seo/technical-seo-audit-checklist/",
"/blog/technical-seo-audit-checklist/":
"/insights/seo/technical-seo-audit-checklist/",
} satisfies Record<string, string>;
const legacyPortfolioRedirects = {
"/portfolio/": "/services/",
"/portfolio/content-marketing-strategy/": "/services/seo-growth/",
"/portfolio/paid-social-campaigns/": "/services/google-ads-management/",
"/portfolio/social-media-management/": "/services/social-media-growth/",
"/portfolio/ai-workflow-automation/": "/services/ai-workflow-automation/",
} satisfies Record<string, string>;
// https://astro.build/config
export default defineConfig({
adapter: cloudflare(),
// Used to generate canonical URLs and sitemap entries.
site: SITE_URL,
// Consistent URL format - all URLs end with /
trailingSlash: "always",
redirects: {
"/blog/": {
status: 301,
destination: "/insights/",
},
"/blog/rss.xml": {
status: 301,
destination: "/insights/rss.xml",
},
...Object.fromEntries(
Object.entries(legacyInsightRedirects).map(([source, destination]) => [
source,
{ status: 301, destination },
]),
),
...Object.fromEntries(
Object.entries(legacyPortfolioRedirects).map(([source, destination]) => [
source,
{ status: 301, destination },
]),
),
},
markdown: {
syntaxHighlight: {
type: "shiki",
excludeLangs: ["math", "d2"],
},
rehypePlugins: [
[
rehypeD2,
{
theme: 0,
darkTheme: 200,
sketch: false,
},
],
rehypeCopyCodeButton,
],
},
vite: {
plugins: [tailwindcss()],
},
integrations: [
solid(),
mdx({
rehypePlugins: [
[
rehypeD2,
{
theme: 0,
darkTheme: 200,
sketch: false,
},
],
rehypeCopyCodeButton,
],
}),
partytown({
config: {
forward: ["dataLayer.push"],
},
}),
sitemap({
filter(page) {
return !new URL(page).pathname.startsWith("/blog/");
},
serialize(item) {
// Enhanced sitemap with priority and changefreq
const url = item.url;
let priority = 0.5;
let changefreq = "monthly";
const lastmod =
getLastmodForUrl(url) ?? item.lastmod ?? new Date().toISOString();
// Homepage gets highest priority
if (url === `${SITE_URL}/`) {
priority = 1.0;
changefreq = "weekly";
}
// Insights posts - high priority, updated occasionally
else if (url.includes("/insights/") && !url.endsWith("/insights/")) {
priority = 0.8;
changefreq = "monthly";
}
// Insights index
else if (url.endsWith("/insights/")) {
priority = 0.9;
changefreq = "weekly";
}
// Service pages - high priority
else if (url.includes("/services/") && !url.endsWith("/services/")) {
priority = 0.8;
changefreq = "monthly";
}
// Services index
else if (url.endsWith("/services/")) {
priority = 0.9;
changefreq = "monthly";
}
// Location landing pages - local SEO/GEO entry points
else if (url.includes("/locations/")) {
priority = url.endsWith("/locations/") ? 0.8 : 0.75;
changefreq = "monthly";
}
// About and contact
else if (url.includes("/about/") || url.includes("/contact/")) {
priority = 0.7;
changefreq = "monthly";
}
return {
...item,
changefreq: changefreq as typeof item.changefreq,
lastmod,
priority,
};
},
}),
AstroPWA({
registerType: "autoUpdate",
includeAssets: ["favicon.ico", "apple-touch-icon.png"],
manifest: {
name: PERSON_NAME,
short_name: "AR10",
theme_color: "#000000",
background_color: "#000000",
display: "standalone",
start_url: "/",
icons: [
{
src: "/pwa-192x192.png",
sizes: "192x192",
type: "image/png",
purpose: "any",
},
{
src: "/pwa-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "any",
},
{
src: "/pwa-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
},
],
},
workbox: {
globPatterns: ["**/*.{js,mjs,css,html,ico,png,svg,webmanifest}"],
runtimeCaching: [
{
urlPattern: /\.(?:png|jpg|jpeg|svg)$/,
handler: "StaleWhileRevalidate",
options: {
cacheName: "images",
expiration: {
maxEntries: 20,
},
},
},
{
urlPattern: /\.(?:woff|woff2|ttf|eot)$/,
handler: "CacheFirst",
options: {
cacheName: "fonts",
expiration: {
maxEntries: 20,
maxAgeSeconds: 7 * 24 * 60 * 60,
},
},
},
],
},
}),
],
});