Skip to content

Clean URLs (output directory structure change) #1239

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

Open
shreyasminocha opened this issue May 30, 2020 · 4 comments
Open

Clean URLs (output directory structure change) #1239

shreyasminocha opened this issue May 30, 2020 · 4 comments

Comments

@shreyasminocha
Copy link

I'm interested in clean URLs for pages:

File: src/foo/bar.md
Expected path: /foo/bar
Actual path: /foo/bar.html

It's mostly a stylistic preference.

I'm transitioning from GitBook and this is one of the few small things I'm having trouble with. Thanks!

Related: #1238

@nihaals
Copy link
Contributor

nihaals commented Jun 11, 2020

I think you're meant to use README.md to index.html, although that feels like an annoying workaround, and I agree that it would be nice to be able to choose between bar.mdbar.html and bar.mdbar/index.html.

@shreyasminocha
Copy link
Author

shreyasminocha commented Jun 16, 2020

While I could create src/foo/bar/readme.md and access it at /foo/bar, it would be a lot more convenient if src/foo/bar.md were accessible at /foo/bar.

@shreyasminocha
Copy link
Author

shreyasminocha commented Jun 17, 2020

Here's a more detailed explanation of what I'm proposing:

Source

src
├── SUMMARY.md
├── foo
│   ├── alpha.md
│   ├── beta.md
│   └── readme.md
├── bar
│   ├── delta.md
│   ├── gamma.md
│   └── readme.md
└── readme.md

Current behaviour

book
├── foo
│   ├── alpha.html
│   ├── beta.html
│   └── index.html
├── bar
│   ├── delta.html
│   ├── gamma.html
│   └── index.html
└── index.html

Proposed behaviour

book
├── foo
│   ├── alpha
│   │   └── index.html
│   ├── beta
│   │   └── index.html
│   └── index.html
├── bar
│   ├── delta
│   │   └── index.html
│   ├── gamma
│   │   └── index.html
│   └── index.html
└── index.html

This proposal is in line with the way hugo, eleventy, and AFAIK even jekyll work.

I suppose this could also take the form of an optional preprocessor which would create a directory for every non-index .md file and move the .md into the directory as index.md or readme.md.

@shreyasminocha shreyasminocha changed the title Clean URLs Clean URLs (output directory structure change) Jun 17, 2020
@sjkim04
Copy link

sjkim04 commented Mar 1, 2022

I agree with this. While there are permalink options in most webpage renderers, mdBook does not. I will open another issue for this.

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

3 participants