#what do hrefLang and lang properties do
1 messages · Page 1 of 1 (latest)
Hi @kindred igloo. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
@short moat
Sorry @kindred igloo, I seem to be having a bit of trouble. Don't worry though, I've pinged my supprt and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
Let me check the knowledge base for you. One moment! :books:
Sorry @kindred igloo, I seem to be having a bit of trouble. Don't worry though, I've pinged my supprt and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
@short moat what do hrefLang and lang properties do on next/link?
Let me check the knowledge base for you. One moment! :books:
The hrefLang and lang properties are not directly used with next/link. However, they are related to internationalization in Next.js.
The lang attribute is automatically added to the <html> tag by Next.js when it knows the language the user is visiting. This helps with accessibility and search engine optimization.
The hreflang attribute is not directly used with next/link, but it's important for internationalized websites. You need to add hreflang meta tags using next/head to inform search engines about the different language versions of a page. You can learn more about hreflang in the Google Webmasters documentation (https://support.google.com/webmasters/answer/189077).
To transition between locales in Next.js, you can use the locale prop with next/link or specify the locale in the transition options when using next/router. Here's an example using next/link:
import Link from 'next/link'
export default function IndexPage(props) {
return (
<Link href="/another" locale="fr">
To /fr/another
</Link>
)
}
Sources:
- Internationalized Routing - Search Engine Optimization (https://nextjs.org/docs/advanced-features/i18n-routing#search-engine-optimization)
- Transition between locales - Part 0 (https://nextjs.org/docs/advanced-features/i18n-routing#transition-between-locales)