Skip to content

hide_from_search_engines? doesn't account for translations #5747

Description

@AshGDS

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions