File tree 3 files changed +16
-1
lines changed
3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,9 @@ export async function findPostLiveSampleBySlug(
75
75
rawBody : body ,
76
76
metadata : { locale : DEFAULT_LOCALE , ...blogMeta } ,
77
77
isMarkdown : true ,
78
+ fileInfo : {
79
+ path : file ,
80
+ } ,
78
81
} ) ;
79
82
return liveSamples . find ( ( page ) => page . id . toLowerCase ( ) === id ) ?. html ;
80
83
}
@@ -94,6 +97,9 @@ export async function findPostBySlug(
94
97
rawBody : body ,
95
98
metadata : { locale : DEFAULT_LOCALE , ...blogMeta } ,
96
99
isMarkdown : true ,
100
+ fileInfo : {
101
+ path : file ,
102
+ } ,
97
103
} ) ;
98
104
return { doc, blogMeta } ;
99
105
}
@@ -177,6 +183,9 @@ export async function buildBlogPosts(options: {
177
183
rawBody : body ,
178
184
metadata : { locale, ...blogMeta } ,
179
185
isMarkdown : true ,
186
+ fileInfo : {
187
+ path : file ,
188
+ } ,
180
189
} ;
181
190
const { doc : builtDoc , liveSamples } = await buildPost ( renderDoc ) ;
182
191
const { doc } = {
Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ export async function render(
91
91
rawHTML ,
92
92
{
93
93
...metadata ,
94
+ path : fileInfo ?. path ,
94
95
url,
95
96
tags : metadata . tags || [ ] ,
96
97
selective_mode,
Original file line number Diff line number Diff line change @@ -108,7 +108,12 @@ export default class Templates {
108
108
} ) ;
109
109
return rendered . trim ( ) ;
110
110
} catch ( error ) {
111
- console . error ( `${ name } macro failed:` , error ) ;
111
+ console . error (
112
+ `The ${ name } macro in ${
113
+ args . env . path ?? args . env . url
114
+ } failed to render.`,
115
+ error
116
+ ) ;
112
117
throw error ;
113
118
}
114
119
}
You can’t perform that action at this time.
0 commit comments