Skip to content
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

relative link is incorrent after executing hexo s #5110

Closed
5 tasks done
D-Sketon opened this issue Nov 20, 2022 · 3 comments · Fixed by #5217
Closed
5 tasks done

relative link is incorrent after executing hexo s #5110

D-Sketon opened this issue Nov 20, 2022 · 3 comments · Fixed by #5217

Comments

@D-Sketon
Copy link
Member

Check List

Please check followings before submitting a new issue.

Expected behavior

After executing hexo s, the relative link of css url in the server should be the same as the one in the public folder.

For example:
The file in the public folder has the following line:
<link rel="stylesheet" href="../../../../css/style.css">

Then the view page source code in the browser should also have the following line:
<link rel="stylesheet" href="../../../../css/style.css">

Actual behavior

Actually the view page source code in the browser has:
<link rel="stylesheet" href="css/style.css">
This causes the css of all pages except the home page to fail to load.

image

How to reproduce?

  • Step1
    hexo init blog to use the lastest hexo and default theme.
  • Step2
    change _config.yml
relative_link: true
  • Step3
    hexo g && hexo s and see localhost:4000/archives in the browser

Is the problem still there under "Safe mode"?

Environment & Settings

Node.js & npm version(node -v && npm -v)

v16.18.0
8.19.2

Your site _config.yml (Optional)

just change relative_link

relative_link: true

Hexo and Plugin version(npm ls --depth 0)

hexo-site@0.0.0 /home/jack/桌面/blog/blog
├── hexo-generator-archive@2.0.0
├── hexo-generator-category@2.0.0
├── hexo-generator-index@3.0.0
├── hexo-generator-tag@2.0.0
├── hexo-renderer-ejs@2.0.0
├── hexo-renderer-marked@6.0.0
├── hexo-renderer-stylus@2.1.0
├── hexo-server@3.0.0
├── hexo-theme-landscape@0.0.3
└── hexo@6.3.0

Your package.json package.json

{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "build": "hexo generate",
    "clean": "hexo clean",
    "deploy": "hexo deploy",
    "server": "hexo server"
  },
  "hexo": {
    "version": "6.3.0"
  },
  "dependencies": {
    "hexo": "^6.3.0",
    "hexo-generator-archive": "^2.0.0",
    "hexo-generator-category": "^2.0.0",
    "hexo-generator-index": "^3.0.0",
    "hexo-generator-tag": "^2.0.0",
    "hexo-renderer-ejs": "^2.0.0",
    "hexo-renderer-marked": "^6.0.0",
    "hexo-renderer-stylus": "^2.1.0",
    "hexo-server": "^3.0.0",
    "hexo-theme-landscape": "^0.0.3"
  }
}

Others

I also tried the old version 5.4.2 of hexo and it doesn't seem to have this problem.

@stevenjoezhang
Copy link
Member

Relevant PR: #4789
The cache should be disabled when relative_link is true. @SukkaW

@D-Sketon
Copy link
Member Author

Relevant PR: #4789 The cache should be disabled when relative_link is true. @SukkaW

issues #4895 is also related to this PR

@stevenjoezhang
Copy link
Member

I'm closing this issue. Please join the discussion in #4895 :)

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

Successfully merging a pull request may close this issue.

2 participants