File tree 2 files changed +14
-0
lines changed
src/renderer/html_handlebars
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ impl HtmlHandlebars {
85
85
if ctx. is_index {
86
86
ctx. data . insert ( "path" . to_owned ( ) , json ! ( "index.md" ) ) ;
87
87
ctx. data . insert ( "path_to_root" . to_owned ( ) , json ! ( "" ) ) ;
88
+ ctx. data . insert ( "is_index" . to_owned ( ) , json ! ( "true" ) ) ;
88
89
let rendered_index = ctx. handlebars . render ( "index" , & ctx. data ) ?;
89
90
let rendered_index = self . post_process ( rendered_index, & ctx. html_config . playpen ) ;
90
91
debug ! ( "Creating index.html from {}" , path) ;
Original file line number Diff line number Diff line change @@ -63,6 +63,19 @@ fn find_chapter(
63
63
. ok_or_else ( || RenderError :: new ( "Type error for `path`, string expected" ) ) ?
64
64
. replace ( "\" " , "" ) ;
65
65
66
+ if !rc. evaluate ( ctx, "@root/is_index" ) ?. is_missing ( ) {
67
+ // Special case for index.md which may be a synthetic page.
68
+ // Target::find won't match because there is no page with the path
69
+ // "index.md" (unless there really is an index.md in SUMMARY.md).
70
+ match target {
71
+ Target :: Previous => return Ok ( None ) ,
72
+ Target :: Next => match chapters. iter ( ) . skip ( 1 ) . next ( ) {
73
+ Some ( chapter) => return Ok ( Some ( chapter. clone ( ) ) ) ,
74
+ None => return Ok ( None ) ,
75
+ } ,
76
+ }
77
+ }
78
+
66
79
let mut previous: Option < StringMap > = None ;
67
80
68
81
debug ! ( "Search for chapter" ) ;
You can’t perform that action at this time.
0 commit comments