Add "similar" link for searching host name

This commit is contained in:
Tanner
2025-12-13 22:37:47 +00:00
parent 957a0794bb
commit 6f7329c659
2 changed files with 9 additions and 2 deletions
+7
View File
@@ -9,6 +9,13 @@ export const sourceLink = (story) => {
return (<a className='source' href={url}>{host}</a>);
};
export const similarLink = (story) => {
const url = story.url || story.link;
const urlObj = new URL(url);
const host = urlObj.hostname.replace(/^www\./, '');
return (<Link to={'/search?q="'+host+'"'} className='similar'>similar</Link>);
};
export const infoLine = (story) =>
<div className='info'>
{story.score} points