Compare commits

...

56 Commits
1.2.0 ... 2.3.0

  • 🏷️ 2.3.0 發佈
  • 🏷️ 2.3.0發佈
  • Merge pull request #194 from theWorkFsz/fix/article-sort-img-src
    fix: 修复 articleSort 设置文章封面逻辑不一致的问题
  • feat: 增加標籤外掛 tag-toggle
     feat: 增加頁面加載動畫preloader close #193
     feat: 適配hexo-generator-indexed插件
     feat: aside subtitle可配置,優先顯示配置內容、沒有的顯示頁面subtitle close #191
     feat: aside card-tags可配置是否顯示顏色
     feat: algolia-search highligh文字加深
     feat: 增加頁面keywords設置 #191
     feat: darkmode和readmode配色微調
    🐛 fix: 修復hide-block 配置顏色顯示出錯的bug
    🐛 fix: 修正zh-TW部分用語
  • 💥 改cdn_use為inject,可插入代碼到head或者bottom
    💥 移除對文章隱藏的支持,如需要,請使用插件,hexo-hide-posts/hexo-generator-indexed
    💥 移除subtitle金山詞霸每日一句,增加搏天api的隨機語錄
     subtitle修改為網頁加載完後再加載,防止api回應過慢而阻礙網頁顯示
     適配valine 1.4.0, 刪除部分valine夜間模式代碼
     meta增加article:published_time和article:modified_time
     當沒有設置Description時,會自動讀取文章前200個文字作為meta Description
     sidebar menu 增加頭像轉圈hover
    💄 調整aside和mobile sidebar 網頁資訊佈局,當缺少一個時,寬度依舊平分
    🐛 調整子目錄的排版(向左對齊),修復只能點擊子目錄文字才能跳轉的bug
    🔥 pug精簡 刪除recent-post.pug  改為引用mixins/post-ui.pug
  • feat: 本地搜索支持顯示文章內容和高亮keyword
    🐛 fix: 修復搜索結果在手機端無法滾動的bug
    🐛 fix: 修復aside categories 查看更多跳轉到tags頁面的bug closes #188
  • feat: aside widget 增加部分參數可配置
     feat: aside widget的Categories,Tags,post,Archives可配置limit
     feat: 整合公告欄配置到aside去
    🐛 fix: 修復當flink.yml內容為空時,報錯的bug
    💄 fix: 修復darkmode下 aside 查看更多文字顏色太淺的bug
  • 🐛 修復POST-META關閉閲讀分鐘和訪問量後,評論量前有分割線的bug
    🐛 修復canvas_ribbon透明度變為1再變回預設值bug
    🐛 修復當default_cover沒設置時,會出現無圖片的bug
    🎨 部分js調整
  • feat: 在設置裏配置js/css(CDN_USE)時可以設定其他參數 closes #152
     feat: readmode下可以切換darkmode和lightmode
    💄 fix: 高分辨率下的界面適配 closes #163
    🐛 fix: 修復DarkMode下,note標簽的顯示bug
  • feat: 增加手動廣告位置
     feat: aside info 裏添加本站總文字
    🎨 refactor: post-meta代碼結構
  • 🐛 1.修復首頁文章日期顯示錯誤的bug
    🐛 2.修復因註釋掉豆瓣設置導致報Cannot read property 'meta' of undefined的bug
    💄 3.調整文章頁post-meta和主頁post-meta的間距
    💄 4.文章頁,當設置只顯示一個日期時,增加文字顯示
  • 🐛 1.修復Gitalk報Error: Cannot read property 'repository' of undefined 的bug
    🐛 2.修復評論utterances 在display_mode設置為dark時,仍顯示light主題的bug
    🐛 3.修復display_mode設置dark沒有效果的bug
    🎨 4.評論增加夜間模式、文章頁判斷,減少不必要的js加載
  • Breaking Change
    1. 不再支持hexo 4.0.0以下版本
    2. 添加hexo fragment_cache,加快生成速度
    3. 完善V5圖標顯示,不再需要同時加載V4和v5圖標
    4. 去除cheerio依賴
    5. 整合豆瓣配置,增加配置遊戲,圖書頁面top_img,可設置是否設置meta,解決部分瀏覽器無法顯示圖片問題
    6. 友情鏈接除列表外可自定義內容
    7. 可設置主頁標題距離頂部距離
    8. 側邊欄可隱藏,可設置手機頁面是否隱藏
    9. 增加disqusjs和utterances 兩個評論
    10. 主頁文章增加tags和更新日期顯示,可以配置post_meta
    11. 首頁subtitle可關閉打字效果,可設置打字效果顯示一次或loop
    12. 增加valine和gitalk的配置
    13. darkmode配置整理
    14. 增加404頁面
    15. post_beautify改為beautify,頁面美化不再只限於post頁,page頁也一樣
    16. 可設置是否顯示cover,可設置各位置的cover顯示
    17. 增加mermaid,可畫流程圖、狀態圖、時序圖、甘特圖等等
    18. 增加pangu配置,中英文之間添加空格
    19. 整合部分配置
    20. post-copyright增加decode網址 (可以顯示中文)
    21. 增加部分顏色配置
    
    Feature
    1. 適配IE
    2. 增加一個Tag Plugins: 圖庫集
    3. 增加一個Tag Plugins: tag-hide 功能 inline/block
    4. 去除page頁開頭顯示與標題一樣的內容
    5. aside 公告欄設置,支持html代碼
    6. 手機界面sidebar顯示進度條和加深對應的標題
    7. 主頁subtitle 的 hitokoto 顯示內容出處
    9. footer 的hexo鏈接改為https
    10. 修改手機下,menus和toc的打開效果
    11. 手機頁面下,搜索界面全屏顯示
    12. SEO優化,標題欄改為h1顯示
    13. 閲讀模式優化,可根據light mode 和darkmode調整背景
    14. 當屏蔽js時,header會出現(之前用js控制,會隱藏)
    
    Fixed
    1. 修復Tencent Analytics的script加載為https #105
    2. 修復相關文章,日期顯示錯誤bug
    3. 修復gitalk報錯問題
    4. 修復當valine background 是絕對地址時無法顯示的bug
    5. 修復medium-zoom 無法使用的bug
    6. 修復在safari下,點擊或移動到首頁文章cover,圓角變成正方形的bug #114
    7. 修復在部分瀏覽器下,aside,友情鏈接頭像轉動變形的bug
    8. 修復在寬度限制下,表格內容溢出屏幕外而出現滾動條的bug \#138
    9. 修復gitalk js 在一些沒有設置評論的page里加載的bug
    10. 修復tag plugins 的gist 在不同主題下的背景顏色問題(黑色主題下,文字不易觀看)
    11. 修復highlight figcaption 顯示不全的bug
    12. 修復disqus評論數無法獲取的bug
    13. 修復子目錄在觸摸屏下點擊,偶爾不出現的bug
    14. 修復a標籤太長(連續英文字母)不會換行的bug
    15. 修復toc滾動時,閲讀進度條也跟著滾動的bug
    16. 修復aside的圖片,可點擊顯示大圖bug
    17. 修復activate-power-mode設置參數無效bug
    18. 修復語言上的錯誤 \#156
    19. 修復主頁在safari桌面端,首頁滾動卡頓的bug
  • Breaking Change
    1. 不再支持hexo 4.0.0以下版本
    2. 添加hexo fragment_cache,加快生成速度
    3. 完善V5圖標顯示,不再需要同時加載V4和v5圖標
    4. 去除cheerio依賴
    5. 整合豆瓣配置,增加配置遊戲,圖書頁面top_img,可設置是否設置meta,解決部分瀏覽器無法顯示圖片問題
    6. 友情鏈接除列表外可自定義內容
    7. 可設置主頁標題距離頂部距離
    8. 側邊欄可隱藏,可設置手機頁面是否隱藏
    9. 增加disqusjs和utterances 兩個評論
    10. 主頁文章增加tags和更新日期顯示,可以配置post_meta
    11. 首頁subtitle可關閉打字效果,可設置打字效果顯示一次或loop
    12. 增加valine和gitalk的配置
    13. darkmode配置整理
    14. 增加404頁面
    15. post_beautify改為beautify,頁面美化不再只限於post頁,page頁也一樣
    16. 可設置是否顯示cover,可設置各位置的cover顯示
    17. 增加mermaid,可畫流程圖、狀態圖、時序圖、甘特圖等等
    18. 增加pangu配置,中英文之間添加空格
    19. 整合部分配置
    20. post-copyright增加decode網址 (可以顯示中文)
    21. 增加部分顏色配置
    Feature
    1. 適配IE
    2. 增加一個Tag Plugins: 圖庫集
    3. 增加一個Tag Plugins: tag-hide 功能 inline/block
    4. 去除page頁開頭顯示與標題一樣的內容
    5. aside 公告欄設置,支持html代碼
    6. 手機界面sidebar顯示進度條和加深對應的標題
    7. 主頁subtitle 的 hitokoto 顯示內容出處
    9. footer 的hexo鏈接改為https
    10. 修改手機下,menus和toc的打開效果
    11. 手機頁面下,搜索界面全屏顯示
    12. SEO優化,標題欄改為h1顯示
    13. 閲讀模式優化,可根據light mode 和darkmode調整背景
    14. 當屏蔽js時,header會出現(之前用js控制,會隱藏)
    Fixed
    1. 修復Tencent Analytics的script加載為https #105
    2. 修復相關文章,日期顯示錯誤bug
    3. 修復gitalk報錯問題
    4. 修復當valine background 是絕對地址時無法顯示的bug
    5. 修復medium-zoom 無法使用的bug
    6. 修復在safari下,點擊或移動到首頁文章cover,圓角變成正方形的bug #114
    7. 修復在部分瀏覽器下,aside,友情鏈接頭像轉動變形的bug
    8. 修復在寬度限制下,表格內容溢出屏幕外而出現滾動條的bug \#138
    9. 修復gitalk js 在一些沒有設置評論的page里加載的bug
    10. 修復tag plugins 的gist 在不同主題下的背景顏色問題(黑色主題下,文字不易觀看)
    11. 修復highlight figcaption 顯示不全的bug
    12. 修復disqus評論數無法獲取的bug
    13. 修復子目錄在觸摸屏下點擊,偶爾不出現的bug
    14. 修復a標籤太長(連續英文字母)不會換行的bug
    15. 修復toc滾動時,閲讀進度條也跟著滾動的bug
    16. 修復aside的圖片,可點擊顯示大圖bug
    17. 修復activate-power-mode設置參數無效bug
    18. 修復語言上的錯誤 \#156
    19. 修復主頁在safari桌面端,首頁滾動卡頓的bug
  • Merge pull request #156 from HolgerHuo/patch-1
    A small translation mistake.
  • Merge pull request #117 from flymin/master
    add more options to gitalk
  • Merge pull request #90 from eallion/dev
    修改 Disqus 为 Disqus.js 版
  • Merge pull request #1 from jerryc127/dev
    解決gitalk報錯問題
  • v2.1.0
    1. 可設置隱藏文章
    2. 適配 Hexo 的 Tag Plugins Code Block With marked lines 顯示
    3. 可配置首頁cover顯示的位置
    4. 更改深色模式下的配色
    5. activate_power_mode 增加關閉顏色和抖動
    6. 增加谷歌廣告,騰訊分析
    7. 相關文章增加時間顯示,調整佈局,垂直居中
    8. 文章頁面,top_img增加評論數顯示
    9. 可以取消點擊圖片觀看大圖
    10. mathjax和kathex可設置每頁都加載還是按需加載
    11. 深色模式下,滾動條顔色的適配
    12. 優化gitalk 在 dark mode下的顯示
    13. 文章頁,文章標題過長時,只顯示三行內容
    14. 深色模式下,背景圖片加上蒙板
    15. 優化深色/閲讀模式下,canvas的顯示
    16. 優化打賞的特效和移動到二維碼不會立刻消失
    17. 優化sub-menu樣式
    18. 修改aside 的tags顔色,在深色模式下不會出現觀看困難
    19. 升級 normalize.css 到最新版
    20. 優化手機上toc和menu的打開動畫
    21. 優化代碼框打開關閉的特效
    22. 精簡js,部分操作改為css控制
    23. 優化主題的一些動畫,不會過於生硬
    
    1. 修復當圖片被a標簽包圍時,點擊圖標沒有跳轉到對應網頁而是出現大圖觀看模式的bug
    2. 修復當網址有subdirectory時,menu、打賞二維碼和lodding_bg 鏈接路徑錯誤的bug
    3. 修復當網址有subdirectory時,
    4. 修復katex 的 CSS無法讀取bug
    5. 修復搜索按鈕在文章頁不顯示的bug
    6. 修復gitalk css引用失敗的bug
    7. 修復 點擊特效 煙花 無效的bug
    8. 修復gitalk報path.startsWith is not a function的bug
    9. 修復 閲讀模式下,背景沒有變純色的bug
    10. 修復閲讀模式下,header 偶爾出現沒有靠攏頂部的bug
    11. 修復Hexo Tag Plugins Block Quote 裏的鏈接顯示出外面的Bug
    12. 修復aside歸檔日期過長導致錯位的bug
    13. 修復toc為空時,toc按鈕仍存在的bug
    14. 修復關閉懶加載後,頭像無法顯示的bug
    15. 修復深色模式下,切換readmode偶爾會無效的bug
    16. 修復在一些手機設備上,toc和menu的按鈕顯示不對齊的bug #72
  • Merge pull request #75 from noraj/patch-2
    Move readme and translate it in english
  • 1. 完善gitalk 在 dark mode下的顯示
    2. 完善footer 有背景和無背景下,在dark mode下的顯示
    3. 界面微調
    4. 增加選項可關閉aside在手機上的顯示
    5. 修復關閉夜間模式情況下,console報Uncaught ReferenceError: autoChangeMode is not defined 的bug
  • 1. 修復gitalk報path.startsWith is not a function的bug #66
    2. 修復在屏幕縮放字體大小而導致menu變爲sidebar模式的bug #64
    3. just-gallery增加上下邊距
  • 1. 修復gitalk報path.startsWith is not a function的bug #66
    2. 修復在屏幕縮放字體大小而導致menu變爲sidebar模式的bug #64
    3. just-gallery增加上下邊距
  • V2.0.0
    Breaking change
    1. 手機端界面卡片化,同時,手機端也可以顯示側邊欄的內容
    2. 修復當menu過多時,header界面出現錯亂的bug。當menu過多時,會變為sidebar模式
    3. 增加medium-zoom大圖查看模式
    4. 增加鼠標點擊特效:文字和愛心 兩個點擊特效
    5. 主頁subtitle可以調用第三方api(金山詞霸每日一句、一言網的一句話、一句網、今日詩詞)
    6. 添加 snackbar 彈窗
    7. 修改nightshift為darkmode,darkmode可隨系統設置而自動切換,可設置隨時間而切換darkmode
    8. 修復hexo自帶的標籤外掛(Tag Plugins)顯示bug(Block Quote、Code Block With caption、Gist、Youtube、Vimeo)
    9. 主題所需要的css和js可根據需要配置CDN
    10. 更改darkmode的加載方式,網站設置dark mode後,現在進入網頁不會在'閃'一下
    11. 背景特效和背景圖片在手機界面也會顯示
    12. 增加justified-gallery圖片顯示(Tag Plugins)
    Feature
    1. 文章頁面,字數統計、閲讀時長和閲讀量前面添加icon
    2. 更改懶加載js
    3. 升級typed.js/instantpage.js到最新版
    4. 搜索和右下角按鈕添加退出特效
    Fixed
    1. 修復在 Hexo 4.0.0下,一些按鈕點擊會跳出一個空白頁的bug
    2. 修復在 Hexo 4.0.0下,分頁按鈕出現代碼的bug
    3. 修復當沒有設置評論時,右下角依舊出現'直達評論'按鈕的bug
    4. 優化sidebar的打開速度
    5. 修復文章頁標題左右邊距不平等的bug
    6. 修復keywords讀取的bug
    7. 修復當post/page 內容為空時,footer位置錯亂的bug
    8. 修復在手機safari,toc sidebar底部內容被遮擋的bug
    9. 完善Dark mode,一些界面的配色
    10. 修復 card-archives 查看更多 跳轉bug
    Remove
    1. 移除Gitment
    2. 移除Gallery
  • V2.0.0
    Breaking change
    1. 手機端界面卡片化,同時,手機端也可以顯示側邊欄的內容
    2. 修復當menu過多時,header界面出現錯亂的bug。當menu過多時,會變為sidebar模式
    3. 增加medium-zoom大圖查看模式
    4. 增加鼠標點擊特效:文字和愛心 兩個點擊特效
    5. 主頁subtitle可以調用第三方api(金山詞霸每日一句、一言網的一句話、一句網、今日詩詞)
    6. 添加 snackbar 彈窗
    7. 修改nightshift為darkmode,darkmode可隨系統設置而自動切換,可設置隨時間而切換darkmode
    8. 修復hexo自帶的標籤外掛(Tag Plugins)顯示bug(Block Quote、Code Block With caption、Gist、Youtube、Vimeo)
    9. 主題所需要的css和js可根據需要配置CDN
    10. 更改darkmode的加載方式,網站設置dark mode後,現在進入網頁不會在'閃'一下
    11. 背景特效和背景圖片在手機界面也會顯示
    12. 增加justified-gallery圖片顯示(Tag Plugins)
    Feature
    1. 文章頁面,字數統計、閲讀時長和閲讀量前面添加icon
    2. 更改懶加載js
    3. 升級typed.js/instantpage.js到最新版
    4. 搜索和右下角按鈕添加退出特效
    Fixed
    1. 修復在 Hexo 4.0.0下,一些按鈕點擊會跳出一個空白頁的bug
    2. 修復在 Hexo 4.0.0下,分頁按鈕出現代碼的bug
    3. 修復當沒有設置評論時,右下角依舊出現'直達評論'按鈕的bug
    4. 優化sidebar的打開速度
    5. 修復文章頁標題左右邊距不平等的bug
    6. 修復keywords讀取的bug
    7. 修復當post/page 內容為空時,footer位置錯亂的bug
    8. 修復在手機safari,toc sidebar底部內容被遮擋的bug
    9. 完善Dark mode,一些界面的配色
    10. 修復 card-archives 查看更多 跳轉bug
    Remove
    1. 移除Gitment
    2. 移除Gallery
  • V2.0.0
    Breaking change
    1. 手機端界面卡片化,同時,手機端也可以顯示側邊欄的內容
    2. 修復當menu過多時,header界面出現錯亂的bug。當menu過多時,會變為sidebar模式
    3. 增加medium-zoom大圖查看模式
    4. 增加鼠標點擊特效:文字和愛心 兩個點擊特效
    5. 主頁subtitle可以調用第三方api(金山詞霸每日一句、一言網的一句話、一句網、今日詩詞)
    6. 添加 snackbar 彈窗
    7. 修改nightshift為darkmode,darkmode可隨系統設置而自動切換,可設置隨時間而切換darkmode
    8. 修復hexo自帶的標籤外掛(Tag Plugins)顯示bug(Block Quote、Code Block With caption、Gist、Youtube、Vimeo)
    9. 主題所需要的css和js可根據需要配置CDN
    10. 更改darkmode的加載方式,網站設置dark mode後,現在進入網頁不會在'閃'一下
    11. 背景特效和背景圖片在手機界面也會顯示
    12. 增加justified-gallery圖片顯示(Tag Plugins)
    Feature
    1. 文章頁面,字數統計、閲讀時長和閲讀量前面添加icon
    2. 更改懶加載js
    3. 升級typed.js/instantpage.js到最新版
    4. 搜索和右下角按鈕添加退出特效
    Fixed
    1. 修復在 Hexo 4.0.0下,一些按鈕點擊會跳出一個空白頁的bug
    2. 修復在 Hexo 4.0.0下,分頁按鈕出現代碼的bug
    3. 修復當沒有設置評論時,右下角依舊出現'直達評論'按鈕的bug
    4. 優化sidebar的打開速度
    5. 修復文章頁標題左右邊距不平等的bug
    6. 修復keywords讀取的bug
    7. 修復當post/page 內容為空時,footer位置錯亂的bug
    8. 修復在手機safari,toc sidebar底部內容被遮擋的bug
    9. 完善Dark mode,一些界面的配色
    10. 修復 card-archives 查看更多 跳轉bug
    Remove
    1. 移除Gitment
    2. 移除Gallery
  • v1.2.2
    1. 修復在hexo 4.0.0下,分頁按鈕渲染不完全的bug
  • v1.2.1
    1. 修復在safari上,頭像旋轉顯示框框的bug
173 changed files with 6888 additions and 5277 deletions

52
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,52 @@
<!--
IMPORTANT: Please follow the template to create a new issue.
重要:請依照該模板來提交。
If you upgrade from the old version, and an error occurs when running, please copy the new content in the config to the butterfly.yml
如果你是由舊版本升級到新版運行時出現報錯請首先把config裏新的內容複製到舊的butterfly設置去
If you are a problem when visit the website, please open your browser 'developer tools (shortcut F12)' and check the console if there is an error, include your website address in the feedback
如果你是線上訪問出現問題請檢查瀏覽器開發人員工具快捷鍵F12的console是否有報錯反饋時附上你的網站
-->
## I want to create a new issue <!-- 我想要建立一個新的issue -->
<!-- Check all with "x" especially FAQ & Documentation!! (使用 "x" 選擇) -->
<!-- 請確認是否都已經翻閱過如下的資料, 尤其是安裝文檔!! -->
- [] Yes, I have read [Hexo Docs page](https://hexo.io/docs/), especially [Templates](https://hexo.io/docs/templates.html), [Variables](https://hexo.io/docs/variables.html), [Helpers](https://hexo.io/docs/helpers.html) and [Troubleshooting](https://hexo.io/docs/troubleshooting.html).
- [] Yes, I have read [Hexo-theme-butterfly Documentation](https://jerryc.me/posts/21cfbf15/).
- [] And yes, I already searched for current [issues](https://github.com/jerryc127/hexo-theme-butterfly/issues?utf8=%E2%9C%93&q=is%3Aissue) and this did not help me.
## Butterfly Information
<!-- Butterfly的版本 -->
<!-- 檢視主題的package.json -->
**Butterfly Version:**
<!-- Windows/macOS/Linux/Android/iOS -->
**Platform:**
<!-- Chrome/Safari/FireFox/.. -->
**Browser:**
## Expected behavior <!-- (預期行為) -->
## Actual behavior <!-- (實際行為) -->
<!-- Please give me the screenshots to locate the issue -->
<!-- 請儘量提供截圖來定位問題 -->
## Steps to reproduce the behavior <!-- (重現步驟) -->
## Feature Request
<!-- If you have any ideas of theme-butterfly, please write down here and we can have a discussion. -->
<!-- 如果你有任何關於Butterfly的功能方面的想法可以在這個部分裡寫下來我們一起討論 -->
---
<!--
Love hexo-theme-butterfly? Please consider starring the repo to support it!
喜歡 hexo-theme-butterfly嗎 考慮一下給它點個star來支援它吧
-->

21
.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
- bug
- enhancement
- Solved
- documentation
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

View File

@@ -1,37 +1,46 @@
# hexo-theme-butterfly # hexo-theme-butterfly
[预览](https://jerryc.me/) <a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.3.0-blue"/></a>
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a>
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a>
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a>
一款基于[hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody)修改的主题 Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/)
## 安装 Based on [hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody) theme.
在你的博客根目录里 ## Installation
Stable branch [recommend]:
``` ```
git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly
``` ```
如果想要安裝比較新的dev分支可以 Dev branch:
``` ```
git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly
``` ```
## 应用主题 ## Configuration
修改hexo配置文件`_config.yml`,把主题改为`Butterfly`
``` Set theme in the hexo work folder's root config file `_config.yml`:
theme: Butterfly
```
>如果你没有pug以及stylus的渲染器请下载安装 npm install hexo-renderer-jade hexo-renderer-stylus --save or yarn add hexo-renderer-jade hexo-renderer-stylus > theme: Butterfly
## 文档 If you don't have pug & stylus renderer, try this:
可查看或[这里](https://docs.jerryc.me/)或[这里](https://jerryc.me/posts/21cfbf15) > npm install hexo-renderer-pug hexo-renderer-stylus
## Documentation
Find in [hexo-theme-butterfly docs](https://docs.jerryc.me) and [JerryC](https://jerryc.me/posts/21cfbf15). it supports `zh-TW`
## Screenshots
## 截图
![image](https://user-images.githubusercontent.com/16351105/58887365-1272f780-8718-11e9-9329-3292c6ba20d4.png) ![image](https://user-images.githubusercontent.com/16351105/58887365-1272f780-8718-11e9-9329-3292c6ba20d4.png)
![image](https://user-images.githubusercontent.com/16351105/58887457-3cc4b500-8718-11e9-9417-2bdea603c92e.png)
![](https://user-images.githubusercontent.com/16351105/58887457-3cc4b500-8718-11e9-9417-2bdea603c92e.png)
![](https://user-images.githubusercontent.com/16351105/69338594-7d03f980-0c9e-11ea-8b64-7f165e6508e2.png)

43
README_CN.md Normal file
View File

@@ -0,0 +1,43 @@
# hexo-theme-butterfly
<a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.3.0-blue"/></a>
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a>
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a>
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a>
Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/)
一款基於[hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody)修改的主題
## 安裝
在你的博客根目錄裡安裝穩定版【推薦】
```
git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly
```
如果想要安裝比較新的dev分支可以
```
git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly
```
## 應用主題
修改hexo配置文件`_config.yml`,把主題改為`Butterfly`
```
theme: Butterfly
```
>如果你沒有pug以及stylus的渲染器請下載安裝 npm install hexo-renderer-pug hexo-renderer-stylus --save or yarn add hexo-renderer-pug hexo-renderer-stylus
## 文檔
可查看[hexo-theme-butterfly docs](https://docs.jerryc.me) 和 [JerryC](https://jerryc.me/posts/21cfbf15)
## 截圖
![image](https://user-images.githubusercontent.com/16351105/58887365-1272f780-8718-11e9-9329-3292c6ba20d4.png)
![image](https://user-images.githubusercontent.com/16351105/58887457-3cc4b500-8718-11e9-9417-2bdea603c92e.png)
![](https://user-images.githubusercontent.com/16351105/69338594-7d03f980-0c9e-11ea-8b64-7f165e6508e2.png)

View File

@@ -1,4 +1,3 @@
# Main menu navigation # Main menu navigation
# --------------- # ---------------
# format: xxx: 連結 || icon # format: xxx: 連結 || icon
@@ -16,7 +15,6 @@ menu:
- Music || /music/ || fa fa-music - Music || /music/ || fa fa-music
- Movie || /movies/ || fa fa-film - Movie || /movies/ || fa fa-film
# Favicon # Favicon
# --------------- # ---------------
favicon: /img/favicon.ico favicon: /img/favicon.ico
@@ -32,32 +30,31 @@ favicon: /img/favicon.ico
# favicon_32_32: /img/pwa/32.png # favicon_32_32: /img/pwa/32.png
# favicon_16_16: /img/pwa/16.png # favicon_16_16: /img/pwa/16.png
# mask_icon: /img/pwa/safari-pinned-tab.svg # mask_icon: /img/pwa/safari-pinned-tab.svg
# shortcut_icon: /img/favicon.ico
# Highlight theme # Highlight theme
# --------------- # ---------------
highlight_theme: light highlight_theme: light # default / darker / pale night / light / ocean
highlight_copy: false #代碼複製按鈕 highlight_copy: true #代碼複製按鈕
highlight_lang: true #代碼語言顯示 highlight_lang: true #代碼語言顯示
highlight_shrink: false #代碼框不展開,需點擊 '>' 打開 highlight_shrink: false # true 全部代碼框不展開,需點擊 '>' 打開 / false 代碼框展開,有'>'點擊按鈕 | none 代碼框展開,不顯示 '>' 按鈕
code_word_wrap: false code_word_wrap: false
# copy setting # copy setting
# 是否禁止複製如果禁止highlight_copy的功能將無效) # 是否禁止複製如果禁止highlight_copy的功能將無效)
# copyright 複製的容後面加上版權信息 # copyright 複製的容後面加上版權信息
copy: copy:
enable: false # true 開 / false 禁止 enable: true # true 開 / false 禁止
copyright: false copyright: false
# social settings # social settings
# formal: # formal:
# icon: link # icon: link || the description
# --------------- # ---------------
social: social:
fa fa-github: https://github.com/jerryc127 fa fa-github: https://github.com/jerryc127 || Github
fa fa-rss: /atom.xml fa fa-envelope: mailto:xxxxxxx@gmail.com || Email
fa fa-rss: /atom.xml || RSS
#### search #### #### search ####
# Algolia search # Algolia search
@@ -70,10 +67,10 @@ algolia_search:
labels: labels:
input_placeholder: Search for Posts input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}" # if there are no result hits_empty: "We didn't find any results for the search: ${query}" # if there are no result
hits_stats: "${hits} results found in ${time} ms" hits_stats: '${hits} results found in ${time} ms'
# Local search # Local search
# Please see doc for more details: https://jerryc.me/posts/21cfbf15/#本地搜索 # Please see doc for more details: https://docs.jerryc.me/config.html#本地搜索
# --------------- # ---------------
local_search: local_search:
enable: false enable: false
@@ -82,90 +79,101 @@ local_search:
hits_empty: "We didn't find any results for the search: ${query}" # if there are no result hits_empty: "We didn't find any results for the search: ${query}" # if there are no result
# MathJax # MathJax
# Please see doc for more details: https://jerryc.me/posts/21cfbf15/#MathJax # Please see doc for more details: https://docs.jerryc.me/config.html#mathjax
# --------------- # ---------------
mathjax: mathjax:
enable: false enable: false
cdn: https://cdn.jsdelivr.net/npm/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML # true 表示每一頁都加載mathjax.js
# false 需要時加載須在使用的Markdown Front-matter 加上 mathjax: true
per_page: false
# KaTeX # KaTeX
# --------------- # ---------------
katex: katex:
enable: false enable: false
cdn: # true 表示每一頁都加載katex.js
css: https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css # false 需要時加載須在使用的Markdown Front-matter 加上 katex: true
per_page: false
hide_scrollbar: true hide_scrollbar: true
# mermaid
#### Analysis #### # see https://github.com/knsv/mermaid
# --------------- # -------------------------------
# baidu_analytics: mermaid:
enable: false
#Google Analytics # built-in themes: default/forest/dark/neutral
google_analytics: theme: default
# stylesheets loaded in the <head>
# ---------------
stylesheets:
- /css/index.css
# scripts loaded in the end of the body
# ---------------
scripts:
- /js/utils.js
- /js/main.js
# cdn for third-party library
# ---------------
cdn:
css:
fontawesome: https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css
# fontawesomeV5: https://use.fontawesome.com/releases/v5.8.1/css/all.css
fancybox: https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css
js:
jquery: https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js
fancybox: https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js
js-cookies: https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js
# Post info settings # Post info settings
# --------------- # ---------------
# avatar: /img/avatar.png avatar:
avatar: https://cdn.jsdelivr.net/gh/jerryc127/CDN@latest/Photo/avatar.png img: /img/avatar.png
effect: false # 頭像會一直轉圈
# the banner image of index # the banner image of index
# if the banner of another page not setting,it will show the top_img index_img:
top_img: https://i.loli.net/2019/05/22/5ce53eb6dc82757840.jpg
#the banner image of post # if the banner of page not setting,it will show the top_img
# if the post not set the post cover and post top image, it will show it default_top_img: /img/index.jpg
post_img: https://cdn.jsdelivr.net/gh/jerryc127/CDN@latest/Photo/post.png
# the default cover of the post
default_cover: https://cdn.jsdelivr.net/gh/jerryc127/CDN@latest/cover/default_bg.png
# the banner image of archive page # the banner image of archive page
archive_img: https://cdn.jsdelivr.net/gh/jerryc127/CDN@latest/Photo/archive.jpg archive_img:
# the banner image of tag page # the banner image of tag page
tag_img: https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/tag-bg.png # tag page, look like https://xxxxxxxxx.com/tags/butterfly
tag_img:
# the banner image of category page # the banner image of category page
category_img: https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/category-bg # category page, look like https://xxxxxxxxx.com/categories/butterfly
category_img:
# 如果你有使用hexo-douban可配置這個
# douban:
# meta: false
# movies_img:
# books_img:
# games_img:
cover:
# 是否顯示文章封面
index_enable: true
aside_enable: true
archives_enable: true
# 封面顯示的位置
# 三個值可配置 left , right , both
position: both
# 當沒有設置cover時默認的封面顯示
default_cover:
- /img/post.jpg
# if the photo link cannot connect,it will show that # if the photo link cannot connect,it will show that
lodding_bg: lodding_bg:
flink: /img/friend_404.gif flink: /img/friend_404.gif #404後圖片
post_page: /img/404.jpg post_page: /img/404.jpg #404後圖片
# post: /img/loading.gif ##加載動畫
# A simple 404 page
error_404:
enable: false
subtitle: 'Page Not Found'
background:
post_meta: post_meta:
date_type: both # or created or updated 文章日期是创建日或者更新日或都显示 page:
categories: true # or false 是否显示分类 date_type: created # created or updated or both 主頁文章日期是創建日或者更新日或都顯示
tags: true # or false 是否显示标签 categories: true # true or false 主頁是否顯示分類
tags: false # true or false 主頁是否顯示標籤
post:
date_type: both # created or updated or both 文章頁日期是創建日或者更新日或都顯示
categories: true # true or false 文章頁是否顯示分類
tags: true # true or false 文章頁是否顯示標籤
# Please see doc for more details: https://jerryc.me/posts/21cfbf15/#字数统计 # Please see doc for more details: https://docs.jerryc.me/config.html#字數統計
wordcount: wordcount:
enable: false enable: false
post_wordcount: true
min2read: true
total_wordcount: true
toc: toc:
enable: true enable: true
@@ -177,6 +185,7 @@ auto_open_sidebar:
post_copyright: post_copyright:
enable: true enable: true
decode: false
license: CC BY-NC-SA 4.0 license: CC BY-NC-SA 4.0
license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/ license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/
@@ -185,7 +194,6 @@ auto_excerpt:
enable: true enable: true
length: 150 length: 150
#### Share System #### #### Share System ####
# ----------------------------------------- # -----------------------------------------
addThis: addThis:
@@ -213,47 +221,84 @@ addtoany:
disqus: disqus:
enable: false enable: false
shortname: shortname:
count: false # dispaly comment count in top_img
# laibili: # Disqus.js版評論系統應對大陸長城的折中方案兼容原版https://github.com/SukkaW/DisqusJS
# enable: false # API 申請地址https://disqus.com/api/applications/
# uid: # 與 disqus 共用樣式
disqusjs:
enable: false
shortname:
siteName:
apikey:
api: https://disqus.skk.moe/disqus/ #一般情況下無需修改 API 地址
admin:
adminLabel:
count: false # dispaly comment count in top_img
# gitment laibili:
# enable: false enable: false
# owner: uid:
# repo:
# client_id:
# client_secret:
# gitalk: gitalk:
# enable: false enable: false
# client_id: client_id:
# client_secret: client_secret:
# repo: repo:
# owner: owner:
# admin: admin:
# language: # en , zh-CN , zh-TW language: zh-CN # en , zh-CN , zh-TW
#### Using this js for redirect to gitalk container after login perPage: 10 # Pagination size, with maximum 100.
#### See https://github.com/gitalk/gitalk/issues/125 distractionFreeMode: false # Facebook-like distraction free mode.
# js: https://cdn.jsdelivr.net/gh/upupming/gitalk@36368e5dffd049e956cdbbd751ff96c28d8255cf/dist/gitalk.min.js pagerDirection: last # Comment sorting direction, available values are last and first.
createIssueManually: false # Gitalk will create a corresponding github issue for your every single page automatically
count: false # dispaly comment count in top_img
# valine comment system. https://valine.js.org # valine comment system. https://valine.js.org
valine: valine:
enable: false # if you want use valine,please set this value is true enable: false # if you want use valine,please set this value is true
appId: # leancloud application app id appId: # leancloud application app id
appKey: # leancloud application app key appKey: # leancloud application app key
notify: false # valine mail notify (true/false) https://github.com/xCss/Valine/wiki notify: false # valine mail notify (true/false) Deprecated in v1.4.0+
verify: false # valine verify code (true/false) verify: false # valine verify code (true/false) Deprecated in v1.4.0+
pageSize: 10 # comment list page size pageSize: 10 # comment list page size
avatar: monsterid # gravatar style https://valine.js.org/#/avatar avatar: monsterid # gravatar style https://valine.js.org/#/avatar
lang: en # i18n: zh-cn/en lang: en # i18n: zh-CN/zh-TW/en/ja
placeholder: Please leave your footprints # valine comment input placeholder(like: Please leave your footprints ) placeholder: Please leave your footprints # valine comment input placeholder(like: Please leave your footprints )
guest_info: nick,mail,link #valine comment header info guest_info: nick,mail,link #valine comment header info
recordIP: false # Record reviewer IP
serverURLs: # This configuration is suitable for domestic custom domain name users, overseas version will be automatically detected (no need to manually fill in)
emojiCDN: # emoji CDN
enableQQ: false # enable the Nickname box to automatically get QQ Nickname and QQ Avatar
requiredFields: nick,mail # required fields nick/mail/link
bg: /img/comment_bg.png # valine background bg: /img/comment_bg.png # valine background
count: false # dispaly comment count in top_img
# utterances
# https://utteranc.es/
utterances:
enable: false
repo:
# 可選 pathname/url/title/og:title
issue_term: pathname
# 可選 github-light/github-dark/github-dark-orange/icy-dark/dark-blue/photon-dark
light_theme: github-light
dark_theme: photon-dark
# Facebook Comments Plugin
# https://developers.facebook.com/docs/plugins/comments/
facebook_comments:
enable: false
app_id:
user_id: # optional
pageSize: 10 # The number of comments to show
order_by: social # social/time/reverse_time
lang: en_US # Language en_US/zh_CN/zh_TW and so on
count: false
##### Footer Settings #### ##### Footer Settings ####
# ------------------------------------ # ------------------------------------
since: 2018 since: 2020
footer_custom_text: footer_custom_text:
@@ -266,6 +311,31 @@ ICP:
text: text:
icon: /img/icp.png icon: /img/icp.png
#### Analysis ####
# ---------------
baidu_analytics:
# Google Analytics
google_analytics:
# Tencent_analytics ID
tencent_analytics:
# Ads
# ---------------
# Google Adsense
google_adsense:
enable: false
js: https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
client:
enable_page_level_ads: true
# 廣告插入位置
# 適用於開啓手動廣告的配置
# ad:
# index:
# aside:
# post:
#### 站長驗證 #### #### 站長驗證 ####
# Google Webmaster tools verification setting # Google Webmaster tools verification setting
@@ -284,17 +354,6 @@ baidu_site_verification:
# see http://zhanzhang.so.com/ # see http://zhanzhang.so.com/
qihu_site_verification: qihu_site_verification:
# 友情鏈接界面設置
Flink:
headline: 友情鏈接
info_headline: 我的Blog資料
name: Blog 名字: JerryC
address: Blog 地址: https://jerryc.me/
avatar: Blog 頭像: https://jerryc.me/img/avatar.png
info: Blog 簡介: 今日事,今日畢
comment: 如果需要交換友鏈,請留言
# 打賞按鈕 # 打賞按鈕
reward: reward:
enable: true enable: true
@@ -310,6 +369,11 @@ reward:
related_post: related_post:
enable: true enable: true
limit: 6 # 顯示推薦文章數目 limit: 6 # 顯示推薦文章數目
date_type: created # or created or updated 文章日期顯示創建日或者更新日
# figcaption
# 圖片描述文字
photofigcaption: false
#### 美化/效果 #### #### 美化/效果 ####
#-------------------------------- #--------------------------------
@@ -324,10 +388,13 @@ related_post:
# button_hover: "#FF7242" # button_hover: "#FF7242"
# text_selection: "#00c4b6" # text_selection: "#00c4b6"
# link_color: "#99a9bf" # link_color: "#99a9bf"
# meta_color: '#858585' # meta_color: "#858585"
# hr_color: "#A4D8FA" # hr_color: "#A4D8FA"
# read-mode-bg_color: '#FAF9DE' # code_foreground: "#F47466"
# inline-code-color: '#F47466' # code_background: "rgba(27, 31, 35, .05)"
# toc_color: "#00c4b6"
# blockquote_padding_color: "#49b1f5"
# blockquote_background_color: "#49b1f5"
# 主頁設置 # 主頁設置
# 默認top_img全屏site_info在中間 # 默認top_img全屏site_info在中間
@@ -335,14 +402,12 @@ related_post:
index_site_info_top: # 主頁標題距離頂部距離 例如 300px/300em/300rem/10% index_site_info_top: # 主頁標題距離頂部距離 例如 300px/300em/300rem/10%
index_top_img_height: # 主頁top_img高度 例如 300px/300em/300rem 不能使用百分比 index_top_img_height: # 主頁top_img高度 例如 300px/300em/300rem 不能使用百分比
# category和tag頁的UI設置 # category和tag頁的UI設置
# index 值代表 UI將與首頁的UI一樣 # index 值代表 UI將與首頁的UI一樣
# 默認跟archives頁面UI一樣 # 默認跟archives頁面UI一樣
category_ui: # 留空或index category_ui: # 留空或index
tag_ui: # 留空或index tag_ui: # 留空或index
# 設置網站背景 # 設置網站背景
# 可設置圖片 或者 顔色 # 可設置圖片 或者 顔色
# 圖片格式 background: url(http://xxxxxx.com/xxx.jpg) # 圖片格式 background: url(http://xxxxxx.com/xxx.jpg)
@@ -353,7 +418,8 @@ background:
# footer是否顯示圖片背景(與top_img一致) # footer是否顯示圖片背景(與top_img一致)
footer_bg: false footer_bg: false
# 背景特效
# 避免卡頓,建議只開啟一個
# canvas_ribbon 禁止彩帶背景 # canvas_ribbon 禁止彩帶背景
# See: https://github.com/hustcc/ribbon.js # See: https://github.com/hustcc/ribbon.js
canvas_ribbon: canvas_ribbon:
@@ -362,10 +428,12 @@ canvas_ribbon:
alpha: 0.6 alpha: 0.6
zIndex: -1 zIndex: -1
click_to_change: false click_to_change: false
mobile: false # false 手機端不顯示 true 手機端顯示
# 動態彩帶 # 動態彩帶
canvas_ribbon_piao: canvas_ribbon_piao:
enable: false enable: false
mobile: false # false 手機端不顯示 true 手機端顯示
# canvas_nest # canvas_nest
# https://github.com/hustcc/canvas-nest.js # https://github.com/hustcc/canvas-nest.js
@@ -375,29 +443,43 @@ canvas_nest:
opacity: 0.7 # the opacity of line (0~1), default: 0.5. opacity: 0.7 # the opacity of line (0~1), default: 0.5.
zIndex: -1 # z-index property of the background, default: -1. zIndex: -1 # z-index property of the background, default: -1.
count: 99 # the number of lines, default: 99. count: 99 # the number of lines, default: 99.
script: https://cdn.jsdelivr.net/gh/jerryc127/CDN/js/canvas-nest.js # or /js/third-party/canvas-nest.js mobile: false # false 手機端不顯示 true 手機端顯示
# 打字效果 # 打字效果
activate_power_mode: activate_power_mode:
enable: false enable: false
colorful: true # 冒光特效
shake: true # 抖動特效
# 鼠標點擊效果 # 鼠標點擊效果
# 避免卡頓,建議只開啟一個
# 點擊煙火特效
fireworks: fireworks:
enable: false enable: false
# 頭像會一直轉圈 # 點擊出現愛心
avatar_effect: false click_heart:
enable: false
# 點擊出現文字,文字可自行修改
ClickShowText:
enable: false
text:
- I
- LOVE
- YOU
fontSize: 15px
# 網站顯示模式 # 網站顯示模式
# day 默認模式 # light 默認模式
# night 黑暗模式(不建議) # dark 黑暗模式(不建議)
display_mode: day display_mode: light
# 美化post頁顯示 # 美化頁顯示
post_beautify: beautify:
enable: false enable: false
title-prefix-icon: '\f0c1' title-prefix-icon: '\f0c1'
title-prefix-icon-color: "#F47466" title-prefix-icon-color: '#F47466'
# 全局字體 # 全局字體
font: font:
@@ -418,33 +500,65 @@ hr:
icon-top: -20px icon-top: -20px
# 主頁subtitle # 主頁subtitle
# 打字效果
# (如果有英文逗號' , ',請使用轉義字符 &#44;)
subtitle: subtitle:
enable: true enable: true
# 打字效果
effect: true
# 循環或者只打字一次
loop: false
# source調用第三方服務
# source: false 關閉調用
# source: 1 調用搏天api的隨機語錄簡體 https://api.btstu.cn/
# source: 2 調用一言網的一句話(簡體) https://hitokoto.cn/
# source: 3 調用一句網(簡體) http://yijuzhan.com/
# source: 4 調用今日詩詞(簡體) https://www.jinrishici.com/
# subtitle 會先顯示 source , 再顯示 sub 的內容
source: false
# (如果有英文逗號' , ',請使用轉義字符 &#44;)
# 如果關閉打字效果subtitle只會顯示sub的第一行文字
sub: sub:
- 今日事&#44;今日畢 - 今日事&#44;今日畢
- Never put off till tomorrow what you can do today - Never put off till tomorrow what you can do today
# fontawesome圖標
# 默認使用的是 fontawesome v4版本的圖標
fontawesome_v5:
enable: false
# 加載動畫 Loading Animation
preloader: false
#### 側邊欄 #### #### 側邊欄 ####
#------------------------------------- #-------------------------------------
# 側邊欄顯示設置 # 側邊欄顯示設置
aside: aside:
enable: true
mobile: true # 手機頁面( 顯示寬度 < 768px 是否顯示aside內容
position: right # left or right position: right # left or right
card_author: true card_author:
card_announcement: true enable: true
card_recent_post: true description:
card_categories: true card_announcement:
card_tags: true enable: true
card_archives: true content: This is my Blog
card_recent_post:
enable: true
limit: 5 # if set 0 will show all
card_categories:
enable: true
limit: 8 # if set 0 will show all
card_tags:
enable: true
limit: 40 # if set 0 will show all
color: false
card_archives:
enable: true
type: monthly # yearly or monthly
format: MMMM YYYY # eg: YYYY年MM月
order: -1 # Sort of order. 1, asc for ascending; -1, desc for descending
limit: 8 # if set 0 will show all
card_webinfo: true card_webinfo: true
# 網站公告
announcement:
content: 感謝訪問本站,若喜歡請收藏 ^_^
# busuanzi count for PV / UV in site # busuanzi count for PV / UV in site
# 訪問人數 # 訪問人數
busuanzi: busuanzi:
@@ -459,7 +573,6 @@ runtimeshow:
enable: true enable: true
start_date: 6/7/2018 00:00:00 start_date: 6/7/2018 00:00:00
#### 右下角按鈕 #### #### 右下角按鈕 ####
#---------------------------------------------- #----------------------------------------------
# 簡繁轉換 # 簡繁轉換
@@ -467,29 +580,57 @@ translate:
enable: true enable: true
# 默認按鈕顯示文字 # 默認按鈕顯示文字
default: default:
#站默认语1: 繁體中文, 2: 简体中文 #站默認語1: 繁體中文, 2: 簡體中文
defaultEncoding: 2 defaultEncoding: 2
#延迟时间,若不在前, 要定延迟翻译时间, 如100表示100ms,默认为0 #延遲時間,若不在前, 要定延遲翻譯時間, 如100表示100ms,默認為0
translateDelay: 0 translateDelay: 0
#博客 #博客
cookieDomain: "https://xxx/" cookieDomain: 'https://xxx/'
#當文字是簡體時,按鈕顯示的文字 #當文字是簡體時,按鈕顯示的文字
msgToTraditionalChinese: "繁" msgToTraditionalChinese: '繁'
#當文字是繁體時,按鈕顯示的文字 #當文字是繁體時,按鈕顯示的文字
msgToSimplifiedChinese: "简" msgToSimplifiedChinese: '簡'
# 夜間模式
nightshift:
enable: true
#閲讀模式 #閲讀模式
readmode: readmode:
enable: true enable: true
# dark mode
darkmode:
enable: true
# dark mode和 light mode切換按鈕
button: true
# 自動切換 dark mode和 light mode
# autoChangeMode: 1 跟隨系統而變化,不支持的瀏覽器/系統將按照時間晚上6點到早上6點之間切換為 dark mode
# autoChangeMode: 2 只按照時間晚上6點到早上6點之間切換為 dark mode
# autoChangeMode: false 取消自動切換
autoChangeMode: 1
#### other #### #### other ####
#------------------------------------------------ #------------------------------------------------
# 圖片大圖查看模式
# 可選 medium_zoom 或者 fancybox
# 只選一個 或者 兩個都不選
#--------------------------------------------
# medium_zoom https://github.com/francoischalifour/medium-zoom
medium_zoom:
enable: false
# fancybox http://fancyapps.com/fancybox/3/
fancybox:
enable: true
# Snackbar 彈窗
# https://github.com/polonel/SnackBar
# position 彈窗位置
# 可選 top-left / top-center / top-right / bottom-left / bottom-center / bottom-right
snackbar:
enable: false
position: bottom-left
bg_light: '#49b1f5' #light mode時彈窗背景
bg_dark: '#2d3035' #dark mode時彈窗背景
#百度推送 #百度推送
baidu_push: baidu_push:
enable: false enable: false
@@ -499,6 +640,12 @@ baidu_push:
instantpage: instantpage:
enable: true enable: true
# https://github.com/vinta/pangu.js
# 中英文之間添加空格
pangu:
enable: false
field: page # page/post
# Note (Bootstrap Callout) # Note (Bootstrap Callout)
# https://muse.theme-next.org/docs/tag-plugins/note # https://muse.theme-next.org/docs/tag-plugins/note
note: note:
@@ -507,7 +654,7 @@ note:
# - modern bs-callout new (v2-v3) alert style. # - modern bs-callout new (v2-v3) alert style.
# - flat flat callout style with background, like on Mozilla or StackOverflow. # - flat flat callout style with background, like on Mozilla or StackOverflow.
# - disabled disable all CSS styles import of note tag. # - disabled disable all CSS styles import of note tag.
style: simple style: flat
icons: true icons: true
border_radius: 3 border_radius: 3
# Offset lighter of background in % for modern and flat styles (modern: -12 | 12; flat: -18 | 6). # Offset lighter of background in % for modern and flat styles (modern: -12 | 12; flat: -18 | 6).
@@ -515,9 +662,9 @@ note:
light_bg_offset: 0 light_bg_offset: 0
# 圖片懶加載 # 圖片懶加載
# https://github.com/aFarkas/lazysizes
lazyload: lazyload:
enable: true enable: true
script: https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js
# 避免重複網址分散seo # 避免重複網址分散seo
canonical: true canonical: true
@@ -532,3 +679,87 @@ twitter_meta: true
# facebook QQ 等 分享自動帶上樣式 # facebook QQ 等 分享自動帶上樣式
# https://i.loli.net/2019/09/08/2wbFJEKloisRvhj.png # https://i.loli.net/2019/09/08/2wbFJEKloisRvhj.png
Open_Graph_meta: true Open_Graph_meta: true
# 開啟hexo自帶的緩存加快生成速度
fragment_cache: true
# inject
# 插入代码到头部</head>之前 和 尾部</body>之前
inject:
head:
# - <link rel="stylesheet" href="xxxxx">
bottom:
# - <script src="xxxx"></script>
# CDN
# 非必要不要修改
CDN:
# main
main_css: /css/index.css
jquery: https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js
main: /js/main.js
utils: /js/utils.js
# comments
blueimp_md5: https://cdn.jsdelivr.net/npm/blueimp-md5/js/md5.min.js
gitalk: https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js
gitalk_css: https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.css
valine: https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js
disqusjs: https://cdn.jsdelivr.net/npm/disqusjs@1.2/dist/disqus.js
disqusjs_css: https://cdn.jsdelivr.net/npm/disqusjs@1.2/dist/disqusjs.css
utterances: https://utteranc.es/client.js
# share
addtoany: https://static.addtoany.com/menu/page.js
sharejs: https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js
sharejs_css: https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css
# search
local_search: /js/search/local-search.js
algolia_js: /js/search/algolia.js
algolia_search: https://cdn.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch.min.js
algolia_search_css: https://cdn.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch.min.css
# math
mathjax: https://cdn.jsdelivr.net/npm/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML
katex: https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css
katex_copytex: https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.js
katex_copytex_css: https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.css
mermaid: https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js
# count
busuanzi: //busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js
# background effect
canvas_ribbon: /js/third-party/canvas-ribbon.js
canvas_ribbon_piao: /js/third-party/piao.js
canvas_nest: /js/third-party/canvas-nest.js
lazyload: https://cdn.jsdelivr.net/npm/lazysizes@latest/lazysizes.min.js
instantpage: https://cdn.jsdelivr.net/npm/instant.page@latest/instantpage.min.js
typed: https://cdn.jsdelivr.net/npm/typed.js
js_cookies: https://cdn.jsdelivr.net/npm/js-cookie/dist/js.cookie.min.js
pangu: https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js
# photo
fancybox_css: https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css
fancybox: https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js
medium_zoom: https://cdn.jsdelivr.net/npm/medium-zoom/dist/medium-zoom.min.js
# snackbar
snackbar_css: https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css
snackbar: https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js
# 鼠標點擊特效
anime: https://cdn.jsdelivr.net/npm/animejs@latest/anime.min.js
activate_power_mode: /js/third-party/activate-power-mode.js
fireworks: /js/third-party/fireworks.js
click_heart: /js/third-party/click_heart.js
ClickShowText: /js/third-party/ClickShowText.js
# fontawesome
fontawesome_v4: https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css
fontawesome_v5: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css
# 簡繁轉換
translate: /js/tw_cn.js

View File

@@ -19,7 +19,6 @@ page:
sticky: Sticky sticky: Sticky
no_title: No title no_title: No title
archives: Archives
post: post:
created: Created created: Created
@@ -27,11 +26,13 @@ post:
wordcount: Word count wordcount: Word count
min2read: "Reading time: %s min" min2read: "Reading time: %s min"
page_pv: Post View page_pv: Post View
comments: Comments
copyright: copyright:
author: Author author: Author
link: Link link: Link
copyright_notice: Copyright Notice copyright_notice: Copyright Notice
copyright_content: 'All articles in this blog are licensed under <a href="%s">%s</a> unless stating additionally.' copyright_content: 'All articles in this blog are licensed under <a href="%s">%s</a> unless stating additionally.'
recommend: Recommend
search: Search search: Search
algolia_search: algolia_search:
@@ -60,21 +61,20 @@ aside:
card_tags: Tags card_tags: Tags
card_archives: Archives card_archives: Archives
card_recent_post: Recent Post card_recent_post: Recent Post
card_bookmark: Add to bookmark card_bookmark: Bookmark
card_webinfo: card_webinfo:
headline: Info headline: Info
article_name: Article article_name: Article
runtime_name: Run time runtime_name: Run time
site_wordcount: Total Count
site_uv_name: UV site_uv_name: UV
site_pv_name: PV site_pv_name: PV
more_button: More
donate: Donate donate: Donate
share: Share share: Share
bookmark: bookmark:
title: Bookmark title: Bookmark
message_prev: Press
message_next: to bookmark this page
rightside: rightside:
readmode_title: Read Mode readmode_title: Read Mode
@@ -94,3 +94,15 @@ copy_copyright:
link: Link link: Link
source: Source source: Source
info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source. info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
Snackbar:
bookmark:
message_prev: Press
message_next: to bookmark this page
chs_to_cht: Traditional Chinese Activated Manually
cht_to_chs: Simplified Chinese Activated Manually
day_to_night: Dark Mode Activated Manually
night_to_day: Light Mode Activated Manually
error_title: Page not found
loading: Loading...

View File

@@ -19,7 +19,6 @@ page:
sticky: Sticky sticky: Sticky
no_title: No title no_title: No title
archives: Archives
post: post:
created: Created created: Created
@@ -27,11 +26,13 @@ post:
wordcount: Word count wordcount: Word count
min2read: "Reading time: %s min" min2read: "Reading time: %s min"
page_pv: Post View page_pv: Post View
comments: Comments
copyright: copyright:
author: Author author: Author
link: Link link: Link
copyright_notice: Copyright Notice copyright_notice: Copyright Notice
copyright_content: 'All articles in this blog are licensed under <a href="%s">%s</a> unless stating additionally.' copyright_content: 'All articles in this blog are licensed under <a href="%s">%s</a> unless stating additionally.'
recommend: Recommend
search: Search search: Search
algolia_search: algolia_search:
@@ -60,20 +61,20 @@ aside:
card_tags: Tags card_tags: Tags
card_archives: Archives card_archives: Archives
card_recent_post: Recent Post card_recent_post: Recent Post
card_bookmark: Add to bookmark card_bookmark: Bookmark
card_webinfo: card_webinfo:
headline: Info headline: Info
article_name: Article article_name: Article
runtime_name: Run time runtime_name: Run time
site_wordcount: Total Count
site_uv_name: UV site_uv_name: UV
site_pv_name: PV site_pv_name: PV
more_button: More
donate: Donate donate: Donate
share: Share share: Share
bookmark: bookmark:
title: Bookmark title: Bookmark
message_prev: Press
message_next: to bookmark this page
rightside: rightside:
readmode_title: Read Mode readmode_title: Read Mode
@@ -93,3 +94,15 @@ copy_copyright:
link: Link link: Link
source: Source source: Source
info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source. info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
Snackbar:
bookmark:
message_prev: Press
message_next: to bookmark this page
chs_to_cht: Traditional Chinese Activated Manually
cht_to_chs: Simplified Chinese Activated Manually
day_to_night: Dark Mode Activated Manually
night_to_day: Light Mode Activated Manually
error_title: Page not found
loading: Loading...

View File

@@ -19,7 +19,6 @@ page:
sticky: 置顶 sticky: 置顶
no_title: 无题 no_title: 无题
archives: 时间轴
post: post:
created: 发表于 created: 发表于
@@ -27,11 +26,14 @@ post:
wordcount: 字数总计 wordcount: 字数总计
min2read: "阅读时长: %s 分钟" min2read: "阅读时长: %s 分钟"
page_pv: 阅读量 page_pv: 阅读量
comments: 评论数
copyright: copyright:
author: 文章作者 author: 文章作者
link: 文章链接 link: 文章链接
copyright_notice: 版权声明 copyright_notice: 版权声明
copyright_content: '本博客所有文章除特别声明外,均采用 <a href="%s">%s</a> 许可协议。转载请注明来自 <a href="%s">%s</a>' copyright_content: '本博客所有文章除特别声明外,均采用
<a href="%s" target="_blank">%s</a> 许可协议。转载请注明来自 <a href="%s" target="_blank">%s</a>'
recommend: 相关推荐
search: 搜索 search: 搜索
algolia_search: algolia_search:
@@ -66,15 +68,15 @@ aside:
headline: 网站资讯 headline: 网站资讯
article_name: 文章数目 article_name: 文章数目
runtime_name: 已运行时间 runtime_name: 已运行时间
site_wordcount: 本站总字数
site_uv_name: 本站访客数 site_uv_name: 本站访客数
site_pv_name: 本站总访问量 site_pv_name: 本站总访问量
more_button: 查看更多
donate: 打赏 donate: 打赏
share: 分享 share: 分享
bookmark: bookmark:
title: 添加书签 title: 添加书签
message_prev:
message_next: 键将本页加入书签
rightside: rightside:
readmode_title: 阅读模式 readmode_title: 阅读模式
@@ -94,3 +96,15 @@ copy_copyright:
link: 链接 link: 链接
source: 来源 source: 来源
info: 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 info: 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
Snackbar:
bookmark:
message_prev:
message_next: 键将本页加入书签
chs_to_cht: 你已切换为繁体
cht_to_chs: 你已切换为简体
day_to_night: 你已切换为深色模式
night_to_day: 你已切换为浅色模式
error_title: 页面没有找到
loading: 加载中...

View File

@@ -9,42 +9,43 @@ footer:
copy: copy:
success: 複製成功 success: 複製成功
error: 複製錯誤 error: 複製錯誤
noSupport: 瀏覽器不支 noSupport: 瀏覽器不支
page: page:
articles: 文章總覽 articles: 文章總覽
tag: 標籤 tag: 標籤
category: 分類 category: 分類
archives: 時間軸 archives: 歸檔
sticky: 置頂 sticky: 置頂
no_title: 無題 no_title: 無題
archives: 時間軸
post: post:
created: 發表於 created: 發表於
updated: 更新於 updated: 更新於
wordcount: 字數總計 wordcount: 字數總計
min2read: "讀時長: %s 分鐘" min2read: "讀時長: %s 分鐘"
page_pv: 讀量 page_pv: 讀量
comments: 評論數
copyright: copyright:
author: 文章作者 author: 文章作者
link: 文章鏈接 link: 文章連結
copyright_notice: 版權聲明 copyright_notice: 版權聲明
copyright_content: '本博客所有文章除特別聲明外,均採用 copyright_content: '本部落格所有文章除特別聲明外,均採用
<a href="%s" target="_blank">%s</a> 許可協議。轉載請註明來自 <a href="%s" target="_blank">%s</a>' <a href="%s" target="_blank">%s</a> 許可協議。轉載請註明來自 <a href="%s" target="_blank">%s</a>'
recommend: 相關推薦
search: search:
algolia_search: algolia_search:
input_placeholder: 文章 input_placeholder: 文章
hits_empty: "找不到您查詢的內容:${query}" hits_empty: "找不到您查詢的內容:${query}"
hits_stats: "找到 ${hits} 條結果,用時 ${time} 毫秒" hits_stats: "找到 ${hits} 條結果,用時 ${time} 毫秒"
local_search: local_search:
label: 本地搜 label: 本地搜
input_placeholder: 文章 input_placeholder: 文章
hits_empty: "找不到您查詢的內容:${query}" hits_empty: "找不到您查詢的內容:${query}"
powered: "提供支" powered: "提供支"
by: by:
pagination: pagination:
@@ -66,32 +67,45 @@ aside:
card_webinfo: card_webinfo:
headline: 網站資訊 headline: 網站資訊
article_name: 文章數目 article_name: 文章數目
runtime_name: 行時間 runtime_name: 行時間
site_wordcount: 本站總字數
site_uv_name: 本站訪客數 site_uv_name: 本站訪客數
site_pv_name: 本站總訪問量 site_pv_name: 本站總訪問量
more_button: 檢視更多
donate: 打賞 donate: 打賞
share: 分享 share: 分享
bookmark: bookmark:
title: 添加書籤 title: 新增書籤
message_prev:
message_next: 鍵將本頁加入書籤
rightside: rightside:
readmode_title: 讀模式 readmode_title: 讀模式
font_plus_title: 放大字 font_plus_title: 放大字
font_minus_title: 縮小字 font_minus_title: 縮小字
translate_title: 簡繁轉換 translate_title: 簡繁轉換
night_mode_title: 夜間模式 night_mode_title: 夜間模式
back_to_top: 回到頂部 back_to_top: 回到頂部
toc: 目錄 toc: 目錄
scroll_to_comment: 直達評論 scroll_to_comment: 直達評論
setting: setting:
runtime_unit: runtime_unit:
copy_copyright: copy_copyright:
author: 作者 author: 作者
link: 鏈接 link: 連結
source: 來源 source: 來源
info: 著作權歸作者所有。商業轉載請聯作者獲得授權,非商業轉載請註明出處。 info: 著作權歸作者所有。商業轉載請聯作者獲得授權,非商業轉載請註明出處。
Snackbar:
bookmark:
message_prev:
message_next: 鍵將本頁加入書籤
chs_to_cht: 你已切換為繁體
cht_to_chs: 你已切換為簡體
day_to_night: 你已切換為深色模式
night_to_day: 你已切換為淺色模式
error_title: 頁面沒有找到
loading: 載入中...

24
layout/404.pug Normal file
View File

@@ -0,0 +1,24 @@
- var top_img = theme.error_404.background || theme.default_top_img
- var bg_img = `background-image: url(${top_img})`
doctype html
html(lang=config.language data-theme=theme.display_mode)
head
include includes/head.pug
body
if theme.preloader
!=partial('includes/loading/loading', {}, {cache:theme.fragment_cache})
if theme.fireworks && theme.fireworks.enable
canvas.fireworks
include includes/mobile-sidebar/index.pug
nav#nav.error-no-found(style=bg_img)
include includes/header/header.pug
#error_info.is-center
h1#error_title= '404'
#error_subtitle= theme.error_404.subtitle
include includes/rightside.pug
!=partial('includes/search/index', {}, {cache:theme.fragment_cache})
include includes/additional-js.pug

View File

@@ -1,4 +1,3 @@
extends includes/layout.pug extends includes/layout.pug
block content block content
@@ -7,5 +6,3 @@ block content
.article-sort-title= _p('page.articles') + ' - ' + site.posts.length .article-sort-title= _p('page.articles') + ' - ' + site.posts.length
+articleSort(page.posts) +articleSort(page.posts)
include includes/pagination.pug include includes/pagination.pug
#aside_content.aside_content
include includes/aside.pug

View File

@@ -2,18 +2,13 @@ extends includes/layout.pug
block content block content
if theme.category_ui == 'index' if theme.category_ui == 'index'
include ./includes/mixins/UI.pug include ./includes/mixins/post-ui.pug
#recent-posts.recent-posts.category_ui #recent-posts.recent-posts.category_ui
+UI_NEW(page.posts) +postUI
include includes/pagination.pug include includes/pagination.pug
#aside_content.aside_content
include includes/aside.pug
else else
include ./includes/mixins/article-sort.pug include ./includes/mixins/article-sort.pug
#category #category
.article-sort-title= _p('page.category') + ' - ' + page.category .article-sort-title= _p('page.category') + ' - ' + page.category
+articleSort(page.posts) +articleSort(page.posts)
include includes/pagination.pug include includes/pagination.pug
#aside_content.aside_content
include includes/aside.pug

View File

@@ -1,31 +1,21 @@
.flink #page
.flink#article-container
if site.data.link
each i in site.data.link each i in site.data.link
h1= i.class_name h2= i.class_name
.post-cards .post-cards
ul.md-links .md-links
each item in i.link_list each item in i.link_list
li.md-links-item .md-links-item
a(href=item.link title=item.name target="_blank") a(href=item.link title=item.name target="_blank")
if theme.lazyload.enable if theme.lazyload.enable
img.lozad(data-src=item.avatar onerror=`onerror=null;src='${theme.lodding_bg.flink}'` height="72px") img.lazyload(data-src=item.avatar onerror=`this.onerror=null;this.src='` + url_for(theme.lodding_bg.flink) + `'` alt=item.name )
else else
img(src=item.avatar onerror=`onerror=null;src='${theme.lodding_bg.flink}'` height="72px") img(src=item.avatar onerror=`this.onerror=null;this.src='` + url_for(theme.lodding_bg.flink) + `'` alt=item.name )
div(class="md-links-title")= item.name .md-links-title= item.name
<br/> .md-links-des= item.descr
div(class="md-links-des")=item.descr != page.content
if page.comments !== false
hr include includes/comments/index.pug
div
p(style="font-size:15px;font-weight:bold")= theme.Flink.info_headline
ul
li= theme.Flink.name
li= theme.Flink.address
li= theme.Flink.avatar
li= theme.Flink.info
hr
.comment_int
p.comment-word= theme.Flink.comment

View File

@@ -1,4 +0,0 @@
extends includes/layout.pug
block content
include includes/gallery/layout.pug

View File

@@ -1,20 +1,24 @@
if (theme.algolia_search.enable) script(src=url_for(theme.CDN.jquery))
script(async src=url_for('/js/search/algolia.js')) script(src=url_for(theme.CDN.utils))
if (theme.mathjax && theme.mathjax.enable) script(src=url_for(theme.CDN.main))
if(!is_tag() && !is_category() && !is_archive())
include ./third-party/mathjax.pug if theme.translate && theme.translate.enable
if (theme.katex && theme.katex.enable) script(src=url_for(theme.CDN.translate))
if(!is_tag() && !is_category() && !is_archive())
include ./third-party/katex.pug if (theme.medium_zoom && theme.medium_zoom.enable)
if (theme.local_search && theme.local_search.enable) script(src=url_for(theme.CDN.medium_zoom))
script(async src=url_for('/js/search/local-search.js'))
if (theme.fancybox && theme.fancybox.enable)
script(src=url_for(theme.CDN.fancybox))
include ./math/index.pug
if theme.fireworks && theme.fireworks.enable if theme.fireworks && theme.fireworks.enable
script(src='https://cdn.jsdelivr.net/npm/animejs@latest/anime.min.js') script(src=url_for(theme.CDN.anime))
script(src=url_for('/js/third-party/fireworks.js')) script(src=url_for(theme.CDN.fireworks))
if theme.nightshift.enable if (theme.snackbar && theme.snackbar.enable)
script(src=url_for('js/nightshift.js')) script(src=url_for(theme.CDN.snackbar))
if (theme.canvas_ribbon && theme.canvas_ribbon.enable) if (theme.canvas_ribbon && theme.canvas_ribbon.enable)
include ./third-party/canvas-ribbon.pug include ./third-party/canvas-ribbon.pug
@@ -25,59 +29,46 @@ if (theme.canvas_ribbon_piao && theme.canvas_ribbon_piao.enable)
if (theme.canvas_nest && theme.canvas_nest.enable) if (theme.canvas_nest && theme.canvas_nest.enable)
include ./third-party/canvas-nest.pug include ./third-party/canvas-nest.pug
if theme.baidu_push && theme.baidu_push.enable
script(src=url_for('js/baidupush.js'))
if theme.activate_power_mode.enable if theme.activate_power_mode.enable
script(src=url_for('js/activate-power-mode.js')) script(src=url_for(theme.CDN.activate_power_mode))
script. script.
POWERMODE.colorful = true; // make power mode colorful POWERMODE.colorful = #{theme.activate_power_mode.colorful};
POWERMODE.shake = true; // turn off shake POWERMODE.shake = #{theme.activate_power_mode.shake};
document.body.addEventListener('input', POWERMODE); document.body.addEventListener('input', POWERMODE);
if theme.translate && theme.translate.enable
script(src=url_for('/js/tw_cn.js'))
script.
translateInitilization()
if is_home() && theme.subtitle.enable
script(src="https://cdn.jsdelivr.net/npm/typed.js@2.0.9")
script.
var typed = new Typed(".subtitle", {
strings: '!{theme.subtitle.sub}'.split(","),
startDelay: 300,
typeSpeed: 100,
loop: true,
backSpeed: 50
});
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
script(async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js") script(async src=url_for(theme.CDN.busuanzi))
if theme.instantpage.enable if theme.instantpage.enable
script(src="https://cdn.jsdelivr.net/npm/instant.page@1.2.2/instantpage.min.js" type="module") script(src=url_for(theme.CDN.instantpage) type="module")
if theme.lazyload.enable if theme.lazyload.enable
script(src=url_for(theme.lazyload.script)) script(src=url_for(theme.CDN.lazyload) async="")
script.
const observer = lozad(); // lazy loads elements with default selector as '.lozad'
observer.observe();
if is_home() && !theme.index_top_img_height && !theme.index_site_info_top //- 鼠標特效
script. if theme.click_heart && theme.click_heart.enable
//首頁fullpage script(src=url_for(theme.CDN.click_heart))
function alignContent() {
for (var n = $(window).height(), e = document.querySelectorAll(".full_page"), i = 0; i < e.length; i++)
e[i].style.height = n + "px";
$("#site-info").each(function () {
var x = $(this).height();
$(this).css("top", (n-x)/2)
})
}
alignContent();
$(window).bind("resize", function () { if theme.ClickShowText && theme.ClickShowText.enable
alignContent() script(src=url_for(theme.CDN.ClickShowText))
})
if theme.pangu && theme.pangu.enable
include ./third-party/pangu.pug
//- search
if theme.algolia_search && theme.algolia_search.enable
script(src=url_for(theme.CDN.algolia_js))
else if theme.local_search && theme.local_search.enable
script(src=url_for(theme.CDN.local_search))
//- mermaid
if theme.mermaid.enable
include ./math/mermaid.pug
if is_home()
include ./head/subtitle.pug
!=fragment_cache('injectBottom', function(){return injectHtml(theme.inject.bottom)})
if theme.preloader
!=partial('includes/loading/loading-js', {}, {cache:theme.fragment_cache})

View File

@@ -1,21 +0,0 @@
if theme.aside.card_author
include widget/card_author.pug
if theme.aside.card_announcement
include widget/card_announcement.pug
if theme.aside.card_recent_post
include widget/card_recent_post.pug
if theme.aside.card_categories
include widget/card_categories.pug
if theme.aside.card_tags
include widget/card_tags.pug
if theme.aside.card_archives
include widget/card_archives.pug
if theme.aside.card_webinfo
include widget/card_webinfo.pug

View File

@@ -1,13 +1,24 @@
if theme.disqus && theme.disqus.enable
#disqus_thread #disqus_thread
script. script.
var unused = null;
var disqus_config = function () { var disqus_config = function () {
this.page.url = '!{ page.permalink }'; this.page.url = '!{ page.permalink }';
this.page.identifier = '!{ page.path }'; this.page.identifier = '!{ page.path }';
this.page.title = '!{ page.title }'; this.page.title = '!{ page.title }';
} };
(function() {
var d = document, s = d.createElement('script'); var d = document, s = d.createElement('script');
s.src = "https://" + '!{theme.disqus.shortname}' +".disqus.com/embed.js"; s.src = 'https://!{theme.disqus.shortname}.disqus.com/embed.js';
s.setAttribute('data-timestamp', '' + +new Date()); s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s); (d.head || d.body).appendChild(s);
})();
if is_post() && theme.disqus.count
script.
function getDisqusCount() {
var d = document, s = d.createElement('script');
s.src = 'https://!{theme.disqus.shortname}.disqus.com/count.js';
s.id = 'dsq-count-scr';
(d.head || d.body).appendChild(s);
}
window.addEventListener('load', getDisqusCount, false);

View File

@@ -0,0 +1,24 @@
#disqus_thread
script(src=url_for(theme.CDN.disqusjs))
script.
var dsqjs = new DisqusJS({
shortname: '!{theme.disqusjs.shortname}',
siteName: "!{theme.disqusjs.siteName}",
identifier: '!{ page.path }',
url: '!{ page.permalink }',
title: '!{ page.title }',
api: '!{theme.disqusjs.api}',
apikey: '!{theme.disqusjs.apikey}',
admin: '!{theme.disqusjs.admin}',
adminLabel: '!{theme.disqusjs.adminLabel}'
});
if is_post() && theme.disqusjs.count
script.
function getDisqusCount() {
var d = document, s = d.createElement('script');
s.src = 'https://!{theme.disqusjs.shortname}.disqus.com/count.js';
s.id = 'dsq-count-scr';
(d.head || d.body).appendChild(s);
}
window.addEventListener('load', getDisqusCount, false);

View File

@@ -0,0 +1,12 @@
#fb-root
script(async defer crossorigin="anonymous" src=`https://connect.facebook.net/${theme.facebook_comments.lang}/sdk.js#xfbml=1&version=v6.0`)
.fb-comments(data-colorscheme = theme.display_mode === 'dark' ? 'dark' : 'light'
data-href=urlNoIndex()
data-numposts= theme.facebook_comments.pageSize || 10
data-order-by= theme.facebook_comments.order_by || 'social'
data-width="100%")
if theme.darkmode.enable
script.
var themeNow = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
document.getElementsByClassName('fb-comments')[0].setAttribute('data-colorscheme',themeNow)

View File

@@ -1,4 +1,3 @@
if theme.gitalk && theme.gitalk.enable
#gitalk-container #gitalk-container
script. script.
var gitalk = new Gitalk({ var gitalk = new Gitalk({
@@ -6,8 +5,23 @@ if theme.gitalk && theme.gitalk.enable
clientSecret: '!{theme.gitalk.client_secret}', clientSecret: '!{theme.gitalk.client_secret}',
repo: '!{theme.gitalk.repo}', repo: '!{theme.gitalk.repo}',
owner: '!{theme.gitalk.owner}', owner: '!{theme.gitalk.owner}',
admin: '!{theme.gitalk.admin}', admin: ['!{theme.gitalk.admin}'],
id: md5(decodeURI(location.pathname)), id: md5(decodeURI(location.pathname)),
language: '!{theme.gitalk.language}' language: '!{theme.gitalk.language}',
perPage: !{theme.gitalk.perPage},
distractionFreeMode: !{theme.gitalk.distractionFreeMode},
pagerDirection: '!{theme.gitalk.pagerDirection}',
createIssueManually: !{theme.gitalk.createIssueManually},
updateCountCallback: commentCount
}) })
gitalk.render('gitalk-container') gitalk.render('gitalk-container')
function commentCount(n){
try {
document.getElementsByClassName('gitalk-comment-count')[0].innerHTML= n
} catch (e) {
return false
}
}

View File

@@ -1,13 +0,0 @@
if theme.gitment && theme.gitment.enable
#gitment-container
script.
var gitment = new Gitment({
id: md5(decodeURI(location.pathname)),
owner: '!{theme.gitment.owner}',
repo: '!{theme.gitment.repo}',
oauth: {
client_id: '!{theme.gitment.client_id}',
client_secret: '!{theme.gitment.client_secret}'
}
})
gitment.render('gitment-container')

View File

@@ -1,35 +1,29 @@
if theme.disqus && theme.disqus.enable - var d = theme.disqus && theme.disqus.enable
- var dj = theme.disqusjs && theme.disqusjs.enable
- var l = theme.laibili && theme.laibili.enable
- var gt = theme.gitalk && theme.gitalk.enable
- var v = theme.valine && theme.valine.enable
- var u = theme.utterances && theme.utterances.enable
- var fb = theme.facebook_comments && theme.facebook_comments.enable
- var isComment = d || dj || l || gt || v || u || fb
if isComment
hr hr
#post-comment #post-comment
.comment_headling .comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true") i.fa.fa-comments.fa-fw(aria-hidden="true")
span= ' ' + _p('comment') span= ' ' + _p('comment')
if d
include ./disqus.pug include ./disqus.pug
else if theme.laibili && theme.laibili.enable else if dj
hr include ./disqusjs.pug
#post-comment else if l
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
span= ' ' + _p('comment')
include ./laibili.pug include ./laibili.pug
else if theme.gitment && theme.gitment.enable else if gt
hr
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
span= ' ' + _p('comment')
include ./gitment.pug
else if theme.gitalk && theme.gitalk.enable
hr
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
span= ' ' + _p('comment')
include ./gitalk.pug include ./gitalk.pug
else if theme.valine && theme.valine.enable else if v
hr
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
span= ' ' + _p('comment')
include ./valine.pug include ./valine.pug
else if u
include ./utterances.pug
else if fb
include ./facebook_comments.pug

View File

@@ -1,4 +1,3 @@
if theme.laibili && theme.laibili.enable
#lv-container(data-id="city" data-uid=theme.laibili.uid) #lv-container(data-id="city" data-uid=theme.laibili.uid)
script. script.
(function(d, s) { (function(d, s) {

View File

@@ -0,0 +1,21 @@
script#utterances_comment(src=theme.CDN.utterances
repo=theme.utterances.repo
issue-term=theme.utterances.issue_term
theme= theme.display_mode === 'dark' ? theme.utterances.dark_theme : theme.utterances.light_theme
crossorigin="anonymous"
async)
if theme.darkmode.enable
script.
var themeNow = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}'
document.getElementById('utterances_comment').setAttribute('theme',themeNow)
function utterancesTheme () {
var theme = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}'
const message = {
type: 'set-theme',
theme: theme
};
const iframe = document.querySelector('.utterances-frame');
iframe.contentWindow.postMessage(message, 'https://utteranc.es');
}

View File

@@ -1,25 +1,37 @@
if theme.valine && theme.valine.enable - let emojiMaps = '""'
if site.data.valine
- emojiMaps = JSON.stringify(site.data.valine)
#vcomment.vcomment #vcomment.vcomment
script(src='https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js') script(src=url_for(theme.CDN.valine))
script. script.
var notify = #{ theme.valine.notify } == true ? true : false; var requestSetting = function (from,set) {
var verify = #{ theme.valine.verify } == true ? true : false; var from = from
var GUEST_INFO = ['nick','mail','link']; var setting = set.split(',').filter(function(item){
var guest_info = '#{ theme.valine.guest_info }'.split(',').filter(function(item){ return from.indexOf(item) > -1
return GUEST_INFO.indexOf(item) > -1
}); });
guest_info = guest_info.length == 0 ? GUEST_INFO :guest_info; setting = setting.length == 0 ? from :setting;
return setting
}
var guestInfo = requestSetting(['nick','mail','link'],'#{ theme.valine.guest_info }')
var requiredFields = requestSetting(['nick','mail','link'],'#{ theme.valine.requiredFields }')
window.valine = new Valine({ window.valine = new Valine({
el:'#vcomment', el:'#vcomment',
notify:notify,
verify:verify,
appId: '#{theme.valine.appId}', appId: '#{theme.valine.appId}',
appKey: '#{theme.valine.appKey}', appKey: '#{theme.valine.appKey}',
notify: #{theme.valine.notify},
verify: #{theme.valine.verify},
placeholder: '#{theme.valine.placeholder}', placeholder: '#{theme.valine.placeholder}',
avatar: '#{theme.valine.avatar}', avatar: '#{theme.valine.avatar}',
guest_info:guest_info, meta: guestInfo,
pageSize: '#{theme.valine.pageSize}', pageSize: '#{theme.valine.pageSize}',
lang: '#{theme.valine.lang}', lang: '#{theme.valine.lang}',
recordIP: true recordIP: #{theme.valine.recordIP},
serverURLs: '#{theme.valine.serverURLs}',
emojiCDN: '#{theme.valine.emojiCDN}',
emojiMaps: !{emojiMaps},
enableQQ: #{theme.valine.enableQQ},
requiredFields: requiredFields
}); });

View File

@@ -1,4 +1,4 @@
#footer #footer-wrap
- var now = new Date() - var now = new Date()
- var nowYear = now.getFullYear() - var nowYear = now.getFullYear()
if theme.since && theme.since != nowYear if theme.since && theme.since != nowYear
@@ -8,7 +8,7 @@
if theme.footer_copyright.enable if theme.footer_copyright.enable
.framework-info .framework-info
span= _p('footer.driven') + ' ' span= _p('footer.driven') + ' '
a(href='http://hexo.io') a(href='https://hexo.io')
span Hexo span Hexo
span.footer-separator | span.footer-separator |
span= _p('footer.theme') + ' ' span= _p('footer.theme') + ' '

View File

@@ -1 +0,0 @@
#gallery!= page.content

View File

@@ -1,124 +1,104 @@
- var without_index = url.replace('index.html', '') - var pageTitle
- var without_html = without_index.replace('.html', '') - if (is_archive()) pageTitle = _p('page.archives')
- var photo_check = is_post() ? page.cover || theme.avatar : theme.avatar - else if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
- var photo_link = url_check (photo_check) ? photo_check : config.url + photo_check - else if (is_category()) pageTitle = _p('page.category') + ': ' + page.category
- else if (is_month()) pageTitle += ': ' + page.month + '/' + page.year
- else if (is_year()) pageTitle += ': ' + page.year
- else if (is_current('/404.html', [strict])) pageTitle = _p('error_title')
- else pageTitle = page.title || config.title || ''
meta(http-equiv="x-dns-prefetch-control" content="on") - var isSubtitle = config.subtitle ? ' - ' + config.subtitle : ''
if theme.canonical - var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title
link(rel="canonical" href=without_html)
if theme.twitter_meta - var pageDescription = page_description()
meta(name="twitter:card" content="summary_large_image") - var pageKeywords
meta(name="twitter:title" content=pageTitle_no_include_blog_name) - if (page.keywords) pageKeywords = Array.isArray(page.keywords) ? (page.keywords).join(',') : ([]).join(',') || page.keywords
meta(name="twitter:description" content=pageDescription) - else if (page.tags && page.tags.length) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',')
meta(name="twitter:image" content=photo_link) - else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
- var pageAuthor = config.email ? config.author + ',' + config.email : config.author
- var pageCopyright = config.copyright || config.author
if theme.Open_Graph_meta meta(charset='UTF-8')
if is_post() meta(http-equiv="X-UA-Compatible" content="IE=edge")
meta(property="og:type" content="article") meta(name="viewport" content="width=device-width,initial-scale=1")
else title= tabTitle
meta(property="og:type" content="website") meta(name="description" content!=pageDescription)
if pageKeywords
meta(property="og:title" content=pageTitle_no_include_blog_name) meta(name="keywords" content=pageKeywords)
meta(property="og:url" content=without_html) meta(name="author" content=pageAuthor)
meta(property="og:site_name" content=config.title) meta(name="copyright" content=pageCopyright)
meta(property="og:description" content=pageDescription) meta(name ="format-detection" content="telephone=no")
meta(property="og:image" content=photo_link) !=favicon_tag(theme.favicon || config.favicon)
if theme.disable_baidu_transformation if theme.disable_baidu_transformation
meta(http-equiv="Cache-Control" content="no-transform") meta(http-equiv="Cache-Control" content="no-transform")
meta(http-equiv="Cache-Control" content="no-siteapp") meta(http-equiv="Cache-Control" content="no-siteapp")
if theme.douban
if theme.douban.meta && (is_current('/movies/', [strict]) || is_current('/books/', [strict]) || is_current('/games/', [strict]))
meta(name="referrer" content="no-referrer")
//- 預解析
!=partial('includes/head/dns_prefetch', {}, {cache:theme.fragment_cache})
//- 網站驗證
!=partial('includes/head/site_verification', {}, {cache:theme.fragment_cache})
//- Open_Graph
include ./head/Open_Graph.pug
//- PWA
if (theme.pwa && theme.pwa.enable)
!=partial('includes/head/pwa', {}, {cache:theme.fragment_cache})
script(src=url_for(theme.CDN.js_cookies))
if theme.darkmode.enable
!=partial('includes/head/darkmode', {}, {cache:theme.fragment_cache})
//- main css
link(rel='stylesheet', href=url_for(theme.CDN.main_css))
if theme.fontawesome_v5 && theme.fontawesome_v5.enable
link(rel='stylesheet', href=url_for(theme.CDN.fontawesome_v5))
else
link(rel='stylesheet', href=url_for(theme.CDN.fontawesome_v4))
if (theme.fancybox && theme.fancybox.enable)
link(rel='stylesheet', href=url_for(theme.CDN.fancybox_css))
if (theme.snackbar && theme.snackbar.enable)
link(rel='stylesheet', href=url_for(theme.CDN.snackbar_css))
if theme.canonical
link(rel="canonical" href=urlNoIndex())
if is_post() if is_post()
if(page.prev) if(page.prev)
link(rel="prev" title=page.prev.title href=url_for(page.prev.permalink) ) link(rel="prev" title=page.prev.title href=url_for(page.prev.permalink) )
if(page.next) if(page.next)
link(rel="next" title=page.next.title href=url_for(page.next.permalink) ) link(rel="next" title=page.next.title href=url_for(page.next.permalink) )
if theme.algolia_search.enable if theme.algolia_search.enable
link(rel="dns-prefetch" href="https://cdn.jsdelivr.net") link(rel="stylesheet" type="text/css" href=url_for(theme.CDN.algolia_search_css))
link(rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.1.1/dist/instantsearch.min.css") script(src=url_for(theme.CDN.algolia_search) defer)
script(src="https://cdn.jsdelivr.net/npm/instantsearch.js@2.1.1/dist/instantsearch.min.js" defer)
if (theme.gitment && theme.gitment.enable) //- comment css
link(rel="dns-prefetch" href="https://unpkg.com") include ./head/comment.pug
link(rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/gitment/style/default.min.css")
script(src="https://cdn.jsdelivr.net/npm/gitment/dist/gitment.browser.min.js")
script(src="https://cdn.jsdelivr.net/npm/blueimp-md5@2.10.0/js/md5.min.js")
if (theme.gitalk && theme.gitalk.enable)
link(rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.css")
if(theme.gitalk.js)
script(src=theme.gitalk.js)
else
script(src="https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js")
script(src="https://cdn.jsdelivr.net/npm/blueimp-md5@2.10.0/js/md5.min.js")
//- google_adsense
!=partial('includes/head/google_adsense', {}, {cache:theme.fragment_cache})
//- analytics
if (theme.pwa && theme.pwa.enable) !=partial('includes/head/analytics', {}, {cache:theme.fragment_cache})
link(rel="manifest" href=theme.pwa.manifest)
if(theme.pwa.theme_color)
meta(name="theme-color" content=theme.pwa.theme_color)
if(theme.pwa.theme_color)
meta(name="msapplication-TileColor" content=theme.pwa.theme_color)
if(theme.pwa.apple_touch_icon)
link(rel="apple-touch-icon" sizes="180x180" href=theme.pwa.apple_touch_icon)
if(theme.pwa.favicon_32_32)
link(rel="icon" type="image/png" sizes="32x32" href=theme.pwa.favicon_32_32)
if(theme.pwa.favicon_16_16)
link(rel="icon" type="image/png" sizes="16x16" href=theme.pwa.favicon_16_16)
if(theme.pwa.mask_icon)
link(rel="mask-icon" href=theme.pwa.mask_icon color="#5bbad5")
if theme.baidu_analytics
link(rel="dns-prefetch" href="https://hm.baidu.com")
script.
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?!{theme.baidu_analytics}";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
if theme.google_analytics
link(rel="dns-prefetch" href="https://www.google-analytics.com")
script.
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '!{theme.google_analytics}', 'auto');
ga('send', 'pageview');
if theme.google_site_verification
meta(name="google-site-verification" content=theme.google_site_verification)
if theme.bing_site_verification
meta(name="msvalidate.01" content=theme.bing_site_verification)
if theme.baidu_site_verification
meta(name="baidu-site-verification" content=theme.baidu_site_verification)
if theme.qihu_site_verification
meta(name="360-site-verification" content=theme.qihu_site_verification)
- var preload_archive_img = theme.archive_img ||theme.top_img || config.top_img
- var preload_tag_img = theme.tag_img ||theme.top_img || config.top_img
- var preload_category_img = theme.category_img ||theme.top_img || config.top_img
- var preload_img = page.top_img || theme.top_img || config.top_img
if (is_archive() && preload_archive_img)
link(rel="preload" href=url_for(preload_archive_img) as="image" )
else if (is_tag() && preload_tag_img)
link(rel="preload" href=url_for(preload_tag_img) as="image" )
else if (is_category() && preload_category_img)
link(rel="preload" href=url_for(preload_category_img) as="image" )
else if (!is_post() && preload_img)
link(rel="preload" href=url_for(preload_img) as="image" )
if theme.blog_title_font.font_link if theme.blog_title_font.font_link
link(rel='stylesheet', href=url_for(theme.blog_title_font.font_link)) link(rel='stylesheet', href=url_for(theme.blog_title_font.font_link))
//- global config
!=partial('includes/head/config', {}, {cache:theme.fragment_cache})
include ./head/config_site.pug
include ./head/noscript.pug
!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)})

View File

@@ -0,0 +1,19 @@
- var contentType = is_post() ? 'article' : 'website'
//- twitter meta
if theme.twitter_meta
meta(name="twitter:card" content="summary")
meta(name="twitter:title" content=pageTitle)
meta(name="twitter:description" content!=pageDescription)
meta(name="twitter:image" content=full_url_for(page.cover || theme.avatar.img))
//- Open_Graph
if theme.Open_Graph_meta
meta(property="og:type" content=contentType)
meta(property="og:title" content=pageTitle)
meta(property="og:url" content=urlNoIndex())
meta(property="og:site_name" content=config.title)
meta(property="og:description" content!=pageDescription)
meta(property="og:image" content=full_url_for(page.cover || theme.avatar.img))
meta(property="article:published_time" content=date_xml(page.date))
meta(property="article:modified_time" content=date_xml(page.updated))

View File

@@ -0,0 +1,22 @@
if theme.baidu_analytics
script.
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?!{theme.baidu_analytics}";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
if theme.google_analytics
script.
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '!{theme.google_analytics}', 'auto');
ga('send', 'pageview');
if theme.tencent_analytics
script(src=`https://tajs.qq.com/stats?sId=${theme.tencent_analytics}` charset="UTF-8")

View File

@@ -0,0 +1,14 @@
if (theme.facebook_comments.enable && page.comments !== false && !is_tag() && !is_category() && !is_archive() && !is_home())
if theme.facebook_comments.app_id
meta(property="fb:app_id" content=theme.facebook_comments.app_id )
if theme.facebook_comments.user_id
meta(property="fb:admins" content=theme.facebook_comments.user_id)
if (theme.disqusjs && theme.disqusjs.enable && page.comments !== false && !is_tag() && !is_category() && !is_archive() && !is_home())
link(rel="stylesheet" type="text/css" href=url_for(theme.CDN.disqusjs_css))
if (theme.gitalk && theme.gitalk.enable && page.comments !== false && !is_tag() && !is_category() && !is_archive() && !is_home())
link(rel="stylesheet" type="text/css" href=url_for(theme.CDN.gitalk_css))
script(src=url_for(theme.CDN.gitalk))
script(src=url_for(theme.CDN.blueimp_md5))

View File

@@ -42,16 +42,38 @@
copyright = JSON.stringify({ copyright = JSON.stringify({
languages: { languages: {
author: _p("copy_copyright.author") + ': ' + config.author, author: _p("copy_copyright.author") + ': ' + config.author,
link: _p("copy_copyright.link") + ': ' + without_html, link: _p("copy_copyright.link") + ': ',
source: _p("copy_copyright.source") + ': ' + config.title, source: _p("copy_copyright.source") + ': ' + config.title,
info: _p("copy_copyright.info") info: _p("copy_copyright.info")
} }
}) })
} }
var copy_copyright_js = theme.copy.enable && theme.copy.copyright var ClickShowText = 'undefined';
if (theme.ClickShowText && theme.ClickShowText.enable) {
ClickShowText = JSON.stringify({
text: theme.ClickShowText.text.join(","),
fontSize: theme.ClickShowText.fontSize
})
}
var Snackbar = 'undefined';
if (theme.snackbar && theme.snackbar.enable) {
Snackbar = JSON.stringify({
bookmark: {
message_prev: _p("Snackbar.bookmark.message_prev"),
message_next: _p("Snackbar.bookmark.message_next")
},
chs_to_cht: _p("Snackbar.chs_to_cht"),
cht_to_chs: _p("Snackbar.cht_to_chs"),
day_to_night: _p("Snackbar.day_to_night"),
night_to_day: _p("Snackbar.night_to_day"),
bgLight: theme.snackbar.bg_light,
bgDark: theme.snackbar.bg_dark,
position: theme.snackbar.position,
})
}
script. script.
var GLOBAL_CONFIG = { var GLOBAL_CONFIG = {
@@ -59,22 +81,28 @@ script.
algolia: !{algolia}, algolia: !{algolia},
localSearch: !{localSearch}, localSearch: !{localSearch},
translate: !{translate}, translate: !{translate},
highlight_copy: '!{theme.highlight_copy}',
highlight_lang: '!{theme.highlight_lang}',
highlight_shrink: '!{theme.highlight_shrink}',
copy: { copy: {
success: '!{_p("copy.success")}', success: '!{_p("copy.success")}',
error: '!{_p("copy.error")}', error: '!{_p("copy.error")}',
noSupport: '!{_p("copy.noSupport")}' noSupport: '!{_p("copy.noSupport")}'
}, },
bookmark: { bookmark: {
title: '!{_p("bookmark.title")}', message_prev: '!{_p("Snackbar.bookmark.message_prev")}',
message_prev: '!{_p("bookmark.message_prev")}', message_next: '!{_p("Snackbar.bookmark.message_next")}'
message_next: '!{_p("bookmark.message_next")}'
}, },
runtime_unit: '!{_p("runtime_unit")}', runtime_unit: '!{_p("runtime_unit")}',
runtime: !{theme.runtimeshow.enable},
copyright: !{copyright}, copyright: !{copyright},
copy_copyright_js: !{copy_copyright_js} ClickShowText: !{ClickShowText},
medium_zoom: !{theme.medium_zoom.enable},
fancybox: !{theme.fancybox.enable},
Snackbar: !{Snackbar},
baiduPush: !{theme.baidu_push && theme.baidu_push.enable},
highlightCopy: !{theme.highlight_copy},
highlightLang: !{theme.highlight_lang},
highlightShrink: '!{theme.highlight_shrink}',
isFontAwesomeV5: !{theme.fontawesome_v5 && theme.fontawesome_v5.enable},
isPhotoFigcaption: !{theme.photofigcaption}
} }

View File

@@ -0,0 +1,7 @@
script.
var GLOBAL_CONFIG_SITE = {
isPost: !{is_post()},
isHome: !{is_home()},
isSidebar: !{is_post() && page.toc !== false && theme.toc.enable && (toc(page.content) !== '' || page.encrypt == true )}
}

View File

@@ -0,0 +1,47 @@
script.
var autoChangeMode = '#{theme.darkmode.autoChangeMode}'
var t = Cookies.get("theme")
if (autoChangeMode == '1'){
var isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches
var isLightMode = window.matchMedia("(prefers-color-scheme: light)").matches
var isNotSpecified = window.matchMedia("(prefers-color-scheme: no-preference)").matches
var hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
if (t === undefined){
if (isLightMode) activateLightMode()
else if (isDarkMode) activateDarkMode()
else if (isNotSpecified || hasNoSupport){
console.log('You specified no preference for a color scheme or your browser does not support it. I Schedule dark mode during night time.')
var now = new Date()
var hour = now.getHours()
var isNight = hour < 6 || hour >= 18
isNight ? activateDarkMode() : activateLightMode()
}
} else if (t == 'light') activateLightMode()
else activateDarkMode()
} else if (autoChangeMode == '2'){
now = new Date();
hour = now.getHours();
isNight = hour < 6 || hour >= 18
if(t === undefined) isNight? activateDarkMode() : activateLightMode()
else if (t === 'light') activateLightMode()
else activateDarkMode()
} else {
if ( t == 'dark' ) activateDarkMode()
else if ( t == 'light') activateLightMode()
}
function activateDarkMode(){
document.documentElement.setAttribute('data-theme', 'dark')
if (document.querySelector('meta[name="theme-color"]') !== null){
document.querySelector('meta[name="theme-color"]').setAttribute('content','#000')
}
}
function activateLightMode(){
document.documentElement.setAttribute('data-theme', 'light')
if (document.querySelector('meta[name="theme-color"]') !== null){
document.querySelector('meta[name="theme-color"]').setAttribute('content','#fff')
}
}

View File

@@ -0,0 +1,22 @@
link(rel="preconnect" href="//cdn.jsdelivr.net")
link(rel="dns-prefetch" href="//cdn.jsdelivr.net")
if theme.google_analytics
link(rel="preconnect" href="https://www.google-analytics.com" crossorigin)
link(rel="dns-prefetch" href="https://www.google-analytics.com")
if theme.baidu_analytics
link(rel="preconnect" href="https://hm.baidu.com")
link(rel="dns-prefetch" href="https://hm.baidu.com")
if theme.tencent_analytics
link(rel="preconnect" href="http://ta.qq.com")
link(rel="dns-prefetch" href="http://ta.qq.com")
if theme.blog_title_font.font_link
link(rel="preconnect" href="https://fonts.googleapis.com" crossorigin)
link(rel="dns-prefetch" href="https://fonts.googleapis.com")
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
link(rel="preconnect" href="//busuanzi.ibruce.info")
link(rel="dns-prefetch" href="//busuanzi.ibruce.info")

View File

@@ -0,0 +1,7 @@
if (theme.google_adsense && theme.google_adsense.enable)
script(async src=theme.google_adsense.js)
script.
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: '!{theme.google_adsense.client}',
enable_page_level_ads: '!{theme.google_adsense.enable_page_level_ads}'
});

View File

@@ -0,0 +1,9 @@
noscript.
<style>
#page-header {
opacity: 1
}
.justified-gallery img{
opacity: 1
}
</style>

View File

@@ -0,0 +1,13 @@
link(rel="manifest" href=theme.pwa.manifest)
if(theme.pwa.theme_color)
meta(name="theme-color" content=theme.pwa.theme_color)
if(theme.pwa.theme_color)
meta(name="msapplication-TileColor" content=theme.pwa.theme_color)
if(theme.pwa.apple_touch_icon)
link(rel="apple-touch-icon" sizes="180x180" href=theme.pwa.apple_touch_icon)
if(theme.pwa.favicon_32_32)
link(rel="icon" type="image/png" sizes="32x32" href=theme.pwa.favicon_32_32)
if(theme.pwa.favicon_16_16)
link(rel="icon" type="image/png" sizes="16x16" href=theme.pwa.favicon_16_16)
if(theme.pwa.mask_icon)
link(rel="mask-icon" href=theme.pwa.mask_icon color="#5bbad5")

View File

@@ -0,0 +1,11 @@
if theme.google_site_verification
meta(name="google-site-verification" content=theme.google_site_verification)
if theme.bing_site_verification
meta(name="msvalidate.01" content=theme.bing_site_verification)
if theme.baidu_site_verification
meta(name="baidu-site-verification" content=theme.baidu_site_verification)
if theme.qihu_site_verification
meta(name="360-site-verification" content=theme.qihu_site_verification)

View File

@@ -0,0 +1,130 @@
if theme.subtitle.enable
- var source = theme.subtitle.source
- var subtitleEffect = theme.subtitle.effect
if subtitleEffect
script(src=url_for(theme.CDN.typed))
if source == '1'
script.
var subtitleType = function () {
var subtitleEffect = !{ subtitleEffect }
fetch('https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json',)
.then(function (res) {
return res.json()
})
.then(function (data) {
if (subtitleEffect) {
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',')
var both = sub.unshift(data.text)
var typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = data.text
}
})
.catch(function (err) {
console.error(err)
})
}
window.addEventListener('load', subtitleType)
else if source == '2'
script.
var subtitleType = function () {
var subtitleEffect = !{ subtitleEffect }
fetch('https://v1.hitokoto.cn')
.then(function (res) {
return res.json()
})
.then(function (data) {
if (subtitleEffect) {
var from = '出自 ' + data.from
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',')
var both = sub.unshift(data.hitokoto, from)
var typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = data.hitokoto
}
})
.catch(function (err) {
console.error(err)
})
}
window.addEventListener('load', subtitleType)
else if source == '3'
script.
var subtitleType = function () {
loadScript('http://yijuzhan.com/api/word.php?m=js', function () {
var subtitleEffect = !{ subtitleEffect }
var con = str[0]
if (subtitleEffect) {
var from = '出自 ' + str[1]
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',')
var both = sub.unshift(con, from)
var typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = con
}
})
}
window.addEventListener('load', subtitleType)
else if source == '4'
script.
var subtitleType = function () {
loadScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js',function () {
var subtitleEffect = !{ subtitleEffect }
jinrishici.load(function (result) {
if (subtitleEffect) {
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',')
var content = result.data.content
var both = sub.unshift(content)
var typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = result.data.content
}
})
}
)
}
window.addEventListener('load', subtitleType)
else
script.
var subtitleEffect = !{subtitleEffect}
if (subtitleEffect) {
var typed = new Typed("#subtitle", {
strings: '!{theme.subtitle.sub}'.split(","),
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50
})
} else {
document.getElementById("subtitle").innerHTML = '!{theme.subtitle.sub[0]}'
}

