D0n9X1n / hexo-tag-cloud

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

我添加了hexo-tag-cloud,但是我的tags页完全没有改变。 #24

Closed jerrywcy closed 4 years ago

jerrywcy commented 4 years ago

我在我的theme文件夹下找不到tagcloud.ejs文件 我的theme是alpha_dust hexo版本是3.9.0 但landscape的theme文件夹下就有tagcloud.ejs文件 next的theme文件夹下也能找到sidebar.swig文件 只有alpha_dust的theme文件夹下没有 image image image 这是我的标签页链接:https://jerrywcy.github.io/tags/ image 似乎完全没有加载出来的样子 能帮忙看看嘛? 麻烦大佬了!

jerrywcy commented 4 years ago

我现在使用的主题就是alpha_dust image image image package.json里的依赖是它自己添加的,我没改过

jerrywcy commented 4 years ago

前两张图片是根目录下的配置文件,第三个是package.json

D0n9X1n commented 4 years ago

看了看代码是在 https://github.com/klugjo/hexo-theme-alpha-dust/blob/master/layout/page.ejs 这里,你就按照下面的方法,把 Tag Cloud 的代码加进去就好,title 和样式自己调整下就好了。

<div class="row">
    <div class="col-sm-12">

        <!--Title and Logo-->
        <% if (page.type === 'tags' || page.type === 'tag') { %>
            <%- partial('_partial/header.ejs', {logoIcon: page.logoIcon || 'fa-tags', headerTitle: page.title}) %>

<!-- Tag Cloud Code -->
            <% if (site.tags.length) { %>
            <script type="text/javascript" charset="utf-8" src="<%- url_for('/js/tagcloud.js') %>"></script>
            <script type="text/javascript" charset="utf-8" src="<%- url_for('/js/tagcanvas.js') %>"></script>
            <div class="widget-wrap">
                <h3 class="widget-title"><%= __('tagcloud') %></h3>
                <div id="myCanvasContainer" class="widget tagcloud">
                <canvas width="250" height="250" id="resCanvas" style="width=100%">
                    <%- tagcloud() %>
                </canvas>
                </div>
            </div>
            <% } %>
<!-- Tag Cloud Code -->

            <section class="main archive-container">
                <% site.tags.forEach(function(tag) { %>
                        <%- partial('_partial/tag-cat-item', {item: {path: tag.path, title: '#' + tag.name}}) %>
                <% }); %>
            </section>
        <% } else if (page.type === 'categories' || page.type === 'category') { %>
            <%- partial('_partial/header.ejs', {logoIcon: page.logoIcon || 'fa-folder-open', headerTitle: page.title}) %>
            <section class="main archive-container">
                <% site.categories.forEach(function(cat) { %>
                        <%- partial('_partial/tag-cat-item', {item: {path: cat.path, title: cat.name}}) %>
                <% }); %>
            </section>
        <% } else { %>
            <%- partial('_partial/header.ejs', {logoIcon: page.logoIcon, headerTitle: ''}) %>
            <section class="main">
                <%- partial('_partial/article-long', {item: page}) %>
            </section>
        <% } %>
    </div>
</div>
jerrywcy commented 4 years ago

有标签云了,谢谢大佬!