File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,10 @@ export default function render(
76
76
blogMeta = null ,
77
77
} : HydrationData = { url }
78
78
) {
79
+ if ( ! locale ) {
80
+ locale = ( doc && doc . locale ) || DEFAULT_LOCALE ;
81
+ }
82
+
79
83
const canonicalURL = `${ BASE_URL } ${ url } ` ;
80
84
81
85
let realPageTitle = pageTitle ;
@@ -139,10 +143,7 @@ export default function render(
139
143
}
140
144
141
145
// Open Graph protocol expects `language_TERRITORY` format.
142
- const ogLocale = ( locale || ( doc && doc . locale ) || DEFAULT_LOCALE ) . replace (
143
- "-" ,
144
- "_"
145
- ) ;
146
+ const ogLocale = locale . replace ( "-" , "_" ) ;
146
147
147
148
if ( locale === "de" ) {
148
149
// Prevent experimental German locale from being indexed.
@@ -158,7 +159,7 @@ export default function render(
158
159
return (
159
160
"<!doctype html>" +
160
161
renderToString (
161
- < html lang = { locale || DEFAULT_LOCALE } prefix = "og: https://ogp.me/ns#" >
162
+ < html lang = { DEFAULT_LOCALE } prefix = "og: https://ogp.me/ns#" >
162
163
< head >
163
164
< meta charSet = "utf-8" />
164
165
< meta name = "viewport" content = "width=device-width,initial-scale=1" />
You can’t perform that action at this time.
0 commit comments