You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by li...@apache.org on 2024/03/20 03:11:56 UTC

(incubator-seata-website) branch docusaurus updated: optimize: optimize zh-cn can't load static js in development environment. (#854)

This is an automated email from the ASF dual-hosted git repository.

liuqiufeng pushed a commit to branch docusaurus
in repository https://gitbox.apache.org/repos/asf/incubator-seata-website.git


The following commit(s) were added to refs/heads/docusaurus by this push:
     new 5d49ef77d1 optimize: optimize zh-cn can't load static js in development environment. (#854)
5d49ef77d1 is described below

commit 5d49ef77d1798f4cfa12d0b002aeed7b1583c750
Author: liuqiufeng <77...@qq.com>
AuthorDate: Wed Mar 20 11:11:52 2024 +0800

    optimize: optimize zh-cn can't load static js in development environment. (#854)
---
 src/analytics.ts | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/analytics.ts b/src/analytics.ts
index 584484cd69..9062d17872 100644
--- a/src/analytics.ts
+++ b/src/analytics.ts
@@ -2,6 +2,10 @@ import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
 
 (function () {
   if (ExecutionEnvironment.canUseDOM) {
+    let prefix = '';
+    if (location.pathname.startsWith('/zh-cn')){
+      prefix = '/zh-cn';
+    }
     let s= document.getElementsByTagName('script')[0];
 
     let matomo = document.createElement('script');
@@ -25,24 +29,24 @@ import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
     s.parentNode.insertBefore(matomo, s);
 
     let gtag = document.createElement('script');
-    gtag.src = '/js/gtag.js';
+    gtag.src = prefix + '/js/gtag.js';
     gtag.async = true;
     s.parentNode.insertBefore(gtag, s);
 
     let hm= document.createElement('script');
-    hm.src = '/js/hm.js';
+    hm.src = prefix + '/js/hm.js';
     hm.async = true;
     s.parentNode.insertBefore(hm, s);
 
     let aplus_v2= document.createElement('script');
-    aplus_v2.src = '/js/aplus_v2.js';
+    aplus_v2.src = prefix + '/js/aplus_v2.js';
     aplus_v2.id = 'beacon-aplus';
     aplus_v2.setAttribute('exparams','clog=o&aplus&sidx=aplusSidx&ckx=aplusCkx');
     aplus_v2.defer= true;
     s.parentNode.insertBefore(aplus_v2, s);
 
     let tracker= document.createElement('script');
-    tracker.src = '/js/tracker.js';
+    tracker.src = prefix + '/js/tracker.js';
     tracker.defer = true;
     s.parentNode.insertBefore(tracker, s);
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org