D0n9X1n / hexo-tag-cloud

Yet, just another tag cloud plugin for hexo.
https://www.npmjs.com/package/hexo-tag-cloud
MIT License
149 stars 26 forks source link

[suggestion] Use Hexo's url_for for subdirectory deployment. #23

Closed astroHaoPeng closed 5 years ago

astroHaoPeng commented 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.

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.

D0n9X1n commented 5 years ago

Thanks.