爲Hexo博客文章添加關鍵字

本文章是爲Hexo博客的next主題的文章增加關鍵字的設定,默認next主題的文章關鍵字取文章的標籤,所以如果想要設置很全的關鍵字,肯定會造成自己的標籤頁的標籤過多,看着過於雜亂,所以就想將文章的關鍵字與標籤分開,下面做簡單的修改即可達到此目的。

修改文件:themes\next\layout_partials\head.swig
修改內容:35行左右,將原來的設置ketwords的代碼覆蓋即可

{% if page.keywords and page.keywords.length %}
  <meta name="keywords" content="{% for key in page.keywords %}{{ key }},{% endfor %}" />
{% elif page.tags and page.tags.length %}
  <meta name="keywords" content="{% for tag in page.tags %}{{ tag.name }},{% endfor %}" />
{% elif theme.keywords %}
  <meta name="keywords" content="{{ theme.keywords }}" />
{% endif %}

歡迎訪問我的個人博客,尋找更多樂趣~~~

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章