整体UI修改
This commit is contained in:
@@ -18,7 +18,7 @@ const render=await import(renderUrl);
|
||||
const channel=await import(await moduleUrl('client/channel.ts',{'../api/protocol':protocol,'./render':renderUrl}));
|
||||
const search=await import(await moduleUrl('client/search.ts',{'../api/protocol':protocol,'./render':renderUrl}));
|
||||
const drama={id:9,slug:'city-story',title:'都市故事',desc:'作品介绍',cover:'https://media.drama.test/poster.webp',onlineAt:'2026-10-20'};
|
||||
const environment=seo.seoEnvironment({config:{foreverUrlAddr:'https://drama.test'}});
|
||||
const environment=seo.seoEnvironment({config:{foreverUrlAddr:'https://huangguocg.com'}});
|
||||
|
||||
test('slug-first paths encode one segment once, preserve ID fallback and accept direct paginated requests',()=>{
|
||||
for(const key of ['city-story','city_story-2026','dushiaiqing']){
|
||||
@@ -26,6 +26,7 @@ test('slug-first paths encode one segment once, preserve ID fallback and accept
|
||||
const path=routes.contentPath(kind,{id:9,slug:' '+key+' '});
|
||||
assert.equal(path,`/${kind}/${encodeURIComponent(key)}/`);
|
||||
assert.equal(routes.parseSitePath(path)[kind==='detail'?'key':'value'],key);
|
||||
if(kind==='detail'){assert.equal(routes.parseSitePath(path+'page/2/'),null);continue;}
|
||||
assert.equal(routes.paginationPath(path,2),path+'page/2/');
|
||||
assert.equal(routes.parseSitePath(path+'page/2/').page,2);
|
||||
}
|
||||
@@ -45,13 +46,13 @@ test('Chinese upstream slugs use IDs in every generated link and SEO URL without
|
||||
assert.ok(render.blockSection({id:31,slug:'必看好剧',name:'必看好剧',type:1,status:true,list:[item]}).includes('href="/config/31/"'));
|
||||
const chapter={id:90,currentEpisode:3,canWatch:true,videoUrl:'https://media.drama.test/3.mp4'};
|
||||
const head=seo.buildPageHead('/play/9/90/','',environment,seo.dramaSeoContent(item,chapter));
|
||||
assert.equal(head.canonical,'https://drama.test/play/9/90/');
|
||||
assert.equal(head.canonical,'https://huangguocg.com/play/9/90/');
|
||||
assert.ok(!JSON.stringify(head.jsonLd).includes('%E9%83%BD'));
|
||||
assert.equal(routes.matchesContentKey(item,'9'),true);
|
||||
assert.deepEqual(routes.contentQuery('9'),{id:9});
|
||||
// Previously issued Chinese slug links remain readable, but their canonical uses the ID.
|
||||
assert.equal(routes.matchesContentKey(item,'都市爱情'),true);
|
||||
assert.equal(seo.buildPageHead('/detail/都市爱情/','',environment,seo.dramaSeoContent(item)).canonical,'https://drama.test/detail/9/');
|
||||
assert.equal(seo.buildPageHead('/detail/都市爱情/','',environment,seo.dramaSeoContent(item)).canonical,'https://huangguocg.com/detail/9/');
|
||||
});
|
||||
|
||||
test('cards, carousel, topics, more lists and suggestions prefer slug while explicit moreUrl remains authoritative',()=>{
|
||||
@@ -96,15 +97,15 @@ test('canonical, pagination, series/episode schema and homepage ItemList use the
|
||||
const content=seo.dramaSeoContent(drama,chapter);
|
||||
for(const key of ['9','city-story']){
|
||||
const head=seo.buildPageHead(`/play/${key}/90/`,'',environment,content);
|
||||
assert.equal(head.canonical,'https://drama.test/play/city-story/90/');
|
||||
assert.equal(head.canonical,'https://huangguocg.com/play/city-story/90/');
|
||||
const graph=head.jsonLd['@graph'];
|
||||
assert.equal(graph.find(node=>node['@type']==='TVSeries').url,'https://drama.test/detail/city-story/');
|
||||
assert.equal(graph.find(node=>node['@type']==='TVSeries').url,'https://huangguocg.com/detail/city-story/');
|
||||
assert.equal(graph.find(node=>node['@type']==='TVEpisode').url,head.canonical);
|
||||
assert.equal(graph.find(node=>node['@type']==='BreadcrumbList').itemListElement[2].item,'https://drama.test/detail/city-story/');
|
||||
assert.equal(graph.find(node=>node['@type']==='BreadcrumbList').itemListElement[2].item,'https://huangguocg.com/detail/city-story/');
|
||||
}
|
||||
const list=seo.listSeoContent({id:7,slug:'city-collection',list:[drama],totalCount:72},{group:'page',key:'theme',value:'7',page:2});
|
||||
const head=seo.buildPageHead('/theme/7/page/2/','',environment,list);
|
||||
assert.equal(head.canonical,'https://drama.test/topics/city-collection/page/2/');assert.equal(head.previous,'https://drama.test/topics/city-collection/');
|
||||
assert.equal(head.canonical,'https://huangguocg.com/topics/city-collection/page/2/');assert.equal(head.previous,'https://huangguocg.com/topics/city-collection/');
|
||||
const home=seo.buildPageHead('/','',environment,seo.homeSeoContent({homeBannerData:[drama]}));
|
||||
assert.equal(home.jsonLd['@graph'].find(node=>node['@type']==='ItemList').itemListElement[0].url,'https://drama.test/detail/city-story/');
|
||||
assert.equal(home.jsonLd['@graph'].find(node=>node['@type']==='ItemList').itemListElement[0].url,'https://huangguocg.com/detail/city-story/');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user