@@ -8,38 +8,40 @@ import lustre/ssg/djot
8
8
import lustre/vdom/vnode
9
9
import tom
10
10
11
- fn include_styles_and_scripts ( page : List ( vnode . Element ( a) ) ) -> vnode . Element ( _) {
11
+ fn include_styles_and_scripts (
12
+ page : List ( vnode . Element ( a) ) ,
13
+ asset_path : String ,
14
+ ) -> vnode . Element ( _) {
12
15
html ( [ ] , [
13
16
head ( [ ] , [
14
17
link ( [
15
- attribute ( "rel" , "stylesheet" ) ,
16
- attribute (
17
- "href" ,
18
+ attribute . rel ( "stylesheet" ) ,
19
+ attribute . href (
18
20
"https://cdn.jsdelivr.net/npm/@catppuccin/palette/css/catppuccin.css" ,
19
21
) ,
20
22
] ) ,
21
23
link ( [
22
- attribute ( " rel" , "stylesheet" ) ,
23
- attribute ( " href" , "assets/ styles.css") ,
24
+ attribute . rel ( "stylesheet" ) ,
25
+ attribute . href ( asset_path <> " styles.css") ,
24
26
] ) ,
25
- script ( [ attribute . src ( "assets/ startup.js") ] , "" ) ,
27
+ script ( [ attribute . src ( asset_path <> " startup.js") ] , "" ) ,
26
28
] ) ,
27
- body ( [ attribute . class ( "gridContainerDesktop " ) ] , [
28
- div ( [ attribute . class ( "gridCell " ) ] , page ) ,
29
+ body ( [ attribute . class ( "grid-container " ) ] , [
30
+ div ( [ attribute . class ( "grid-cell " ) ] , page ) ,
29
31
] ) ,
30
32
] )
31
33
}
32
34
33
- pub fn render_md_path ( path : String ) -> vnode . Element ( _) {
35
+ pub fn render_md_path ( path : String , asset_path : String ) -> vnode . Element ( _) {
34
36
let assert Ok ( posts . FileSource ( _ , md ) ) = posts . from_file ( path )
35
37
36
38
djot . render ( md , djot . default_renderer ( ) )
37
- |> include_styles_and_scripts
39
+ |> include_styles_and_scripts ( asset_path )
38
40
}
39
41
40
- pub fn render_md ( md : String ) -> vnode . Element ( _) {
42
+ pub fn render_md ( md : String , asset_path : String ) -> vnode . Element ( _) {
41
43
djot . render ( md , djot . default_renderer ( ) )
42
- |> include_styles_and_scripts
44
+ |> include_styles_and_scripts ( asset_path )
43
45
}
44
46
45
47
pub fn render_matter (
@@ -68,5 +70,5 @@ pub fn render_links(base: String, sources: List(posts.PostSource)) {
68
70
|> list . map ( render_matter ( base , _) )
69
71
70
72
[ html . h1 ( [ ] , [ text ( "Blogs" ) ] ) , .. rendered_matters ]
71
- |> include_styles_and_scripts
73
+ |> include_styles_and_scripts ( "assets/" )
72
74
}
0 commit comments