diff --git a/lib/plugins/tag/post_link.js b/lib/plugins/tag/post_link.js
index d70ada3726..d8d94fbfb8 100644
--- a/lib/plugins/tag/post_link.js
+++ b/lib/plugins/tag/post_link.js
@@ -30,8 +30,9 @@ module.exports = ctx => {
}
let title = args.length ? args.join(' ') : post.title;
- const attrTitle = escapeHTML(title);
- if (escape === 'true') title = attrTitle;
+ // Let attribute be the true post title so it appears in tooltip.
+ const attrTitle = escapeHTML(post.title);
+ if (escape === 'true') title = escapeHTML(title);
const link = encodeURL(resolve(ctx.config.root, post.path));
diff --git a/test/scripts/tags/post_link.js b/test/scripts/tags/post_link.js
index 473edd5f41..22696cf553 100644
--- a/test/scripts/tags/post_link.js
+++ b/test/scripts/tags/post_link.js
@@ -33,7 +33,7 @@ describe('post_link', () => {
});
it('title', () => {
- postLink(['foo', 'test']).should.eql('test');
+ postLink(['foo', 'test']).should.eql('test');
});
it('should escape tag in title by default', () => {
@@ -45,7 +45,7 @@ describe('post_link', () => {
});
it('should escape tag in custom title', () => {
- postLink(['title-with-tag', '', 'title', 'true']).should.eql('<test> title');
+ postLink(['title-with-tag', '', 'title', 'true']).should.eql('<test> title');
});
it('should not escape tag in title', () => {
@@ -54,7 +54,7 @@ describe('post_link', () => {
it('should not escape tag in custom title', () => {
postLink(['title-with-tag', 'This is a Bold "statement"', 'false'])
- .should.eql('This is a Bold "statement"');
+ .should.eql('This is a Bold "statement"');
});
it('should throw if no slug', () => {