From f64ec5dc6d7f6d2ed75384ea287a7b1cd332e818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=93=E5=8F=91=E5=8F=97=E9=95=BF=E7=94=9F?= Date: Wed, 8 May 2019 22:56:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=85=A7=E7=89=87=E5=A2=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 6 ++-- source/lab/index.md | 7 ----- source/photo_wall/index.md | 7 +++++ themes/yilia/_config.yml | 9 ++---- themes/yilia/languages/default.yml | 4 ++- themes/yilia/languages/fr.yml | 4 ++- themes/yilia/languages/ja.yml | 4 ++- themes/yilia/languages/ru.yml | 4 ++- themes/yilia/languages/zh-CN.yml | 4 ++- themes/yilia/languages/zh-tw.yml | 4 ++- themes/yilia/layout/_partial/after-footer.ejs | 31 +++++++++---------- themes/yilia/layout/_partial/article.ejs | 3 +- .../yilia/source-src/config/photo-wall.json | 30 ++++++++++++++++++ themes/yilia/source-src/css/main.scss | 1 + .../yilia/source-src/css/page/photo-wall.scss | 21 +++++++++++++ themes/yilia/source-src/js/fix.js | 14 ++------- themes/yilia/source-src/js/main.js | 7 ++++- themes/yilia/source-src/js/photo-wall.js | 13 ++++++++ themes/yilia/source-src/js/viewer.js | 6 ++-- 19 files changed, 124 insertions(+), 55 deletions(-) delete mode 100644 source/lab/index.md create mode 100644 source/photo_wall/index.md create mode 100644 themes/yilia/source-src/config/photo-wall.json create mode 100644 themes/yilia/source-src/css/page/photo-wall.scss create mode 100644 themes/yilia/source-src/js/photo-wall.js diff --git a/_config.yml b/_config.yml index a658e64..818e065 100644 --- a/_config.yml +++ b/_config.yml @@ -11,7 +11,7 @@ title: Silence subtitle: 世上有条唯一的路,除了你无人能走 description: keywords: -author: 柠烟夏季 +author: 夏夜梦星辰 language: zh-CN timezone: @@ -82,14 +82,14 @@ theme: yilia # 图片存储仓库地址 picture_cdn: https://blog-cdn.nos-eastchina1.126.net -### 站点地图 +# 站点地图 sitemap: path: sitemap.xml template: ./sitemap_template.xml baidusitemap: path: baidusitemap.xml - +# 内容索引json jsonContent: meta: false pages: false diff --git a/source/lab/index.md b/source/lab/index.md deleted file mode 100644 index b72e349..0000000 --- a/source/lab/index.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: 实验室 -date: 2018-5-24 10:05:28 -pageid: lab ---- -这里是内容 -[测试超链接](https://www.baidu.com) diff --git a/source/photo_wall/index.md b/source/photo_wall/index.md new file mode 100644 index 0000000..7d574af --- /dev/null +++ b/source/photo_wall/index.md @@ -0,0 +1,7 @@ +--- +title: 照片墙 +date: 2018-5-24 10:05:28 +pageid: PhotoWall +--- + +
diff --git a/themes/yilia/_config.yml b/themes/yilia/_config.yml index 3c19c1a..409c523 100644 --- a/themes/yilia/_config.yml +++ b/themes/yilia/_config.yml @@ -8,9 +8,9 @@ menu: name: jenkins url: /jenkins/ target: _blank - laboratory: # 实验室 - name: laboratory - url: /lab/ + photo_wall: # 照片墙 + name: photo_wall + url: /photo_wall/ # SubNav subnav: @@ -35,9 +35,6 @@ rss: /atom.xml # Content -# 是否在新窗口打开链接 -open_in_new: false - # 打赏 # 打赏type设定:0-关闭打赏; 1-文章对应的md文件里有reward:true属性,才有打赏; 2-所有文章均有打赏 reward_type: 1 diff --git a/themes/yilia/languages/default.yml b/themes/yilia/languages/default.yml index ae53427..5cd3079 100644 --- a/themes/yilia/languages/default.yml +++ b/themes/yilia/languages/default.yml @@ -1,3 +1,5 @@ +# 英语(默认) + categories: Categories category: Category search: Search @@ -15,7 +17,7 @@ share: Share show_full_text: Show Full Text home: Homepage informal_essay: Informal Essay -laboratory: Laboratory +photo_wall: Photo Wall netdisc: Netdisc all_articles: All Articles about_me: About Me \ No newline at end of file diff --git a/themes/yilia/languages/fr.yml b/themes/yilia/languages/fr.yml index f0b33dd..4cc2da5 100644 --- a/themes/yilia/languages/fr.yml +++ b/themes/yilia/languages/fr.yml @@ -1,3 +1,5 @@ +# 法语 + categories: Catégories category: Catégorie search: Rechercher @@ -15,7 +17,7 @@ share: Partager show_full_text: Voir le texte intégral de la home: Homepage informal_essay: Essais -laboratory: Laboratoires +photo_wall: Mur de photo netdisc: Disque réseau all_articles: Tous les articles about_me: À propos de moi \ No newline at end of file diff --git a/themes/yilia/languages/ja.yml b/themes/yilia/languages/ja.yml index 6f079be..cf96066 100644 --- a/themes/yilia/languages/ja.yml +++ b/themes/yilia/languages/ja.yml @@ -1,3 +1,5 @@ +# 日语 + categories: カテゴリー category: カテゴリー search: 検索 @@ -15,7 +17,7 @@ share: シェア show_full_text: 記事全体を見る home: ホーム informal_essay: エッセイ -laboratory: 研究室 +photo_wall: フォトウォール netdisc: ネットワークディスク all_articles: すべての記事 about_me: 私について \ No newline at end of file diff --git a/themes/yilia/languages/ru.yml b/themes/yilia/languages/ru.yml index de8b394..0eeb1a8 100644 --- a/themes/yilia/languages/ru.yml +++ b/themes/yilia/languages/ru.yml @@ -1,3 +1,5 @@ +# 俄语 + categories: Категории category: Категория search: Поиск @@ -15,7 +17,7 @@ share: Поделиться show_full_text: просмотреть полный текст home: дома informal_essay: эссе -laboratory: лаборатория +photo_wall: Фото стена netdisc: Сетевой диск all_articles: Все статьи about_me: Обо мне \ No newline at end of file diff --git a/themes/yilia/languages/zh-CN.yml b/themes/yilia/languages/zh-CN.yml index e9a63ed..832ed5e 100644 --- a/themes/yilia/languages/zh-CN.yml +++ b/themes/yilia/languages/zh-CN.yml @@ -1,3 +1,5 @@ +# 中文简体 + categories: 分类 category: 分类 search: 搜索 @@ -15,7 +17,7 @@ share: 分享 show_full_text: 查看全文 home: 主页 informal_essay: 随笔 -laboratory: 实验室 +photo_wall: 照片墙 netdisc: 网盘 all_articles: 所有文章 about_me: 关于我 \ No newline at end of file diff --git a/themes/yilia/languages/zh-tw.yml b/themes/yilia/languages/zh-tw.yml index 01d860c..d041dc7 100644 --- a/themes/yilia/languages/zh-tw.yml +++ b/themes/yilia/languages/zh-tw.yml @@ -1,3 +1,5 @@ +# 中文繁体 + categories: 分類 category: 分類 search: 搜尋 @@ -15,7 +17,7 @@ share: 分享 show_full_text: 查看全文 home: 主頁 informal_essay: 隨筆 -laboratory: 實驗室 +photo_wall: 照片墻 netdisc: 網盤 all_articles: 所有文章 about_me: 關於我 \ No newline at end of file diff --git a/themes/yilia/layout/_partial/after-footer.ejs b/themes/yilia/layout/_partial/after-footer.ejs index 6b77468..cbf696d 100644 --- a/themes/yilia/layout/_partial/after-footer.ejs +++ b/themes/yilia/layout/_partial/after-footer.ejs @@ -1,14 +1,13 @@ <%- partial('script') %> @@ -18,13 +17,13 @@ window.yiliaConfig = { diff --git a/themes/yilia/layout/_partial/article.ejs b/themes/yilia/layout/_partial/article.ejs index 28a676e..1f98f3d 100644 --- a/themes/yilia/layout/_partial/article.ejs +++ b/themes/yilia/layout/_partial/article.ejs @@ -13,13 +13,14 @@ <% if (post.excerpt && index){ %> <%- post.excerpt %> <% } else { %> + <% if (!page.pageid){ %>
总字数 <%= wordcount(post.content) %>
|
预计阅读时间 <%= min2read(post.content) %> 分钟
+ <% } %> <%- post.content %> <% } %> - <% if ((theme.reward_type === 2 || (theme.reward_type === 1 && post.reward)) && !index){ %>
diff --git a/themes/yilia/source-src/config/photo-wall.json b/themes/yilia/source-src/config/photo-wall.json new file mode 100644 index 0000000..c8c0411 --- /dev/null +++ b/themes/yilia/source-src/config/photo-wall.json @@ -0,0 +1,30 @@ +[ + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00001.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00002.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00003.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00004.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00005.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00006.png"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00007.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00001.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00002.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00003.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00004.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00005.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00006.png"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00007.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00001.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00002.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00003.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00004.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00005.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00006.png"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00007.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00001.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00002.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00003.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00004.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00005.jpg"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00006.png"}, + {"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00007.jpg"} +] \ No newline at end of file diff --git a/themes/yilia/source-src/css/main.scss b/themes/yilia/source-src/css/main.scss index dc8100f..7eb2d75 100644 --- a/themes/yilia/source-src/css/main.scss +++ b/themes/yilia/source-src/css/main.scss @@ -19,6 +19,7 @@ @import "./footer"; @import "./waifu"; @import "./night"; +@import "./page/photo-wall"; @media screen and (max-width: 800px) { @import "./mobile"; @import "./mobile-slider"; diff --git a/themes/yilia/source-src/css/page/photo-wall.scss b/themes/yilia/source-src/css/page/photo-wall.scss new file mode 100644 index 0000000..0bcf3e5 --- /dev/null +++ b/themes/yilia/source-src/css/page/photo-wall.scss @@ -0,0 +1,21 @@ +/* +* 照片墙页面专用css +*/ +// 瀑布流最外层 +#photo-wall { + margin: 0 auto; + column-count: auto; + column-width: 240px; + column-gap: 20px; + // 每一列图片包含层 + .item { + margin-bottom: 20px; + // 防止多列布局,分页媒体和多区域上下文中的意外中断 + break-inside: avoid; + } + // 图片 + .item-img { + width: 100%; + vertical-align: middle; + } +} diff --git a/themes/yilia/source-src/js/fix.js b/themes/yilia/source-src/js/fix.js index 721ce91..ebf2933 100644 --- a/themes/yilia/source-src/js/fix.js +++ b/themes/yilia/source-src/js/fix.js @@ -8,21 +8,11 @@ function init() { $nav.innerHTML = $nav.innerHTML + '' } - // 新窗口打开 - if (yiliaConfig && yiliaConfig.open_in_new) { - let $a = document.querySelectorAll(('.article-entry a:not(.article-more-a)')) - $a.forEach(($em) => { - let target = $em.getAttribute('target'); - if (!target || target === '') { - $em.setAttribute('target', '_blank'); - } - }) - } // 目录序号 if (yiliaConfig && yiliaConfig.toc_hide_index) { - let $a = document.querySelectorAll(('.toc-number')) + let $a = document.querySelectorAll('.toc-number') Array.prototype.forEach.call($a, function($em){ - $em.style.display = 'none'; + $em.style.display = 'none' }) } } diff --git a/themes/yilia/source-src/js/main.js b/themes/yilia/source-src/js/main.js index a6612d1..4c862bc 100644 --- a/themes/yilia/source-src/js/main.js +++ b/themes/yilia/source-src/js/main.js @@ -16,6 +16,11 @@ Util.addLoadEvent(function() { }) const commentConfig = require("../config/comment.json") if(window.yiliaConfig.isPost && commentConfig.valine.enable) { - // 如果是文章详情页面, 并且启用了评论, 则加载评论相关代码 + // 文章详情页面, 并且启用了评论, 则加载评论相关代码 import(/* webpackChunkName: "comment" */ './comment') +} + +if(window.yiliaConfig.pageid === 'PhotoWall') { + // 自定义的照片墙页面 + import(/* webpackChunkName: "photo-wall" */ './photo-wall') } \ No newline at end of file diff --git a/themes/yilia/source-src/js/photo-wall.js b/themes/yilia/source-src/js/photo-wall.js new file mode 100644 index 0000000..629b674 --- /dev/null +++ b/themes/yilia/source-src/js/photo-wall.js @@ -0,0 +1,13 @@ +import photoWallJson from '../config/photo-wall.json' + +var content = '
' +photoWallJson.forEach(item => { + content += ` +
+ +
+ ` +}) +content += '
' + +document.getElementById('photo-wall').innerHTML = content \ No newline at end of file diff --git a/themes/yilia/source-src/js/viewer.js b/themes/yilia/source-src/js/viewer.js index fb908c5..a616cf7 100644 --- a/themes/yilia/source-src/js/viewer.js +++ b/themes/yilia/source-src/js/viewer.js @@ -36,6 +36,6 @@ function init() { } // export default { init } -Util.addLoadEvent(function() { - init() -}) \ No newline at end of file +if(!window.yiliaConfig.pageid) { // 非个性化页面的普通文章 + Util.addLoadEvent(init) +} \ No newline at end of file