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

helper function <%- css(path, ...) %> not working fine with relative_url #4895

Closed
5 tasks done
bill-xia opened this issue Feb 5, 2022 · 2 comments · Fixed by #5217
Closed
5 tasks done

helper function <%- css(path, ...) %> not working fine with relative_url #4895

bill-xia opened this issue Feb 5, 2022 · 2 comments · Fixed by #5217

Comments

@bill-xia
Copy link

bill-xia commented Feb 5, 2022

Check List

Please check followings before submitting a new issue.

Expected behavior

relative_url: true is configured in _config.yml.

<%- css('/css/style.css') %> in public/archives/page/2/index.html should generate:

<link rel="stylesheet" href="../../../css/style.css">

Actual behavior

It actually generates:

<link rel="stylesheet" href="../../../../css/style.css">

Sometimes (in another theme) it only generates one ../, I think it may be a cache problem. I'm not sure it's not a problem outside hexo.

How to reproduce?

  • init a site, using default theme landscape is OK.
  • put 20 articles into source/ directory
  • edit site configuration file _config.yml:
per_page: 10
pagination_dir: page

relative_link: true
  • hexo g
  • catch public/archives/page/02/index.html

The <link> tag of /css/style.css can be with a wrong relative path.

Is the problem still there under "Safe mode"?

Under safe mode, these pages cannot be generated, so I can't be sure.

Environment & Settings

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

v16.13.1
8.3.2

Your site _config.yml (Optional)

Your theme _config.yml (Optional)

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

hexo-site@0.0.0 /Users/wilson/Developer/proj/hexo-theme
├── hexo-deployer-git@3.0.0
├── hexo-generator-archive@1.0.0
├── hexo-generator-category@1.0.0
├── hexo-generator-feed@3.0.0
├── hexo-generator-index@2.0.0
├── hexo-generator-sitemap@2.2.0
├── hexo-generator-tag@1.0.0
├── hexo-renderer-ejs@1.0.0
├── hexo-renderer-markdown-them@1.0.1
├── hexo-renderer-stylus@2.0.1
├── hexo-server@2.0.0
├── hexo-theme-landscape@0.0.3
├── hexo@6.0.0
├── katex@0.13.24
└── markdown-them@1.0.15

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.0.0"
  },
  "dependencies": {
    "hexo": "^6.0.0",
    "hexo-deployer-git": "^3.0.0",
    "hexo-generator-archive": "^1.0.0",
    "hexo-generator-category": "^1.0.0",
    "hexo-generator-feed": "^3.0.0",
    "hexo-generator-index": "^2.0.0",
    "hexo-generator-sitemap": "^2.1.0",
    "hexo-generator-tag": "^1.0.0",
    "hexo-renderer-ejs": "^1.0.0",
    "hexo-renderer-markdown-them": "^1.0.1",
    "hexo-renderer-stylus": "^2.0.0",
    "hexo-server": "^2.0.0",
    "hexo-theme-landscape": "^0.0.3",
    "katex": "^0.13.18",
    "markdown-them": "^1.0.13"
  }
}

Others

@stevenjoezhang
Copy link
Member

Relevant PR: #4789

@stevenjoezhang
Copy link
Member

Fixed in #5217

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants