Skip to content

Commit

Permalink
Fix exturl title (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
小柚子 authored Feb 8, 2021
1 parent 941e981 commit 3a1b30a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/filters/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ hexo.extend.filter.register('after_post_render', data => {
const link = parse(href);
if (!link.protocol || link.hostname === siteHost) return match;

// Return encrypted URL with title.
const title = match.match(/title="([^"]+)"/);
if (title) return `<span class="exturl" data-url="${Buffer.from(href).toString('base64')}" title="${title[1]}">${html}<i class="fa fa-external-link-alt"></i></span>`;

return `<span class="exturl" data-url="${Buffer.from(href).toString('base64')}">${html}<i class="fa fa-external-link-alt"></i></span>`;
});
}
Expand Down

0 comments on commit 3a1b30a

Please sign in to comment.