Skip to content

Commit

Permalink
Fix exturl title (next-theme#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
小柚子 authored and moonfox committed Apr 5, 2021
1 parent 38931f9 commit 9ccd7cc
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 9ccd7cc

Please sign in to comment.