Configure Node SSR adapter, sitemap, and add .gitignore
This commit is contained in:
@@ -1,5 +1,89 @@
|
||||
// @ts-check
|
||||
import { defineConfig } from 'astro/config';
|
||||
import dotenv from 'dotenv';
|
||||
import node from '@astrojs/node';
|
||||
import sitemap from '@astrojs/sitemap';
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({});
|
||||
// Environment detection
|
||||
const isProd = process.env.NODE_ENV === 'production';
|
||||
dotenv.config();
|
||||
|
||||
export default defineConfig({
|
||||
site: 'https://noelleparisdesign.com', // Updated URL
|
||||
output: 'server',
|
||||
|
||||
adapter: node({
|
||||
mode: 'standalone'
|
||||
}),
|
||||
|
||||
// Integrations
|
||||
integrations: [
|
||||
sitemap({
|
||||
changefreq: 'monthly',
|
||||
priority: 0.8,
|
||||
serialize(item) {
|
||||
// Homepage gets highest priority
|
||||
if (item.url === 'https://noelleparisdesign.com/' || item.url === 'https://noelleparisdesign.com') {
|
||||
item.priority = 1.0;
|
||||
item.changefreq = 'monthly';
|
||||
}
|
||||
// Main services page
|
||||
else if (item.url === 'https://noelleparisdesign.com/services/' || item.url === 'https://noelleparisdesign.com/services') {
|
||||
item.priority = 0.9;
|
||||
item.changefreq = 'monthly';
|
||||
}
|
||||
// Individual service pages
|
||||
else if (item.url.includes('/services/')) {
|
||||
item.priority = 0.8;
|
||||
item.changefreq = 'monthly';
|
||||
}
|
||||
// About page
|
||||
else if (item.url.includes('/about')) {
|
||||
item.priority = 0.8;
|
||||
item.changefreq = 'monthly';
|
||||
}
|
||||
// Contact page
|
||||
else if (item.url.includes('/contact')) {
|
||||
item.priority = 0.7;
|
||||
item.changefreq = 'monthly';
|
||||
}
|
||||
|
||||
return item;
|
||||
},
|
||||
// Filter out API routes
|
||||
filter: (page) => !page.includes('/api/')
|
||||
})
|
||||
],
|
||||
|
||||
// Development server settings
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: 4321,
|
||||
middleware: [
|
||||
(req, res, next) => {
|
||||
if (isProd) return next();
|
||||
|
||||
const clientIP = req.socket.remoteAddress || '';
|
||||
if (
|
||||
clientIP === '127.0.0.1' ||
|
||||
clientIP === '::1' ||
|
||||
clientIP.startsWith('192.168.1.')
|
||||
) {
|
||||
next();
|
||||
} else {
|
||||
res.statusCode = 403;
|
||||
res.end('Access denied: Your IP is not in the allowed range (192.168.1.0/24)');
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// Vite configuration
|
||||
vite: {
|
||||
server: {
|
||||
allowedHosts: ['noelleparisdesign.com', 'www.noelleparisdesign.com'],
|
||||
hmr: {
|
||||
port: isProd ? 8081 : 4321 // Matches PORT 8081 set in your systemd service
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user