File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -4,16 +4,22 @@ interface Post {
4
4
content : string
5
5
}
6
6
7
+ const GITHUB_RAW_HOST = 'https://raw.githubusercontent.com'
8
+ const GITHUB_RAW_PATH = 'hfidelis/hfidelis.github.io/main/src/services/posts/files/'
9
+ const GITHUB_RAW_URL = `${ GITHUB_RAW_HOST } /${ GITHUB_RAW_PATH } `
10
+
7
11
const posts = import . meta. glob (
8
12
'@/services/posts/files/*.md' ,
9
13
{ import : 'default' , eager : true } ,
10
14
)
11
15
const postPaths = Object . keys ( posts )
12
16
13
- const getPostContent = async ( path : string ) : Promise < string > => {
17
+ const getPostContent = async ( path : string ) : Promise < string > => {
14
18
const content = await import ( path )
15
19
16
- const rawContent = await fetch ( content . default )
20
+ const extractedPath = content . default . split ( '/' ) . pop ( )
21
+
22
+ const rawContent = await fetch ( GITHUB_RAW_URL + extractedPath )
17
23
18
24
return await rawContent . text ( )
19
25
}
You can’t perform that action at this time.
0 commit comments