Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added index.html to tags and archives links #5544

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/models/category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion lib/models/tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/helper/list_archives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
82 changes: 41 additions & 41 deletions test/scripts/helpers/list_archives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ describe('list_archives', () => {

result.should.eql([
'<ul class="archive-list">',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/">February 2014</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">October 2013</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">June 2013</a><span class="archive-list-count">2</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/index.html">February 2014</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/index.html">October 2013</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/index.html">June 2013</a><span class="archive-list-count">2</span></li>',
'</ul>'
].join(''));
});
Expand All @@ -49,8 +49,8 @@ describe('list_archives', () => {

result.should.eql([
'<ul class="archive-list">',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/">2014</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/">2013</a><span class="archive-list-count">3</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/index.html">2014</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/index.html">2013</a><span class="archive-list-count">3</span></li>',
'</ul>'
].join(''));
});
Expand All @@ -62,9 +62,9 @@ describe('list_archives', () => {

result.should.eql([
'<ul class="archive-list">',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/">2014/2</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">2013/10</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">2013/6</a><span class="archive-list-count">2</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/index.html">2014/2</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/index.html">2013/10</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/index.html">2013/6</a><span class="archive-list-count">2</span></li>',
'</ul>'
].join(''));
});
Expand All @@ -75,9 +75,9 @@ describe('list_archives', () => {
});

result.should.eql([
'<a class="archive-link" href="/archives/2014/02/">February 2014<span class="archive-count">1</span></a>',
'<a class="archive-link" href="/archives/2013/10/">October 2013<span class="archive-count">1</span></a>',
'<a class="archive-link" href="/archives/2013/06/">June 2013<span class="archive-count">2</span></a>'
'<a class="archive-link" href="/archives/2014/02/index.html">February 2014<span class="archive-count">1</span></a>',
'<a class="archive-link" href="/archives/2013/10/index.html">October 2013<span class="archive-count">1</span></a>',
'<a class="archive-link" href="/archives/2013/06/index.html">June 2013<span class="archive-count">2</span></a>'
].join(', '));
});

Expand All @@ -88,9 +88,9 @@ describe('list_archives', () => {

result.should.eql([
'<ul class="archive-list">',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/">February 2014</a></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">October 2013</a></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">June 2013</a></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/index.html">February 2014</a></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/index.html">October 2013</a></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/index.html">June 2013</a></li>',
'</ul>'
].join(''));
});
Expand All @@ -102,9 +102,9 @@ describe('list_archives', () => {
});

result.should.eql([
'<a class="archive-link" href="/archives/2014/02/">February 2014</a>',
'<a class="archive-link" href="/archives/2013/10/">October 2013</a>',
'<a class="archive-link" href="/archives/2013/06/">June 2013</a>'
'<a class="archive-link" href="/archives/2014/02/index.html">February 2014</a>',
'<a class="archive-link" href="/archives/2013/10/index.html">October 2013</a>',
'<a class="archive-link" href="/archives/2013/06/index.html">June 2013</a>'
].join(', '));
});

Expand All @@ -115,9 +115,9 @@ describe('list_archives', () => {

result.should.eql([
'<ul class="archive-list">',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">June 2013</a><span class="archive-list-count">2</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">October 2013</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/">February 2014</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/index.html">June 2013</a><span class="archive-list-count">2</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/index.html">October 2013</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/index.html">February 2014</a><span class="archive-list-count">1</span></li>',
'</ul>'
].join(''));
});
Expand All @@ -131,9 +131,9 @@ describe('list_archives', () => {

result.should.eql([
'<ul class="archive-list">',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/">FEBRUARY 2014</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">OCTOBER 2013</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">JUNE 2013</a><span class="archive-list-count">2</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/index.html">FEBRUARY 2014</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/index.html">OCTOBER 2013</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/index.html">JUNE 2013</a><span class="archive-list-count">2</span></li>',
'</ul>'
].join(''));
});
Expand All @@ -147,9 +147,9 @@ describe('list_archives', () => {
});

