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

hbshin pushed a commit to branch new-web
in repository https://gitbox.apache.org/repos/asf/age-website.git


The following commit(s) were added to refs/heads/new-web by this push:
     new 677e2973 Fix isBrowser Check
677e2973 is described below

commit 677e29730673d98bbcaf60112717f1f861101b9a
Author: Hanbyeol Shin /  David Shin / 신한별 
<[email protected]>
AuthorDate: Tue Feb 7 14:29:49 2023 +0900

    Fix isBrowser Check
---
 src/components/Layout.js | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/components/Layout.js b/src/components/Layout.js
index df4d0c85..7aa4ba5d 100644
--- a/src/components/Layout.js
+++ b/src/components/Layout.js
@@ -35,20 +35,25 @@ const TemplateWrapper = ({ children }) => {
   };
 
   const titleNameMapper = () => {
-    const pathName = window.location.pathname;
-    const urlToTitle = {
-      '/overview' : 'Overview | Apache AGE',
-      '/team' : 'Team | Apache AGE',
-      '/release-notes' : 'Release Notes | Apache AGE',
-      '/joinus' : 'Community | Apache AGE',
-      '/contribution/how' : 'Contribution | Apache AGE',
-      '/contribution/guide' : 'Code Convention | Apache AGE',
-      '/contribution/volunteers' : 'Volunteer Guideline | Apache AGE',
-      '/contribution/requirements' : 'Committer Requirements | Apache AGE',
-      '/contribution/process' : 'Release Process | Apache AGE',
-      '/download' : 'Download | Apache AGE',
-    }
-    return urlToTitle[pathName] ?? 'Apache AGE';    
+    const isBrowser = typeof window !== 'undefined';
+    if (isBrowser) {
+      const pathName = window.location.pathname;
+      const urlToTitle = {
+        '/overview' : 'Overview | Apache AGE',
+        '/team' : 'Team | Apache AGE',
+        '/release-notes' : 'Release Notes | Apache AGE',
+        '/joinus' : 'Community | Apache AGE',
+        '/contribution/how' : 'Contribution | Apache AGE',
+        '/contribution/guide' : 'Code Convention | Apache AGE',
+        '/contribution/volunteers' : 'Volunteer Guideline | Apache AGE',
+        '/contribution/requirements' : 'Committer Requirements | Apache AGE',
+        '/contribution/process' : 'Release Process | Apache AGE',
+        '/download' : 'Download | Apache AGE',
+      }
+      return urlToTitle[pathName] ?? 'Apache AGE';    
+    } else {
+      return 'Apache AGE';
+    }    
   }
 
   return (

Reply via email to