Files
Emil_Shanayev_Resume/components/TitleSync.tsx
T
EmilandClaude Sonnet 5 04c1cc5877
Deploy to GitHub Pages / build (push) Canceled after 0s
Deploy to GitHub Pages / deploy (push) Canceled after 0s
Make the resume bilingual and part of the shared site chrome
Adds a Russian version (data/resume.ru.json, default language) with an RU/EN
switch stored under the key shared with the front page and the portfolio.
The top bar becomes the site-wide one (brand, Resume, Portfolio, Gitea,
Contact, language, theme) with a second row of anchors for this page's
sections, and the fonts move to Unbounded and Onest so the three pages share
one type system. Portfolio links now point at /portfolio/.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XtcZtnG4GQA1d6mW5PNrS9
2026-09-20 23:48:38 +03:00

24 lines
768 B
TypeScript

'use client'
import { useEffect } from 'react'
/** Keeps the tab title in the visitor's language: Next re-applies its default title while hydrating. */
export default function TitleSync() {
useEffect(() => {
const apply = () => {
const html = document.documentElement
const wanted = html.getAttribute(`data-title-${html.dataset.lang}`)
if (wanted && document.title !== wanted) document.title = wanted
}
apply()
const observer = new MutationObserver(apply)
observer.observe(document.head, { childList: true, subtree: true, characterData: true })
window.addEventListener('langchange', apply)
return () => {
observer.disconnect()
window.removeEventListener('langchange', apply)
}
}, [])
return null
}