From 5724ae4f0195c6ec6afd6e7ee81b80c6418838f9 Mon Sep 17 00:00:00 2001 From: Michal Kowalik Date: Sun, 8 Sep 2024 16:24:07 +0200 Subject: [PATCH] feat: added index.html to tags and archives links --- lib/models/category.ts | 2 +- lib/models/tag.ts | 2 +- test/scripts/helpers/list_categories.ts | 100 ++++++++--------- test/scripts/helpers/list_tags.ts | 70 ++++++------ test/scripts/helpers/tagcloud.ts | 140 ++++++++++++------------ test/scripts/models/category.ts | 4 +- test/scripts/models/tag.ts | 4 +- 7 files changed, 161 insertions(+), 161 deletions(-) diff --git a/lib/models/category.ts b/lib/models/category.ts index 2fdbfb58df..b94359b3d4 100644 --- a/lib/models/category.ts +++ b/lib/models/category.ts @@ -33,7 +33,7 @@ export = (ctx: Hexo) => { if (catDir === '/') catDir = ''; if (!catDir.endsWith('/')) catDir += '/'; - return `${catDir + this.slug}/`; + return `${catDir + this.slug}/index.html`; }); Category.virtual('permalink').get(function() { diff --git a/lib/models/tag.ts b/lib/models/tag.ts index 84a118aa25..901cb9f699 100644 --- a/lib/models/tag.ts +++ b/lib/models/tag.ts @@ -24,7 +24,7 @@ export = (ctx: Hexo) => { let tagDir = ctx.config.tag_dir; if (!tagDir.endsWith('/')) tagDir += '/'; - return `${tagDir + this.slug}/`; + return `${tagDir + this.slug}/index.html`; }); Tag.virtual('permalink').get(function() { diff --git a/test/scripts/helpers/list_categories.ts b/test/scripts/helpers/list_categories.ts index eccb59df7c..9846ed2612 100644 --- a/test/scripts/helpers/list_categories.ts +++ b/test/scripts/helpers/list_categories.ts @@ -42,18 +42,18 @@ describe('list_categories', () => { result.should.eql([ '' ].join('')); @@ -67,13 +67,13 @@ describe('list_categories', () => { result.should.eql([ '' ].join('')); @@ -85,10 +85,10 @@ describe('list_categories', () => { }); result.should.eql([ - 'bat1', - 'baz4', - 'bar2', - 'foo1' + 'bat1', + 'baz4', + 'bar2', + 'foo1' ].join(', ')); }); @@ -100,18 +100,18 @@ describe('list_categories', () => { result.should.eql([ '' ].join('')); @@ -125,18 +125,18 @@ describe('list_categories', () => { result.should.eql([ '' ].join('')); @@ -150,13 +150,13 @@ describe('list_categories', () => { result.should.eql([ '' ].join('')); @@ -170,16 +170,16 @@ describe('list_categories', () => { result.should.eql([ '