Skip to content

Commit

Permalink
fix: generateWebmentionBlock code on webmentions article
Browse files Browse the repository at this point in the history
  • Loading branch information
ripixel committed Mar 22, 2021
1 parent 8790dd4 commit 3877b38
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions thoughts/articles/2021-03-21_Webmentions-are-Fun.md
Expand Up @@ -247,16 +247,26 @@ const generateWebmentionBlock = (
// do" coding for personal stuff. You can always see the source code for this site
// on my GitHub if you really want to see how bad it is...!

return content
.replace(/{mention_link}/g, !isComment ? mention.url : mention.author.url)
.replace(
/{mention_avatar}/g,
(!isComment ? mention.photo : mention.author.photo) ??
'/default_avatar.png'
)
.replace(/{mention_name}/g, !isComment ? mention.name : mention.author.name)
.replace(/{comment}/g, isComment ? mention.content.value : '')
.replace(/{comment_link}/g, isComment ? mention.url : '');
return mentions
.map((mention) => {
return content
.replace(
/{mention_link}/g,
!isComment ? mention.url : mention.author.url
)
.replace(
/{mention_avatar}/g,
(!isComment ? mention.photo : mention.author.photo) ??
'/default_avatar.png'
)
.replace(
/{mention_name}/g,
!isComment ? mention.name : mention.author.name
)
.replace(/{comment}/g, isComment ? mention.content.value : '')
.replace(/{comment_link}/g, isComment ? mention.url : '');
})
.join('');
};
```

Expand Down

0 comments on commit 3877b38

Please sign in to comment.