feat: URLs with no index.html suffix #3047
Conversation
|
Certainly fixes my issue #3028 . Would love to get this in. |
|
@ehuss or @Dylan-DPC, I think many people would appreciate this being merged. I'd love any feedback you have to share. |
This comment has been minimized.
This comment has been minimized.
|
Just had to hop into the discussion and say that this fixed my issue with cloudflare pages Before: https://ad2d70e6.csbook-a6u.pages.dev/ Thanks for your work <3 |
When clean URLs are enabled, pages are output to subdirectories (e.g., `foo/bar/index.html`). In-content relative links like `[Link](other.md)` were being converted to `other/` without accounting for the current page's subdirectory location. The fix modifies `fix_link` to: 1. Take the source chapter path as a parameter 2. Calculate `path_to_root` using `clean_url_path_to_root` 3. Prepend `path_to_root` to the fixed link This ensures in-content links work correctly from any page depth.
- add tests for ResourceHelper clean URL paths
The preprocessor now handles {{#if}}...{{else}}...{{/if}} blocks by keeping only the first branch and stripping trailing whitespace. Also adds required meta object for ESLint 10 compatibility.
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
If I've read this right, the So, I wonder if the property needs a better name, to avoid confusing people who will see files on disk that still have a |
|
@jonathanpallant - this is true. I'm open to suggestions for a better name if you have one. |
|
It seems they are called Clean URLS so the option could be However, |
|
All URLs are "clean" including |
|
Oh, I though the question was how to call the option that controls this behavior. For that I suggested |
|
I'm open to My other question is what should we do with |
|
Regarding the So I checked what happens now: (mdbook v0.5.2) If I create a file called If I create a file called If I create a file called So I think we should keep the names without the ps. Sorry for making two unrelated comments in one message earlier. |
|
So I've thought about this a bit, and I don't love how it's going to fundamentally change the on-disk structures of my rendered book. I have a lot of old copies of the book, and it seems useful that the changes between versions are all currently relatively small. For my specific issue, #2993 is a much less invasive fix. Perhaps we can just do both - then I get a free choice about whether to enable this option or not? |
|
I didn't write the other PRs, but am not opposed to having both. Options can be nice. |
Fixes #1251
Vaguely related PRs: #2570, #2993, #3028, #3034, #3038