We currently have some basic code in frontend to check if a path should be excluded from search engines. Essentially it's [arraydata].include?(content_item.base_path)
The array data usually only contains the English version of the base path. Therefore, if a translation is ever added to the page, it won't be excluded from search engines. This is because the code explicitly looks for /my-path and not /my-path.cy or /my-path.fr.
As we're working to a deadline at the moment, I've added some code in this PR #5745 that just cuts off the .cy from a base path before doing the check, so that we have something working for our needs at the moment.
However, we probably need to review if this is the best approach at handling translated base paths.
I believe the content_id of a page stays the same across translations, so maybe we need to be using that in this code instead. In #5745 we were working with pages that are not yet published though, so there's a risk that the content_id could change if we're in a situation where we're working with draft pages that change ID before they're published.
We currently have some basic code in
frontendto check if a path should be excluded from search engines. Essentially it's[arraydata].include?(content_item.base_path)The array data usually only contains the English version of the base path. Therefore, if a translation is ever added to the page, it won't be excluded from search engines. This is because the code explicitly looks for
/my-pathand not/my-path.cyor/my-path.fr.As we're working to a deadline at the moment, I've added some code in this PR #5745 that just cuts off the
.cyfrom a base path before doing the check, so that we have something working for our needs at the moment.However, we probably need to review if this is the best approach at handling translated base paths.
I believe the
content_idof a page stays the same across translations, so maybe we need to be using that in this code instead. In #5745 we were working with pages that are not yet published though, so there's a risk that thecontent_idcould change if we're in a situation where we're working with draft pages that change ID before they're published.