I think this might have something to do with shared properties and multi-language setup.
My code is as follows:
var noIndex = Model is ISeo ? (Model as ISeo).NoIndex : false;
@if (noIndex)
{
<meta name="robots" content="noindex">
}
For the Dutch (and default) version of the site, the tag shows up correctly in the source code. However, for the English version, it does not appear at all.
Does anyone know why this happens? Could it be related to how shared properties behave between languages?
I can’t tell from your description if the Seo composition has been set to Allow vary by culture and the NoIndex property has then been set to Vary by culture as well (which could allow for a scenario where the Dutch version is allowed to be indexed while the English version shouldn’t).
Does the property show up as greyed out with the “No Index is shared…” warning and the button to edit it (on documents in the Content section)?
The Seo composition is set to allow vary by culture, and the noindex property is not set to vary by culture. When we created the English page we could set the NoIndex property. After we found out the NoIndex property is not correctly filled on the model we created the Dutch (default) translation of that page. Now the NoIndex property can only be edited on the Dutch page but not the English (as expected). The Dutch page is not published though (we don’t want that one published) but the NoIndex property still doesn’t show up on the English page’s model.
Using the preview function on the Dutch version of the page will result in the model being filled correctly, however the English page still doesn’t have the property filled.
An update; after publishing the Dutch page all works fine, also after then unpublishing the Dutch page it’s still working like expected. So unless the default language version of the page was published it seems the shared property on the composition is not working.