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/lib/plugins/helper/list_archives.ts b/lib/plugins/helper/list_archives.ts
index c4ee26a93a..ca656665f8 100644
--- a/lib/plugins/helper/list_archives.ts
+++ b/lib/plugins/helper/list_archives.ts
@@ -79,7 +79,7 @@ function listArchivesHelper(this: LocalsType, options: Options = {}) {
url += `${item.month}/`;
}
- return url_for.call(this, url);
+ return url_for.call(this, url + 'index.html');
};
if (style === 'list') {
diff --git a/test/scripts/helpers/list_archives.ts b/test/scripts/helpers/list_archives.ts
index 43ea874267..57daa64986 100644
--- a/test/scripts/helpers/list_archives.ts
+++ b/test/scripts/helpers/list_archives.ts
@@ -35,9 +35,9 @@ describe('list_archives', () => {
result.should.eql([
'
'
].join(''));
});
@@ -49,8 +49,8 @@ describe('list_archives', () => {
result.should.eql([
''
].join(''));
});
@@ -62,9 +62,9 @@ describe('list_archives', () => {
result.should.eql([
''
].join(''));
});
@@ -75,9 +75,9 @@ describe('list_archives', () => {
});
result.should.eql([
- 'February 20141',
- 'October 20131',
- 'June 20132'
+ 'February 20141',
+ 'October 20131',
+ 'June 20132'
].join(', '));
});
@@ -88,9 +88,9 @@ describe('list_archives', () => {
result.should.eql([
''
].join(''));
});
@@ -102,9 +102,9 @@ describe('list_archives', () => {
});
result.should.eql([
- 'February 2014',
- 'October 2013',
- 'June 2013'
+ 'February 2014',
+ 'October 2013',
+ 'June 2013'
].join(', '));
});
@@ -115,9 +115,9 @@ describe('list_archives', () => {
result.should.eql([
''
].join(''));
});
@@ -131,9 +131,9 @@ describe('list_archives', () => {
result.should.eql([
''
].join(''));
});
@@ -147,9 +147,9 @@ describe('list_archives', () => {
});
result.should.eql([
- 'FEBRUARY 20141',
- 'OCTOBER 20131',
- 'JUNE 20132'
+ 'FEBRUARY 20141',
+ 'OCTOBER 20131',
+ 'JUNE 20132'
].join(', '));
});
@@ -160,9 +160,9 @@ describe('list_archives', () => {
});
result.should.eql([
- 'February 20141',
- 'October 20131',
- 'June 20132'
+ 'February 20141',
+ 'October 20131',
+ 'June 20132'
].join(''));
});
@@ -173,9 +173,9 @@ describe('list_archives', () => {
result.should.eql([
''
].join(''));
});
@@ -187,9 +187,9 @@ describe('list_archives', () => {
result.should.eql([
''
].join(''));
});
@@ -201,9 +201,9 @@ describe('list_archives', () => {
result.should.eql([
''
].join(''));
});
@@ -216,9 +216,9 @@ describe('list_archives', () => {
result.should.eql([
''
].join(''));
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([
'',
'- ',
- 'bat1',
+ 'bat1',
'
',
'- ',
- 'baz4',
+ 'baz4',
'
',
'- ',
- 'bar2',
+ 'bar2',
'
',
'
',
' ',
'- ',
- 'foo1',
+ 'foo1',
'
',
'
'
].join(''));
@@ -67,13 +67,13 @@ describe('list_categories', () => {
result.should.eql([
'',
'- ',
- 'bat1',
+ 'bat1',
'
',
'- ',
- 'baz4',
+ 'baz4',
'
',
'- ',
- 'foo1',
+ 'foo1',
'
',
'
'
].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([
'',
'- ',
- 'bat',
+ 'bat',
'
',
'- ',
- 'baz',
+ 'baz',
'
',
'- ',
- 'bar',
+ 'bar',
'
',
'
',
' ',
'- ',
- 'foo',
+ 'foo',
'
',
'
'
].join(''));
@@ -125,18 +125,18 @@ describe('list_categories', () => {
result.should.eql([
'',
'- ',
- 'bat1',
+ 'bat1',
'
',
'- ',
- 'baz4',
+ 'baz4',
'
',
'- ',
- 'bar2',
+ 'bar2',
'
',
'
',
' ',
'- ',
- 'foo1',
+ 'foo1',
'
',
'
'
].join(''));
@@ -150,13 +150,13 @@ describe('list_categories', () => {
result.should.eql([
'',
'- ',
- 'bat1',
+ 'bat1',
'
',
'- ',
- 'baz4',
+ 'baz4',
'
',
'- ',
- 'foo1',
+ 'foo1',
'
',
'
'
].join(''));
@@ -170,16 +170,16 @@ describe('list_categories', () => {
result.should.eql([
'',
'- ',
- 'foo1',
+ 'foo1',
'
',
'- ',
- 'bat1',
+ 'bat1',
'
',
'- ',
- 'baz4',
+ 'baz4',
'
',
'- ',
- 'bar2',
+ 'bar2',
'
',
'
',
' ',
@@ -195,18 +195,18 @@ describe('list_categories', () => {
result.should.eql([
'',
'- ',
- 'foo1',
+ 'foo1',
'
',
'- ',
- 'baz4',
+ 'baz4',
'
',
'- ',
- 'bar2',
+ 'bar2',
'
',
'
',
' ',
'- ',
- 'bat1',
+ 'bat1',
'
',
'
'
].join(''));
@@ -222,18 +222,18 @@ describe('list_categories', () => {
result.should.eql([
'',
'- ',
- 'BAT1',
+ 'BAT1',
'
',
'- ',
- 'BAZ4',
+ 'BAZ4',
'
',
'- ',
- 'BAR2',
+ 'BAR2',
'
',
'
',
' ',
'- ',
- 'FOO1',
+ 'FOO1',
'
',
'
'
].join(''));
@@ -246,10 +246,10 @@ describe('list_categories', () => {
});
result.should.eql([
- 'bat1',
- 'baz4',
- 'bar2',
- 'foo1'
+ 'bat1',
+ 'baz4',
+ 'bar2',
+ 'foo1'
].join(''));
});
@@ -260,10 +260,10 @@ describe('list_categories', () => {
});
result.should.eql([
- 'bat1|',
- 'baz4|',
- 'bar2|',
- 'foo1'
+ 'bat1|',
+ 'baz4|',
+ 'bar2|',
+ 'foo1'
].join(''));
});
@@ -275,18 +275,18 @@ describe('list_categories', () => {
result.should.eql([
'',
'- ',
- 'bat1',
+ 'bat1',
'
',
'- ',
- 'baz4',
+ 'baz4',
'
',
'- ',
- 'bar2',
+ 'bar2',
'
',
'
',
' ',
'- ',
- 'foo1',
+ 'foo1',
'
',
'
'
].join(''));
@@ -300,18 +300,18 @@ describe('list_categories', () => {
result.should.eql([
'',
'- ',
- 'bat1',
+ 'bat1',
'
',
'- ',
- 'baz4',
+ 'baz4',
'
',
'- ',
- 'bar2',
+ 'bar2',
'
',
'
',
' ',
'- ',
- 'foo1',
+ 'foo1',
'
',
'
'
].join(''));
diff --git a/test/scripts/helpers/list_tags.ts b/test/scripts/helpers/list_tags.ts
index 138c70d308..c86e126ea5 100644
--- a/test/scripts/helpers/list_tags.ts
+++ b/test/scripts/helpers/list_tags.ts
@@ -39,9 +39,9 @@ describe('list_tags', () => {
result.should.eql([
''
].join(''));
});
@@ -53,8 +53,8 @@ describe('list_tags', () => {
result.should.eql([
''
].join(''));
});
@@ -65,9 +65,9 @@ describe('list_tags', () => {
});
result.should.eql([
- 'bar1',
- 'baz2',
- 'foo1'
+ 'bar1',
+ 'baz2',
+ 'foo1'
].join(', '));
});
@@ -78,9 +78,9 @@ describe('list_tags', () => {
result.should.eql([
''
].join(''));
});
@@ -92,9 +92,9 @@ describe('list_tags', () => {
result.should.eql([
''
].join(''));
});
@@ -111,9 +111,9 @@ describe('list_tags', () => {
result.should.eql([
''
].join(''));
});
@@ -131,9 +131,9 @@ describe('list_tags', () => {
});
result.should.eql([
- 'bar1',
- 'baz2',
- 'foo1'
+ 'bar1',
+ 'baz2',
+ 'foo1'
].join(''));
});
@@ -144,9 +144,9 @@ describe('list_tags', () => {
result.should.eql([
''
].join(''));
});
@@ -158,9 +158,9 @@ describe('list_tags', () => {
result.should.eql([
''
].join(''));
});
@@ -174,9 +174,9 @@ describe('list_tags', () => {
result.should.eql([
''
].join(''));
});
@@ -188,9 +188,9 @@ describe('list_tags', () => {
});
result.should.eql([
- 'bar1',
- 'baz2',
- 'foo1'
+ 'bar1',
+ 'baz2',
+ 'foo1'
].join(''));
});
@@ -201,8 +201,8 @@ describe('list_tags', () => {
result.should.eql([
''
].join(''));
});
@@ -239,7 +239,7 @@ describe('list_tags transform', () => {
result.should.eql([
''
].join(''));
});
diff --git a/test/scripts/helpers/tagcloud.ts b/test/scripts/helpers/tagcloud.ts
index 3704694ee7..f5beccafe0 100644
--- a/test/scripts/helpers/tagcloud.ts
+++ b/test/scripts/helpers/tagcloud.ts
@@ -42,10 +42,10 @@ describe('tagcloud', () => {
const result = tagcloud();
result.should.eql([
- 'abc',
- 'bcd',
- 'cde',
- 'def'
+ 'abc',
+ 'bcd',
+ 'cde',
+ 'def'
].join(' '));
});
@@ -68,8 +68,8 @@ describe('tagcloud', () => {
}));
result.should.eql([
- 'abc',
- 'bcd'
+ 'abc',
+ 'bcd'
].join(' '));
});
@@ -80,10 +80,10 @@ describe('tagcloud', () => {
});
result.should.eql([
- 'abc',
- 'bcd',
- 'cde',
- 'def'
+ 'abc',
+ 'bcd',
+ 'cde',
+ 'def'
].join(' '));
});
@@ -96,7 +96,7 @@ describe('tagcloud', () => {
});
result.should.eql([
- 'abc'
+ 'abc'
].join(' '));
});
@@ -106,10 +106,10 @@ describe('tagcloud', () => {
});
result.should.eql([
- 'abc',
- 'bcd',
- 'cde',
- 'def'
+ 'abc',
+ 'bcd',
+ 'cde',
+ 'def'
].join(' '));
});
@@ -119,10 +119,10 @@ describe('tagcloud', () => {
});
result.should.eql([
- 'def',
- 'abc',
- 'cde',
- 'bcd'
+ 'def',
+ 'abc',
+ 'cde',
+ 'bcd'
].join(' '));
});
@@ -135,14 +135,14 @@ describe('tagcloud', () => {
orderby: 'rand'
});
- result1.should.have.string('def');
- result1.should.have.string('abc');
- result1.should.have.string('cde');
- result1.should.have.string('bcd');
- result2.should.have.string('def');
- result2.should.have.string('abc');
- result2.should.have.string('cde');
- result2.should.have.string('bcd');
+ result1.should.have.string('def');
+ result1.should.have.string('abc');
+ result1.should.have.string('cde');
+ result1.should.have.string('bcd');
+ result2.should.have.string('def');
+ result2.should.have.string('abc');
+ result2.should.have.string('cde');
+ result2.should.have.string('bcd');
});
it('order', () => {
@@ -151,10 +151,10 @@ describe('tagcloud', () => {
});
result.should.eql([
- 'def',
- 'cde',
- 'bcd',
- 'abc'
+ 'def',
+ 'cde',
+ 'bcd',
+ 'abc'
].join(' '));
});
@@ -164,8 +164,8 @@ describe('tagcloud', () => {
});
result.should.eql([
- 'abc',
- 'bcd'
+ 'abc',
+ 'bcd'
].join(' '));
});
@@ -177,10 +177,10 @@ describe('tagcloud', () => {
});
result.should.eql([
- 'ABC',
- 'BCD',
- 'CDE',
- 'DEF'
+ 'ABC',
+ 'BCD',
+ 'CDE',
+ 'DEF'
].join(' '));
});
@@ -192,10 +192,10 @@ describe('tagcloud', () => {
});
result.should.eql([
- 'abc',
- 'bcd',
- 'cde',
- 'def'
+ 'abc',
+ 'bcd',
+ 'cde',
+ 'def'
].join(' '));
});
@@ -207,10 +207,10 @@ describe('tagcloud', () => {
});
result.should.eql([
- 'abc',
- 'bcd',
- 'cde',
- 'def'
+ 'abc',
+ 'bcd',
+ 'cde',
+ 'def'
].join(' '));
});
@@ -222,10 +222,10 @@ describe('tagcloud', () => {
});
result.should.eql([
- 'abc',
- 'bcd',
- 'cde',
- 'def'
+ 'abc',
+ 'bcd',
+ 'cde',
+ 'def'
].join(' '));
});
@@ -237,10 +237,10 @@ describe('tagcloud', () => {
});
result.should.eql([
- 'abc',
- 'bcd',
- 'cde',
- 'def'
+ 'abc',
+ 'bcd',
+ 'cde',
+ 'def'
].join(' '));
});
@@ -254,7 +254,7 @@ describe('tagcloud', () => {
});
result.should.eql([
- 'abc'
+ 'abc'
].join(' '));
});
@@ -276,10 +276,10 @@ describe('tagcloud', () => {
});
result.should.eql([
- 'abc',
- 'bcd',
- 'cde',
- 'def'
+ 'abc',
+ 'bcd',
+ 'cde',
+ 'def'
].join(', '));
});
@@ -289,10 +289,10 @@ describe('tagcloud', () => {
});
result.should.eql([
- 'abc',
- 'bcd',
- 'cde',
- 'def'
+ 'abc',
+ 'bcd',
+ 'cde',
+ 'def'
].join(' '));
});
@@ -300,10 +300,10 @@ describe('tagcloud', () => {
const result = tagcloud({ show_count: true });
result.should.eql([
- 'abc2',
- 'bcd4',
- 'cde3',
- 'def1'
+ 'abc2',
+ 'bcd4',
+ 'cde3',
+ 'def1'
].join(' '));
});
@@ -311,10 +311,10 @@ describe('tagcloud', () => {
const result = tagcloud({ show_count: true, count_class: 'tag-count' });
result.should.eql([
- 'abc2',
- 'bcd4',
- 'cde3',
- 'def1'
+ 'abc2',
+ 'bcd4',
+ 'cde3',
+ 'def1'
].join(' '));
});
});
diff --git a/test/scripts/models/category.ts b/test/scripts/models/category.ts
index c0b0009b10..4a815eb084 100644
--- a/test/scripts/models/category.ts
+++ b/test/scripts/models/category.ts
@@ -98,7 +98,7 @@ describe('Category', () => {
const data = await Category.insert({
name: 'foo'
});
- data.path.should.eql(hexo.config.category_dir + '/' + data.slug + '/');
+ data.path.should.eql(hexo.config.category_dir + '/' + data.slug + '/index.html');
Category.removeById(data._id);
});
@@ -128,7 +128,7 @@ describe('Category', () => {
const data = await Category.insert({
name: 'foo'
});
- data.permalink.should.eql(hexo.config.url + '/' + data.path.replace(/\.html$/, ''));
+ data.permalink.should.eql(hexo.config.url + '/' + data.path);
Category.removeById(data._id);
});
diff --git a/test/scripts/models/tag.ts b/test/scripts/models/tag.ts
index 94108d6521..5f61b0f9e2 100644
--- a/test/scripts/models/tag.ts
+++ b/test/scripts/models/tag.ts
@@ -78,7 +78,7 @@ describe('Tag', () => {
name: 'foo'
});
- data.path.should.eql(hexo.config.tag_dir + '/' + data.slug + '/');
+ data.path.should.eql(hexo.config.tag_dir + '/' + data.slug + '/index.html');
Tag.removeById(data._id);
});
@@ -110,7 +110,7 @@ describe('Tag', () => {
name: 'foo'
});
- data.permalink.should.eql(hexo.config.url + '/' + data.path.replace(/\.html$/, ''));
+ data.permalink.should.eql(hexo.config.url + '/' + data.path);
Tag.removeById(data._id);
});