好吧,我承认自己是一个外貌协会。
既然倒腾了这个博客,就尽量让自己感到舒服😌。
废话不多说了,开始吧。

添加网站浏览量统计

  • 不蒜子官网:http://busuanzi.ibruce.info/
  • 安装脚本(必选),在 themes\yilia\layout_partial\footer.ejs 最后添加:
    <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
  • 添加网站访问量标签(可选),在 footer.ejs 插入如下代码:
    <span id="busuanzi_container_site_pv">
    本站总访问量<span id="busuanzi_value_site_pv"></span></span>
    <span id="busuanzi_container_site_uv">
    本站访客数<span id="busuanzi_value_site_uv"></span>人次
    </span>
  • 添加文章点击量标签(可选),修改 themes\yilia\layout_partial\article.ejsheader 标签:
    <header class="article-header">
    <%- partial('post/title', {class_name: 'article-title'}) %>
    <!--显示阅读次数-->
    <% if (!index && post.comments){ %>
      <br/>
      <a class="cloud-tie-join-count" href="javascript:void(0);" style="color:gray;font-size:14px;cursor: text">
      <span class="icon-sort"></span>
      <span id="busuanzi_container_page_pv" style="color:#f173ac;font-size:14px;">
        阅读数: <span id="busuanzi_value_page_pv"></span>&nbsp;&nbsp;
      </span>
      </a>
    <% } %>
    <% if (!post.noDate){ %>
    <%- partial('post/date', {class_name: 'archive-article-date', date_format: null}) %>
    <% } %>
    </header>
     

添加网站评论

  • gitalk 项目地址:https://github.com/gitalk/gitalk

  • 创建 OAuths Apps:

    1. Application name 和 Application description 填入自己喜欢的名称和描述
    2. Homepage URL 和 Authorization callback URL 填入域名
    3. 注册之后,会看到Client ID和Client Secret
  • _config.yml文件中进行相关配置:

    # 配置gitalk
    gitalk: 
    enable: true
    client_id: 1c92f03bc20099211872
    client_secret: 5c5b458be40fd177ac8592700e296b1465d86f36
    repo: lalalei21.github.io
    owner: lalalei21
    admin: lalalei21
  • 安装脚本文件和使用容器,在_posts文件夹中新建gitalk.ejs

    <!-- gitalk.ejs -->
    <div id="gitalk-container" style="padding: 0 30px;"></div>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
    <script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>
    <script>
    var gitalk = new Gitalk({
      clientID: '<%=theme.gitalk.client_id%>',
      clientSecret: '<%=theme.gitalk.client_secret%>',
      repo: '<%=theme.gitalk.repo%>',
      owner: '<%=theme.gitalk.owner%>',
      admin: '<%=theme.gitalk.admin%>',
      id: '<%=page.date%>',      // Ensure uniqueness and length less than 50
      distractionFreeMode: false  // Facebook-like distraction free mode
    })
    gitalk.render('gitalk-container')
    </script>
  • article.ejs的末尾添加:

    <% if(theme.gitalk.enable){ %>
      <%- partial('post/gitalk', {
          key: post.slug,
          title: post.title,
          url: config.url+url_for(post.path)
        }) %>
    <% } %>

 

添加看板娘

 
更多优化持续更新…^^