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:
+11
-4
@@ -2,9 +2,11 @@ const express = require('express');
|
||||
const router = express.Router();
|
||||
const contentService = require('../services/content');
|
||||
|
||||
router.get('/blogs', (req, res) => {
|
||||
function renderBlogListing(req, res, filterType, filterVal) {
|
||||
let posts = contentService.getAllPosts();
|
||||
const { category, tag, page } = req.query;
|
||||
const category = filterType === 'category' ? filterVal : req.query.category;
|
||||
const tag = filterType === 'tag' ? filterVal : req.query.tag;
|
||||
const page = req.query.page;
|
||||
|
||||
let activeFilter = null;
|
||||
|
||||
@@ -29,7 +31,7 @@ router.get('/blogs', (req, res) => {
|
||||
const taxonomy = contentService.getTaxonomy();
|
||||
|
||||
res.render('pages/blogs', {
|
||||
title: activeFilter ? `Blogs - ${activeFilter.type}: ${activeFilter.value}` : 'Blogs',
|
||||
title: activeFilter ? `${activeFilter.value} - ${activeFilter.type === 'category' ? 'Category' : 'Tag'} - ${res.locals.site.title}` : `Blogs - ${res.locals.site.title}`,
|
||||
posts: paginatedPosts,
|
||||
currentPage,
|
||||
totalPages,
|
||||
@@ -37,6 +39,11 @@ router.get('/blogs', (req, res) => {
|
||||
activeFilter,
|
||||
taxonomy
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
router.get('/blogs', (req, res) => renderBlogListing(req, res));
|
||||
router.get('/category/:category', (req, res) => renderBlogListing(req, res, 'category', req.params.category));
|
||||
router.get('/tag/:tag', (req, res) => renderBlogListing(req, res, 'tag', req.params.tag));
|
||||
router.get('/tags/:tag', (req, res) => renderBlogListing(req, res, 'tag', req.params.tag));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
Reference in New Issue
Block a user