File tree 1 file changed +12
-5
lines changed
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -227,11 +227,11 @@ func InjectPageOpt(page *Page, opt *PageOpt) error {
227
227
opt .Dir .Category = filepath .Join (opt .Dir .Wiki , "cache" , "category" )
228
228
229
229
// convert all HTTP roots to /
230
- opt .Root .Wiki = filepath .ToSlash (opt .Root .Wiki )
231
- opt .Root .Image = filepath .ToSlash (opt .Root .Image )
232
- opt .Root .Category = filepath .ToSlash (opt .Root .Category )
233
- opt .Root .Page = filepath .ToSlash (opt .Root .Page )
234
- opt .Root .File = filepath .ToSlash (opt .Root .File )
230
+ opt .Root .Wiki = startWithSlash ( filepath .ToSlash (opt .Root .Wiki ) )
231
+ opt .Root .Image = startWithSlash ( filepath .ToSlash (opt .Root .Image ) )
232
+ opt .Root .Category = startWithSlash ( filepath .ToSlash (opt .Root .Category ) )
233
+ opt .Root .Page = startWithSlash ( filepath .ToSlash (opt .Root .Page ) )
234
+ opt .Root .File = startWithSlash ( filepath .ToSlash (opt .Root .File ) )
235
235
236
236
// easy bool options
237
237
pageOptBool := map [string ]* bool {
@@ -329,3 +329,10 @@ func InjectPageOpt(page *Page, opt *PageOpt) error {
329
329
330
330
return nil
331
331
}
332
+
333
+ func startWithSlash (s string ) string {
334
+ if s == "" || s [0 ] == '/' {
335
+ return s
336
+ }
337
+ return "/" + s
338
+ }
You can’t perform that action at this time.
0 commit comments