-
Notifications
You must be signed in to change notification settings - Fork 712
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
Use absolute URL's for the assets #940
Comments
This isn't possible right now with the default theme, but it would be a neat feature to have. |
Momentarily I am doing this bad hack in const Handlebars = require('handlebars');
const BASE_URL="https://some.app/";
Handlebars.registerHelper('relativeURL', function(url) {
return BASE_URL + url;
});
module.exports = {
// typedoc configs
} |
I went for another hack. It's broken only for the sed -re 's@<(\w+)(.*)href="([^http].*)"(.*)>@<\1\2href="/api\/\3"\4>@g' -i ./dist/api/index.html
sed -re 's@"(assets/.+)"@"/api/\1"@g' -i ./dist/api/index.html Basically I use the To explain a bit more: The second one works the same way but search for every "assets/" (for script, search, etc...) |
@RohitRox sorry to bother, but could you explain more? Because I tried to config in the same way but didn't work. |
I get it. Basically I need to overwrite the custom helper "relativeURL" initally defined in typedoc, to do that I need to register another one and make sure that both typedoc and my own project are using the same Handlebars. |
+1 There should be |
+1 |
Slightly confused how this works in the actual typedoc website where generated docs are hosted at edit: ah, trailing slash is important. I was using next.js as a proxy for the generated output which strips trailing slashes by default. |
GitHub Pages doesn't work with relative paths. This option is necessary. |
Given that TypeDoc's site, which includes two rendered TypeDoc projects, is deployed to GH pages with no issues I'm pretty confident in saying this is false... |
It doesn't work for Zeromq.js. I just broke the documentation so that you can check: http://zeromq.github.io/zeromq.js/modules/_index_.html The source Here is the reason: |
The site you linked to is built with an ancient version of TypeDoc... which isn't even TypeDoc, it's an unmaintained fork. The problem you're running into is not relative links, but that the |
OK, updating the typedoc fixes that issue. I missed the package renaming and |
I was in the same situation (deploying to a subdirectory in Vercel: /public/docs). As @chrisui stated, link to your TypeDoc documentation directory with a trailing slash until this issue is resolved or an option is provided. Do NOT do this:
Do this:
|
An option |
I want to be able to use clean URLs with trailing slashes for the links in my generated docs (e.g. page.html becomes /page/), however all the references to the assets are relative, so they all break when using clean URLs with a trailing slash.
Is there any way to make the links to the assets relative (I provide a base path)?
The text was updated successfully, but these errors were encountered: