Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not Generating menu-title from title set in book.toml #596

Closed
HopperMCS opened this issue Jan 28, 2018 · 13 comments
Closed

Not Generating menu-title from title set in book.toml #596

HopperMCS opened this issue Jan 28, 2018 · 13 comments

Comments

@HopperMCS
Copy link

It only generated it once. Now, despite no changes, the tag is appearing empty in the HTML. Is this a known problem?

@Michael-F-Bryan
Copy link
Contributor

Looking at the User Guide it looks like the page title is getting set correctly (chapter is called SUMMARY.md, book title is mdBook Documentation) :

<title>SUMMARY.md - mdBook Documentation</title>

Would you be able to show us what you currently have in your book.toml? The book.toml format changed recently so you'll want to check the configuration page to make sure you're setting the title correctly. If you're using the old format it should have emitted a big warning saying so.

@HopperMCS
Copy link
Author

@Michael-F-Bryan I tried this, it doesn't work:

[book]
title = "Example book"

@Michael-F-Bryan
Copy link
Contributor

Would you be able to explain what you are expecting to see versus what you are actually seeing?

Also, what did you mean by "It only generated it once"?

@HopperMCS
Copy link
Author

The title at the top between the appearance and print buttons. It generated properly once, but all revisions after that don't have it despite being in book.toml

@Michael-F-Bryan
Copy link
Contributor

The top bar is hidden when you scroll down, but should show itself again when you scroll up. Would you be able to point us to an example so we can try to reproduce the issue?

@sorin-davidoi does this sound like a CSS/JS issue?

@sorin-davidoi
Copy link
Contributor

@Michael-F-Bryan Doesn't look like it, based on the following

the tag is appearing empty in the HTML

@MGageMorgan could you provide a screenshot? The actual page (HTML) would also be useful, along with your browser (and version).

@HopperMCS
Copy link
Author

HopperMCS commented Jan 30, 2018

You see the title in thin text? That's supposed to be set in book.toml, right? It's set in book.toml, but does not generate.
screenshot_2018-01-29-20-02-42

This is what mine keeps getting, even though the title key-value thing is set in book.toml:
screenshot_2018-01-29-20-06-22

And I mean it generated a set of pages with it ONCE, but on next run it was gone - and I have yet to see it reappear.

@Michael-F-Bryan
Copy link
Contributor

I believe that's what you'll see when you don't set the book's title. Can you set the RUST_LOG environment variable to trace and run mdbook build again? It'll spew out loads of output, but at the very top should be a bunch of lines starting with something like Config: Config { ... }. This prints out everything mdbook read from your book.toml.

For example, this is how I'd do it on my windows machine at work (using PowerShell):

Output of $env:RUST_LOG = "trace"; mdbook build

PS C:\Users\mbryan\AppData\Local\Temp\test> $env:RUST_LOG = "trace"
PS C:\Users\mbryan\AppData\Local\Temp\test> mdbook build
2018-01-30 12:38:05 [DEBUG] (mdbook::book): Loading config from C:\Users\mbryan\AppData\Local\Temp\test\book.toml
2018-01-30 12:38:05 [DEBUG] (mdbook::config): Updating the config from environment variables
2018-01-30 12:38:05 [TRACE] (mdbook::book): Config: Config {
2018-01-30 12:38:05 [TRACE] (mdbook::book):     book: BookConfig {
2018-01-30 12:38:05 [TRACE] (mdbook::book):         title: None,
2018-01-30 12:38:05 [TRACE] (mdbook::book):         authors: [],
2018-01-30 12:38:05 [TRACE] (mdbook::book):         description: None,
2018-01-30 12:38:05 [TRACE] (mdbook::book):         src: "src",
2018-01-30 12:38:05 [TRACE] (mdbook::book):         multilingual: false
2018-01-30 12:38:05 [TRACE] (mdbook::book):     },
2018-01-30 12:38:05 [TRACE] (mdbook::book):     build: BuildConfig {
2018-01-30 12:38:05 [TRACE] (mdbook::book):         build_dir: "book",
2018-01-30 12:38:05 [TRACE] (mdbook::book):         create_missing: true,
2018-01-30 12:38:05 [TRACE] (mdbook::book):         preprocess: None
2018-01-30 12:38:05 [TRACE] (mdbook::book):     },
2018-01-30 12:38:05 [TRACE] (mdbook::book):     rest: Table(
2018-01-30 12:38:05 [TRACE] (mdbook::book):         {}
2018-01-30 12:38:05 [TRACE] (mdbook::book):     )
2018-01-30 12:38:05 [TRACE] (mdbook::book): }


If you redirect all that output into a file, GitHub should let you upload the logs so we can have a better look at what's happening.

Is it possible to get a link to the rendered HTML page, or even the repository so we can try to reproduce the problem? At the moment it feels like we're guessing in the dark, which makes debugging the issue more difficult.


And I mean it generated a set of pages with it ONCE, but on next run it was gone - and I have yet to see it reappear.

The only changes I can think of to do with the title and rendering is when we updated the configuration format before v0.1.0. Hence all the questions about how it's been configured.

@HopperMCS
Copy link
Author

Here.

I normally don't do this as communities get pissed when I don't provide a minimal viable example in-line, but if you're willing to deal with my garbage, sure! (I wouldn't be surprised if it was something simple...I haven't had time to do this stuff...)

@azerupi
Copy link
Contributor

azerupi commented Feb 1, 2018

On a hunch, based on the directory structure from your repo, do you invoke mdbook in the project-files directory or like mdbook build project-files from the root?

If you do either one, it will not work like you expect. If you run mdbook from the root it will find your book.tom file but not the source files as it expects to find an src directory at the same level, but yours are inside a project-files directory.

If you run mdbook inside project-files or with mdbook build project-files it will assume that project-files/ is the root of your book and therefore will not find the book.toml configuration file that is one level down. This would explain why it uses the default title and not the one you specified.

@JaneSmith
Copy link

I believe I'm having the same problem.

book.toml:

[book]
title = "My book"
description = "My book description"
authors = "Jane"

I've tried running mdbook build and mdbook watch from the root directory (where book.toml is). My page files are in the /src/ subdirectory. The book gets generated and everything seems to be fine except for the attributes defined in book.toml.

The generated page has this in its head block:

<title>Test Page - </title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="">

@ghost
Copy link

ghost commented Dec 28, 2019

#1118

@ehuss
Copy link
Contributor

ehuss commented May 24, 2021

I believe this was caused by the authors field being a string (instead of an array). That should generate an error now via #1539.

@ehuss ehuss closed this as completed May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants