Closed IgorZanellaDev closed 3 years ago
Hi @IgorZanellaDev , just noticed this as well.
I believe you also need to take into account the prefixDefault
parameter to prepend the path with defaultLang
?
Yes, you are right, I only copypasted.
Done, I added defaultPrefix check, hope someone can see this PR.
Thx @IgorZanellaDev. Yup, that’d be cool!
@sidharthachatterjee @pieh can you review and eventually merge it?
It's something we miss in our landing as well.
I've chosen the homepage on purpose due to recommendations from Google: https://developers.google.com/search/docs/advanced/crawling/localized-versions#xdefault
If we want to introduce this feature I'd want it as a prop on the SEO
component and keep the existing behavior for now by setting the default value false
then.
Ok, I added a boolean in gatsby-config options, could you check now? I also updated the readme file. The boolean is in useLocalization hook.
Hi!
Sorry if I was unclear on this but I meant that it should be a prop on the <SEO />
component, e.g. <SEO xDefaultCurrent />
and then it would have the functionality. In the SEO component itself it would have xDefaultCurrent = false
as a parameter.
Ok, but how can I pass the prop to seo component? In plugin config like I did?
react-helmet
dedupes itself so if you place the <SEO />
component (imported from the theme) in your page and add the prop it should override the behavior from the theme. You could also shadow (https://www.gatsbyjs.com/docs/how-to/plugins-and-themes/shadowing/) the SEO component and add the prop there.
The first assumption I'd need to double check first though.
After some tests I decided to shadow the component in our project, I close the PR, thank you, bye.
Hi, there is a SEO problem in the x-default link tag. As you can see here x-default is referred to defaultSiteUrl without path, so hrefLang will be wrong in the pages which are not the home page.
I modified the href to use the default language current page.
If for someone x-default like this is good like this, we can also add a prop to choose whether use defaultSiteUrl or current page.
Wrong for me ⛔️
Right for me ✅