View File

@@ -1,13 +0,0 @@
#header
#page-header
span#blog_name.pull-left
a#site-name.blog_title(href=url_for('/')) #[=config.title]
i.fa.fa-bars.fa-fw.toggle-menu.pull-right.close(aria-hidden="true")
span.pull-right.menus
.menus_items
include menu_item.pug
span#search_button.pull-right
if (theme.algolia_search.enable || theme.local_search && theme.local_search.enable)
a.site-page.social-icon.search
i.fa.fa-search.fa-fw
span=' '+_p('search')

View File

@@ -0,0 +1,17 @@
#page-header
span#blog_name.pull_left
a#site-name.blog_title(href=url_for('/')) #[=config.title]
span.pull_right.menus
if (theme.algolia_search.enable || theme.local_search && theme.local_search.enable)
#search_button
a.site-page.social-icon.search
i.fa.fa-search.fa-fw
span=' '+_p('search')
!=fragment_cache('menus', function(){return partial('includes/header/menu_item')})
span.toggle-menu.close
a.site-page
i.fa.fa-bars.fa-fw(aria-hidden="true")

View File

@@ -0,0 +1,43 @@
if is_home()
- var top_img = theme.index_img || theme.default_top_img
else if is_post()
- var top_img = page.top_img || page.cover || page.randomcover || theme.default_top_img
else if is_archive()
- var top_img = theme.archive_img || theme.default_top_img
else if is_tag()
- var top_img = theme.tag_img || theme.default_top_img
else if is_category()
- var top_img = theme.category_img || theme.default_top_img
else
- var top_img = page.top_img || theme.default_top_img
if theme.douban
if is_current('/movies/', [strict])
- var top_img = theme.douban.movies_img || theme.default_top_img
else if is_current('/books/', [strict])
- var top_img = theme.douban.books_img || theme.default_top_img
else if is_current('/games/', [strict])
- var top_img = theme.douban.games_img || theme.default_top_img
- var bg_img = top_img && top_img !== true ? `background-image: url(${top_img})` : ''
- var site_title = is_archive() ? _p('page.archives') : page.title || page.tag || page.category || config.title
- var isHomeClass = is_home() ? 'full_page' : 'not-index-bg'
- is_post() ? isHomeClass = 'post-bg' : isHomeClass
#nav(class=isHomeClass style=bg_img)
!=partial('includes/header/header', {}, {cache:theme.fragment_cache})
if is_home()
#site-info
h1#site_title=site_title
#site_subtitle
span#subtitle
if(theme.social)
#site_social_icons
!=fragment_cache('social', function(){return partial('includes/header/social')})
#scroll_down
i.fa.fa-angle-down.scroll-down-effects
else if is_post()
include ./post-info.pug
else
#page_site-info
h1#site_title=site_title

