hexo-editor icon indicating copy to clipboard operation
hexo-editor copied to clipboard

博客在二级目录的时候生成路径异常

Open icandura opened this issue 5 years ago • 4 comments

我的博客是放在网站的二级目录 在hexo的配置文件中是这样设置的

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://www.abc.com
root: /blog/
permalink: posts/:title/
permalink_defaults:

直接使用hexo g命令来生成的时候目录是对的,都能指向正确的地址 比如文章地址是 https://www.abc.com/blog/posts/helloworld

但是在 hexo editor 中点击 generate 按钮来生成的时候 输出文件的指向都变成根目录了 即文章地址指向了 https://www.abc.com/posts/helloworld

这是我的 hexo editor 的配置文件,看看是不是哪里设置错了?

# access the hexo editor directly
local: false

# the username to login hexo editor
username: abc

# the password for logining hexo editor
password: abcabcabcabc

# the blog directory
base_dir: /usr/hexo/blog

# port
port: 2048

icandura avatar Jul 10 '19 08:07 icandura

base_dir 需要指定为 Hexo 博客根目录,确认下 base_dir 和你执行 hexo g 的目录是否一致

tajpure avatar Jul 11 '19 11:07 tajpure

base_dir 是设定在我 hexo init 出来的目录,即 /usr/hexo/blog 相应的,在命令行执行 hexo g 的时候也是在这个目录下执行。 生成的 public 文件夹的路径为 /usr/hexo/blog/public 。

后续通过 ln -s 软连接把该 public 文件夹映射到 /var/www/blog 。 即 blog -> /usr/hexo/blog/public

icandura avatar Jul 12 '19 00:07 icandura

我按照你的方法,通过“hexo editor 中点击 generate”,也是生成至 /usr/hexo/blog/public。无法重现上述问题,请提供更详细的重现方式。

tajpure avatar Jul 15 '19 04:07 tajpure

我搭建了一个环境,您试试看新建些文章或者修改一些内容再重新生成,来对比一下 博客地址: https://cdn.myfq.ml/blog 说明页面: https://cdn.myfq.ml/blog/2019/07/17/test/ hexo-editor管理地址: http://cdn.myfq.ml:2048 用户名和密码均为: blogtest

主要问题是用 hexo g 直接生成则页面正常,用hexo-editor后台点击generate生成就造成页面异常 我猜测问题可能出在主题上,我使用的是 yelee 主题

icandura avatar Jul 17 '19 09:07 icandura