Closed astroHaoPeng closed 5 years ago
This demo for NexT them fails if blog is deployed in a subdirectory: .js wrong path.
{% if site.tags.length > 1 %} <script type="text/javascript" charset="utf-8" src="/js/tagcloud.js"></script> <script type="text/javascript" charset="utf-8" src="/js/tagcanvas.js"></script> <div class="widget-wrap"> <h3 class="widget-title">Tag Cloud</h3> <div id="myCanvasContainer" class="widget tagcloud"> <canvas width="250" height="250" id="resCanvas" style="width=100%"> {{ list_tags() }} </canvas> </div> </div> {% endif %}
If deployed in a subdirectory, i.e., root = /blog/ for example, the following changes will help.
root = /blog/
"/js/tagcloud.js"
"{{ url_for('/js/tagcloud.js') }}"
"/js/tagcanvas.js"
"{{ url_for('/js/tagcanvas.js') }}"
It makes use of the official Hexo helper url_for (see here), so that browser can find .js with correct url.
url_for
Please confirm this. Thx.
Thanks.
This demo for NexT them fails if blog is deployed in a subdirectory: .js wrong path.
If deployed in a subdirectory, i.e.,
root = /blog/
for example, the following changes will help."/js/tagcloud.js"
to"{{ url_for('/js/tagcloud.js') }}"
"/js/tagcanvas.js"
to"{{ url_for('/js/tagcanvas.js') }}"
It makes use of the official Hexo helper
url_for
(see here), so that browser can find .js with correct url.Please confirm this. Thx.