标签 Typecho 下的文章

元气秋刀鱼-小站1周年-封面图

前言

去年某天看了一个博客很不错啊,特别的心动。之前旧服务器,网页打开速度着实有些慢,突然就被共鸣到了,于是转移阵地重新购买服务器(脑袋一热做的决定),价格从原先60米/年变为500米/年。

这么狠心总可以用心好好freestyle一下自己的小站了吧...

最终因为自己才疏学浅,愣是毛都没研究出来,说实话刚开始失败后,真的就差点断了博客这个念头。后来又仔细想想这米也花了,没这DIY能力,那索性就专注于记录生活吧

于是这一年中便慢慢养成了,每月写1-2篇生活记录的习惯,也算是建站以来最上心的、最成功的一件事,再怎么样这大米有听到个响

现在体会到沉下心慢慢坚持做一件事,累计时间久了也会从中得到成就感,而且这比一时来的成就感更加的强烈

感谢

一路走来碰到许多好心人,建博客的人,都是善良、热心、有趣的

这帮人可以在我遇到技术困难时,亲自指导助我一臂之力;

也可以在心烦抱怨的时候,写一条评论鼓励我;

还可以节日期间,收到关于各地博友的祝福......

[images]
元气秋刀鱼-小站1周年-配图01
元气秋刀鱼-小站1周年-配图02
元气秋刀鱼-小站1周年-配图03
[/images]

谢谢所有与我为邻的各位博友们,希望你们能越来越好,我也会继续坚持!

节日期间给博客添加一对小灯笼,该灯笼由html+css纯代码构成,几乎不会影响网站加载速度,而且显示效果很好看,为了以防下次自己忘记如何设置,记录一下以备不时之需。

教程转自:https://www.isisy.com/828.html

添加html代码

<div class="deng-box1">
 <div class="deng">
 <div class="xian"></div>
 <div class="deng-a"><div class="deng-b"><div class="deng-t">新年</div></div></div>
 <div class="shui shui-a"><div class="shui-c"></div><div class="shui-b"></div></div>
 </div>
 </div>
<div class="deng-box2">
 <div class="deng">
 <div class="xian"></div>
 <div class="deng-a">
 <div class="deng-b"><div class="deng-t">快乐</div></div></div>
 <div class="shui shui-a"><div class="shui-c"></div><div class="shui-b"></div></div>
 </div>
 </div>

添加css代码

在您的模板后台自定义css中或css样式文件中添加如下代码:

