feat: implement programmatic SEO infrastructure with localized service pages
This commit is contained in:
50
setup_locations.mjs
Normal file
50
setup_locations.mjs
Normal file
@@ -0,0 +1,50 @@
|
||||
import postgres from 'postgres';
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
dotenv.config({ path: '.env.local' });
|
||||
|
||||
const sql = postgres(process.env.DATABASE_URL);
|
||||
|
||||
async function setup() {
|
||||
try {
|
||||
console.log('Creating locations table...');
|
||||
await sql`
|
||||
CREATE TABLE IF NOT EXISTS locations (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
slug VARCHAR(255) UNIQUE NOT NULL,
|
||||
description TEXT,
|
||||
display_order INTEGER DEFAULT 0
|
||||
)
|
||||
`;
|
||||
|
||||
const locations = [
|
||||
{ name: 'Bodrum', slug: 'bodrum', description: 'Bodrum profesyonel drone çekimi ve dijital medya çözümleri.' },
|
||||
{ name: 'Marmaris', slug: 'marmaris', description: 'Marmaris otel çekimleri ve sosyal medya yönetimi.' },
|
||||
{ name: 'Fethiye', slug: 'fethiye', description: 'Fethiye turizm odaklı video prodüksiyon hizmetleri.' },
|
||||
{ name: 'Datça', slug: 'datca', description: 'Datça butik işletmeler için dijital pazarlama.' },
|
||||
{ name: 'Dalaman', slug: 'dalaman', description: 'Dalaman kurumsal tanıtım ve drone hizmetleri.' },
|
||||
{ name: 'Milas', slug: 'milas', description: 'Milas sanayi ve tarım odaklı prodüksiyon çözümleri.' },
|
||||
{ name: 'Menteşe', slug: 'mentese', description: 'Muğla merkez Menteşe kurumsal medya yönetimi.' }
|
||||
];
|
||||
|
||||
console.log('Inserting locations...');
|
||||
for (const loc of locations) {
|
||||
await sql`
|
||||
INSERT INTO locations (name, slug, description)
|
||||
VALUES (${loc.name}, ${loc.slug}, ${loc.description})
|
||||
ON CONFLICT (slug) DO UPDATE SET
|
||||
name = EXCLUDED.name,
|
||||
description = EXCLUDED.description
|
||||
`;
|
||||
}
|
||||
|
||||
console.log('Locations setup complete!');
|
||||
process.exit(0);
|
||||
} catch (err) {
|
||||
console.error('Error setting up locations:', err);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
setup();
|
||||
Reference in New Issue
Block a user