Huxpro / huxpro.github.io

My Blog / Jekyll Themes / PWA
http://huangxuan.me
Apache License 2.0
7.04k stars 5.32k forks source link

tagscloud的鼠标悬停提示问题 #344

Open Paradiseeee opened 4 years ago

Paradiseeee commented 4 years ago

描述

基本情况参考下面的复现描述
研究了一下发现凡是在最后一个tag和下一个a标签之间的文字,都会触发悬停提示。
亦即:如果在2019前面加上任意一个a标签,就不再出现悬停时的提示。
进一步发现跟_inlcudes/featured-tags.html中的以下代码有关,如果不进行排序,直接替换为{{ tags }},也不会出现以上情况。

    <div class="tags">
        {% capture tags %}
        ...
        {% endcapture %}
        {{ tags | split:'</a>' | sort | join:'</a>' }}    <!-- 相关代码 -->
    </div>

复现

commit版本(最新2019-10-21):dad59c21bd257be7400a016ae3a93e88fc49dc75

进入链接https://huangxuan.me/archive/,鼠标悬停到时间轴的2019文本上,便能看到关于标签云中最后一个tag的文字提示:QC(Quickcheck)


本人是一个好奇的前端小白,望解答:pray:

Ynjxsjmh commented 4 years ago

页面是 archive.html,里面也没有 inlcude 语句,所以我觉得和你说的那个 _inlcudes/featured-tags.html 没有关系。

我倒是觉得会和 archive.html 下面这几段有关

                {% capture tags %}
                {% for tag in site.tags %}
                <a data-sort="{{ site.posts.size | minus: tag[1].size | prepend: '0000' | slice: -4, 4 }}"
                    data-encode="{{ tag[0] | strip | url_encode }}"
                    class="tag-button"
                    title="{{ tag[0] }}" rel="{{ tag[1].size }}">
                    {{ tag[0] }}
                    <sup>{{tag[1].size}}</sup>
                </a>
                {% endfor %}
                {% endcapture %}

至于为什么只出现一次,就没仔细看,不太清楚