Dynamicly add noindex/nofollow to specific CMS pages

Hi!

So, ive got CMS reviews where not all are done, rather 50% and ongoing.
Im looking for a way to add meta noindex to the CMS pages that are not done yet, Adding a pointer to a text field in the CMS where you but the does not work, as webflow dont put the “Put code here to be put in ” to the accual head tag of the page? (this is beyond me)…

Anyone got any idea?

You can access the header part of any CMS Item from the Collection Template page. From there, you can add static and dynamic elements as custom head code. But you can’t set visibility conditions.

So in your case, I would add a text field in your collection setting, that you’d call “noindex + nofollow head code”. And in this text field, once in an item, you’d paste the entire meta code:

<meta name=”robots” content=”noindex, follow”>

http://vincent.polenordstudio.fr/snap/Webflow_-_Record_shop__CMS_tutorial_2018-10-10_13-12-13.png

Now in the head code box of the collection template page, you’ll call this field, and just this field. Now if your item has the field filled, then the nofollow code will appear on its page, and if not, there won’t be nothing added.

http://vincent.polenordstudio.fr/snap/Webflow_-_Record_shop__CMS_tutorial_2018-10-10_13-13-14.png

This is exactly what ive done, did not work, as it did not put the meta inside the head tag…
(https://i.gyazo.com/a4bcd0ec28d9ae3617abb46da69a02e4.png)
Resulted in:

Have this worked for you?

1 Like

Haha no, I get the same weird behavior than you.

It sounds like a bug…

@Brando sorry to disturb, could you have a look? What we ask for being put inside of HEAD is definitely put inside of body, wrapped inside quotes. Bug, or some sort of limitation? Thanks in advance for having a quick look.

I’ve seen issue before - I think the CMS doesn’t want to export code.

So I do exactly what @vincent said - except I only put the noindex, nofollow text in the text field - so the

image

The CMS text entry
image

And the live html
image

It works!

Yes, but if you have 500+ reviews and you want to avoid >>meta name=“robots” content=“”> you have to add “index” to all the other 420+ rewviews, so would like to avoid that… :confused:

@Diarmuid_Sexton cool, and thanks for the demo! However this is what I wanted to avoid, for the same reasons @Niclas_Walfridsson is exposing. I don’t know the effects of letting an empty meta in the head (and I don’t want to be yelled at by my SEO guy :sweat_smile: )

Well you can add “index, follow” if you don’t want to leave it empty.

1 Like

@Niclas_Walfridsson @Diarmuid_Sexton I think I found a clean way to use @Diarmuid_Sexton solution.

Use his syntax, then in the field on Webflow, use either noindex, nofollow or index . In this case, the code is always correct.

Well, now that you can export all your CMS items, why not export them all - then delete them - and then upload them all with the “noindex, nofollow” text where necessary.

That would be cool but the export and import feature isn’t yet complete. You can’t import things like references, or CMS images… other things you can export and import require some preparation work, it’s not a 2 clicks thing like you can do on a SQL database with WP.

Yes, absolutely - it does depend on the complexity of the CMS collection.

@Niclas_Walfridsson
Here’s a wishlist item which I created in April 2017 looking for this feature:
https://wishlist.webflow.com/ideas/WEBFLOW-I-619

Add you votes / comments to that.

1 Like

Shouldent this be counted as a bug and prioritized instead of having workarounds?
Cant wait another year for this to be fixxed… :confused:

@Brando is this something you can push out fast?

1 Like

Heyo @Niclas_Walfridsson @vincent

Was out of the office yesterday so am just seeing this today. That’s definitely weird that the first method Vincent proposed ends up dropping that meta name in the body :thinking:

I’ll do some testing on this end and report the glitch to the team — thanks everyone! :slight_smile:

1 Like

One way to make your work-in-progress CMS pages not get indexed is to save the CMS items as Draft. Would that help? Then the CMS pages wouldn’t be published at all but would still be available in the Editor if someone else needs to review the pages.

Sadly no, as we are having quite an extensive use of multiple collections and references, this is not a possibility.
Have you been able to recreate it or found whats causing the tags to become plain text in the body?

I was able to recreate the problem too. The reason is that Webflow escapes the content that comes from a CMS variable so that sites’ HTML wouldn’t break in unexpected ways. So, what happens is that the meta tag text that comes from a CMS variable in custom code is included to the page as plain text. Most browsers don’t like that. So when a browser parses the HTML and spots the plain in the head tag, it just renders it in the body tag as text.

What indeed should work is to have something @Diarmuid_Sexton already mentioned, which is creating a text field that is used as a custom code variable in the content attribute of a meta tag. If CMS export + import is not feasible for your use case, you can use the Webflow CMS API for adding the field values.

Here’s the Webflow University article about the API Intro to the Webflow API | Webflow University, and the API documentation https://developers.webflow.com.

1 Like

That makes sense, Would be a big problem if people make mistakes in the CMS if a content writer starts playing dev or whatever.
Yes, I could do this, and will write some code to have it auto-update our 500+ items.

(Sneaking in another question as youre already here)
Are you planning on adding cors or possibility to generate API tokens with read-only access for the webflow API?

Back to initial.
However I can argue for adding the possibility to add noindex to separate pages, what happened to us was that we got flagged by Google as the sitemap is autogenerated, yet we could not exclude cms that were not done.
Also when this could be a problem is when you apply relational DB theory to the CMS (in lack of better words) and don’t want to export little to no content to be autogenerated to the sitemap.

I’ll do something for now, but would like to plea that you add functionality to exclude specific CMS pages of a collection.

Best regards.

Potentially you could use Google Tag Manager to dynamically insert the noindex instead?