//CSS压缩版
.deng-box1{position:fixed;top:-30px;left:5px;z-index:9999;pointer-events:none}
.deng{position:relative;width:120px;height:90px;margin:50px;background:#d8000f;background:rgba(216,0,15,0.8);border-radius:50% 50%;-webkit-transform-origin:50% -100px;-webkit-animation:swing 3s infinite ease-in-out;box-shadow:-5px 5px 50px 4px rgba(250,108,0,1)}
.deng::before{position:absolute;top:-7px;left:29px;height:12px;width:60px;content:" ";display:block;z-index:999;border-radius:5px 5px 0 0;border:solid 1px #dc8f03;background:#ffa500;background:linear-gradient(to right,#dc8f03,#ffa500,#dc8f03,#ffa500,#dc8f03)}
.xian{position:absolute;top:-20px;left:60px;width:2px;height:20px;background:#dc8f03}
.deng-box1{pointer-events:none}
.deng-a{width:100px;height:90px;background:#d8000f;background:rgba(216,0,15,0.1);margin:12px 8px 8px 10px;border-radius:50% 50%;border:2px solid #dc8f03}
.deng-b{width:45px;height:90px;background:#d8000f;background:rgba(216,0,15,0.1);margin:-2px 8px 8px 26px;border-radius:50% 50%;border:2px solid #dc8f03}
.deng-t{font-family:华文行楷,Arial,Lucida Grande,Tahoma,sans-serif;font-size:1.5rem;color:#ffa500;font-weight:bold;line-height:42px;text-align:center;width:25px;margin:0 auto}
.shui-a{position:relative;width:5px;height:20px;margin:-5px 0 0 59px;-webkit-animation:swing 4s infinite ease-in-out;-webkit-transform-origin:50% -45px;background:#ffa500;border-radius:0 0 5px 5px}
.shui-c{position:absolute;top:18px;left:-2px;width:10px;height:35px;background:#ffa500;border-radius:0 0 0 5px}
.shui-b{position:absolute;top:14px;left:-2px;width:10px;height:10px;background:#dc8f03;border-radius:50%}
.deng::after{position:absolute;bottom:-7px;left:10px;height:12px;width:60px;content:" ";display:block;margin-left:20px;border-radius:0 0 5px 5px;border:solid 1px #dc8f03;background:#ffa500;background:linear-gradient(to right,#dc8f03,#ffa500,#dc8f03,#ffa500,#dc8f03)}
.deng-box2{position:fixed;top:-30px;right:5px;z-index:9999;pointer-events:none}
.deng-box2 .deng{position:relative;width:120px;height:90px;margin:50px;background:#d8000f;background:rgba(216,0,15,0.8);border-radius:50% 50%;-webkit-transform-origin:50% -100px;-webkit-animation:swing 5s infinite ease-in-out;box-shadow:-5px 5px 30px 4px rgba(252,144,61,1)}
.deng-box2{pointer-events:none}
@-moz-keyframes swing{0%{-moz-transform:rotate(-10deg)}
50%{-moz-transform:rotate(10deg)}
100%{-moz-transform:rotate(-10deg)}
}@-webkit-keyframes swing{0%{-webkit-transform:rotate(-10deg)}
50%{-webkit-transform:rotate(10deg)}
100%{-webkit-transform:rotate(-10deg)}}

以下是未压缩版

//CSS未压缩版
.deng-box1 {
    position: fixed;
    top: -30px;
    left: 5px;
    z-index: 9999;
    pointer-events: none;
}

.deng {
    position: relative;
    width: 120px;
    height: 90px;
    margin: 50px;
    background: #d8000f;
    background: rgba(216, 0, 15, 0.8);
    border-radius: 50% 50%;
    -webkit-transform-origin: 50% -100px;
    -webkit-animation: swing 3s infinite ease-in-out;
    box-shadow: -5px 5px 50px 4px rgba(250, 108, 0, 1);
}

.deng::before {
    position: absolute;
    top: -7px;
    left: 29px;
    height: 12px;
    width: 60px;
    content: " ";
    display: block;
    z-index: 999;
    border-radius: 5px 5px 0 0;
    border: solid 1px #dc8f03;
    background: #ffa500;
    background: linear-gradient(to right, #dc8f03, #ffa500, #dc8f03, #ffa500, #dc8f03);
}

.xian {
    position: absolute;
    top: -20px;
    left: 60px;
    width: 2px;
    height: 20px;
    background: #dc8f03;
}

.deng-box1 {
    pointer-events: none;
}

.deng-a {
    width: 100px;
    height: 90px;
    background: #d8000f;
    background: rgba(216, 0, 15, 0.1);
    margin: 12px 8px 8px 10px;
    border-radius: 50% 50%;
    border: 2px solid #dc8f03;
}

.deng-b {
    width: 45px;
    height: 90px;
    background: #d8000f;
    background: rgba(216, 0, 15, 0.1);
    margin: -2px 8px 8px 26px;
    border-radius: 50% 50%;
    border: 2px solid #dc8f03;
}

.deng-t {
    font-family: 华文行楷,Arial,Lucida Grande,Tahoma,sans-serif;
    font-size: 1.5rem;
    color: #ffa500;
    font-weight: bold;
    line-height: 42px;
    text-align: center;
    width: 25px;
    margin: 0 auto;
}

.shui-a {
    position: relative;
    width: 5px;
    height: 20px;
    margin: -5px 0 0 59px;
    -webkit-animation: swing 4s infinite ease-in-out;
    -webkit-transform-origin: 50% -45px;
    background: #ffa500;
    border-radius: 0 0 5px 5px;
}

.shui-c {
    position: absolute;
    top: 18px;
    left: -2px;
    width: 10px;
    height: 35px;
    background: #ffa500;
    border-radius: 0 0 0 5px;
}

.shui-b {
    position: absolute;
    top: 14px;
    left: -2px;
    width: 10px;
    height: 10px;
    background: #dc8f03;
    border-radius: 50%;
}

.deng::after {
    position: absolute;
    bottom: -7px;
    left: 10px;
    height: 12px;
    width: 60px;
    content: " ";
    display: block;
    margin-left: 20px;
    border-radius: 0 0 5px 5px;
    border: solid 1px #dc8f03;
    background: #ffa500;
    background: linear-gradient(to right, #dc8f03, #ffa500, #dc8f03, #ffa500, #dc8f03);
}

.deng-box2 {
    position: fixed;
    top: -30px;
    right: 5px;
    z-index: 9999;
    pointer-events: none;
}

.deng-box2 .deng {
    position: relative;
    width: 120px;
    height: 90px;
    margin: 50px;
    background: #d8000f;
    background: rgba(216, 0, 15, 0.8);
    border-radius: 50% 50%;
    -webkit-transform-origin: 50% -100px;
    -webkit-animation: swing 5s infinite ease-in-out;
    box-shadow: -5px 5px 30px 4px rgba(252, 144, 61, 1);
}

.deng-box2 {
    pointer-events: none;
}

@-moz-keyframes swing {
    0% {
        -moz-transform: rotate(-10deg)
    }

    50% {
        -moz-transform: rotate(10deg)
    }
 
    100% {
        -moz-transform: rotate(-10deg)
    }
}

@-webkit-keyframes swing {
    0% {
        -webkit-transform: rotate(-10deg)
    }

    50% {
        -webkit-transform: rotate(10deg)
    }

    100% {
        -webkit-transform: rotate(-10deg)
    }
}

若您不想在手机端显示效果,可以在自定义css中追加如下代码:

@media (max-width: 900px){.deng-box1{display:none;}}
@media (max-width: 900px){.deng-box2{display:none;}}

若您需要修改灯笼的位置,可在css代码中找到.deng-box1,调整left的px值,找到.deng-box2,调整right的px值

最后,去您的主页刷新下页面,灯笼就出来了

陈阿叔博客-Typecho教程-灯笼挂件

一、安装主题

1、安装主题

找到主题目录yourdomain.com/usr/themes,上传“主题文件”

解压主题压缩包,有的主题压缩包会有后缀,例如:「主题名字-master」,去掉后缀修改「主题名字」主题名字就可以了

2、设置主题

登录Typecho后台管理,点击“更改外观”

点击“启用”主题就生效了,有些主题自带后台设置,可在“设置外观”标签里设置

二、评论默认头像修改

1、使用方法

国内基本无法加载默认头像,为了美观可以更换头像源

网站根目录下,找到“config.inc.php”文件,修改在54行处代码

原始代码:
define('__TYPECHO_GRAVATAR_PREFIX__', 'http://www.gravatar.com');
修改代码:
define('__TYPECHO_GRAVATAR_PREFIX__', 'https://gravatar.loli.net/avatar/');

2、替换地址

http://gravatar.ihuan.me/avatar/

https://gravatar.loli.net/avatar/

http://dn-qiniu-avatar.qbox.me/avatar

三、评论显示QQ头像

属于默认头像的拓展操作,不喜欢默认头像的可以看过来哦~

评论填写QQ邮箱,显示QQ头像

评论不是QQ邮箱,显示随机头像

1、使用方法

找到yourdomain.com/usr/themes/主题文件夹中的“comments.php”文件,搜索gravatar,在29行左右

下方代码替换默认的代码

<span itemprop="image"><?php $number=$comments->mail;
if(preg_match('|^[1-9]\d{4,11}@qq\.com$|i',$number)){
echo '<img src="https://q2.qlogo.cn/headimg_dl? bs='.$number.'&dst_uin='.$number.'&dst_uin='.$number.'&;dst_uin='.$number.'&spec=100&url_enc=0&referer=bu_interface&term_type=PC" width="46px" height="46px" style="border-radius: 50%;float: left;margin-top: 0px;margin-right: 10px;margin-bottom:-2px">'; 
}else{
echo '<img src="https://api.ixiaowai.cn/api/api.php" width="46px" height="46px" style="border-radius: 50%;float: left;margin-top: 0px;margin-right: 10px;margin-bottom:-2px">';
}
?>
</span>

2、效果展示

效果还是不错的,如果觉得头像加载慢,下方有推荐其他头像API接口

3、头像API接口

修改上面复制的代码,替换图片API地址

默认代码:
echo '<img src="https://api.ixiaowai.cn/api/api.php" width="46px" height="46px" style="border-radius: 50%;float: left;margin-top: 0px;margin-right: 10px;margin-bottom:-2px">';

修改代码:
echo '<img src="替换地址" width="46px" height="46px" style="border-radius: 50%;float: left;margin-top: 0px;margin-right: 10px;margin-bottom:-2px">';

API网站

小歪API: https://api.ixiaowai.cn

保罗API: https://api.paugram.com/help/wallpaper

岁月小筑: https://img.xjh.me

东方Project: https://img.paulzzh.tech/

Unsplash:https://source.unsplash.com/

四、安装博客插件

1、安装插件

找到插件目录yourdomain.com/usr/plugins,上传“插件”

解压插件压缩包,有的插件压缩包会有后缀,例如:「插件名字-master」,去掉后缀修改「插件名字」为插件名就可以了

2、设置插件

插件安装好后,默认“禁用状态”,点击“启用”插件即生效

按需求设置插件内容就可以了

五、邮件提醒插件

一般个人站点,流量不是很大,不太会天天登陆,很容易回复不及时

推荐一款非常必要的插件,有人评论后会发送邮件通知提醒,反之回复后也会发送提醒邮件给对方

其余的插件可在typecho插件合集网站自行按需下载安装

插件名称插件描述版本作者
LoveKKCommentTypecho 评论通知、找回密码插件1.0.5康粑粑

1、插件下载地址

原作者GitHub:https://github.com/ylqjgm/LoveKKComment

2、配置邮件提醒插件

发件人设置

进入后台插件 - 开启插件 - 进入设置,进行配置

我用的是SMTP模式设置,另外两种没试过,请自行体验哦

3、效果展示

有人评论后,收到邮件的效果

回复评论后,发送的邮件效果

4、QQ邮箱开启SMTP服务

打开“IMAP/SMTP服务”会出现一串「安全码」,复制好这串「安全码」

5、插件SMTP设置

我开始填写的是,SSL加密/465端口,验证后建议我更换TLS加密/587端口

大家可以先尝试SSL加密/465端口,填完后点击“保存设置”

注意:填完后点击“保存”,会开始验证假死状态,不要操作,等一会有操作提醒

6、大功告成

收到评论效果展示

评论得到回复效果展示

六、总结

上面的内容肯定不是最完美的,还有seo优化、实用小插件、安装脚本,界面美化等操作都没有说到

个人比较喜欢极简,觉得上面的操作对于做个人博客已经足够了

希望本篇文章可以帮助到你,有不足的地方也希望大家留下评论