result.should.eql([
'<a class="archive-link" href="/archives/2014/02/">FEBRUARY 2014<span class="archive-count">1</span></a>',
'<a class="archive-link" href="/archives/2013/10/">OCTOBER 2013<span class="archive-count">1</span></a>',
'<a class="archive-link" href="/archives/2013/06/">JUNE 2013<span class="archive-count">2</span></a>'
'<a class="archive-link" href="/archives/2014/02/index.html">FEBRUARY 2014<span class="archive-count">1</span></a>',
'<a class="archive-link" href="/archives/2013/10/index.html">OCTOBER 2013<span class="archive-count">1</span></a>',
'<a class="archive-link" href="/archives/2013/06/index.html">JUNE 2013<span class="archive-count">2</span></a>'
].join(', '));
});

Expand All @@ -160,9 +160,9 @@ describe('list_archives', () => {
});

result.should.eql([
'<a class="archive-link" href="/archives/2014/02/">February 2014<span class="archive-count">1</span></a>',
'<a class="archive-link" href="/archives/2013/10/">October 2013<span class="archive-count">1</span></a>',
'<a class="archive-link" href="/archives/2013/06/">June 2013<span class="archive-count">2</span></a>'
'<a class="archive-link" href="/archives/2014/02/index.html">February 2014<span class="archive-count">1</span></a>',
'<a class="archive-link" href="/archives/2013/10/index.html">October 2013<span class="archive-count">1</span></a>',
'<a class="archive-link" href="/archives/2013/06/index.html">June 2013<span class="archive-count">2</span></a>'
].join(''));
});

Expand All @@ -173,9 +173,9 @@ describe('list_archives', () => {

result.should.eql([
'<ul class="test-list">',
'<li class="test-list-item"><a class="test-list-link" href="/archives/2014/02/">February 2014</a><span class="test-list-count">1</span></li>',
'<li class="test-list-item"><a class="test-list-link" href="/archives/2013/10/">October 2013</a><span class="test-list-count">1</span></li>',
'<li class="test-list-item"><a class="test-list-link" href="/archives/2013/06/">June 2013</a><span class="test-list-count">2</span></li>',
'<li class="test-list-item"><a class="test-list-link" href="/archives/2014/02/index.html">February 2014</a><span class="test-list-count">1</span></li>',
'<li class="test-list-item"><a class="test-list-link" href="/archives/2013/10/index.html">October 2013</a><span class="test-list-count">1</span></li>',
'<li class="test-list-item"><a class="test-list-link" href="/archives/2013/06/index.html">June 2013</a><span class="test-list-count">2</span></li>',
'</ul>'
].join(''));
});
Expand All @@ -187,9 +187,9 @@ describe('list_archives', () => {

result.should.eql([
'<ul class="archive-list">',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/">二月 2014</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">十月 2013</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">六月 2013</a><span class="archive-list-count">2</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/index.html">二月 2014</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/index.html">十月 2013</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/index.html">六月 2013</a><span class="archive-list-count">2</span></li>',
'</ul>'
].join(''));
});
Expand All @@ -201,9 +201,9 @@ describe('list_archives', () => {

result.should.eql([
'<ul class="archive-list">',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/">Februar 2014</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">Oktober 2013</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">Juni 2013</a><span class="archive-list-count">2</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/index.html">Februar 2014</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/index.html">Oktober 2013</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/index.html">Juni 2013</a><span class="archive-list-count">2</span></li>',
'</ul>'
].join(''));
});
Expand All @@ -216,9 +216,9 @@ describe('list_archives', () => {

result.should.eql([
'<ul class="archive-list">',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/">2014 02 +0900</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">2013 10 +0900</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">2013 06 +0900</a><span class="archive-list-count">2</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/02/index.html">2014 02 +0900</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/index.html">2013 10 +0900</a><span class="archive-list-count">1</span></li>',
'<li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/index.html">2013 06 +0900</a><span class="archive-list-count">2</span></li>',
'</ul>'
].join(''));

Expand Down
Loading