coston / react-obfuscate

An intelligent React component to obfuscate any contact link!
https://react-obfuscate.coston.io
MIT License
110 stars 17 forks source link

Generates a page during production build #287

Closed jordanlambrecht closed 1 year ago

jordanlambrecht commented 1 year ago

Hiya,

Screaming Frog and Google Search Console are picking up on ghost pages generated by ROE. Any ideas why or how to fix it?

Screen Shot 2022-10-06 at 11 23 25
coston commented 1 year ago

Hey @jordanlambrecht, it looks like your are obfuscating page links. In that case, it's working as expected. Part of the point of react-obfuscate is to obfuscate email addresses, other text, or [in this case] links that you don't want picked up by a crawler (e.g. Google Search Console).

For the pages in your screenshot, I recommend that you do not obfuscate those links.

jordanlambrecht commented 1 year ago

Hey @coston, I don't think I am. Here are two examples of my code:

import Obfuscate from 'react-obfuscate'

export const Footer: NextPage = () => {
  return (
                    <li className='mt-3 text-xl text-cream'>
                      <Obfuscate tel={'402-302-0323'} className={'text-cream  '}>
                        402 302 0323
                      </Obfuscate>
                    </li>
  )
}

export default Footer
import Obfuscate from 'react-obfuscate'
const About_Team_Header = ({ source, frontMatter }) => {
  return (
 <Obfuscate
                  email={frontMatter.email}
                  className={'block italic text-peach cursor-pointer text-left'}
                />
  )
}
export default About_Team_Header
coston commented 1 year ago

@jordanlambrecht you are right. I get what the problem is now. 🎯 Because the email link href is "obfuscated", Google Search Console interprets it to be a relative link.

Quick solution: using the linkText prop, create your own obfuscated placeholder with the mailto: prefix (e.g. mailto:obfuscated.)

Package improvement: include all the Common Options prefixes in the obfuscated href so that contact urls aren't captured by crawlers as navigation links.

coston commented 1 year ago

@jordanlambrecht please let me know what you think about my analysis of the problem and the solution. Also, are you interested in contributing the package improvement?

jordanlambrecht commented 1 year ago

@coston am I a dick if I do linktext={'tel:911'}

jordanlambrecht commented 1 year ago

But yup! Confirmed. That worked. Thank you!

rodrigo-arias commented 9 months ago

@coston thanks for creating this plugin. I wonder if by default the href attribute before human iteration should be generated with the prefix of the link used: email, tel, sms, etc. as appropriate and thus avoid issues with crawlers. Glad to submit a PR if you agree.