Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

16
  • Just for clarification, can I paste that entire snippet in the Layout Update XML field for the CMS page I am trying to update? Or do I have to create a dedicated Magento_Theme/layout/noindex_nofollow.xml layout file in order for it to work? Commented May 3, 2018 at 15:29
  • When I try to paste the entire snippet I get an error Please correct the XML data and try again. XML declaration allowed only at the start of the document Line: 1 Commented May 3, 2018 at 15:30
  • Ah yes, this snippet is intented to live in a file within your theme. Unfortunately, in M2, I have not had much success setting robots by pasting the content into the "Layout Update XML" section. It worked in M1 but in M2 it still does not. Commented May 3, 2018 at 16:10
  • Btw, as long as you have access to your file system, you can still target a specific page, you just need to determine the layout handle for the specific page. Commented May 3, 2018 at 16:10
  • I tried your suggestion, but I am still unable to get it to work. I created the file app/design/frontend/<vendor>/<theme>/Magento_Theme/layout/noindex_nofollow.xml with the XML snippet you provided. On my CMS page I inserted <update handle="noindex_nofollow" /> and was able to save it successfully. Then I cleared my cache. But the page on the frontend still has the default <meta name="robots" content="INDEX,FOLLOW"/> meta tag. Is there something obvious that I am overlooking? Commented May 3, 2018 at 16:49