View File

@@ -0,0 +1,19 @@
.menus_items
each value, label in theme.menu
if !Array.isArray(value)
.menus_item
a.site-page(href=url_for(trim(value.split('||')[0])))
i.fa-fw(class=trim(value.split('||')[1]))
span=' '+label
else
.menus_item
a.site-page
i.fa-fw(class=trim(label.split('||')[1]) aria-hidden="true")
span=' '+ trim(label.split('||')[0])
i.fa.fa-chevron-down.menus-expand(aria-hidden="true")
ul.menus_item_child
each i in value
li
a.site-page(href=url_for(trim(i.split('||')[1])))
i.fa-fw(class=trim(i.split('||')[2]))
span=' '+trim(i.split('||')[0])

View File

@@ -0,0 +1,91 @@
#post-info
#post-title
.posttitle= page.title || _p('no_title')
#post-meta
.meta-firstline
if (theme.post_meta.post.date_type)
if (theme.post_meta.post.date_type === 'both')
time.post-meta__date
span.post-meta__date-created(title= _p('post.created')+' '+full_date(page.date))
i.fa.fa-calendar(aria-hidden="true")
=' '+_p('post.created')+' '+date(page.date, config.date_format)
span.post-meta__separator |
span.post-meta__date-updated(title= _p('post.updated')+' '+full_date(page.updated))
i.fa.fa-history(aria-hidden="true")
=' '+_p('post.updated')+' '+date(page.updated, config.date_format)
else
- var data_type_update = theme.post_meta.post.date_type === 'updated'
- var date_type = data_type_update ? 'updated' : 'date'
- var date_icon = data_type_update ? 'fa-history' :'fa-calendar'
- var data_info = data_type_update ? _p('post.updated') : _p('post.created')
time.post-meta__date(title=data_info + ' ' + full_date(page[date_type]))
i.fa(class=date_icon aria-hidden="true")
=' ' + data_info + ' ' + date(page[date_type], config.date_format)
if (theme.post_meta.post.categories && page.categories.data.length > 0)
span.post-meta__categories
if (theme.post_meta.post.date_type)
span.post-meta__separator |
each item, index in page.categories.data
i.fa.fa-inbox.post-meta__icon(aria-hidden="true")
a(href=url_for(item.path)).post-meta__categories #[=item.name]
if (index < page.categories.data.length - 1)
i.fa.fa-angle-right.post-meta__separator(aria-hidden="true")
.meta-secondline
- let postWordcount = theme.wordcount.enable && (theme.wordcount.post_wordcount || theme.wordcount.min2read)
if (postWordcount)
span.post-meta-wordcount
if theme.wordcount.post_wordcount
- var wordCountIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-file-word' : 'fa fa-file-word-o'
i.post-meta__icon(class=wordCountIcon aria-hidden="true")
span= _p('post.wordcount') + ':'
span.word-count= wordcount(page.content)
if theme.wordcount.min2read
span.post-meta__separator |
if theme.wordcount.min2read
- var readCountIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-clock' : 'fa fa-clock-o'
i.post-meta__icon(class=readCountIcon aria-hidden="true")
span= _p('post.min2read', min2read(page.content, {cn: 350, en: 160}))
.meta-thirdline
span.post-meta-pv-cv
if (postWordcount && theme.busuanzi.page_pv)
span.post-meta__separator |
if theme.busuanzi.page_pv
i.fa.fa-eye.post-meta__icon(aria-hidden="true")
span=_p('post.page_pv') + ':'
span#busuanzi_value_page_pv
span.post-meta-commentcount
- var commentCount = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-comments' : 'fa fa-comment-o'
if ((theme.disqus && theme.disqus.enable && theme.disqus.count && page.comments !== false) || (theme.disqusjs && theme.disqusjs.enable && theme.disqusjs.count && page.comments !== false))
if (postWordcount || theme.busuanzi.page_pv)
span.post-meta__separator |
i.post-meta__icon(class=commentCount aria-hidden="true")
span= _p('post.comments') + ':'
span.disqus-comment-count.comment-count
a(href=full_url_for(page.path) + '#disqus_thread')
else if (theme.valine && theme.valine.enable && theme.valine.count && page.comments !== false)
if (postWordcount || theme.busuanzi.page_pv)
span.post-meta__separator |
i.post-meta__icon(class=commentCount aria-hidden="true")
span= _p('post.comments') + ':'
a(href=url_for(page.path) + '#post-comment' itemprop="discussionUrl")
span.valine-comment-count.comment-count(data-xid=url_for(page.path) itemprop="commentCount")
else if (theme.gitalk && theme.gitalk.enable && theme.gitalk.count && page.comments !== false)
if (postWordcount || theme.busuanzi.page_pv)
span.post-meta__separator |
i.post-meta__icon(class=commentCount aria-hidden="true")
span= _p('post.comments') + ':'
a(href=url_for(page.path) + '#post-comment')
span.gitalk-comment-count.comment-count
else if theme.facebook_comments.enable && theme.facebook_comments.count && page.comments !== false
if (postWordcount || theme.busuanzi.page_pv)
span.post-meta__separator |
i.post-meta__icon(class=commentCount aria-hidden="true")
span= _p('post.comments') + ':'
a.comment-count(href=url_for(page.path) + '#post-comment')
span.fb-comments-count(data-href=urlNoIndex())

View File

@@ -0,0 +1,4 @@
each url, icon in theme.social
a.social-icon(href=trim(url.split('||')[0]) target="_blank"
title=url.split('||')[1] === undefined ? '' : trim(url.split('||')[1]))
i(class=icon aria-hidden="true")

View File

@@ -1,93 +1,45 @@
- var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : ''
- var pageTitle = page.title || config.subtitle || ''
- if (is_archive()) pageTitle = _p('page.archives')
- if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
- if (is_category()) pageTitle = _p('page.category') + ': ' + page.category
- if (is_month()) pageTitle += ': ' + page.month + '/' + page.year
- if (is_year()) pageTitle += ': ' + page.year
- var pageTitle_saved //- 暫時存儲pageTitle
- var pageTitle_no_include_blog_name //- 存儲pageTitle 不帶 " | "meta用
- var home_subtitle_true //有subtitle
//- home時顯示config.title (JerryC),其他顯示 pageTitle。meta用
- is_home() ? pageTitle_no_include_blog_name = config.title : pageTitle_no_include_blog_name = pageTitle
//- 暫時存儲pageTitle
- pageTitle ? pageTitle_saved = pageTitle + ' | ' + config.title : pageTitle_saved = config.title
//- 是否有 config.subtitle 是各自显示
- config.subtitle ? home_subtitle_true = ' - ' + config.subtitle : home_subtitle_true = ''
//- home時pageTitle顯示 JerryC - subtitle其他顯示 pageTitle | JerryC
- is_home() ? pageTitle = config.title + home_subtitle_true : pageTitle = pageTitle_saved
//- 判断keywords
- var pageDescription = page.description || page.title || config.description || ''
- var pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
- if (page.tags && page.tags.data) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',')
- var pageAuthor = config.email ? config.author + ',' + config.email : config.author
- var pageCopyright = config.copyright || config.author
- var body_class = theme.display_mode == 'night' ? 'night-mode' : ''
doctype html doctype html
html(lang=config.language) html(lang=config.language data-theme=theme.display_mode)
head head
meta(charset='UTF-8')
meta(http-equiv="X-UA-Compatible" content="IE=edge")
meta(name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1")
title= pageTitle
meta(name="description" content=pageDescription)
meta(name="keywords" content=pageKeywords)
meta(name="author" content=pageAuthor)
meta(name="copyright" content=pageCopyright)
meta(name ="format-detection" content="telephone=no")
!=favicon_tag(config.favicon || theme.favicon || '/favicon.ico')
if theme.stylesheets !== undefined && theme.stylesheets.length > 0
each url in theme.stylesheets
link(rel='stylesheet', href=url_for(url))
each item in theme.cdn.css
if item !== undefined
link(rel='stylesheet', href=item)
include ./head.pug include ./head.pug
include ./config.pug body
body(class=body_class) if theme.preloader
!=partial('includes/loading/loading', {}, {cache:theme.fragment_cache})
if theme.fireworks && theme.fireworks.enable if theme.fireworks && theme.fireworks.enable
canvas.fireworks canvas.fireworks
include ./header.pug
include ./mobile-sidebar.pug !=partial('includes/mobile-sidebar/index', {}, {cache:theme.fragment_cache})
include ./sidebar.pug
#body-wrap #body-wrap
if theme.background if theme.background
#web_bg - var is_photo = theme.background.substring(3,0) === 'url' ? 'photo':'color'
if (is_post() && page.toc != false && theme.toc.enable) #web_bg(data-type=is_photo)
i.fa.fa-arrow-right#toggle-sidebar(aria-hidden="true") include ./header/index.pug
include ./sidebar.pug
if (!is_post()) if (!is_post())
include ./nav.pug main#content-inner.layout_page(class=hideAside)
#content-outer
block top_img
if (!is_post())
#content-inner.layout_page
if body if body
div!= body div!= body
else else
block content block content
include widget/index.pug
else else
#content-inner.layout.layout_post main#content-inner.layout_post
if body if body
div!= body div!= body
else else
block content block content
- var footer_bg = theme.footer_bg == false ? '' : bg_img - var footer_bg = theme.footer_bg == false ? '' : bg_img
footer(style=footer_bg) - var is_bg = theme.footer_bg == false ? 'color' : 'photo'
include ./footer.pug footer#footer(style=footer_bg data-type=is_bg)
!=partial('includes/footer', {}, {cache:theme.fragment_cache})
include ./rightside.pug include ./rightside.pug
each item in theme.cdn.js !=partial('includes/search/index', {}, {cache:theme.fragment_cache})
if item !== undefined
script(src=url_for(item))
if theme.scripts !== undefined && theme.scripts.length > 0
//- scripts list from config.yml
each url in theme.scripts
script(src=url_for(url))
include ./additional-js.pug include ./additional-js.pug
include ./search/index.pug

View File

@@ -0,0 +1,6 @@
script.
var endLoading = function () {
document.body.style.overflow = 'auto';
document.getElementById('loading-box').classList.add("loaded")
}
window.addEventListener('load',endLoading)

View File

@@ -0,0 +1,9 @@
#loading-box
.loading-left-bg
.loading-right-bg
.spinner-box
.configure-border-1
.configure-core
.configure-border-2
.configure-core
.loading-word= _p('loading')

View File

@@ -0,0 +1,15 @@
if theme.mathjax && theme.mathjax.enable
if theme.mathjax.per_page
if(!is_tag() && !is_category() && !is_archive() && !is_home())
include ./mathjax.pug
else
if page.mathjax
include ./mathjax.pug
if theme.katex && theme.katex.enable
if theme.katex.per_page
if(!is_tag() && !is_category() && !is_archive() && !is_home())
include ./katex.pug
else
if page.katex
include ./katex.pug

View File

@@ -0,0 +1,7 @@
link(rel="stylesheet" type="text/css" href=theme.CDN.katex)
script(src=url_for(theme.CDN.katex_copytex))
link(rel="stylesheet" type="text/css" href=theme.CDN.katex_copytex_css)
script.
$(function () {
$('span.katex-display').wrap('<div class="katex-wrap"></div>')
})

View File

@@ -24,4 +24,4 @@ script(type="text/x-mathjax-config").
} }
}); });
script(src=theme.mathjax.cdn) script(src=theme.CDN.mathjax)

