一招解決給hexo博客添加版權(quán)聲明的方法

今天更換了新的Hexo主題:
hexo-theme-hiero

預(yù)覽我的博客
覺(jué)得挺好看的,文章底部沒(méi)有版權(quán)說(shuō)明,自己動(dòng)手也加上了。

新建文件 copyright.ejs

themes\hiker\layout\_partial新建文件copyright.ejs

打開(kāi)copyright.ejs,添加一下內(nèi)容。

<div>
        <ul class="post-copyright">
          <li class="post-copyright-author">
          <strong><%= __('copyright.author') %> </strong><%= config.author%></a>
          </li>
          <li class="post-copyright-link">
          <strong><%= __('copyright.link') %> </strong>
          <a href="<%- config.root %><%- post.path %>" target="_blank" title="<%= post.title %>"><%- config.url %>/<%- post.path %></a>
          </li>
          <li class="post-copyright-license">
            <strong><%= __('copyright.license_title') %>  </strong>
            <%= __('copyright.left_license_content') %><a rel="license"  target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">CC BY-NC-ND 4.0</a>
            <%= __('copyright.right_license_content') %>
          </li>
        </ul>
      <div>
復(fù)制代碼

修改article.ejs文件

打開(kāi)themes\hiker\layout\_partial\article.ejs添加一下內(nèi)容,位置介于donate和comment之間

<% if (!index && theme.donate.enable){ %>
        <%- partial('donate') %>
      <% } %>
       <!-- 要添加的內(nèi)容 -->
      <% if (!index && theme.copyright.enable){ %>
      <%- partial('copyright') %>
      <% } %>
      <!---->
      <% if (!index && post.comments && (theme.gentie_productKey || theme.duoshuo_shortname || theme.disqus_shortname || theme.uyan_uid || theme.wumii || theme.livere_shortname)){ %>
        <%- partial('comment') %>
      <% } %>
復(fù)制代碼

我的截圖如下:介于donate和comment之間

image.png

修改 article.styl

修改themes\hiker\source\css\_partial\article.styl,在末端添加以下內(nèi)容。

.post-copyright {
    margin: 2em 0 0;
    padding: 0.5em 1em;
    border-left: 3px solid #FF1700;
    background-color: #F9F9F9;
    list-style: none;
}

.post-copyright li {
    line-height: 30px;
}
復(fù)制代碼

修改語(yǔ)言文件

在themes\hiker\languages中,找到你應(yīng)用的語(yǔ)言文件,例如zh-TW,打開(kāi)并添加以下內(nèi)容。

copyright:
    author: "作者: "
    link: "文章連結(jié): "
    license_title: "版權(quán)聲明: "
    left_license_content: "本網(wǎng)志所有文章除特別聲明外,均采用 "
    right_license_content: "許可協(xié)議。轉(zhuǎn)載請(qǐng)注明出處!"
復(fù)制代碼

修改主題設(shè)置文件

打開(kāi)themes\hiker\_config.yml,添加以下內(nèi)容。

#版權(quán)信息
copyright:
    enable: true
復(fù)制代碼

引用文獻(xiàn)鏈接:https://juejin.im/post/5d728f506fb9a06aef090e47

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀(guān)點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 最近更換了新的Hexo主題hexo-theme-hiker,覺(jué)得挺好看的。文章底部沒(méi)有版權(quán)說(shuō)明,自己動(dòng)手加上。 新...
    _iamjerry閱讀 3,474評(píng)論 2 1
  • 1. 設(shè)置主題風(fēng)格 打開(kāi) themes/next/_config.yml 文件,搜索 scheme 關(guān)鍵字,將你...
    遲道閱讀 21,361評(píng)論 10 47
  • 寫(xiě)在前面 本文主要是NexT主題配置以及頁(yè)面的樣式優(yōu)化,參考了許多大佬的文章以及配置文件。 本文參考的文章都會(huì)直接...
    格物_志閱讀 2,246評(píng)論 0 7
  • 摘要:通過(guò)將Hexo同時(shí)部署到Github和GitCafe,使用Dnspod對(duì)來(lái)自國(guó)內(nèi)外的流量分別DNS解析至Gi...
    Masukio閱讀 1,148評(píng)論 0 2
  • 寫(xiě)這篇文章,或者說(shuō)心想記的初衷是感覺(jué)自己太無(wú)能了~ 簡(jiǎn)短的說(shuō)說(shuō)我的故事,可以用一句話(huà)來(lái)描述我畢業(yè)到現(xiàn)在狀態(tài):什么也...
    SuperJ_閱讀 155評(píng)論 0 0

友情鏈接更多精彩內(nèi)容