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 ({ export default function ItemInfo ({
item, pendingSats, full, commentsText = 'comments', item, pendingSats, full, commentsText = 'comments',
commentTextSingular = 'comment', className, embellishUser, extraInfo, onEdit, editText, commentTextSingular = 'comment', className, embellishUser, extraInfo, onEdit, editText,
onQuoteReply onQuoteReply, nofollow
}) { }) {
const editThreshold = new Date(item.createdAt).getTime() + 10 * 60000 const editThreshold = new Date(item.createdAt).getTime() + 10 * 60000
const me = useMe() const me = useMe()
@ -64,6 +64,7 @@ export default function ItemInfo ({
<span> \ </span> <span> \ </span>
</>} </>}
<Link <Link
rel={nofollow}
href={`/items/${item.id}`} onClick={(e) => { href={`/items/${item.id}`} onClick={(e) => {
const viewedAt = commentsViewedAt(item) const viewedAt = commentsViewedAt(item)
if (viewedAt) { if (viewedAt) {
@ -91,7 +92,7 @@ export default function ItemInfo ({
{embellishUser} {embellishUser}
</Link> </Link>
<span> </span> <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))} {timeSince(new Date(item.createdAt))}
</Link> </Link>
{item.prior && {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 [pendingSats, setPendingSats] = useState(0)
const image = item.url && item.url.startsWith(process.env.NEXT_PUBLIC_IMGPROXY_URL) 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 ( return (
<> <>
@ -50,6 +51,7 @@ export default function Item ({ item, rank, belowTitle, right, full, children, s
<div className={styles.hunk}> <div className={styles.hunk}>
<div className={`${styles.main} flex-wrap`}> <div className={`${styles.main} flex-wrap`}>
<Link <Link
rel={nofollow}
href={`/items/${item.id}`} href={`/items/${item.id}`}
onClick={(e) => { onClick={(e) => {
const viewedAt = commentsViewedAt(item) const viewedAt = commentsViewedAt(item)
@ -76,7 +78,7 @@ export default function Item ({ item, rank, belowTitle, right, full, children, s
<> <>
<a <a
className={styles.link} target='_blank' href={item.url} 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?:|^)\/\//, '')} {item.url.replace(/(^https?:|^)\/\//, '')}
</a> </a>
@ -85,6 +87,7 @@ export default function Item ({ item, rank, belowTitle, right, full, children, s
<ItemInfo <ItemInfo
full={full} item={item} pendingSats={pendingSats} full={full} item={item} pendingSats={pendingSats}
onQuoteReply={replyRef?.current?.quoteReply} onQuoteReply={replyRef?.current?.quoteReply}
nofollow={nofollow}
embellishUser={Number(item?.user?.id) === AD_USER_ID && <Badge className={styles.newComment} bg={null}>AD</Badge>} embellishUser={Number(item?.user?.id) === AD_USER_ID && <Badge className={styles.newComment} bg={null}>AD</Badge>}
/> />
{belowTitle} {belowTitle}