rgithubbookdowngitbook

Download button in gitbook leads to 404 page not found


I have a simple bookdown project that is producing both a gitbook and pdf versions of the output. Locally, both work, the output goes to docs, and when I click the download button in the browser I get the pdf version.

When I push to GitHub and set the project pages up to show the docs folder, the gitbook version is there and working fine. However clicking the download pdf button gives a 404 page not found error, and trying to get the pdf directly by appending the filename to the URL doesn't work either. The file _main.pdf is in the docs folder in the repo.

I'm currently specifying the download option in _output.yml as bookdown::gitbook: number_sections: no config: download: null I've tried various other options in there (filename, just the extension, leaving out the download option altogether), and nothing changes.

The book is here and the GitHub repo is https://github.com/atyre2/vet-obserror


Solution

  • When your website is not built with Github Pages, you must present a .nojekyll file (see bookdown's documentation).

    If it still does not work, it might be a bug of Github Pages to me (files with names starting with underscores are not well supported for some reason). In your _bookdown.yml, you can add an option to change the filename, e.g. book_filename: "vet-obserror".