diff --git a/src/renderer/html_handlebars/helpers/navigation.rs b/src/renderer/html_handlebars/helpers/navigation.rs
index 02e23e4f..56c6c5a9 100644
--- a/src/renderer/html_handlebars/helpers/navigation.rs
+++ b/src/renderer/html_handlebars/helpers/navigation.rs
@@ -149,12 +149,12 @@ pub fn next(c: &Context, _h: &Helper, r: &Handlebars, rc: &mut RenderContext) ->
if let Some(previous) = previous {
- let path = match previous.get("path") {
+ let previous_path = match previous.get("path") {
Some(p) => p,
None => return Err(RenderError{ desc: "No path found for chapter in JSON data"})
};
- if path == ¤t {
+ if previous_path == ¤t {
debug!("[*]: Found current chapter");
debug!("[*]: Creating BTreeMap to inject in context");
@@ -169,6 +169,7 @@ pub fn next(c: &Context, _h: &Helper, r: &Handlebars, rc: &mut RenderContext) ->
None => return Err(RenderError{ desc: "No title found for chapter in JSON data"})
}
+
let link = path_to_root.join(Path::new(path).with_extension("html"));
debug!("[*]: Inserting link: {:?}", link);