Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: provide an Alternate language content links #6603

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

erral
Copy link
Member

@erral erral commented Jan 18, 2025


Closes #6602

Some comments:

I have found some issues on testing this, because the component injects the links to the Helmet, so I found here that I could use Helmet.peek() to get the current state of the Helmet in the tests and check there the links I inject.

But it had a side-effect: as explained in the linked issue of react-helmet I found that between tests Helmet returns the previous state of the Helmet. So I reordered the tests in order to get them passing. I know that this is not the solution at all, but I haven't found any other test regarding the Helmet in the Volto codebase, so I don't know how to tackle this. Any help will be appreciated.

@erral erral requested a review from mamico January 18, 2025 17:36
Copy link

netlify bot commented Jan 18, 2025

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit 84963e2
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/679110cbc8d4a20007feb723

Copy link
Member

@mamico mamico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pnicolli
Copy link
Contributor

Just to make sure: is this also rendered server-side? In case it's not, do we need it to be rendered server-side?
The code looks good but this kind of things bit us in the past already.

@erral
Copy link
Member Author

erral commented Jan 20, 2025

Just to make sure: is this also rendered server-side? In case it's not, do we need it to be rendered server-side? The code looks good but this kind of things bit us in the past already.

Er... I need to check this.

Copy link
Member

@sneridagh sneridagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I think it should work on SSR too, but a confirmation would be great.
@erral don't worry about the test, Helmet is basically a hack and has some caveats, but it should be fine.

@davisagli
Copy link
Member

@erral Can you check the failing multilingual cypress tests?

<link
key={key}
rel="alternate"
hreflang={item.language}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erral It does work on the SSR but I see this warning in client

Warning: Invalid DOM property `hreflang`. Did you mean `hrefLang`?
    at link
    at head
    at html
    at Html     

if we use hrefLang, I think the browser will handle the conversion. On the server we get it as hrefLang, does it cause issues in SEO ? I think the HTML attributes are case insensitive, the search engines should parse it as hreflang.

Copy link
Member Author

@erral erral Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erral It does work on the SSR but I see this warning in client

Warning: Invalid DOM property `hreflang`. Did you mean `hrefLang`?
    at link
    at head
    at html
    at Html     

if we use hrefLang, I think the browser will handle the conversion. On the server we get it as hrefLang, does it cause issues in SEO ? I think the HTML attributes are case insensitive, the search engines should parse it as hreflang.

mmmm, this may be something similar to class vs className when rendering the react component.

I need to check this with SSR and the failing tests also, I will tackle this when I have some time later this week.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nileshgulia1 @erral HTML attributes are not case sensitive, but in React they are!

@erral
Copy link
Member Author

erral commented Jan 22, 2025

Just to make sure: is this also rendered server-side? In case it's not, do we need it to be rendered server-side? The code looks good but this kind of things bit us in the past already.

Yes, it is rendered in SSR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Volto is missing content alternate hreflangs
6 participants