File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 11baseURL : ' https://innersourcecommons.org/'
22defaultContentLanguage : ' en'
33defaultContentLanguageInSubdir : false
4+ params :
5+ # Redirect to default language if translation is missing
6+ redirectMissingTranslations : true
7+
48title : InnerSource Commons
59
610pluralizeListTitles : false
Original file line number Diff line number Diff line change 99 {{- partial "footer.html" . -}}
1010</ body >
1111
12+ {{ if not .Content }}
13+ {{ if .Site.Params.redirectMissingTranslations }}
14+ < script >
15+ const path = window . location . pathname ;
16+ const pathParts = path . split ( '/' ) ;
17+ const currentLang = pathParts [ 1 ] ;
18+
19+ // If not English, try English version
20+ if ( currentLang !== 'en' && currentLang . length === 2 ) {
21+ const englishPath = path . replace ( `/${ currentLang } /` , '/en/' ) ;
22+
23+ // Check if English version exists (you'd need to implement this check)
24+ fetch ( englishPath )
25+ . then ( response => {
26+ if ( response . ok ) {
27+ window . location . href = englishPath ;
28+ }
29+ } )
30+ . catch ( ( ) => {
31+ // Show 404 page
32+ } ) ;
33+ }
34+ </ script >
35+ {{ end }}
36+ {{ end }}
1237</ html >
You can’t perform that action at this time.
0 commit comments