View File

@@ -0,0 +1,8 @@
script.
if (document.getElementsByClassName('mermaid').length) {
loadScript('!{theme.CDN.mermaid}',function () {
mermaid.initialize({
theme: '!{theme.mermaid.theme}',
})
})
}

View File

@@ -1,20 +0,0 @@
each value, label in theme.menu
if !Array.isArray(value)
.menus_item
a.site-page(href=trim(value.split('||')[0]))
i.fa-fw(class=trim(value.split('||')[1]))
span=' '+label
else
.menus_item
a.site-page
i.fa-fw(class=trim(label.split('||')[1]) aria-hidden="true")
span=' '+ trim(label.split('||')[0])
i.fa.fa-chevron-down.menus-expand(aria-hidden="true")
ul.menus_item_child
each i in value
li
a.site-page(href=trim(i.split('||')[1]))
i.fa-fw(class=trim(i.split('||')[2]))
span=' '+trim(i.split('||')[0])
script.
document.body.addEventListener('touchstart', function(){ });

View File

@@ -1,41 +0,0 @@
mixin UI_NEW(posts)
- posts.each(function(article,index){
.recent-post-item.article-container
- var link = article.link || article.path
if index%2 == 0
.post_cover.is_left
a(href=url_for(link) title=article.title || _p('no_title'))
- var post_cover = article.cover
if theme.lazyload.enable
img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
else
img.post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
else
.post_cover.is_right
a(href=url_for(link) title=article.title || _p('no_title'))
- var post_cover = article.cover
if theme.lazyload.enable
img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
else
img.post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.recent-post-info
a.article-title(href=url_for(link) title= article.title || _p('no_title'))= article.title || _p('no_title')
if (theme.post_meta.date_type)
- var date_type = theme.post_meta.date_type == 'updated' ? 'updated' : 'date'
time.post-meta__date #[i.fa.fa-calendar(aria-hidden="true")] #[=date(article[date_type], config.date_format)]
if (theme.post_meta.categories && article.categories.data.length > 0)
span.article-meta
span.article-meta__separator |
each item, index in article.categories.data
i.fa.fa-inbox.article-meta__icon(aria-hidden="true")
a(href=url_for(item.path)).article-meta__categories #[=item.name]
if (index < article.categories.data.length - 1)
i.fa.fa-angle-right(aria-hidden="true")
if theme.auto_excerpt && theme.auto_excerpt.enable
- const content = strip_html(article.content)
- let expert = content.substring(0, theme.auto_excerpt.length)
- content.length > theme.auto_excerpt.length ? expert += ' ...' : ''
.content!= expert
else
.content!= article.description
- })

View File

