Hey everyone, I’d like to know if it’s possible for parameterized pages (with ?) to have their meta robots set to
Hey @fabiano.dev, how’s it going?
I’d try it via a custom app rendering a helmet when needed, something along these lines:
import React from 'react'
import { Helmet } from 'react-helmet'
const NoIndexApp = ({ params }) => {
// Assuming you have the full URL
const url = new URL(window.location.href)
const shouldNoIndex = url.searchParams.toString().length > 0 // Returns true if there's a parameter
return shouldNoIndex && (
<>
<Helmet>
<meta name="robots" content="noindex, nofollow" />
</Helmet>
</>
)
}
export default NoIndexApp
Hey buddy! Always coming to my rescue, thank you so much — I’ll run the tests internally and get back to you soon.