No Slug Home Page Redirect to Language Specific Home Page


Hi everyone,

I have a language specific issue for a customer whose website is on HubSpot COS.

I need the home page without slug to redirect to either the /fr homepage or /en homepage, depending on the language setting in the user's cookie.

Right now, I only used a 301 redirect from no slug to /fr (main language), but I would really like the website to recognize the user's language for direct traffic coming from the homepage without slug.

Normally, we used to deal with that on the server side, but now that the site is on HubSpot, we don't have access anymore.

So is there a simple script I could put in the header of the no slug homepage to detect cookie language? Or should I do it differently?

Thanks guys !


Hi @pcharette,

It's not currently possible (or at least, not reliable) to include client side Javascript that detects a user's preferred language, since that information is primarily passed in the Accept-Language header. Currently, you can target smart content based on preferred language, but otherwise it's not accessible client-side. I've included a couple resources that might be helpful below:


@Derek_Gervais "not reliable" is better than nothing. Where can we do it?