前言 心血来潮想记录一下自己的通关游戏,但在网上找了很久始终没有找到适合自己的(excel,notion,一些第三方APP小程序和网站都被我pass了),我这么难伺候,干脆自己做一个好了。正好翻到了butterfly主题如何新建电影推荐,书籍推荐页面,快速学会 ,于是在这个基础上微调了一下,效果可见游戏录 , 图源来自steamgriddb
魔改步骤大致如下(css根据自己的需要进行调整,不通用 ):
新建pug文件 在themes/butterfly/layout/includes/page文件下新建games.pug文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 .game-row { display: flex; flex-wrap: wrap; justify-content: space-between; } .hexo-game-item { padding-bottom: 10px; position: relative; clear: both; padding: 10px 0; border-bottom: 1px #ddd solid; background: transparent; border: var(--style-border); box-shadow: var(--lee-shadow-border); border-radius: 12px; margin: 8px 0; height: 180px; min-height: 180px !important; width: 50%; /* 修改此处 */ overflow: hidden; } .hexo-game-picture { position: absolute; left: 0; top: 0px; width: 33%; height: 100%; } .hexo-game-picture img { width: 100%; height: 100%; margin: 0; border-radius: 8px !important; } @media screen and (max-width: 600px) { .hexo-game-item { width: 100%; } } .hexo-game-comments, .hexo-game-meta { font-size: 12px; } .hexo-game-info { padding-left: 160px !important; margin-right: 0.5rem; } @media screen and (min-width: 1300px) { .hexo-game-item { width: 32%; } } .hexo-game-item .hexo-game-picture > a { padding: 0; } .hexo-game-tabs { display: none; } .hexo-game-title a { border-bottom: 0px !important; } .hexo-game-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; line-height: 1; } .hexo-game-meta { color: var(--lee-secondtext); margin-top: 0.3rem; line-height: 1.05; font-size: 0.7rem !important; } .hexo-game-pagination { margin: auto; width: 100%; display: flex; justify-content: center; align-items: center; }
引入pug文件 在themes/butterfly/layout/page.pug文件中引入创建的页面,注意对齐。
1 2 3 4 5 6 7 8 9 case page.type when 'tags' include includes/page/tags.pug when 'link' include includes/page/flink.pug when 'categories' include includes/page/categories.pug + when 'games' + include includes/page/games.pug
引入css文件 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 .game-row { display : flex; flex-wrap : wrap; justify-content : space-between; } .hexo-game-item { padding-bottom : 10px ; position : relative; clear : both; padding : 10px 0 ; border-bottom : 1px #ddd solid; background : transparent; border : var (--style-border); box-shadow : var (--lee-shadow-border); border-radius : 12px ; margin : 8px 0 ; height : 180px ; min-height : 180px !important ; width : 50% ; overflow : hidden; } .hexo-game-picture { position : absolute; left : 0 ; top : 0px ; width : 33% ; height : 100% ; } .hexo-game-picture img { width : 100% ; height : 100% ; margin : 0 ; border-radius : 8px !important ; } @media screen and (max-width : 600px ) { .hexo-game-item { width : 100% ; } } .hexo-game-comments ,.hexo-game-meta { font-size : 12px ; } .hexo-game-info { padding-left : 160px !important ; margin-right : 0.5rem ; } @media screen and (min-width : 1300px ) { .hexo-game-item { width : 32% ; } } .hexo-game-item .hexo-game-picture > a { padding : 0 ; } .hexo-game-tabs { display : none; } .hexo-game-title a { border-bottom : 0px !important ; } .hexo-game-title { overflow : hidden; text-overflow : ellipsis; white-space : nowrap; font-size : 1rem ; line-height : 1 ; } .hexo-game-meta { color : var (--lee-secondtext); margin-top : 0.3rem ; line-height : 1.05 ; font-size : 0.7rem !important ; } .hexo-game-pagination { margin : auto; width : 100% ; display : flex; justify-content : center; align-items : center; }
添加yml文件 在博客根目录新建source/_data/games.yml文件,如果_data文件夹也没有的话需要自己创建。参考友链 部署。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - class_name: 正在玩的 class_desc: game_list: - name: Anoo1800 cover: https://cdn2.steamgriddb.com/file/sgdb-cdn/thumb/3716117c62e07aa6f23b6fe84990378e.jpg grade: ★★★★★ 神作 comment: - name: Stellaris cover: https://cdn2.steamgriddb.com/file/sgdb-cdn/thumb/b2d07452cf118e98723c0dae380ea76b.jpg grade: ★★★★★ 神作 comment: - name: Sid Meier's Civilization VI cover: https://cdn2.steamgriddb.com/file/sgdb-cdn/thumb/8ed3c515dce6189b61a43f476df23644.jpg grade: ★★★★☆ 推荐 comment: