Closed AdnanTech closed 6 months ago
There is no need to set root: ./
https://github.com/hexojs/hexo/issues/2163#issuecomment-252039651, https://github.com/hexojs/hexo/issues/4244#issuecomment-614447281 had told you answer.
you shou use use http://
instead of file://
to preview your website.
use http-server, serve or other tools to preview public/
Check List
hexo version
to check)Expected behavior
hexo generate
should produce static files correctly linked with URLs pointing to the correct posts and index page. CSS and JS files generated by hexo should be found by pages correctly. This happens when the root path is set/
, when the root path is set to./
, the css files are correctly linked but the post URLs do not work correctly.This error has occured with both a new project using hexo as well as a project configured with hexo icarus theme. Tested on both Windows 11 and Ubuntu.
Similar posts:
Actual behavior
hexo server
shows the website correctly, with all links working. when I usehexo generate
, the post webpages are incorrectly generated.When I use
root: ./
instead ofroot: /
in the_configure.yml
file, theindex.html
content correctly displays, however the posts content does not display correctly, and the console logsLoading failed for the <script> with source “file:///c:/Users/adnan/Desktop/test/public/2023/12/05/hello-world/js/script.js”.
, along with the other js files. This suggests a major error with how my project is routing files whenhexo generate
is executed.How to reproduce?
To test with changed root
_configure.yml
, add lineroot: ./
Is the problem still there under
Safe mode
?yes
Your Node.js & npm version
Your Hexo and Plugin version
Your
package.json
Your site's
_config.yml
(Optional)Others
No response