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

Unable to get proper relative links in Hexo #5249

Open
5 tasks done
podybman opened this issue Jul 25, 2023 · 3 comments
Open
5 tasks done

Unable to get proper relative links in Hexo #5249

podybman opened this issue Jul 25, 2023 · 3 comments

Comments

@podybman
Copy link

podybman commented Jul 25, 2023

Check List

Please check followings before submitting a new issue.

  • I have already read Docs page & Troubleshooting page
  • I have already searched existing issues and they are not help to me
    -> and I was told to open a new one
  • I examined error or warning messages and it's difficult to solve
  • Using the latest version of Hexo (run hexo version to check)
  • Node.js is higher than minimum required version

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?

  • Step1 create a markdown file postA
  • Step2 create a markdown file postB
  • Step3 make a relative lin to postB in postA
  • Step4 generate

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
Copy link
Member

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

@podybman
Copy link
Author

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

@kebuAAA
Copy link

kebuAAA commented Oct 26, 2023

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

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

No branches or pull requests

3 participants