nuxt.com icon indicating copy to clipboard operation
nuxt.com copied to clipboard

fix: add rel to props from prose a

Open Barbapapazes opened this issue 1 year ago • 3 comments

Hello,

Actually, every external links have rel="nofollow" which is far from ideal in terms of SEO and security.

Also, it's impossible to customize the rel for a specific link since remark-mdc automatically add rel="nofollow". This plugin should not be opinitated about links (https://github.com/nuxtlabs/remark-mdc/issues/71).

This PR add rel to ProseA props to restore default NuxtLink behavior. This is a temporary mitigation since the remark-mdc issue should be solved.

In the same time, I'm asking for a whitlist of website, https://github.com/nuxt/nuxt/issues/25466, to help to remove the noreferrer from some links. I think that the noopener noreferrer is not correctly used in NuxtLink.

https://stackoverflow.com/questions/50773152/when-should-i-use-rel-noreferrer

Barbapapazes avatar Feb 01 '24 08:02 Barbapapazes

This PR will simply ignore the rel attribute as it won't be proxied to NuxtLink anymore. Also, this will completely break all styling on links made by Nuxt UI Pro: https://github.com/nuxt/ui-pro/blob/v3/src/runtime/components/prose/A.vue

This behavior should be controlled by @nuxt/content, @farnabaz can you confirm?

benjamincanac avatar Jul 17 '25 09:07 benjamincanac

I believe we can remove rel="nofollow" from anchor links in the MDC parser. That way we don't need to override ProseA component to ignore rel attribute.

Could you try disabling rehype-external-links plugin?

mdc: {
    rehypePlugins: {
      'rehype-external-links': false
    }
  }

farnabaz avatar Jul 17 '25 10:07 farnabaz

rehype-external-links

It does not work @farnabaz

I just push in this PR if you want to have a look

atinux avatar Sep 15 '25 14:09 atinux