From bc53720dd9fa7e11cc3b34c67fe95692aa085e28 Mon Sep 17 00:00:00 2001
From: Uiolee <22849383+uiolee@users.noreply.github.com>
Date: Tue, 13 Feb 2024 21:20:47 +0800
Subject: [PATCH 1/4] docs(README): Update Sponsors images (#5410)
* Update README.md
* fix typo
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 6ed5f7bcee..1e507d6eda 100644
--- a/README.md
+++ b/README.md
@@ -95,7 +95,7 @@ Also, we welcome PR or issue to [official-plugins](https://github.com/hexojs).
## Sponsors
-
+[![Sponsors](https://opencollective.com/hexo/tiers/sponsors.svg?width=600)](https://opencollective.com/hexo)
## License
From 6bf9e6c2454f8852e8350fefc1b10666eee9a12c Mon Sep 17 00:00:00 2001
From: Dimas Lanjaka
Date: Tue, 20 Feb 2024 14:28:19 +0700
Subject: [PATCH 2/4] chore: make callback on exit optional (#5421)
---
lib/hexo/index.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/hexo/index.ts b/lib/hexo/index.ts
index c5e48f8723..97540dbf5c 100644
--- a/lib/hexo/index.ts
+++ b/lib/hexo/index.ts
@@ -660,7 +660,7 @@ class Hexo extends EventEmitter {
});
}
- exit(err: Error): Promise {
+ exit(err?: Error): Promise {
if (err) {
this.log.fatal(
{ err },
From 6cf699363ae74e0d7d072375f70717e8689624a7 Mon Sep 17 00:00:00 2001
From: mobeicanyue <81098819+mobeicanyue@users.noreply.github.com>
Date: Thu, 22 Feb 2024 00:17:32 +0800
Subject: [PATCH 3/4] test: fix typos (#5426)
---
test/scripts/helpers/css.js | 2 +-
test/scripts/helpers/full_url_for.js | 2 +-
test/scripts/helpers/js.js | 2 +-
test/scripts/helpers/url_for.js | 2 +-
test/scripts/hexo/hexo.js | 2 +-
test/scripts/hexo/post.js | 6 +++---
test/scripts/processors/asset.js | 2 +-
test/scripts/tags/full_url_for.js | 2 +-
test/scripts/tags/url_for.js | 2 +-
9 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/test/scripts/helpers/css.js b/test/scripts/helpers/css.js
index 6241ff93fd..21eb15bd50 100644
--- a/test/scripts/helpers/css.js
+++ b/test/scripts/helpers/css.js
@@ -62,7 +62,7 @@ describe('css', () => {
assertResult(css({href: '/script.css', foo: 'bar'}), {href: '/script.css', foo: 'bar'});
});
- it('mulitple objects', () => {
+ it('multiple objects', () => {
assertResult(css({href: '/foo.css'}, {href: '/bar.css'}), [{href: '/foo.css'}, {href: '/bar.css'}]);
assertResult(css({href: '/aaa.css', bbb: 'ccc'}, {href: '/ddd.css', eee: 'fff'}),
[{href: '/aaa.css', bbb: 'ccc'}, {href: '/ddd.css', eee: 'fff'}]);
diff --git a/test/scripts/helpers/full_url_for.js b/test/scripts/helpers/full_url_for.js
index 313de00273..f84653db00 100755
--- a/test/scripts/helpers/full_url_for.js
+++ b/test/scripts/helpers/full_url_for.js
@@ -17,7 +17,7 @@ describe('full_url_for', () => {
fullUrlFor('/index.html').should.eql(ctx.config.url + '/index.html');
});
- it('internel url (pretty_urls.trailing_index disabled)', () => {
+ it('internal url (pretty_urls.trailing_index disabled)', () => {
ctx.config.pretty_urls = { trailing_index: false };
fullUrlFor('index.html').should.eql(ctx.config.url + '/');
fullUrlFor('/index.html').should.eql(ctx.config.url + '/');
diff --git a/test/scripts/helpers/js.js b/test/scripts/helpers/js.js
index 22a23805b1..89cfad5b6c 100644
--- a/test/scripts/helpers/js.js
+++ b/test/scripts/helpers/js.js
@@ -66,7 +66,7 @@ describe('js', () => {
assertResult(js({src: '/script.js', foo: 'bar'}), {src: '/script.js', foo: 'bar'});
});
- it('mulitple objects', () => {
+ it('multiple objects', () => {
assertResult(js({src: '/foo.js'}, {src: '/bar.js'}), [{src: '/foo.js'}, {src: '/bar.js'}]);
assertResult(js({src: '/aaa.js', bbb: 'ccc'}, {src: '/ddd.js', eee: 'fff'}),
[{src: '/aaa.js', bbb: 'ccc'}, {src: '/ddd.js', eee: 'fff'}]);
diff --git a/test/scripts/helpers/url_for.js b/test/scripts/helpers/url_for.js
index 8f953a7d10..4f84e7153b 100644
--- a/test/scripts/helpers/url_for.js
+++ b/test/scripts/helpers/url_for.js
@@ -50,7 +50,7 @@ describe('url_for', () => {
ctx.config.relative_link = false;
});
- it('internel url (pretty_urls.trailing_index disabled)', () => {
+ it('internal url (pretty_urls.trailing_index disabled)', () => {
ctx.config.pretty_urls = { trailing_index: false };
ctx.path = '';
ctx.config.root = '/';
diff --git a/test/scripts/hexo/hexo.js b/test/scripts/hexo/hexo.js
index b039ec1fb0..181f324fda 100644
--- a/test/scripts/hexo/hexo.js
+++ b/test/scripts/hexo/hexo.js
@@ -70,7 +70,7 @@ describe('Hexo', () => {
hexo.config_path.should.eql(join(__dirname, '_config.yml'));
});
- it('constructs mutli-config', () => {
+ it('constructs multi-config', () => {
const configs = ['../../../fixtures/_config.json', '../../../fixtures/_config.json'];
const args = { _: [], config: configs.join(',') };
const hexo = new Hexo(base_dir, args);
diff --git a/test/scripts/hexo/post.js b/test/scripts/hexo/post.js
index 109bf2367b..890a62b541 100644
--- a/test/scripts/hexo/post.js
+++ b/test/scripts/hexo/post.js
@@ -1371,7 +1371,7 @@ describe('Post', () => {
});
// https://github.com/hexojs/hexo/issues/5301
- it('render() - dont escape uncomplete tags', async () => {
+ it('render() - dont escape incomplete tags', async () => {
const content = 'dont drop `{% }` 11111 `{# }` 22222 `{{ }` 33333';
const data = await post.render(null, {
@@ -1385,8 +1385,8 @@ describe('Post', () => {
data.content.should.not.contains('`'); // `
});
- it('render() - uncomplete tags throw error', async () => {
- const content = 'nunjucks should thorw {# } error';
+ it('render() - incomplete tags throw error', async () => {
+ const content = 'nunjucks should throw {# } error';
try {
await post.render(null, {
diff --git a/test/scripts/processors/asset.js b/test/scripts/processors/asset.js
index 2a268714c3..673dec29bd 100644
--- a/test/scripts/processors/asset.js
+++ b/test/scripts/processors/asset.js
@@ -93,7 +93,7 @@ describe('asset', () => {
]);
});
- it('asset - type: create (when source path is configed to parent directory)', async () => {
+ it('asset - type: create (when source path is configured to parent directory)', async () => {
const file = newFile({
path: '../../source/foo.jpg',
type: 'create',
diff --git a/test/scripts/tags/full_url_for.js b/test/scripts/tags/full_url_for.js
index ea01912392..05a8d4929e 100644
--- a/test/scripts/tags/full_url_for.js
+++ b/test/scripts/tags/full_url_for.js
@@ -30,7 +30,7 @@ describe('full_url_for', () => {
$('a').html().should.eql('index');
});
- it('internel url (pretty_urls.trailing_index disabled)', () => {
+ it('internal url (pretty_urls.trailing_index disabled)', () => {
ctx.config.pretty_urls = { trailing_index: false };
let $ = cheerio.load(fullUrlFor('index index.html'));
$('a').attr('href').should.eql(ctx.config.url + '/');
diff --git a/test/scripts/tags/url_for.js b/test/scripts/tags/url_for.js
index 1b905df59a..4fe9d38fcc 100644
--- a/test/scripts/tags/url_for.js
+++ b/test/scripts/tags/url_for.js
@@ -80,7 +80,7 @@ describe('url_for', () => {
ctx.config.relative_link = false;
});
- it('internel url (pretty_urls.trailing_index disabled)', () => {
+ it('internal url (pretty_urls.trailing_index disabled)', () => {
ctx.config.pretty_urls = { trailing_index: false };
ctx.path = '';
ctx.config.root = '/';
From 7ef26adcae37b39ffc9c9f7dad37943a47715e20 Mon Sep 17 00:00:00 2001
From: choi sung ki
Date: Thu, 22 Feb 2024 01:20:21 +0900
Subject: [PATCH 4/4] fix(tag/post_link): support url with subdir (#5419)
---
lib/plugins/tag/post_link.ts | 8 +++++++-
test/scripts/tags/post_link.js | 5 +++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/lib/plugins/tag/post_link.ts b/lib/plugins/tag/post_link.ts
index 67289df469..9aec591a9d 100644
--- a/lib/plugins/tag/post_link.ts
+++ b/lib/plugins/tag/post_link.ts
@@ -41,7 +41,13 @@ export = (ctx: Hexo) => {
const attrTitle = escapeHTML(post.title || post.slug);
if (escape === 'true') title = escapeHTML(title);
- const url = new URL(post.path, ctx.config.url).pathname + (hash ? `#${hash}` : '');
+ // guarantee the base url ends with a slash. (case of using a subdirectory in the url of the site)
+ let baseUrl = ctx.config.url;
+ if (!baseUrl.endsWith('/')) {
+ baseUrl += '/';
+ }
+
+ const url = new URL(post.path, baseUrl).pathname + (hash ? `#${hash}` : '');
const link = encodeURL(url);
return `${title}`;
diff --git a/test/scripts/tags/post_link.js b/test/scripts/tags/post_link.js
index 05839a8098..8d4d89f546 100644
--- a/test/scripts/tags/post_link.js
+++ b/test/scripts/tags/post_link.js
@@ -77,4 +77,9 @@ describe('post_link', () => {
it('should keep hash', () => {
postLink(['foo#bar']).should.eql('Hello world');
});
+
+ it('should keep subdir', () => {
+ hexo.config.url = 'http://example.com/subdir';
+ postLink(['foo']).should.eql('Hello world');
+ });
});