Hi there,
I was just wondering if anyone has successfully configured a robots
meta tag on their Frontity site? I’m currently in the position where I have set up a staging site that I would like to block from being indexed by google, as I don’t want the staging site to cause a duplicate content issue with the live website. I am trying to do this by setting the value of the robots meta tag to noindex
across the website, which should prevent most search engines from indexing the site.
For reference, my WordPress install has the REST API - Head Tags plugin, and my Frontity installation is using the @frontity/head-tags
package.
I have tried the following:
Adding additional robots
tag to the Frontity <Head>
component
My first attempt to solve this issue involved me adding the <meta name="robots" content="noindex" />
meta tag to the header of my site by importing the <Head>
component in my components/index.js
file.
This solution seems to work fine when running my site in development mode, but once run in production mode, this meta value is overwritten by the value pulled in via the @frontity/head-tags
package.
Setting the “Discourage search engines from indexing this site” WordPress setting
Setting this value on my CMS does not seem to override the robots
meta value. I believe that this value is not returned as part of the REST API - Head Tags plugin.
Disabling @frontity/head-tags
This solution does resolve the issue, but with the result of removing all meta tag pulling from WordPress, resulting in just the meta values that I have specified in the <Head>
component being served.
This is a temporary solution that I suppose I could extend by optionally including the package depending on the environment I’m running.
Ideal Solution
My ideal solution to this issue would be either to always respect the values specified in the <Head>
component of the Frontity application, or extending the REST API - Head Tags plugin to respect the value of the “Discourage search engines from indexing this site” WordPress setting.
Has anyone else experience this issue, or found a solution to this problem?
Cheers,
Sean