feat(migration): complete WordPress migration and UX refinements

- Migrate historical posts, localized assets, and 103 comments
- Colocate media into posts/<slug>/images/ and remove wp-content
- Add native bilingual support for ai-can-change post (English default, /zh variant)
- Support clean taxonomy routing (/category/:category and /tag/:tag)
- Dynamically populate categories and tags in sitemap.xml
- Fix header scroll padding/margin offsets for anchor and reference links
- Constrain image and media widths to prevent content overflow
- Redesign homepage recent posts to 4 compact editorial cards
- Restore valid binary favicon.ico and high-res icon assets
- Remove placeholder content and sample test comments
This commit is contained in:
2026-09-16 23:09:09 -07:00
parent 8c0b04db0e
commit f52b3fe9e4
87 changed files with 3417 additions and 190 deletions
+1
View File
@@ -145,6 +145,7 @@ class ContentService {
defaultPost.availableLanguages = availableLangs;
for (const v of Object.values(variants)) {
v.availableLanguages = availableLangs;
v.defaultLang = defaultPost.lang;
}
this.postsBySlug.set(slug, {
+31
View File
@@ -80,6 +80,37 @@ class DatabaseService {
CREATE INDEX IF NOT EXISTS idx_comments_email ON comments(author_email);
`);
// Auto-seed comments if comments table is newly created and comments.json exists
try {
const count = this.db.prepare('SELECT COUNT(*) as c FROM comments').get().c;
const seedFile = path.join(dataDir, 'comments.json');
if (count === 0 && fs.existsSync(seedFile)) {
const seedData = JSON.parse(fs.readFileSync(seedFile, 'utf8'));
const insertStmt = this.db.prepare(`
INSERT INTO comments (id, post_slug, author_name, author_email, author_website, body, created_at, approved, ip)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
`);
this.db.exec('BEGIN');
for (const c of seedData) {
insertStmt.run(
c.id,
c.post_slug,
c.author_name,
c.author_email,
c.author_website,
c.body,
c.created_at,
c.approved,
c.ip || ''
);
}
this.db.exec('COMMIT');
console.log(`[DB] Seeded ${seedData.length} comments from ${seedFile}`);
}
} catch (err) {
console.warn('[DB] Warning: Failed to auto-seed comments:', err.message);
}
console.log(`[DB] Unified SQLite database initialized at ${this.dbPath}`);
}