Implement complete multilingual support using Hugo's multilingual mode with German (de) as default and English (en) as secondary language.
Changes:
- Configure Hugo multilingual mode with language-specific parameters
- Reorganize content using language suffix pattern (filename.de.md, filename.en.md)
- Translate all content to English (home page and CV page)
- Implement language switcher that maintains page context
- Add language-specific navigation menus
- Update templates to use language-aware URL functions (relLangURL)
- Fix navbar brand and Home links to respect current language
- Add translationKey to content frontmatter for explicit translation linking
URL Structure:
- German: /de/ (home), /de/cv/ (CV page)
- English: /en/ (home), /en/cv/ (CV page)
Key Implementation Details:
- Use filename.{lang}.md pattern instead of {lang}/filename.md subdirectories
- Always use relLangURL for internal navigation, never .Site.BaseURL
- Menu URLs must include language prefix when defaultContentLanguageInSubdir = true
- Added translationKey to frontmatter for proper translation discovery
Documented 5 critical bugs and their solutions in design.md for future reference.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
31 lines
1.0 KiB
HTML
31 lines
1.0 KiB
HTML
<div class="collapse navbar-collapse" id="navbarNav">
|
|
<ul class="navbar-nav ms-auto">
|
|
<li class="nav-item">
|
|
<a class="nav-link{{ if .IsHome }} active{{ end }}" aria-current="page" href="{{ "/" | relLangURL }}">Home</a>
|
|
</li>
|
|
{{ range .Site.Menus.main }}
|
|
<li class="nav-item">
|
|
<a class="nav-link{{ if $.IsMenuCurrent "main" . }} active{{ end }}" href="{{ .URL }}">{{ .Name }}</a>
|
|
</li>
|
|
{{ end }}
|
|
|
|
{{/* Language Switcher - Show only alternative language */}}
|
|
{{ if .IsTranslated }}
|
|
{{ range .Translations }}
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{ .RelPermalink }}">{{ .Language.LanguageName }}</a>
|
|
</li>
|
|
{{ end }}
|
|
{{ else }}
|
|
{{/* Fallback to home page if no translation exists */}}
|
|
{{ range .Site.Languages }}
|
|
{{ if ne $.Language.Lang .Lang }}
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{ .Lang | relLangURL }}">{{ .LanguageName }}</a>
|
|
</li>
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
</ul>
|
|
</div>
|