docs: Add SSR setup guide and update SSR polyfills
- Add SSR_ANLEITUNG.md with step-by-step setup instructions - Add SSR_DOKUMENTATION.md with technical SSR documentation - Update ssr-dom-polyfill.ts for better SSR compatibility - Update ssr-dom-preload.mjs for dev:ssr mode - Update DEPLOYMENT.md with SSR deployment instructions
This commit is contained in:
@@ -1,117 +1,117 @@
|
||||
-- =============================================================
|
||||
-- SEO SLUG MIGRATION SCRIPT
|
||||
-- Run this directly in your PostgreSQL database
|
||||
-- =============================================================
|
||||
|
||||
-- First, let's see how many listings need slugs
|
||||
SELECT 'Businesses without slugs: ' || COUNT(*) FROM businesses_json
|
||||
WHERE data->>'slug' IS NULL OR data->>'slug' = '';
|
||||
|
||||
SELECT 'Commercial properties without slugs: ' || COUNT(*) FROM commercials_json
|
||||
WHERE data->>'slug' IS NULL OR data->>'slug' = '';
|
||||
|
||||
-- =============================================================
|
||||
-- UPDATE BUSINESS LISTINGS WITH SEO SLUGS
|
||||
-- Format: title-city-state-shortid (e.g., restaurant-austin-tx-a3f7b2c1)
|
||||
-- =============================================================
|
||||
|
||||
UPDATE businesses_json
|
||||
SET data = jsonb_set(
|
||||
data::jsonb,
|
||||
'{slug}',
|
||||
to_jsonb(
|
||||
LOWER(
|
||||
REGEXP_REPLACE(
|
||||
REGEXP_REPLACE(
|
||||
CONCAT(
|
||||
-- Title (first 50 chars, cleaned)
|
||||
SUBSTRING(
|
||||
REGEXP_REPLACE(
|
||||
LOWER(COALESCE(data->>'title', '')),
|
||||
'[^a-z0-9\s-]', '', 'g'
|
||||
), 1, 50
|
||||
),
|
||||
'-',
|
||||
-- City or County
|
||||
REGEXP_REPLACE(
|
||||
LOWER(COALESCE(data->'location'->>'name', data->'location'->>'county', '')),
|
||||
'[^a-z0-9\s-]', '', 'g'
|
||||
),
|
||||
'-',
|
||||
-- State
|
||||
LOWER(COALESCE(data->'location'->>'state', '')),
|
||||
'-',
|
||||
-- First 8 chars of UUID
|
||||
SUBSTRING(id::text, 1, 8)
|
||||
),
|
||||
'\s+', '-', 'g' -- Replace spaces with hyphens
|
||||
),
|
||||
'-+', '-', 'g' -- Replace multiple hyphens with single
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
WHERE data->>'slug' IS NULL OR data->>'slug' = '';
|
||||
|
||||
-- =============================================================
|
||||
-- UPDATE COMMERCIAL PROPERTIES WITH SEO SLUGS
|
||||
-- =============================================================
|
||||
|
||||
UPDATE commercials_json
|
||||
SET data = jsonb_set(
|
||||
data::jsonb,
|
||||
'{slug}',
|
||||
to_jsonb(
|
||||
LOWER(
|
||||
REGEXP_REPLACE(
|
||||
REGEXP_REPLACE(
|
||||
CONCAT(
|
||||
-- Title (first 50 chars, cleaned)
|
||||
SUBSTRING(
|
||||
REGEXP_REPLACE(
|
||||
LOWER(COALESCE(data->>'title', '')),
|
||||
'[^a-z0-9\s-]', '', 'g'
|
||||
), 1, 50
|
||||
),
|
||||
'-',
|
||||
-- City or County
|
||||
REGEXP_REPLACE(
|
||||
LOWER(COALESCE(data->'location'->>'name', data->'location'->>'county', '')),
|
||||
'[^a-z0-9\s-]', '', 'g'
|
||||
),
|
||||
'-',
|
||||
-- State
|
||||
LOWER(COALESCE(data->'location'->>'state', '')),
|
||||
'-',
|
||||
-- First 8 chars of UUID
|
||||
SUBSTRING(id::text, 1, 8)
|
||||
),
|
||||
'\s+', '-', 'g' -- Replace spaces with hyphens
|
||||
),
|
||||
'-+', '-', 'g' -- Replace multiple hyphens with single
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
WHERE data->>'slug' IS NULL OR data->>'slug' = '';
|
||||
|
||||
-- =============================================================
|
||||
-- VERIFY THE RESULTS
|
||||
-- =============================================================
|
||||
|
||||
SELECT 'Migration complete! Checking results...' AS status;
|
||||
|
||||
-- Show sample of updated slugs
|
||||
SELECT
|
||||
id,
|
||||
data->>'title' AS title,
|
||||
data->>'slug' AS slug
|
||||
FROM businesses_json
|
||||
LIMIT 5;
|
||||
|
||||
SELECT
|
||||
id,
|
||||
data->>'title' AS title,
|
||||
data->>'slug' AS slug
|
||||
FROM commercials_json
|
||||
LIMIT 5;
|
||||
-- =============================================================
|
||||
-- SEO SLUG MIGRATION SCRIPT
|
||||
-- Run this directly in your PostgreSQL database
|
||||
-- =============================================================
|
||||
|
||||
-- First, let's see how many listings need slugs
|
||||
SELECT 'Businesses without slugs: ' || COUNT(*) FROM businesses_json
|
||||
WHERE data->>'slug' IS NULL OR data->>'slug' = '';
|
||||
|
||||
SELECT 'Commercial properties without slugs: ' || COUNT(*) FROM commercials_json
|
||||
WHERE data->>'slug' IS NULL OR data->>'slug' = '';
|
||||
|
||||
-- =============================================================
|
||||
-- UPDATE BUSINESS LISTINGS WITH SEO SLUGS
|
||||
-- Format: title-city-state-shortid (e.g., restaurant-austin-tx-a3f7b2c1)
|
||||
-- =============================================================
|
||||
|
||||
UPDATE businesses_json
|
||||
SET data = jsonb_set(
|
||||
data::jsonb,
|
||||
'{slug}',
|
||||
to_jsonb(
|
||||
LOWER(
|
||||
REGEXP_REPLACE(
|
||||
REGEXP_REPLACE(
|
||||
CONCAT(
|
||||
-- Title (first 50 chars, cleaned)
|
||||
SUBSTRING(
|
||||
REGEXP_REPLACE(
|
||||
LOWER(COALESCE(data->>'title', '')),
|
||||
'[^a-z0-9\s-]', '', 'g'
|
||||
), 1, 50
|
||||
),
|
||||
'-',
|
||||
-- City or County
|
||||
REGEXP_REPLACE(
|
||||
LOWER(COALESCE(data->'location'->>'name', data->'location'->>'county', '')),
|
||||
'[^a-z0-9\s-]', '', 'g'
|
||||
),
|
||||
'-',
|
||||
-- State
|
||||
LOWER(COALESCE(data->'location'->>'state', '')),
|
||||
'-',
|
||||
-- First 8 chars of UUID
|
||||
SUBSTRING(id::text, 1, 8)
|
||||
),
|
||||
'\s+', '-', 'g' -- Replace spaces with hyphens
|
||||
),
|
||||
'-+', '-', 'g' -- Replace multiple hyphens with single
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
WHERE data->>'slug' IS NULL OR data->>'slug' = '';
|
||||
|
||||
-- =============================================================
|
||||
-- UPDATE COMMERCIAL PROPERTIES WITH SEO SLUGS
|
||||
-- =============================================================
|
||||
|
||||
UPDATE commercials_json
|
||||
SET data = jsonb_set(
|
||||
data::jsonb,
|
||||
'{slug}',
|
||||
to_jsonb(
|
||||
LOWER(
|
||||
REGEXP_REPLACE(
|
||||
REGEXP_REPLACE(
|
||||
CONCAT(
|
||||
-- Title (first 50 chars, cleaned)
|
||||
SUBSTRING(
|
||||
REGEXP_REPLACE(
|
||||
LOWER(COALESCE(data->>'title', '')),
|
||||
'[^a-z0-9\s-]', '', 'g'
|
||||
), 1, 50
|
||||
),
|
||||
'-',
|
||||
-- City or County
|
||||
REGEXP_REPLACE(
|
||||
LOWER(COALESCE(data->'location'->>'name', data->'location'->>'county', '')),
|
||||
'[^a-z0-9\s-]', '', 'g'
|
||||
),
|
||||
'-',
|
||||
-- State
|
||||
LOWER(COALESCE(data->'location'->>'state', '')),
|
||||
'-',
|
||||
-- First 8 chars of UUID
|
||||
SUBSTRING(id::text, 1, 8)
|
||||
),
|
||||
'\s+', '-', 'g' -- Replace spaces with hyphens
|
||||
),
|
||||
'-+', '-', 'g' -- Replace multiple hyphens with single
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
WHERE data->>'slug' IS NULL OR data->>'slug' = '';
|
||||
|
||||
-- =============================================================
|
||||
-- VERIFY THE RESULTS
|
||||
-- =============================================================
|
||||
|
||||
SELECT 'Migration complete! Checking results...' AS status;
|
||||
|
||||
-- Show sample of updated slugs
|
||||
SELECT
|
||||
id,
|
||||
data->>'title' AS title,
|
||||
data->>'slug' AS slug
|
||||
FROM businesses_json
|
||||
LIMIT 5;
|
||||
|
||||
SELECT
|
||||
id,
|
||||
data->>'title' AS title,
|
||||
data->>'slug' AS slug
|
||||
FROM commercials_json
|
||||
LIMIT 5;
|
||||
|
||||
Reference in New Issue
Block a user