Open ytakashina opened 5 years ago
When I put my web page in a sub directory on my server, the rocket was not displayed, raising the 404 error.
GET http://example.com/js/totop.js?v=1.0.0 net::ERR_ABORTED 404 (Not Found
This happens because the path to totop.js is hard-coded in layout/layout.ejs.
layout/layout.ejs
https://github.com/iTimeTraveler/hexo-theme-hiker/blob/eff78fa8f8642e4288c5b89c966ff3f3974805b2/layout/layout.ejs#L38
I propose to use theme.root defined in _config.yml in the hexo startar:
theme.root
_config.yml
<script type="text/javascript" src="<%- theme.root %>js/totop.js?v=1.0.0" async=""></script>
Since the default value of theme.root is /, I think the above modification is safe for conventional users who put their web pages in the site root. I'm willing to create a PR for this issue if requested.
/
When I put my web page in a sub directory on my server, the rocket was not displayed, raising the 404 error.
This happens because the path to totop.js is hard-coded in
layout/layout.ejs
.https://github.com/iTimeTraveler/hexo-theme-hiker/blob/eff78fa8f8642e4288c5b89c966ff3f3974805b2/layout/layout.ejs#L38
I propose to use
theme.root
defined in_config.yml
in the hexo startar:Since the default value of
theme.root
is/
, I think the above modification is safe for conventional users who put their web pages in the site root. I'm willing to create a PR for this issue if requested.