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

Add rewrite_to_dir config to rewrite index file path #684

Closed
wants to merge 2 commits into from
Closed

Add rewrite_to_dir config to rewrite index file path #684

wants to merge 2 commits into from

Conversation

weihanglo
Copy link
Member

@weihanglo weihanglo commented Apr 30, 2018

The PR is for

Rewrite specified filename of URLs to directory index /.

Intent

Need cleans URL for sharing article and chapters. File paths of index.html are redundant.

Details

Add a new config field rewrite-to-dir under [output.html]. This field accepts Vec<String> of filename. Take a look for an example:

[output.html]
mathjax-support = true
no-section-label = true
rewrite-to-dir = ["index.html"]

This configuration only affects TOC and navigation without touch any actual contents.

@Michael-F-Bryan
Copy link
Contributor

Michael-F-Bryan commented May 11, 2018

This sounds like a pretty good idea. I usually write the "main" chapter for each level as index.md just so it'll be accessible at /. I do have a couple questions though.

How should this interact with #685? Ideally I should be able to write the top level item in each directory as README.md and then have it accessible as /.

Also something to keep in mind is this blah/index.html => blah/ behaviour only works when you're viewing the file on a server. If you read the book from file (e.g. rustup doc --book, mdbook build --open) clicking on a blah/ link will present you with the contents of the blah directory instead of a rendered blah/README.md file...

@weihanglo
Copy link
Member Author

Sorry, I didn't think of reading books from file system. I'll close this pull request. Thanks for your review!

@weihanglo weihanglo closed this May 12, 2018
@weihanglo weihanglo deleted the feature/rewrite-to-dir branch October 19, 2019 09:03
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

Successfully merging this pull request may close these issues.

2 participants