@@ -3,16 +3,18 @@ mixin articleSort(posts)
- var year - var year
- posts.each(function (article) { - posts.each(function (article) {
- var tempYear = date(article.date, 'YYYY') - var tempYear = date(article.date, 'YYYY')
- var no_cover = article.cover === false || !theme.cover.archives_enable ? 'no-article-cover' : ''
if tempYear !== year if tempYear !== year
- year = tempYear - year = tempYear
.article-sort-item.year= year .article-sort-item.year= year
.article-sort-item .article-sort-item(class=no_cover)
if article.cover && theme.cover.archives_enable
.article-sort-img .article-sort-img
a.article-sort-item__img(href=url_for(article.path)) a.article-sort-item__img(href=url_for(article.path))
img(src=article.cover) img(src=`${article.cover}` alt=article.title || 'No Title' onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'`)
.article-sort-post .article-sort-post
a.article-sort-item__post(href=url_for(article.path)) a.article-sort-item__post(href=url_for(article.path))
i.fa.fa-clock-o(aria-hidden="true") i.fa.fa-clock-o(aria-hidden="true")
time.article-sort-item__time= date(article.date) time.article-sort-item__time(title=_p('post.created') + ' ' + full_date(article.date))= date(article.date, config.date_format)
.article-sort-item__title= article.title || 'No Title' .article-sort-item__title= article.title || 'No Title'
- }) - })

View File

@@ -0,0 +1,68 @@
mixin postUI(posts)
each article , index in page.posts.data
.recent-post-item
- var link = article.link || article.path
- var title = article.title || _p('no_title')
- var leftOrRight = index%2 == 0 ? 'left_radius' : 'right_radius'
- var post_cover = article.cover
- var no_cover = article.cover === false || !theme.cover.index_enable ? 'no-cover' : ''
if post_cover && theme.cover.index_enable
.post_cover(class=leftOrRight)
a(href=url_for(link) title=title)
if theme.lazyload.enable
img.post_bg.lazyload(data-src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
else
img.post_bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
.recent-post-info(class=no_cover)
a.article-title(href=url_for(link) title=title)= title
.article-meta-wrap
if (is_home() && (article.top || article.sticky > 0))
span.article-meta
i.fa.fa-thumb-tack.article-meta__icon.sticky
span.sticky= _p('sticky')
span.article-meta__separator |
if (theme.post_meta.page.date_type)
if (theme.post_meta.page.date_type === 'both')
time.post-meta__date
span.post-meta__date-created(title=_p('post.created') + ' ' + full_date(article.date))
i.fa.fa-calendar(aria-hidden="true")
=date(article.date, config.date_format)
span.article-meta__separator |
span.post-meta__date-updated(title=_p('post.updated') + ' ' + full_date(article.updated))
i.fa.fa-history(aria-hidden="true")
=date(article.updated, config.date_format)
else
- var data_type_updated = theme.post_meta.page.date_type === 'updated'
- var date_type = data_type_updated ? 'updated' : 'date'
- var date_icon = data_type_updated ? 'fa-history' :'fa-calendar'
- var date_title = data_type_updated ? _p('post.updated') : _p('post.created')
time.post-meta__date(title=date_title + ' ' + full_date(article[date_type]))
i.fa(class=date_icon aria-hidden="true")
=date(article[date_type], config.date_format)
if (theme.post_meta.page.categories && article.categories.data.length > 0)
span.article-meta
span.article-meta__separator |
each item, index in article.categories.data
i.fa.fa-inbox.article-meta__icon(aria-hidden="true")
a(href=url_for(item.path)).article-meta__categories #[=item.name]
if (index < article.categories.data.length - 1)
i.fa.fa-angle-right(aria-hidden="true")
if (theme.post_meta.page.tags && article.tags.data.length > 0)
span.article-meta.tags
span.article-meta__separator |
each item, index in article.tags.data
i.fa.fa-tag.article-meta__icon(aria-hidden="true")
a(href=url_for(item.path)).article-meta__tags #[=item.name]
if (index < article.tags.data.length - 1)
span.article-meta__link -
if theme.auto_excerpt && theme.auto_excerpt.enable
- const content = strip_html(article.content)
- let expert = content.substring(0, theme.auto_excerpt.length)
- content.length > theme.auto_excerpt.length ? expert += ' ...' : ''
.content!= expert
else
.content!= article.description
if theme.ad && theme.ad.index
if (index + 1) % 3 == 0
.recent-post-item.ad_height!=theme.ad.index

View File

@@ -1,46 +0,0 @@
#mobile-sidebar
#menu_mask
#mobile-sidebar-menus
.mobile_author_icon
img.lozad.avatar_img(src=url_for(theme.avatar) onerror=`onerror=null;src='${theme.lodding_bg.flink}'`)
.mobile_post_data
if site.posts.length
.mobile_data_item.is_center
.mobile_data_link
a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles')
.length_num= site.posts.length
if site.tags.length
.mobile_data_item.is_center
.mobile_data_link
a(href=url_for(config.tag_dir) + '/' )
.headline= _p('aside.tags')
.length_num= site.tags.length
if site.categories.length
.mobile_data_item.is_center
.mobile_data_link
a(href=url_for(config.category_dir) + '/')
.headline= _p('aside.categories')
.length_num= site.categories.length
hr
.menus_items
include menu_item.pug
- const showToc = is_post() && page.toc != false && theme.toc.enable
-
let tocNumber
if (page.toc_number !== undefined) tocNumber = page.toc_number
else if (theme.toc.number !== undefined) tocNumber = theme.toc.number
else tocNumber = true
-
if (showToc)
#mobile-sidebar-toc
.toc_mobile_headline= _p('sidebar.catalog')
if (page.encrypt == true)
.toc-div-class(style="display:none")!=toc(page.origin,{"class":"toc_mobile_items",list_number:tocNumber})
else
!=toc(page.content,{"class":"toc_mobile_items",list_number:tocNumber})

View File

@@ -0,0 +1,3 @@
#mobile-sidebar
#menu_mask
include ../mobile-sidebar/mobile-menus.pug

View File

@@ -0,0 +1,26 @@
#mobile-sidebar-menus
.mobile_author_icon
img.avatar-img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.lodding_bg.flink}'` alt="avatar")
.mobile_post_data
if site.posts.length
.mobile_data_item.is-center
.mobile_data_link
a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles')
.length_num= site.posts.length
if site.tags.length
.mobile_data_item.is-center
.mobile_data_link
a(href=url_for(config.tag_dir) + '/' )
.headline= _p('aside.tags')
.length_num= site.tags.length
if site.categories.length
.mobile_data_item.is-center
.mobile_data_link
a(href=url_for(config.category_dir) + '/')
.headline= _p('aside.categories')
.length_num= site.categories.length
hr
!=fragment_cache('menus', function(){return partial('includes/header/menu_item')})

View File

@@ -1,39 +0,0 @@
if is_archive()
- var top_img = theme.archive_img ||theme.top_img || config.top_img
else if is_tag()
- var top_img = theme.tag_img ||theme.top_img || config.top_img
else if is_category()
- var top_img = theme.category_img ||theme.top_img || config.top_img
else
- var top_img = page.top_img||theme.top_img || config.top_img
- var bg_img = top_img && top_img !== true ? `background-image: url(${top_img})` : ''
if is_home()
nav#nav.full_page
.nav_bg(style=bg_img)
#site-info
#site-title
span.blogtitle= page.title || page.tag || page.category || config.title
#site-sub-title
span.subtitle
if(theme.social)
#site-social-icons
each url, icon in theme.social
a.social-icon(href=url target="_blank")
i(class=icon)
.scroll-down
i.fa.fa-angle-down.scroll-down-effects
else
nav#nav.not_index_bg
.nav_bg(style=bg_img)
#page_site-info
#site-title
if (is_archive())
span.blogtitle= _p('archives')
else
span.blogtitle= page.title || page.tag || page.category || config.title

View File

@@ -1,6 +0,0 @@
- site.tags.sort('path').each(function (tags){
- var fontSize = Math.floor(Math.random() * 15 + 15) + "px"; //15 ~ 30
- var color = "rgb(" + Math.floor(Math.random() * 201) + ", " + Math.floor(Math.random() * 201) +", " + Math.floor(Math.random() * 201) +")"; // 0,0,0 -> 200,200,200
a(href=url_for(tags.path) style='font-size:' + fontSize + ';color:' + color)=tags.name
-})

View File

@@ -1,8 +1,9 @@
- -
var options = { var options = {
prev_text: '<i class="fa fa-chevron-left"></i>', prev_text: '<i class="fa fa-fw fa-chevron-left" aria-hidden="true"></i>',
next_text: '<i class="fa fa-chevron-right"></i>', next_text: '<i class="fa fa-fw fa-chevron-right" aria-hidden="true"></i>',
mid_size: 1 mid_size: 1,
escape: false
} }
if(!is_post()) if(!is_post())
@@ -12,51 +13,27 @@ if(!is_post())
else else
nav#pagination.pagination_post nav#pagination.pagination_post
if(page.prev) if(page.prev)
if(page.next) - var hasPageNext = page.prev ? 'pull_left' : 'pull-full'
.prev-post.pull-left .prev-post(class=hasPageNext)
- var pagination_cover = page.prev.cover - var pagination_cover = page.prev.cover === false ? page.prev.randomcover : page.prev.cover
a(href=url_for(page.prev.path)) a(href=url_for(page.prev.path))
if theme.lazyload.enable if theme.lazyload.enable
img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` ) img.prev_cover.lazyload(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` )
else else
img.prev_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` ) img.prev_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` )
.pagination-info
.label=_p('pagination.prev') .label=_p('pagination.prev')
.prev_info .prev_info=page.prev.title
span=page.prev.title
else
.prev-post.pull-full
- var pagination_cover = page.prev.cover
a(href=url_for(page.prev.path))
if theme.lazyload.enable
img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
else
img.prev_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.label=_p('pagination.prev')
.prev_info
span=page.prev.title
if(page.next) if(page.next)
if(page.prev) - var hasPagePrev = page.prev ? 'pull_right' : 'pull-full'
.next-post.pull-right - var pagination_cover = page.next.cover == false ? page.next.randomcover : page.next.cover
- var pagination_cover = page.next.cover .next-post(class=hasPagePrev)
a(href=url_for(page.next.path)) a(href=url_for(page.next.path))
if theme.lazyload.enable if theme.lazyload.enable
img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) img.next_cover.lazyload(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
else else
img.next_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`) img.next_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.pagination-info
.label=_p('pagination.next') .label=_p('pagination.next')
.next_info .next_info=page.next.title
span=page.next.title
else
.next-post.pull-full
- var pagination_cover = page.next.cover
a(href=url_for(page.next.path))
if theme.lazyload.enable
img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
else
img.next_cover(src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.label=_p('pagination.next')
.next_info
span=page.next.title

View File

@@ -0,0 +1,13 @@
if (theme.post_copyright && theme.post_copyright.enable && page.copyright != false)
.post-copyright
.post-copyright__author
span.post-copyright-meta= _p('post.copyright.author') + ": "
span.post-copyright-info
a(href=`mailto:${config.email}`) #[=config.author]
.post-copyright__type
span.post-copyright-meta= _p('post.copyright.link') + ": "
span.post-copyright-info
a(href=url_for(page.permalink))= theme.post_copyright.decode ? decodeURI(page.permalink) : page.permalink
.post-copyright__notice
span.post-copyright-meta= _p('post.copyright.copyright_notice') + ": "
span.post-copyright-info!= _p('post.copyright.copyright_content', theme.post_copyright.license_url, theme.post_copyright.license, config.url, config.title)

View File

@@ -1,11 +1,11 @@
.post-reward .post-reward
a.reward-button a.reward-button.button--primary.button--animated
i.fa.fa-qrcode i.fa.fa-qrcode
= ' ' + _p('donate') = ' ' + _p('donate')
.reward-main .reward-main
ul.reward-all ul.reward-all
each item in theme.reward.QR_code each item in theme.reward.QR_code
li.reward-item li.reward-item
img.lozad.post-qr-code__img(src=(item.itemlist||item).img) img.lazyload.post-qr-code__img(src=url_for((item.itemlist||item).img) alt=(item.itemlist||item).text)
.post-qr-code__desc=(item.itemlist||item).text .post-qr-code__desc=(item.itemlist||item).text

View File

@@ -1,46 +0,0 @@
each article , index in page.posts.data
.recent-post-item.article-container
- var link = article.link || article.path
if index%2 == 0
.post_cover.is_left
a(href=url_for(link) title=article.title || _p('no_title'))
- var post_cover = article.cover
if theme.lazyload.enable
img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
else
img.post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
else
.post_cover.is_right
a(href=url_for(link) title=article.title || _p('no_title'))
- var post_cover = article.cover
if theme.lazyload.enable
img.post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
else
img.post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.recent-post-info
a.article-title(href=url_for(link) title= article.title || _p('no_title'))= article.title || _p('no_title')
if (article.top)
span.article-meta
i.fa.fa-thumb-tack.article-meta__icon.sticky
span.sticky= _p('sticky')
span.article-meta__separator(style="margin-right: 0.3rem") |
if (theme.post_meta.date_type)
- var date_type = theme.post_meta.date_type == 'updated' ? 'updated' : 'date'
time.post-meta__date #[i.fa.fa-calendar(aria-hidden="true")] #[=date(article[date_type], config.date_format)]
if (theme.post_meta.categories && article.categories.data.length > 0)
span.article-meta
span.article-meta__separator |
each item, index in article.categories.data
i.fa.fa-inbox.article-meta__icon(aria-hidden="true")
a(href=url_for(item.path)).article-meta__categories #[=item.name]
if (index < article.categories.data.length - 1)
i.fa.fa-angle-right(aria-hidden="true")
if theme.auto_excerpt && theme.auto_excerpt.enable
- const content = strip_html(article.content)
- let expert = content.substring(0, theme.auto_excerpt.length)
- content.length > theme.auto_excerpt.length ? expert += ' ...' : ''
.content!= expert
else
.content!= article.description

View File

@@ -2,19 +2,22 @@ section#rightside.rightside
#rightside-config-hide #rightside-config-hide
if theme.readmode.enable && is_post() if theme.readmode.enable && is_post()
i#readmode.fa.fa-book(title=_p('rightside.readmode_title')) i#readmode.fa.fa-book(title=_p('rightside.readmode_title'))
if is_post()
i#font_plus.fa.fa-plus(title=_p('rightside.font_plus_title')) i#font_plus.fa.fa-plus(title=_p('rightside.font_plus_title'))
i#font_minus.fa.fa-minus(title=_p('rightside.font_minus_title')) i#font_minus.fa.fa-minus(title=_p('rightside.font_minus_title'))
if theme.translate && theme.translate.enable if theme.translate && theme.translate.enable
a#translateLink.translate_chn_to_cht(href="javascript:translatePage();" title=_p('rightside.translate_title'))= theme.translate.default a#translateLink.translate_chn_to_cht(href="javascript:translatePage();" title=_p('rightside.translate_title') target="_self")= theme.translate.default
if theme.nightshift && theme.nightshift.enable if theme.darkmode.enable && theme.darkmode.button
- var display_mode = theme.display_mode == 'night'? 'fa fa-sun-o' : 'fa fa-moon-o' - var lightModeIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-sun' : 'fa fa-sun-o'
i#nightshift.nightshift(class=display_mode title=_p('rightside.night_mode_title')) - var darkModeIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-moon' : 'fa fa-moon-o'
- var display_mode = theme.display_mode == 'dark' ? lightModeIcon : darkModeIcon
i#darkmode.darkmode(class=display_mode title=_p('rightside.night_mode_title'))
#rightside-config-show #rightside-config-show
#rightside_config(title=_p("rightside.setting")) #rightside_config(title=_p("rightside.setting"))
i.fa.fa-cog(aria-hidden="true") i.fa.fa-cog(aria-hidden="true")
if is_post() && page.comments !== false if is_post() && page.comments !== false && isComment
a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment")) a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment"))
i.scroll_to_comment.fa.fa-comments i.scroll_to_comment.fa.fa-comments
if is_post() && page.toc != false && theme.toc.enable if is_post() && page.toc !== false && theme.toc.enable && (toc(page.content) !== '' || page.encrypt == true )
i#mobile-toc-button.fa.fa-list-ul.close(title=_p("rightside.toc") aria-hidden="true") i#mobile-toc-button.fa.fa-list-ul.close(title=_p("rightside.toc") aria-hidden="true")
i.fa.fa-arrow-up#go-up(title=_p("rightside.back_to_top") aria-hidden="true") i.fa.fa-arrow-up#go-up(title=_p("rightside.back_to_top") aria-hidden="true")

View File

@@ -3,7 +3,7 @@
#local-input-panel #local-input-panel
#local-search-input #local-search-input
.local-search-box .local-search-box
input(placeholder=_p("local_search.input_placeholder")).local-search-box--input input(placeholder=_p("local_search.input_placeholder") type="text").local-search-box--input
hr hr
#local-search-results #local-search-results
#local-hits #local-hits

View File

@@ -4,6 +4,6 @@
a(class="a2a_button_" + name) a(class="a2a_button_" + name)
a.a2a_dd(href="https://www.addtoany.com/share") a.a2a_dd(href="https://www.addtoany.com/share")
script(async src="https://static.addtoany.com/menu/page.js") script(async src=url_for(theme.CDN.addtoany))

View File

@@ -1,4 +1,4 @@
if (theme.sharejs && theme.sharejs.enable) if (theme.sharejs && theme.sharejs.enable)
.social-share(data-image= page.cover|| theme.avatar data-sites= theme.sharejs.sites) .social-share(data-image= page.cover|| theme.avatar.img data-sites= theme.sharejs.sites)
link(rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js@1.0.16/dist/css/share.min.css") link(rel="stylesheet" href=url_for(theme.CDN.sharejs_css))
script(src="https://cdn.jsdelivr.net/npm/social-share.js@1.0.16/dist/js/social-share.min.js") script(src=url_for(theme.CDN.sharejs))

View File

@@ -1,15 +1,16 @@
- let showToc = is_post() && page.toc !== false && theme.toc.enable && (toc(page.content) !== '' || page.encrypt == true )
- let autoOpenSidebar = theme.auto_open_sidebar.enable === true ? 'on' : ''
- var sidebar_class = theme.auto_open_sidebar.enable === true ? 'auto_open' : ''
#sidebar(class=sidebar_class)
- const showToc = is_post() && page.toc != false && theme.toc.enable
- -
let tocNumber let tocNumber
if (page.toc_number !== undefined) tocNumber = page.toc_number if (page.toc_number !== undefined) tocNumber = page.toc_number
else if (theme.toc.number !== undefined) tocNumber = theme.toc.number else if (theme.toc.number !== undefined) tocNumber = theme.toc.number
else tocNumber = true else tocNumber = true
- -
if(showToc) if(showToc)
i.fa.fa-arrow-right#toggle-sidebar(aria-hidden="true" class=autoOpenSidebar)
#sidebar
.sidebar-toc .sidebar-toc
div.sidebar-toc__title= _p('sidebar.catalog') div.sidebar-toc__title= _p('sidebar.catalog')
div.sidebar-toc__progress div.sidebar-toc__progress

View File

@@ -1 +1 @@
script(color=theme.canvas_nest.color opacity=theme.canvas_nest.opacity zIndex=theme.canvas_nest.zIndex count=theme.canvas_nest.count src=url_for(theme.canvas_nest.script)) script#canvas_nest(color=theme.canvas_nest.color opacity=theme.canvas_nest.opacity zIndex=theme.canvas_nest.zIndex count=theme.canvas_nest.count mobile=`${theme.canvas_nest.mobile}` src=url_for(theme.CDN.canvas_nest))

View File

@@ -1 +1 @@
script(id="ribbon" src=url_for('https://cdn.jsdelivr.net/gh/jerryc127/CDN@latest/js/piao.js')) script(id="ribbon_piao" mobile=`${theme.canvas_ribbon_piao.mobile}` src=url_for(theme.CDN.canvas_ribbon_piao))

View File

@@ -1,3 +1,3 @@
script(id="ribbon" src=url_for('/js/third-party/canvas-ribbon.js') size=theme.canvas_ribbon.size script(defer id="ribbon" src=url_for(theme.CDN.canvas_ribbon) size=theme.canvas_ribbon.size
alpha=theme.canvas_ribbon.alpha zIndex=theme.canvas_ribbon.zIndex data-click=`${theme.canvas_ribbon.click_to_change}`) alpha=theme.canvas_ribbon.alpha zIndex=theme.canvas_ribbon.zIndex mobile=`${theme.canvas_ribbon.mobile}` data-click=`${theme.canvas_ribbon.click_to_change}`)

View File

@@ -1,7 +0,0 @@
link(rel="stylesheet" type="text/css" href=theme.katex.cdn.css)
script(src='https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.js')
link(rel="stylesheet" type="text/css" href='https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.css')
script.
$(function () {
$('span.katex-display').wrap('<div class="katex-wrap"></div>')
})

13
layout/includes/third-party/pangu.pug vendored Normal file
View File

@@ -0,0 +1,13 @@
script(src=url_for(theme.CDN.pangu))
if theme.pangu.field === 'post'
if is_post()
script.
document.addEventListener('DOMContentLoaded', function() {
pangu.spacingElementById('content-inner')
})
else if theme.pangu.field === 'page'
script.
document.addEventListener('DOMContentLoaded', function() {
pangu.spacingElementById('content-inner')
})

View File

@@ -0,0 +1,2 @@
.card-widget.card-ad
!= theme.ad.aside

View File

@@ -1,6 +1,6 @@
.card_widget.card-announcement .card-widget.card-announcement
.card-content .card-content
.item_headline .item-headline
i.fa.fa-bullhorn.card-announcement-animation(aria-hidden="true") i.fa.fa-bullhorn.card-announcement-animation(aria-hidden="true")
span= _p('aside.card_announcement') span= _p('aside.card_announcement')
.announcement_content= theme.announcement.content .announcement_content!= theme.aside.card_announcement.content

View File

@@ -1,6 +1,11 @@
.card_widget.card-archives .card-widget.card-archives
.card-content .card-content
.item_headline .item-headline
i.fa.fa-archive(aria-hidden="true") i.fa.fa-archive(aria-hidden="true")
span= _p('aside.card_archives') span= _p('aside.card_archives')
div.archives_item!= list_archives({type:'monthly',format: 'YYYY年MM月'})
- let type = theme.aside.card_archives.type || 'monthly'
- let format = theme.aside.card_archives.format || 'MMMM YYYY'
- let order = theme.aside.card_archives.order || -1
- let limit = theme.aside.card_archives.limit === 0 ? 0 : theme.aside.card_archives.limit || 8
!= aside_archives({ type:type, format: format, order: order, limit: limit })

View File

@@ -1,43 +1,34 @@
.card_widget.card-author .card-widget.card-info
.card-content .card-content
.post_data .card-info-avatar.is-center
.data-item.is_center img.avatar-img(src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.lodding_bg.flink) + `'` alt="avatar")
img.lozad.avatar_img(src=url_for(theme.avatar) onerror=`onerror=null;src='${theme.lodding_bg.flink}'`) .author-info__name= config.author
p.author-info__name.is_center= config.author .author-info__description= theme.aside.card_author.description || config.description
p.author-info__description.is_center= config.description
.post_data.data_config .card-info-data
if site.posts.length if site.posts.length
.data-item.is_center .card-info-data-item.is-center
.data_link a(href=url_for(config.archive_dir))
a(href=url_for(config.archive_dir) + '/') .headline= _p('aside.articles')
p.headline= _p('aside.articles') .length_num= site.posts.length
p.length_num= site.posts.length
if site.tags.length if site.tags.length
.data-item.is_center .card-info-data-item.is-center
.data_link a(href=url_for(config.tag_dir))
a(href=url_for(config.tag_dir) + '/' ) .headline= _p('aside.tags')
p.headline= _p('aside.tags') .length_num= site.tags.length
p.length_num= site.tags.length
if site.categories.length if site.categories.length
.data-item.is_center .card-info-data-item.is-center
.data_link a(href=url_for(config.category_dir))
a(href=url_for(config.category_dir) + '/') .headline= _p('aside.categories')
p.headline= _p('aside.categories') .length_num= site.categories.length
p.length_num= site.categories.length
.post_data.is_center .card-info-bookmark.is-center
a#bookmark-it.data-item.bookmark.bookmarke--primary.bookmark--animated(href="javascript:;" title= _p('aside.card_bookmark') ) a#bookmark-it.bookmark.button--primary.button--animated(href="javascript:;" title= _p('aside.card_bookmark') target="_self")
i.fa.fa-bookmark(aria-hidden="true") i.fa.fa-bookmark(aria-hidden="true")
span= _p('aside.card_bookmark') || 'Follow Me' span= _p('aside.card_bookmark') || 'Follow Me'
if(theme.social) if(theme.social)
.post_data.data_config .card-info-social-icons.is-center
#aside-social-icons !=fragment_cache('social', function(){return partial('includes/header/social')})
each url, icon in theme.social
a.social-icon.data-item(href=url target="_blank")
i(class=icon)

View File

@@ -1,23 +1,9 @@
if site.categories.length if site.categories.length
.card_widget.card-categories .card-widget.card-categories
.card-content .card-content
.item_headline .item-headline
i.fa.fa-folder-open(aria-hidden="true") i.fa.fa-folder-open(aria-hidden="true")
span= _p('aside.card_categories') span= _p('aside.card_categories')
ul.aside_category_item !=aside_categories({ limit: theme.aside.card_categories.limit === 0 ? 0 : theme.aside.card_categories.limit || 8 })
mixin displayCategories(parent = undefined)
- site.categories.find({ parent }).sort("name").each(function(category) {
- var childCount = site.categories.find({ parent: category._id }).count();
li.aside_category_list
a.aside_category_list_link(href=url_for(category.path))
span.aside_category_list_name= category.name
span.aside_category_list_length= category.length
if childCount > 0
ul.aside_category_item.child
+displayCategories(category._id)
- })
+displayCategories()

View File

@@ -1,23 +1,26 @@
.card_widget.card-recent-post .card-widget.card-recent-post
.card-content .card-content
.item_headline .item-headline
i.fa.fa-history(aria-hidden="true") i.fa.fa-history(aria-hidden="true")
span= _p('aside.card_recent_post') span= _p('aside.card_recent_post')
.aside_recent_item .aside-recent-item
- site.posts.sort('date', -1).limit(5).each(function(article){ - var postLimit = theme.aside.card_recent_post.limit === 0 ? site.posts.length : theme.aside.card_recent_post.limit || 5
.aside_recent_post - site.posts.sort('date', -1).limit(postLimit).each(function(article){
.aside-recent-post
- var link = article.link || article.path - var link = article.link || article.path
a(href=url_for(link)) - var title = article.title || _p('no_title')
- var no_cover = article.cover === false || !theme.cover.aside_enable ? 'no-aside-cover' : ''
- var post_cover = article.cover - var post_cover = article.cover
.aside_post_cover
a(href=url_for(link))
if post_cover && theme.cover.aside_enable
.aside-post-cover
if theme.lazyload.enable if theme.lazyload.enable
img.aside_post_bg.lozad(data-src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title')) img.aside-post-bg.lazyload(data-src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` title=title alt=title)
else else
img.aside_post_bg(src=`${post_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` title=article.title || _p('no_title')) img.aside-post-bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` title=title alt=title)
div#aside_title .aside-post-title(class=no_cover)
.aside_post_title(href=url_for(link) title=article.title || _p('no_title'))= article.title || _p('no_title') .aside-post_title(href=url_for(link) title=article.title || _p('no_title'))= article.title || _p('no_title')
if (theme.post_meta.date_type) time.aside-post_meta.post-meta__date(title=_p('post.created') + ' ' + full_date(article.date)) #[=date(article.date, config.date_format)]
- var date_type = theme.post_meta.date_type == 'updated' ? 'updated' : 'date'
time.aside_post_meta.post-meta__date #[=date(article[date_type], config.date_format)]
- }) - })

View File

@@ -1,7 +1,12 @@
if site.tags.length if site.tags.length
.card_widget.card-tags .card-widget.card-tags
.card-content .card-content
.item_headline .item-headline
i.fa.fa-tags(aria-hidden="true") i.fa.fa-tags(aria-hidden="true")
span= _p('aside.card_tags') span= _p('aside.card_tags')
.card-tag-cloud!= tagcloud({min_font: 16, max_font: 24, amount: 200, color: true, start_color: '#999', end_color: '#000'})
- let tagLimit = theme.aside.card_tags.limit === 0 ? 0 : theme.aside.card_tags.limit || 40
if theme.aside.card_tags.color
.card-tag-cloud!=cloudTags({source: site.tags, minfontsize: 16, maxfontsize: 22, limit: tagLimit})
else
.card-tag-cloud!= tagcloud({min_font: 16, max_font: 22, amount: tagLimit , color: true, start_color: '#999', end_color: '#99a9bf'})

View File

@@ -1,24 +1,27 @@
.card_widget.card-webinfo - var webinfoIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'fas fa-chart-line' : 'fa fa-line-chart'
.card-widget.card-webinfo
.card-content .card-content
.item_headline .item-headline
i.fa.fa-line-chart(aria-hidden="true") i(class=webinfoIcon aria-hidden="true")
span= _p('aside.card_webinfo.headline') span= _p('aside.card_webinfo.headline')
.webinfo .webinfo
.webinfo_item .webinfo-item
.webinfo_article_name= _p('aside.card_webinfo.article_name') + " :" .webinfo-article-name= _p('aside.card_webinfo.article_name') + " :"
.webinfo_article_count= site.posts.length .webinfo-article-count= site.posts.length
if theme.runtimeshow.enable if theme.runtimeshow.enable
.webinfo_item .webinfo-item
.webinfo_runtime_name= _p('aside.card_webinfo.runtime_name') + " :" .webinfo-runtime-name= _p('aside.card_webinfo.runtime_name') + " :"
#webinfo_runtime_count.webinfo_runtime_count #webinfo-runtime-count.webinfo-runtime-count(start_date=theme.runtimeshow.start_date)
script#runtionshow(src=url_for('js/runtimeshow.js') start_date=theme.runtimeshow.start_date) if theme.wordcount.enable && theme.wordcount.total_wordcount
.webinfo-item
.webinfo-site-wordcount-name=_p('aside.card_webinfo.site_wordcount') + " :"
.webinfo-site-wordcount=totalcount(site)
if theme.busuanzi.site_uv if theme.busuanzi.site_uv
.webinfo_item .webinfo-item
.webinfo_site_uv_name= _p('aside.card_webinfo.site_uv_name') + " :" .webinfo-site-uv-name= _p('aside.card_webinfo.site_uv_name') + " :"
.webinfo_site_uv_count#busuanzi_value_site_uv .webinfo-site-uv-count#busuanzi_value_site_uv
if theme.busuanzi.site_pv if theme.busuanzi.site_pv
.webinfo_item .webinfo-item
.webinfo_site_name= _p('aside.card_webinfo.site_pv_name') + " :" .webinfo-site-name= _p('aside.card_webinfo.site_pv_name') + " :"
.webinfo_site_pv_count#busuanzi_value_site_pv .webinfo-site-pv-count#busuanzi_value_site_pv

View File

@@ -0,0 +1,19 @@
if theme.aside.enable
if page.aside !== false
#aside_content.aside_content
if theme.aside.card_author.enable
!=partial('includes/widget/card_author', {}, {cache:theme.fragment_cache})
if theme.aside.card_announcement.enable
!=partial('includes/widget/card_announcement', {}, {cache:theme.fragment_cache})
if theme.aside.card_recent_post.enable
!=partial('includes/widget/card_recent_post', {}, {cache:theme.fragment_cache})
if theme.ad && theme.ad.aside
!=partial('includes/widget/card_ad', {}, {cache:theme.fragment_cache})
if theme.aside.card_categories.enable
!=partial('includes/widget/card_categories', {}, {cache:theme.fragment_cache})
if theme.aside.card_tags.enable
!=partial('includes/widget/card_tags', {}, {cache:theme.fragment_cache})
if theme.aside.card_archives.enable
!=partial('includes/widget/card_archives', {}, {cache:theme.fragment_cache})
if theme.aside.card_webinfo
!=partial('includes/widget/card_webinfo', {}, {cache:theme.fragment_cache})

View File

@@ -1,8 +1,7 @@
extends includes/layout.pug extends includes/layout.pug
block content block content
include ./includes/mixins/post-ui.pug
#recent-posts.recent-posts #recent-posts.recent-posts
include includes/recent-posts.pug +postUI
include includes/pagination.pug include includes/pagination.pug
#aside_content.aside_content
include includes/aside.pug

View File

@@ -7,20 +7,13 @@ block content
| - | -
span.tag-cloud__amount= site.tags.length span.tag-cloud__amount= site.tags.length
.tag-cloud-tags .tag-cloud-tags
include includes/page_tag.pug !=cloudTags({source: site.tags, minfontsize: 15, maxfontsize: 30, limit: 0})
if page.comments !== false if page.comments !== false
include includes/comments/index.pug include includes/comments/index.pug
#aside_content.aside_content
include includes/aside.pug
else if page.type === 'link' else if page.type === 'link'
include flink.pug include flink.pug
if page.comments !== false
include includes/comments/index.pug
#aside_content.aside_content
include includes/aside.pug
else if page.type === 'categories' else if page.type === 'categories'
#post-content.category-content .category-content
.category-lists .category-lists
.category__title= _p('page.category') .category__title= _p('page.category')
| - | -
@@ -28,14 +21,8 @@ block content
div!= list_categories() div!= list_categories()
if page.comments !== false if page.comments !== false
include includes/comments/index.pug include includes/comments/index.pug
#aside_content.aside_content
include includes/aside.pug
else else
article#page #page
h1= page.title #article-container!= page.content
.article-container!= page.content
include includes/pagination.pug
if page.comments !== false if page.comments !== false
include includes/comments/index.pug include includes/comments/index.pug
#aside_content.aside_content
include includes/aside.pug

View File

@@ -1,75 +1,24 @@
extends includes/layout.pug extends includes/layout.pug
block top_img
- var top_img = page.top_img || page.cover || theme.post_meta.top_img || theme.post_img || theme.top_img || config.top_img
- var bg_img = top_img !== true ? `background-image: url(${top_img})` : ''
div#top-container(style=bg_img)
#post-info
#post-title
.posttitle=page.title || _p('no_title')
#post-meta
if (theme.post_meta.date_type)
if (theme.post_meta.date_type === 'both')
time.post-meta__date
i.fa.fa-calendar(aria-hidden="true")
=' '+_p('post.created')+' '+date(page.date, config.date_format)
span.post-meta__separator |
i.fa.fa-history(aria-hidden="true")
=' '+_p('post.updated')+' '+date(page.updated, config.date_format)
else
- var date_type = theme.post_meta.date_type === 'updated' ? 'updated' : 'date'
time.post-meta__date #[i.fa.fa-calendar(aria-hidden="true")] #[=date(page[date_type], config.date_format)]
if (theme.post_meta.categories && page.categories.data.length > 0)
if (theme.post_meta.date_type)
span.post-meta__separator.mobile_hidden |
span.mobile_hidden
each item, index in page.categories.data
i.fa.fa-inbox.post-meta__icon(aria-hidden="true")
a(href=url_for(item.path)).post-meta__categories #[=item.name]
if (index < page.categories.data.length - 1)
i.fa.fa-angle-right(aria-hidden="true")
.post-meta-wordcount
if (theme.wordcount && theme.wordcount.enable)
span= _p('post.wordcount') + ': '
span.word-count= wordcount(page.content)
span.post-meta__separator |
span= _p('post.min2read', min2read(page.content, {cn: 350, en: 160}))
if (theme.wordcount && theme.wordcount.enable && theme.busuanzi.page_pv)
span.post-meta__separator |
if theme.busuanzi.page_pv
span= _p('post.page_pv') + ': '
span#busuanzi_value_page_pv
block content block content
article#post(class="") article#post(class="")
#post-content.article-container!= page.content #article-container!=page.content
if (theme.post_copyright && theme.post_copyright.enable && page.copyright != false) include includes/post/post-copyright.pug
.post-copyright
.post-copyright__author
span.post-copyright-meta= _p('post.copyright.author') + ": "
span.post-copyright-info
a(href=`mailto:${config.email}`) #[=config.author]
.post-copyright__type
span.post-copyright-meta= _p('post.copyright.link') + ": "
span.post-copyright-info
a(href=url_for(page.permalink)) #[=page.permalink]
.post-copyright__notice
span.post-copyright-meta= _p('post.copyright.copyright_notice') + ": "
span.post-copyright-info!= _p('post.copyright.copyright_content', theme.post_copyright.license_url, theme.post_copyright.license, config.url, config.title)
.tag_share .tag_share
if (theme.post_meta.tags) if (theme.post_meta.post.tags)
.post-meta__tag-list .post-meta__tag-list
each item, index in page.tags.data each item, index in page.tags.data
a(href=url_for(item.path)).post-meta__tags #[=item.name] a(href=url_for(item.path)).post-meta__tags #[=item.name]
include includes/share/index.pug !=partial('includes/share/index', {}, {cache:theme.fragment_cache})
if theme.reward.enable if theme.reward.enable
include includes/reward.pug !=partial('includes/post/reward', {}, {cache:theme.fragment_cache})
include includes/pagination.pug
//- ad
if theme.ad && theme.ad.post
.post-ad!=theme.ad.post
include includes/pagination.pug
if theme.related_post && theme.related_post.enable if theme.related_post && theme.related_post.enable
!= related_posts(page,site.posts) != related_posts(page,site.posts)
if page.comments !== false if page.comments !== false

View File

@@ -2,17 +2,13 @@ extends includes/layout.pug
block content block content
if theme.tag_ui == 'index' if theme.tag_ui == 'index'
include ./includes/mixins/UI.pug include ./includes/mixins/post-ui.pug
#recent-posts.recent-posts #recent-posts.recent-posts
+UI_NEW(page.posts) +postUI
include includes/pagination.pug include includes/pagination.pug
#aside_content.aside_content
include includes/aside.pug
else else
include ./includes/mixins/article-sort.pug include ./includes/mixins/article-sort.pug
#tag #tag
.article-sort-title= _p('page.tag') + ' - ' + page.tag .article-sort-title= _p('page.tag') + ' - ' + page.tag
+articleSort(page.posts) +articleSort(page.posts)
include includes/pagination.pug include includes/pagination.pug
#aside_content.aside_content
include includes/aside.pug

View File

@@ -1,5 +1,18 @@
{ {
"name": "hexo-theme-melody", "name": "hexo-theme-butterfly",
"version": "1.2.0", "version": "2.3.0",
"description": "A Hexo Theme: Butterfly" "private": true,
"engines": {
"node": ">=8.10.0"
},
"description": "A Simple and Card UI Design theme for Hexo",
"keywords": [
"hexo",
"theme",
"butterfly",
"Card UI Design"
],
"repository": "https://github.com/jerryc127/hexo-theme-butterfly.git",
"author": "Jerry <wong@jerryc.me>",
"license": "MIT"
} }

15
scripts/events/404.js Normal file
View File

@@ -0,0 +1,15 @@
/**
* Butterfly
* 404 error page
*/
'use strict'
hexo.extend.generator.register('404', function (locals) {
if (!hexo.theme.config.error_404.enable) return
return {
path: '404.html',
data: locals.posts,
layout: ['404']
}
})

View File

@@ -2,6 +2,8 @@
* Note: configs in _data/butterfly.yml will replace configs in hexo.theme.config. * Note: configs in _data/butterfly.yml will replace configs in hexo.theme.config.
*/ */
'use strict'
hexo.on('generateBefore', function () { hexo.on('generateBefore', function () {
const rootConfig = hexo.config const rootConfig = hexo.config
if (hexo.locals.get) { if (hexo.locals.get) {

View File

@@ -0,0 +1,39 @@
/**
* Butterfly
* lazyload
* replace src to data-src
* add class 'lazyload'
*/
'use strict'
const url_for = require('hexo-util').url_for.bind(hexo)
function lazyProcess (htmlContent) {
var bg = url_for(hexo.theme.config.lodding_bg.post)
return htmlContent.replace(
/<img(.*?)src="(.*?)"(.*?)>/gi,
(str, p1, p2, p3) => {
if (/data-src/gi.test(str)) {
return str
}
if (/class="(.*?)"/gi.test(str)) {
str = str.replace(/class="(.*?)"/gi, (classStr, p1) => {
return classStr.replace(p1, `${p1} lazyload`)
})
str = str.replace(p2, `${bg}`)
return str.replace('>', ` data-src="${p2}">`)
}
str = str.replace(p2, `${bg}`)
return str.replace(p3, ` class="lazyload" data-src="${p2}" ${p3}`)
}
)
}
var processPost = function (data) {
if (!hexo.theme.config.lazyload.enable) return
data.content = lazyProcess.call(this, data.content)
return data
}
hexo.extend.filter.register('after_post_render', processPost)

View File

@@ -0,0 +1,34 @@
/**
* Butterfly
* ramdom cover
*/
'use strict'
hexo.extend.filter.register('before_post_render', function (data) {
if (data.cover === false) {
data.randomcover = randomCover()
return data
}
data.cover = data.cover || randomCover()
return data
})
var randomCover = function () {
var theme = hexo.theme.config
var cover
var num
if (theme.cover.default_cover) {
if (!Array.isArray(theme.cover.default_cover)) {
cover = theme.cover.default_cover
return cover
} else {
num = Math.floor(Math.random() * theme.cover.default_cover.length)
cover = theme.cover.default_cover[num]
return cover
}
} else {
return theme.default_top_img
}
}

View File

@@ -1,16 +0,0 @@
hexo.extend.tag.register('gallery', args => {
const url = args[0]
const title = args[1] || 'No title'
return `
<div
class="gallery-item"
style="background-image: url('${url}')"
data-title="${title}"
data-url="${url}"
>
<div class="gallery-item__title">
${title}
</div>
</div>
`
})

View File

@@ -0,0 +1,112 @@
/**
* Butterfly
* for aside archives
*/
'use strict'
hexo.extend.helper.register('aside_archives', function (options = {}) {
const { config } = this
const archiveDir = config.archive_dir
const { timezone } = config
const lang = toMomentLocale(this.page.lang || this.page.language || config.language)
let { format } = options
const type = options.type || 'monthly'
const { transform } = options
const showCount = Object.prototype.hasOwnProperty.call(options, 'show_count') ? options.show_count : true
const order = options.order || -1
const compareFunc = type === 'monthly'
? (yearA, monthA, yearB, monthB) => yearA === yearB && monthA === monthB
: (yearA, monthA, yearB, monthB) => yearA === yearB
const limit = options.limit
const moreButton = this._p('aside.more_button')
let result = ''
if (!format) {
format = type === 'monthly' ? 'MMMM YYYY' : 'YYYY'
}
const posts = this.site.posts.sort('date', order)
if (!posts.length) return result
const data = []
let length = 0
posts.forEach(post => {
// Clone the date object to avoid pollution
let date = post.date.clone()
if (timezone) date = date.tz(timezone)
const year = date.year()
const month = date.month() + 1
const lastData = data[length - 1]
if (!lastData || !compareFunc(lastData.year, lastData.month, year, month)) {
if (lang) date = date.locale(lang)
const name = date.format(format)
length = data.push({
name,
year,
month,
count: 1
})
} else {
lastData.count++
}
})
const link = item => {
let url = `${archiveDir}/${item.year}/`
if (type === 'monthly') {
if (item.month < 10) url += '0'
url += `${item.month}/`
}
return this.url_for(url)
}
result += '<ul class="card-archive-list">'
const len = data.length
const Judge = limit === 0 ? len : Math.min(len, limit)
for (let i = 0; i < Judge; i++) {
const item = data[i]
result += '<li class="card-archive-list-item">'
result += `<a class="card-archive-list-link" href="${link(item)}">`
result += '<span class="card-archive-list-date">'
result += transform ? transform(item.name) : item.name
result += '</span>'
if (showCount) {
result += `<span class="card-archive-list-count">${item.count}</span>`
}
result += '</a>'
result += '</li>'
}
if (len > Judge) {
result += '<li class="card-archive-list-item more is-center">'
result += `<a class="card-archive-list-link-more" href="${this.url_for(archiveDir)}">
<span>${moreButton}</span><i class="fa fa-angle-right" aria-hidden="true"></i></a></li>`
}
result += '</ul>'
return result
})
var toMomentLocale = function (lang) {
if (lang === undefined) {
return undefined
}
// moment.locale('') equals moment.locale('en')
// moment.locale(null) equals moment.locale('en')
if (!lang || lang === 'en' || lang === 'default') {
return 'en'
}
return lang.toLowerCase().replace('_', '-')
}

View File

@@ -0,0 +1,97 @@
/**
* Butterfly
* for aside categories
*/
'use strict'
hexo.extend.helper.register('aside_categories', function (categories, options) {
if (
!options &&
(!categories || !Object.prototype.hasOwnProperty.call(categories, 'length'))
) {
options = categories
categories = this.site.categories
}
if (!categories || !categories.length) return ''
options = options || {}
const { config } = this
const showCount = Object.prototype.hasOwnProperty.call(options, 'show_count')
? options.show_count
: true
const depth = options.depth ? parseInt(options.depth, 10) : 0
const orderby = options.orderby || 'name'
const order = options.order || 1
const categoryDir = this.url_for(config.category_dir)
const limit = options.limit === 0 ? categories.length : options.limit
const buttonLabel = this._p('aside.more_button')
const prepareQuery = (parent) => {
const query = {}
if (parent) {
query.parent = parent
} else {
query.parent = {
$exists: false,
}
}
return categories
.find(query)
.sort(orderby, order)
.filter((cat) => cat.length)
}
const hierarchicalList = (t, level, parent) => {
let result = ''
if (t > 0) {
prepareQuery(parent).forEach((cat, i) => {
if (t > 0) {
t = t - 1
let child
if (!depth || level + 1 < depth) {
var childList = hierarchicalList(t, level + 1, cat._id)
child = childList[0]
t = childList[1]
}
result += '<li class="card-category-list-item">'
result += `<a class="card-category-list-link" href="${this.url_for(
cat.path
)}">`
result += `<span class="card-category-list-name">${cat.name}</span>`
if (showCount) {
result += `<span class="card-category-list-count">${cat.length}</span>`
}
result += '</a>'
result += '</li>'
if (child) {
result += `<ul class="card-category-list child">${child}</ul>`
}
}
})
}
return [result, t]
}
const list = hierarchicalList(limit, 0)
var moreButton = function () {
var moreHtml = ''
if (categories.length <= limit) return ''
moreHtml += '<li class="card-category-list-item more is-center">'
moreHtml += `<a class="card-category-list-link-more" href="${categoryDir}">
<span>${buttonLabel}</span><i class="fa fa-angle-right" aria-hidden="true"></i></a></li>`
return moreHtml
}
return `<ul class="card-category-list">
${list[0]}
${moreButton()}
</ul>`
})

