diff --git a/src/cmd/shelf.rs b/src/cmd/shelf.rs index e49de2d113..adf788a955 100644 --- a/src/cmd/shelf.rs +++ b/src/cmd/shelf.rs @@ -42,12 +42,11 @@ fn process_book( book.config.book.shelf_url = Some(shelf_url.to_path_buf()); book.build()?; - // Create post in index file let title = book.config.book.title.unwrap_or_default(); - writeln!( - index_file, - "## [{title}](<../../{BOOKS_DIR}/{title}/{INDEX_HTML_FILE}>)" - )?; + let book_link = format!("## [{title}](<../../{BOOKS_DIR}/{title}/{INDEX_HTML_FILE}>)"); + + // Create post in index file + writeln!(index_file, "{book_link}")?; writeln!(index_file)?; let desc = book.config.book.description.unwrap_or_default(); writeln!(index_file, "{desc}")?; @@ -58,9 +57,13 @@ fn process_book( let mut file_path = shelf_source.clone(); file_path.push(&file_name); let mut bf = File::create(file_path)?; - writeln!(bf, "# {title}")?; + writeln!(bf, "{book_link}")?; writeln!(bf)?; writeln!(bf, "{desc}")?; + writeln!(bf)?; + writeln!(bf)?; + let authors = book.config.book.authors.join(", "); + writeln!(bf, "*{authors}*")?; // Add the chapter to the summary writeln!(summary, "- [{title}](./{file_name})")?;