Unable to set "no index" property in Spartacus angular 9

424 Views Asked by At

I tried to change page specific meta tag as <meta name="robots" content="noindex"> and also I am having robot tags in pages api. But it's not changed in page still it shows <meta name="robots" content="INDEX, FOLLOW">. Below image for the reference of API returning values:

pages api

Kindly give some suggestions even I have customized the PageMetaResolver. I don't know how to handle this issue.

1

There are 1 best solutions below

1
On

You can provide your own customized normalizer. For example, you can provide a new custom normalizer as explained in here https://sap.github.io/spartacus-docs/connecting-to-other-systems/#providing-custom-converters.

providers: [
    {
      provide: CMS_PAGE_NORMALIZER,
      useClass: YourCustomNormalizer,
      multi: true
    }
  ]

You can copy paste what was done in the source code (OccCmsPageNormalizer), and change what is being pushed in the switch case, such as

   case Occ.PageRobots.INDEX_NOFOLLOW:
          robots.push('noindex'); -- or any of your already created custom enums
          break;

Similarly, you can extend OccCmsPageNormalizer and override normalizeRobots function to change the behavior to your needs