hexojs / hexo

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

Unable to get proper relative links in Hexo #5249

Open podybman opened 11 months ago

podybman commented 11 months ago

Check List

Please check followings before submitting a new issue.

Expected behavior

When using the Markdown for a relative link like [[My other post]](myotherpost.md), I expect the resulting link, after generating the website to link to the correct destination.

Actual behavior

The link works in most markdown editors because files are in the same folder, but once it's generated, the URL rewriting of Hexo gets in the way of the link. The link isn't parsed by Hexo at all, it's left as a relative link which cannot work because the URL rewriting adds a few /

How to reproduce?

Is the problem still there under "Safe mode"?

yes

Environment & Settings

v20.4.0
9.7.2
**├── 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.1.1
├── hexo-renderer-stylus@3.0.0
├── hexo-server@3.0.0
├── hexo-theme-landscape@1.0.0
├── hexo-theme-redefine@2.2.2
└── hexo@6.3.0**
{
  "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": "^3.0.0",
    "hexo-server": "^3.0.0",
    "hexo-theme-landscape": "^1.0.0",
    "hexo-theme-redefine": "^2.2.2"
  }
}
stevenjoezhang commented 11 months ago

You can use post_link tag instead. It's not recommended to write relative link to another post.

podybman commented 11 months ago

But then the link wouldn't follow locally in markdown editors :/

kebuAAA commented 8 months ago

I met the same problem and was wodering if there was a feasible solution.