-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
site-url not respected in links #1764
Comments
All links in your book should be relative, so it shouldn't matter where it is located. The If you are using absolute links, like |
in my case, I am moving the generated rust documentation into the
I'm not sure I understand, all frameworks that expose a base-url do this: they rewrite all absolute links using the base url. What is a use case where you wouldn't want that? |
mdbook is broken due to rust-lang/mdBook#1764
I'd second this. Writing a large book with Always using absolute url links resolve this issue nicely, resulting in a huge savings of time. I believe this feature is sorely needed. Right now, I use a templating engine |
This probably isn't used in practice very often, but I can imagine a book that wants to link to other pages on the same website (that aren't part of a book). We don't use it for rust-lang, so I would be fine changing it, but it could possibly be a breaking change for other users, so it would need to wait for the next incompatible release. |
yeah I'm not personally convinced, from a site-url standpoint everything else is "external" and should be linked with a fully-qualified URL
no worries : ) |
Actually it is used very often for me. It is not absolutely needed as I can always use It happens a lot during periods of heavy revision. If I move a folder up/down, then God forbid! |
Hey you all! Not sure if what I did solves your issue. But could you check #1802 and test it if you have some time? |
What should I do to test an open unmerged PR? Never done this before... or is it in the |
Yes, you can build the Here's the repo/branch: https://github.com/joaofreires/mdBook/tree/add_absolute_links_support Note: as described in the PR, you need to set the feature as [output.html]
site-url = "/some/path/"
use-site-url-as-root = true |
Seems to work just fine! I particularly like the fact that it doesn't add the site url if going through |
With this change, I can actually remove @ehuss I wonder if this PR can be merged? Since it introduces a new option flag, it should not break any existing build. |
Now if I would ask for one more thing: make the Right now, it is either relative path based off the current file, or an absolute path based off the file system root (which is extremely unusual). It is much more common to have include files offset from |
@schungx, the If I have some free time I can implement this preprocessor or try to extend/change the current |
The For example, I have [`Foo`]: /path/to/foo.md
[`Bar`]: /path/to/bar.md
[baz]: /path/to/baz.md And then in each file: {{ #include ../links.md }}
Now I can use [`Foo`] and [`Bar`] and [baz] anywhere I like! It works very well, except for having to always put in the right number of |
Is there any update on this? The PR/Branch proposed seems like a decent fix, and would resolve the issues im having too, but this seems to have died in the water? Thanks |
Bump please @ehuss Thanks |
Bump here. Ran into this just now, and needed to revert a PR that seemed to work fine in local development, but failed upon being deployed to github pages (where our book is hosted under |
…tion with templated markdown (#310)" (#322) Turns out absolute links don't work correctly: rust-lang/mdBook#1764 This means that the guide is busted when published on openvmm.dev/guide, even if it works correctly locally. Unfortunate...
@daprilik This might be due to the changes in #2414 I also had some issues and had to roll back to v0.4.40. Still trying to pin down exactly what the issue is, but before v0.4.41 the links in the sidebar are all relative. v0.4.41 made them non-relative, but (speculation) doesn't prepend the |
Since I set the site-url (or base url in other frameworks):
I would expect all markdown links to be rewritten to respect that in my book. They aren't :o
The text was updated successfully, but these errors were encountered: