nofollow on unqualified content

This commit is contained in:
keyan 2023-10-16 13:44:07 -05:00
parent a19b392787
commit e12e2481f4
2 changed files with 7 additions and 3 deletions

View File

@ -22,7 +22,7 @@ import MuteDropdownItem from './mute'
export default function ItemInfo ({
item, pendingSats, full, commentsText = 'comments',
commentTextSingular = 'comment', className, embellishUser, extraInfo, onEdit, editText,
onQuoteReply
onQuoteReply, nofollow
}) {
const editThreshold = new Date(item.createdAt).getTime() + 10 * 60000
const me = useMe()
@ -64,6 +64,7 @@ export default function ItemInfo ({
<span> \ </span>
</>}
<Link
rel={nofollow}
href={`/items/${item.id}`} onClick={(e) => {
const viewedAt = commentsViewedAt(item)
if (viewedAt) {
@ -91,7 +92,7 @@ export default function ItemInfo ({
{embellishUser}
</Link>
<span> </span>
<Link href={`/items/${item.id}`} title={item.createdAt} className='text-reset' suppressHydrationWarning>
<Link rel={nofollow} href={`/items/${item.id}`} title={item.createdAt} className='text-reset' suppressHydrationWarning>
{timeSince(new Date(item.createdAt))}
</Link>
{item.prior &&

View File

@ -30,6 +30,7 @@ export default function Item ({ item, rank, belowTitle, right, full, children, s
const [pendingSats, setPendingSats] = useState(0)
const image = item.url && item.url.startsWith(process.env.NEXT_PUBLIC_IMGPROXY_URL)
const nofollow = item.sats + item.boost < NOFOLLOW_LIMIT && !item.position ? 'nofollow' : ''
return (
<>
@ -50,6 +51,7 @@ export default function Item ({ item, rank, belowTitle, right, full, children, s
<div className={styles.hunk}>
<div className={`${styles.main} flex-wrap`}>
<Link
rel={nofollow}
href={`/items/${item.id}`}
onClick={(e) => {
const viewedAt = commentsViewedAt(item)
@ -76,7 +78,7 @@ export default function Item ({ item, rank, belowTitle, right, full, children, s
<>
<a
className={styles.link} target='_blank' href={item.url}
rel={`noreferrer ${item.sats + item.boost >= NOFOLLOW_LIMIT ? '' : 'nofollow'} noopener`}
rel={`noreferrer ${nofollow} noopener`}
>
{item.url.replace(/(^https?:|^)\/\//, '')}
</a>
@ -85,6 +87,7 @@ export default function Item ({ item, rank, belowTitle, right, full, children, s
<ItemInfo
full={full} item={item} pendingSats={pendingSats}
onQuoteReply={replyRef?.current?.quoteReply}
nofollow={nofollow}
embellishUser={Number(item?.user?.id) === AD_USER_ID && <Badge className={styles.newComment} bg={null}>AD</Badge>}
/>
{belowTitle}