58
scripts/helpers/page.js Normal file
View File

@@ -0,0 +1,58 @@
/**
* Butterfly
* @example
* page_description()
* injectHtml(data)
* cloudTags(source, minfontsize, maxfontsize, limit)
*/
'use strict'
const { stripHTML } = require('hexo-util')
hexo.extend.helper.register('page_description', function () {
const { config, page } = this
let description = page.description || page.content || page.title || config.description
if (description) {
description = stripHTML(description).substring(0, 200)
.trim()
.replace(/\n/g, ' ')
return description
}
})
hexo.extend.helper.register('injectHtml', function (data) {
let result = ''
if (!data) return ''
for (var i = 0; i < data.length; i++) {
result += data[i]
}
return result
})
hexo.extend.helper.register('cloudTags', function (options = {}) {
const env = this
const source = options.source
const minfontsize = options.minfontsize
const maxfontsize = options.maxfontsize
const limit = options.limit || 8
let result = ''
const tagLimit = limit === 0 ? source.length : limit
source.sort('name').limit(tagLimit).forEach(function (tags) {
var fontSize = Math.floor(Math.random() * (maxfontsize - minfontsize) + minfontsize) + 'px'
var color = 'rgb(' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ')' // 0,0,0 -> 200,200,200
result += `<a href='${env.url_for(tags.path)}' style='font-size:${fontSize}; color:${color}'>${tags.name}</a>`
})
return result
})
hexo.extend.helper.register('urlNoIndex', function () {
const { permalink } = hexo.config
let url = this.url.replace(/index\.html$/, '')
if (!permalink.endsWith('.html')) {
url = url.replace(/\.html$/, '')
}
return url
})

View File

@@ -0,0 +1,126 @@
/**
* Butterfly
* Related Posts
* According the tag
*/
'use strict'
hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
var relatedPosts = []
currentPost.tags.forEach(function (tag) {
allPosts.forEach(function (post) {
if (isTagRelated(tag.name, post.tags)) {
var relatedPost = {
title: post.title,
path: post.path,
cover: post.cover,
randomcover: post.randomcover,
weight: 1,
updated: post.updated,
created: post.date
}
var index = findItem(relatedPosts, 'path', post.path)
if (index !== -1) {
relatedPosts[index].weight += 1
} else {
if (currentPost.path !== post.path) {
relatedPosts.push(relatedPost)
}
}
}
})
})
if (relatedPosts.length === 0) {
return ''
}
var result = ''
const hexoConfig = hexo.theme.config.rootConfig
const config = hexo.theme.config
var limitNum = config.related_post.limit || 6
var dateType = config.related_post.date_type || 'created'
var headlineLang = this._p('post.recommend')
var lazySrc = config.lazyload.enable ? 'data-src' : 'src'
var lazyClass = config.lazyload.enable ? 'lazyload' : ''
relatedPosts = relatedPosts.sort(compare('weight'))
if (relatedPosts.length > 0) {
result += '<div class="relatedPosts">'
result +=
'<div class="relatedPosts_headline"><i class="fa fa-fw fa-thumbs-up" aria-hidden="true"></i><span>' +
' ' +
headlineLang +
'</span></div>'
result += '<div class="relatedPosts_list">'
for (var i = 0; i < Math.min(relatedPosts.length, limitNum); i++) {
var cover =
relatedPosts[i].cover === false
? relatedPosts[i].randomcover
: relatedPosts[i].cover
result +=
'<div class="relatedPosts_item"><a href="' +
hexoConfig.root +
relatedPosts[i].path +
'" title="' +
relatedPosts[i].title +
'">'
result +=
'<img class="relatedPosts_cover ' +
lazyClass +
'"' +
lazySrc +
'="' +
cover +
'">'
if (dateType === 'created') {
result +=
'<div class="relatedPosts_main is-center"><div class="relatedPosts_date"><i class="fa fa-calendar fa-fw" aria-hidden="true"></i>' +
' ' +
this.date(relatedPosts[i].created, hexoConfig.date_format) +
'</div>'
} else {
result +=
'<div class="relatedPosts_main is-center"><div class="relatedPosts_date"><i class="fa fa-history fa-fw" aria-hidden="true"></i>' +
' ' +
this.date(relatedPosts[i].updated, hexoConfig.date_format) +
'</div>'
}
result +=
'<div class="relatedPosts_title">' + relatedPosts[i].title + '</div>'
result += '</div></a></div>'
}
result += '</div><div class="clear_both"></div></div>'
return result
}
})
function isTagRelated (tagName, TBDtags) {
var result = false
TBDtags.forEach(function (tag) {
if (tagName === tag.name) {
result = true
}
})
return result
}
function findItem (arrayToSearch, attr, val) {
for (var i = 0; i < arrayToSearch.length; i++) {
if (arrayToSearch[i][attr] === val) {
return i
}
}
return -1
}
function compare (attr) {
return function (a, b) {
var val1 = a[attr]
var val2 = b[attr]
return val2 - val1
}
}

Some files were not shown because too many files have changed in this diff Show More