备份
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 . ├── _config.yml ├── languages │ └── zh-CN.yml ├── layout | ├── index.pug │ └── includes │ ├── addons │ │ ├── blackandwhite.pug │ │ ├── footplayerh.pug │ │ └── funnytitle.pug │ ├── footer.pug │ ├── header │ │ └── index.pug │ ├── page │ │ └── flink.pug │ ├── layout.pug │ └── third-party │ └── comments │ └── valine.pug ├── source | └── css | ├── _layout | | └── categoryBar.styl | └── _page | └── flink.styl └── scripts └── filters └── random_cover.js
美化友链 增加了如下文件\butterfly\layout\includes\page\flink.pug
修改了如下文件\butterfly\source\css\_page\flink.styl
[Blogroot]\source\_data\link.yml
\butterfly\_config.yml
首页单列变双列 修改了如下文件 双列左右高度随意排布 文件blog\source\mogai.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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 .recent-post-area { display : flex; flex-direction : column; } #recent-posts { margin-top : -1rem ; column-count : 2 ; column-gap : 10px ; } #recent-posts >.recent-post-item { margin-top : 1rem ; display : inline-block; height : auto; width : 100% ; margin-bottom : 10px ; break-inside : avoid; } #recent-posts >.recent-post-item .post_cover { width : 100% ; height : 200px ; } #recent-posts >.recent-post-item .post_cover img .post_bg { width : 100% ; height : 100% ; } #recent-posts >.recent-post-item >.recent-post-info >.content { display : none; } #recent-posts >.recent-post-item { -webkit-flex-direction : column; -ms-flex-direction : column; flex-direction : column; } #recent-posts >.recent-post-item .left_radius { border-radius : 8px 8px 0 0 ; } #recent-posts >.recent-post-item .right_radius { border-radius : 8px 8px 0 0 ; } .recent-post-info { padding : 0 40px ; margin-top : 1em ; width : 100% !important ; } #recent-posts >.recent-post-item >.recent-post-info >.article-title { -webkit-line-clamp: 1 ; margin-top : 0.3rem ; margin-bottom : 0.3rem ; color : var (--text-highlight-color); font-size : 1.2em ; line-height : 1.4 ; } #recent-posts >.recent-post-item >.recent-post-info >.article-meta-wrap { margin-bottom : 1rem ; } @media screen and (max-width : 768px ) { #recent-posts >.recent-post-item { width : 100% ; } #recent-posts { column-count : 1 ; } }
文件blog/themes/butterfly/layout/index.pug
1 2 3 4 5 6 7 8 9 10 11 extends includes/layout.pug block content include ./includes/mixins/post-ui.pug .recent-post-area #recent-posts.recent-posts if theme.categoryBar.enable .recent-post-item(style='height:auto;width:100%;padding:0px;') #categoryBar!= list_categories(site.categories,{class: 'categoryBar',depth: 1}) +postUI include includes/pagination.pug
分类磁贴 修改了如下文件butterfly\layout\index.pug
[Blogroot]\_config.butterfly.yml
增加了如下文件\butterfly\source\css\_layout\categoryBar.styl
卡片透明 修改了如下文件 启用SSL 这里的启用ssl是指在本地预览的时候启用ssl,为了方便某些测试和功能因此使用了这个功能
当然本网站的数据还是依托github经由cloudflare转发所提供的,次修改仅供我自己测试用。
参考(抄袭)内容:https://www.programmersought.com/article/73016589463/
在网站根目录下放置关于ssl证书的key
和pem
文件 修改/node_modules/hexo-server/lib
目录下的server.js(需要备份)文件如下 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 var fs = require ('fs' );var connect = require ('connect' );var http = require ('https' );var chalk = require ('chalk' );var Promise = require ('bluebird' );var open = require ('opn' );var net = require ('net' );var url = require ('url' );var express = require ('express' );var httpApp = express();httpApp.all("*" , (req, res, next ) => { let host = req.headers.host; host = host.replace(/\:\d+$/ , '' ); res.redirect(307 , `https://${host} ${req.path} ` ); }); httpApp.listen(80 , function ( ) { console .log('http on 80 Welcome to Smileyan.cn' ); }); const options = { key : fs.readFileSync("./********.key" ), cert : fs.readFileSync("./********.pem" ) } module .exports = function (args ) { var app = connect(); var config = this .config; var ip = args.i || args.ip || config.server.ip || undefined ; var port = parseInt (args.p || args.port || config.server.port || process.env.port, 10 ) || 4000 ; var root = config.root; var self = this ; return checkPort(ip, port).then(function ( ) { return self.extend.filter.exec('server_middleware' , app, { context : self }); }).then(function ( ) { if (args.s || args.static) { return self.load(); } return self.watch(); }).then(function ( ) { return startServer(http.createServer(options, app), 4000 , ip); }).then(function (server ) { var addr = server.address(); var addrString = formatAddress(ip || addr.address, addr.port, root); self.log.info('Hexo is running at %s . Press Ctrl+C to stop.' , chalk.underline(addrString)); self.emit('server' ); if (args.o || args.open) { open(addrString); } return server; }).catch(function (err ) { switch (err.code) { case 'EADDRINUSE' : self.log.fatal('Port %d has been used. Try other port instead.' , port); break ; case 'EACCES' : self.log.fatal('Permission denied. You can\'t use port ' + port + '.' ); break ; } self.unwatch(); throw err; }); }; function startServer (server, port, ip ) { return new Promise (function (resolve, reject ) { server.listen(port, ip, function ( ) { resolve(server); }); server.on('error' , reject); }); } function checkPort (ip, port ) { return new Promise (function (resolve, reject ) { if (port > 65535 || port < 1 ) { return reject(new Error ('Port number ' + port + ' is invalid. Try a number between 1 and 65535.' )); } var server = net.createServer(); server.once('error' , reject); server.once('listening' , function ( ) { server.close(); resolve(); }); server.listen(port, ip); }); } function formatAddress (ip, port, root ) { var hostname = ip; if (ip === '0.0.0.0' || ip === '::' ) { hostname = 'localhost' ; } return url.format({ protocol : 'http' , hostname : hostname, port : port, path : root }); }
然后再次运行服务器就必须使用ssl进行浏览了