hexojs / hexojs/hexo

Unable to get proper relative links in Hexo

Open
#5,249 4 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
41.8k
Forks
41
PR merge metrics
No merged PRs in 30d

Description

## Check List

Please check followings before submitting a new issue.

- [x] I have already read [Docs page](https://hexo.io/docs/) & [Troubleshooting page](https://hexo.io/docs/troubleshooting)
- [x] I have already searched existing issues and they are not help to me
-> and I was told to open a new one
- [x] I examined error or warning messages and it's difficult to solve
- [x] Using [the latest](https://github.com/hexojs/hexo/releases) version of Hexo (run `hexo version` to check)
- [x] Node.js is higher than [minimum required version](https://hexo.io/docs/#Minimum-required-Node-js-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"
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.