hexojs / hexo

A fast, simple & powerful blog framework, powered by Node.js.
https://hexo.io
MIT License
39.62k stars 4.87k forks source link

Hexo to use relative path instead of URL #592

Closed KaptainKrayola closed 8 years ago

KaptainKrayola commented 10 years ago

I want to be able to generate a site that I can open from a windows folder or any URL just by uploading the folder. Currently it seems that the config requires a URL to build the site but that will not work in this case.

Can you add an argument/option that allows for all links / stylesheets / etc to just be relative to the location the file is opened from?

tommy351 commented 10 years ago

Ref #651

KaptainKrayola commented 10 years ago

There still is a problem with the generation of the navigation. Navigation links still aren't being built with the proper path to them. If you have "root" in the path it goes all the way back to "/" but if you don't then the navigation won't work for pages outside of the section you are in.

so like

file:///C:/site/sub-folder1/index.html links to file:///C:/site/sub-folder2/index.html

but if you have root in the url it links to file:///C:/sub-folder2/index.html and without "root" it links to file:///C:/sub-folder1/sub-folder2/index.html

tommy351 commented 10 years ago

@KaptainKrayola I'll fix it later.

Xuanwo commented 10 years ago

@tommy351 Did you fix it ?

tommy351 commented 10 years ago

I found this problem when using fragment caching. Maybe you can try not to use fragment_cache helper.

jbenet commented 9 years ago

Im curious if this is still a problem. In many settings, the URL root cannot be determined a priori, so all the links must be relative.

If this is the case, i'll come back with a really cool way to deploy hexo websites for free :) -- Thanks.

podybman commented 1 year ago

I find myself having this issue on a fresh install. Regression?

stevenjoezhang commented 1 year ago

@podybman It depends on the theme you are using. If it has fragment_cache enabled and does not provide an option to disable, relative links may be incorrect.

podybman commented 1 year ago

It's a fresh install si that's the default theme (landscape I believe)

stevenjoezhang commented 1 year ago

@podybman If you found that the style is missing, it's caused by https://github.com/hexojs/hexo/pull/5217 You can try to install the latest release candidate version of Hexo npm i hexo@7.0.0-rc2

Xuanwo commented 1 year ago

Hi, please don't reply to an old & closed issues. Start a new one instead, thanks!