Hexo: Permalink not including root

Created on 13 Jun 2017  Β·  4Comments  Β·  Source: hexojs/hexo

Environment Info

Node version(node -v): 7.8.9

Your site _config.yml (Optional):

root: /blog/
url: http://127.0.0.1:4000/       # Note: don't forget to modify the CNAME file to your url
permalink: :title-:abbrlink/
permalink_defaults:

Your theme _config.yml (Optional):
Nothing relevant

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

β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
└── [email protected]

For BUG

I've placed <%= page.permalink %> in post.ejs and the result is http://127.0.0.1:4000/El-meu-primer-post-ada5698b/

This link is not working as root is /blog/. Also <%= config.url + config.root + (page.path||'').replace('index.html', '') %> produces http://127.0.0.1:4000/blog/El-meu-primer-post-ada5698b/ which is ok.

I've tried to change permalink directive in _config.yml to include :root with no success. Also this change breaks the links in home page. index.ejs:

<% page.posts.each(function(post){ %>
<div class="post-preview">

    <a href="<%- config.root %><%- post.path %>">

Am I missing something?

bug

Most helpful comment

@NoahDragon thanks

The url should include the root path: http://127.0.0.1:4000/blog

So what I guess is that _config.yml should be:

url: http://127.0.0.1:4000/blog
root: /

In this case, why is root parameter for? Just for curiosity...

All 4 comments

The url should include the root path: http://127.0.0.1:4000/blog

The new config file has mentioned this in comment:
image

@NoahDragon thanks

The url should include the root path: http://127.0.0.1:4000/blog

So what I guess is that _config.yml should be:

url: http://127.0.0.1:4000/blog
root: /

In this case, why is root parameter for? Just for curiosity...

@miqmago Good question. I'm not sure, and will have a look.

Maybe, it will be used to deploy.
I think that this is important BUG.

Was this page helpful?
0 / 5 - 0 ratings