From c2217f666c583c1cf5e9624927ed62620996bf5c Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 22 Feb 2017 14:26:48 +0800 Subject: [PATCH] site: fix infinte redirect loop --- site/theme/static/template.html | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/site/theme/static/template.html b/site/theme/static/template.html index 213b4bcd1e..82ff50374a 100644 --- a/site/theme/static/template.html +++ b/site/theme/static/template.html @@ -43,7 +43,7 @@ var queryString = location.search; if (queryString) { var isZhCNConfig = queryString.indexOf('zh-CN') > -1; - if (isZhCNConfig !== isZhCN(pathname)) { + if (isZhCNConfig && !isZhCN(pathname)) { location.pathname = getLocalizedPathname(pathname, isZhCNConfig) } } @@ -55,6 +55,7 @@ location.pathname = getLocalizedPathname(pathname, lang === 'zh-CN'); } } + document.documentElement.className += isZhCN(pathname) ? 'zh-cn' : 'en-us'; })() @@ -74,9 +75,6 @@ if (!window.Promise) { document.writeln(' -