File tree 2 files changed +5
-4
lines changed
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ class Index {
92
92
renderBlogs ( ) {
93
93
let blogList = document . getElementById ( 'blogList' ) ;
94
94
if ( blogList ) {
95
+ const pathName = window . location . pathname ;
95
96
blogList . innerHTML = '' ;
96
97
this . blogs . forEach ( blog => {
97
98
let blogDiv = document . createElement ( 'div' ) ;
@@ -101,7 +102,7 @@ class Index {
101
102
let blogTitleDiv = document . createElement ( 'div' ) ;
102
103
blogTitleDiv . className = 'font-bold text-xl mb-2' ;
103
104
let blogLink = document . createElement ( 'a' ) ;
104
- blogLink . href = './ blogs' + blog . Path ;
105
+ blogLink . href = pathName + ' blogs' + blog . Path ;
105
106
blogLink . target = '_blank' ;
106
107
blogLink . className = 'block text-lg py-2 text-neutral-600 hover:text-neutral-800 dark:text-neutral-300 dark:hover:text-neutral-100' ;
107
108
blogLink . innerText = "📑 " + blog . Title ;
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class Index {
26
26
document . addEventListener ( 'DOMContentLoaded' , ( ) => this . init ( ) ) ;
27
27
}
28
28
29
- init ( ) {
29
+ init ( ) {
30
30
this . getData ( ) ;
31
31
this . addEvent ( ) ;
32
32
}
@@ -119,8 +119,8 @@ class Index {
119
119
120
120
renderBlogs ( ) : void {
121
121
let blogList = document . getElementById ( 'blogList' ) ;
122
-
123
122
if ( blogList ) {
123
+ const pathName = window . location . pathname ;
124
124
blogList . innerHTML = '' ;
125
125
this . blogs . forEach ( blog => {
126
126
let blogDiv = document . createElement ( 'div' ) ;
@@ -130,7 +130,7 @@ class Index {
130
130
let blogTitleDiv = document . createElement ( 'div' ) ;
131
131
blogTitleDiv . className = 'font-bold text-xl mb-2' ;
132
132
let blogLink = document . createElement ( 'a' ) ;
133
- blogLink . href = './ blogs' + blog . Path ;
133
+ blogLink . href = pathName + ' blogs' + blog . Path ;
134
134
blogLink . target = '_blank' ;
135
135
blogLink . className = 'block text-lg py-2 text-neutral-600 hover:text-neutral-800 dark:text-neutral-300 dark:hover:text-neutral-100' ;
136
136
blogLink . innerText = "📑 " + blog . Title ;
You can’t perform that action at this time.
0 commit comments