此文记录这个博客的美化、修改、优化记录。
与本页关联的页面是:


前言

由于本人技术不佳,所有内容皆从网络收集整理,很多内容也忘记了出处,可联系我注明出处。如有侵权,请联系我删除。

请您须知:
1.做任何破坏性操作前,请一定要备份原文件,并做一个简短的记录。(比如直接修改站点文件,删除某配置里的代码等)
2.美化的尽头尽是默认,请合理选择效果,以达到网站最佳访问状态。
3.这些内容皆从网络获取,我不对它做任何担保,请您开始前务必备份好站点数据。

修改文件的参考说明

文件名/目录说明
component/aside.php左边导航栏
component/comments.php评论区
component/footer.php底部版权、音乐播放器之类
component/header.php页面头,没啥要改的
component/headnav.php顶部导航
component/say.php时光机动态
component/sidebar.php右侧栏目
component/third_party_comments.php3.3.0 新增,第三方评论
css/博客 CSS,一般不要改
fonts/博客字体,一般不要改
img/图像,一般不要改
js/js 文件,一般不要改
lang/语言文件
libs/Content.php文章内容
libs/...一般不要改
usr/另一个语言文件?
404.php404 界面
archive.php整合
booklist.php书单
cross.php时光机
files.php归档
functions.php配置界面的东西
guestbook.php留言板
index.php首页
links.php友链
page.php文章页面整合
post.php文章输出

我懒得一个一个记了(直接贴大佬地址!)

大家伙自己去抄作业吧!这些非原创的我尽量贴出原地址,有些没贴的就是很久以前抄的,忘记了。才不是懒得写什么的!

参考来源:青宁

青宁大佬网页备份


为了防止大佬跑路、地址被更改找不到抄作业的路,截止 2022 年 3 月 12 日,我擅自存了一份底。

由于这完全出于我个人愿意,也算留做自己的备份用,在上方大佬的博客还能访问之前,此内容将一直不可见。

该部分仅登录用户可见

参考来源 2:WuMe

参考来源 3:Sanakey

美化类

访问网站时的加载动画

推荐度:★☆☆☆☆
评语:真的很影响速度,别加!
效果图:无,自己加起来试试。

访问网站时的加载动画


修改文件web/usr/themes/handsome/component/header.php,往最后加上以下代码:

<!--加载动画-->
    <style>
    #PageLoading{background-color:#3a3f51;height:100%;width:100%;position:fixed;z-index:1;margin-top:0px;top:0px;}
    #PageLoading-center{width:100%;height:100%;position:relative;}
    #PageLoading-center-absolute{
        position:absolute;left:50%;top:50%;
        height:200px;width:200px;
        margin-top:-100px;
        margin-left:-100px;
    }
    .object2{
        -moz-border-radius:50% 50% 50% 50%;
        -webkit-border-radius:50% 50% 50% 50%;
        border-radius:50% 50% 50% 50%;
        position:absolute;
        border-left:5px solid #FFB6C1;
        border-right:5px solid #b6def7;
        border-top:5px solid transparent;
        border-bottom:5px solid transparent;
        -webkit-animation:animate 2s infinite;
        animation:animate 2s infinite;

    }
    #object_one{left:75px;top:75px;width:50px;height:50px;}
    #object_two{left:65px;top:65px;width:70px;height:70px;-webkit-animation-delay:0.1s;animation-delay:0.1s;}
    #object_three{left:55px;top:55px;width:90px;height:90px;-webkit-animation-delay:0.2s;animation-delay:0.2s;}
    #object_four{left:45px;top:45px;width:110px;height:110px;-webkit-animation-delay:0.3s;animation-delay:0.3s;}
    @-webkit-keyframes animate{50%{-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);transform:rotate(180deg);}
    100%{-ms-transform:rotate(0deg);-webkit-transform:rotate(0deg);transform:rotate(0deg);}}
    @keyframes animate{50%{-ms-transform:rotate(180deg);-webkit-transform:rotate(180deg);transform:rotate(180deg);}
    100%{-ms-transform:rotate(0deg);-webkit-transform:rotate(0deg);transform:rotate(0deg);}}
    </style>

<!--加载动画-->
<body id="body" class="fix-padding skt-loading">
    <body id="body" class="fix-padding" style="overflow:hidden">
        <div id="PageLoading" style="z-index:99999999;">
            <div id="PageLoading-center">
                <div id="PageLoading-center-absolute">
                    <div class="object2" id="object_four"></div>
                    <div class="object2" id="object_three"></div>
                    <div class="object2" id="object_two"></div>
                    <div class="object2" id="object_one"></div>
                </div>
            </div>
        </div>
    </body>
</body>

在后台主题外观设置里的开发者设置里的自定义 JavaScript里加上:

/*加载动画*/
/*header.php*/
$(function () {
  $("#PageLoading").fadeOut(400);
  $("#body").css("overflow", "");
});

修改字体

推荐度:★★★☆☆
评语:影响速度也是数一数二的,别用太大的字体,可以换成其他的试试。我反复横跳了数次,最后还是关了。可能哪天找到更好的办法了会继续用!
效果图:无,自己加起来试试

这里示例的字体为:Noto Serif SC

使用 GoogleFonts 代码(加载速度不够理想)


在后台主题外观设置里的开发者设置里的自定义输出 head 头部的 HTML 代码里加上从谷歌字体网站拿到的<link>
比如:

<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:[email protected]&display=swap" rel="stylesheet">

字体后面的 600 代表粗细,可以自己修改。

再将谷歌字体网站CSS rules to specify families 里的内容,填写到主题外观设置里的开发者设置里的自定义 css
比如:

* {
    font-family: 'Noto Serif SC', serif;
}

使用国内大佬的优化版字体(速度更快)


参考来源:https://www.itggg.cn/fx/522.html (爆胎)

在后台题外观设置里的开发者设置里的自定义输出 head 头部的 HTML 代码里加上下面的代码:

<link href="https://itggg.cn/font/NotoSerifSC/font-weight-600" rel="stylesheet">

再到题外观设置开发者设置定义 css加下面的代码:

* {
  font-family: "Noto Serif SC";
}

保存,然后去刷新主页看效果吧。

给首页文章头图加上高斯模糊

推荐度:★★★☆☆
评语:根据个人爱好,我觉得加了不够简洁,与我现在网站气质不相符)逃
效果图:无,自己加起来试试

给首页文章预览图加上高斯模糊


在后台题外观设置开发者设置定义 css加上下面的代码:

.topButton {
  top: unset;
  bottom: 135px;
}
.settings {
  top: unset;
  bottom: 46px;
}
#goToTop {
  color: #fff !important;
  background-color: #f99 !important;
}

.tt-small-blur {
  position: relative;
  z-index: 1;
  display: flex;
  overflow: hidden;
  background-color: #333;
  color: #fff;
}
.tt-small-blur .tt-left-box {
  z-index: 1;
  -webkit-clip-path: polygon(0 0, 94% 0, 100% 100%, 0 100%);
  clip-path: polygon(0 0, 94% 0, 100% 100%, 0 100%);
}
.tt-small-blur .tt-left-img {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
  object-fit: cover;
}
.tt-small-blur .tt-blur-img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  background-position: center;
  background-size: cover;
  transform: scale(1.4);
  -o-object-fit: cover;
  object-fit: cover;
  -webkit-filter: blur(1.275rem) brightness(0.83);
  filter: blur(1.275rem) brightness(0.83);
}
.tt-small-blur .post-meta {
  z-index: 1;
  display: flex;
  color: inherit;
  flex-direction: column;
  justify-content: space-between;
}
.tt-small-blur .text-title {
  color: inherit;
}
.tt-small-blur .post-meta h2,
.tt-small-blur .post-meta p {
  text-shadow: 0.1875rem 0.1875rem 0.3125rem #333;
  letter-spacing: 0.09rem;
}
.tt-small-blur .text-muted {
  color: inherit;
}
.tt-small-blur .post-meta {
  padding: 30px 30px 15px 30px;
}
@media (max-width: 500px) {
  .tt-small-blur .index-post-title {
    display: -webkit-box;
    display: -moz-box;
    overflow: hidden;
    margin-bottom: 2px;
    height: 48px;
    text-overflow: ellipsis;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.4;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    -moz-line-clamp: 2;
    -moz-box-orient: vertical;
    word-break: break-all;
  }
}
@media (max-width: 500px) {
  .tt-small-blur .summary {
    display: none;
  }
}
@media (max-width: 380px) {
  .tt-small-blur .post-meta {
    padding: 10px 15px;
  }
}
@media (min-width: 768px) and (max-width: 1199px) {
  .tt-small-blur .summary {
    height: 55px;
  }
  .tt-small-blur .line-lg {
    margin-top: 1px;
    margin-bottom: 1px;
  }
}

给 handsome 主题添加专用评论 UA 显示

推荐度:★★★★☆
评语:挺不错的,好看又实用,影响速度也只有一点点。
效果图:UA效果演示

需要的文件请在上方地址查找下载
下载完成后在后台添加插件

相关代码


在到usr/themes/handsome/component/comments.php文件里找到下面这行,意思是在评论的名字后面显示。

<b class="fn"><?php echo $author; ?></b>

在上面这行下面添加代码:

<?php UserAgent_Plugin::get_useragent($comments->agent,$comments->ip); ?>

注意:Typecho 开启 CDN 后,可能无法获取访客真实 IP,只能取得 CDN 节点 IP,为此可以在 Typecho 博客网站的根目录的 config.inc.php 插入下面的代码

//** 防止CDN造成无法获取客户真实IP地址 */
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{
    $list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
    $_SERVER['REMOTE_ADDR'] = $list[0];
}

美化 404 地址

推荐度:★★★★★
评语:好看又好用,直接吹爆,有什么好说的!
效果图:看下面的参考来源

美化 404 地址


一定记得要将原 404.php 文件备份一份

将以下内容添加到404.php中,记得修改里面带有注释的地方。

<?php
echo "<!DOCTYPE html>"

  . "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"
  . "   "
  . "   <title>你把我弄丢了 - 404</title>"
  . "   <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"

// 地址修改成自己的
  . "   <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/ilittlemoe/[email protected]/404page/normalize.min.css\">"
  . "   <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/ilittlemoe/[email protected]/404page/bootstrap.min.css\">"
  . "   <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/gh/ilittlemoe/[email protected]/404page/style.css\">"


  . " <script type=\"text/javascript\" src=\"chrome-extension://odphnbhiddhdpoccbialllejaajemdio/scripts/inspector.js\"></script></head>"
  . "<div id=\"like996_identification\" style=\"background-color: rgba(211, 211, 211, 0.86); align-items: center; justify-content: center; position: fixed; color: black; top: -5em; height: 2em; margin: 0em; padding: 3px 0em 0em; font-size: 1.2em; width: 100%; left: 0px; right: 0px; text-align: center; z-index: 2147483647; display: none;\">Text.</div>"
  . "   <!-- partial:index.partial.html -->"
  . "   <div class=\"hamburger-menu\">"
  . "       <button class=\"burger\" data-state=\"closed\">"
  . "           <span></span>"
  . "           <span></span>"
  . "           <span></span>"
  . "       </button>"
  . "   </div>"
  . "   <nav data-state=\"closed\">"
  . "       <ul>"
  // 地址修改成自己的
  . "        <li>"
  . "               <a href=\"https://www.moelitt.ml\">Home</a>"
  . "           </li>"
  . "           <li>"
  . "               <a href=\"https://www.moelitt.ml/message_board.html\">留言</a>"
  . "           </li>"
  . "           <li>"
  . "               <a href=\"https://www.moelitt.ml/my-bilibili.html\">音乐</a>"
  . "           </li>"
  . "           <li>"
  . "               <a href=\"https://www.moelitt.ml/cross.html\">时光机</a>"
  . "           </li>"
  . " </ul>"
  . "   </nav>"
  . "   <main>"
  . "       <div class=\"container\">"
  . "           <div class=\"row\">"
  . "               <div class=\"col-md-6 align-self-center\">"
  . "                   <svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 800 600\" style=\"visibility: visible;\">"
  . "                       <g>"
  . "                           <defs>"
  . "                               <clippath id=\"GlassClip\">"
  . "                                   <path d=\"M380.857,346.164c-1.247,4.651-4.668,8.421-9.196,10.06c-9.332,3.377-26.2,7.817-42.301,3.5"
  . "               s-28.485-16.599-34.877-24.192c-3.101-3.684-4.177-8.66-2.93-13.311l7.453-27.798c0.756-2.82,3.181-4.868,6.088-5.13"
  . "               c6.755-0.61,20.546-0.608,41.785,5.087s33.181,12.591,38.725,16.498c2.387,1.682,3.461,4.668,2.705,7.488L380.857,346.164z\"></path>"
  . "                               </clippath>"
  . "                               <clippath id=\"cordClip\">"
  . "                                   <rect width=\"800\" height=\"600\"></rect>"
  . "                               </clippath>"
  . "                           </defs>"
  . "                           <g id=\"planet\" transform=\"matrix(1,-0.0022,0.0022,1,-0.2394,1.2495)\" style=\"transform-origin: 0px 0px;\">"
  . "                               <circle fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-miterlimit=\"10\" cx=\"572.859\" cy=\"108.803\" r=\"90.788\"></circle>"
  . "                               <circle id=\"craterBig\" fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-miterlimit=\"10\" cx=\"548.891\" cy=\"62.319\" r=\"13.074\" style=\"transform-origin: 0px 0px;\" transform=\"matrix(1,0,0,1,0.19,0)\"></circle>"
  . "                               <circle id=\"craterSmall\" fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-miterlimit=\"10\" cx=\"591.743\" cy=\"158.918\" r=\"7.989\" style=\"transform-origin: 0px 0px;\" transform=\"matrix(1,0,0,1,-0.19,0)\"></circle>"
  . "                               <path id=\"ring\" fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" d=\""
  . "        M476.562,101.461c-30.404,2.164-49.691,4.221-49.691,8.007c0,6.853,63.166,12.408,141.085,12.408s141.085-5.555,141.085-12.408"
  . "        c0-3.378-15.347-4.988-40.243-7.225\"></path>"
  . "                               <path id=\"ringShadow\" opacity=\"0.5\" fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" d=\""
  . "        M483.985,127.43c23.462,1.531,52.515,2.436,83.972,2.436c36.069,0,68.978-1.19,93.922-3.149\"></path>"
  . "                           </g>"
  . "                           <g id=\"stars\">"
  . "                               <g id=\"starsBig\">"
  . "                                   <g transform=\"matrix(0.9997,0.024,-0.024,0.9997,6.2989,-12.3569)\" style=\"transform-origin: 0px 0px;\">"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"518.07\" y1=\"245.375\" x2=\"518.07\" y2=\"266.581\"></line>"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"508.129\" y1=\"255.978\" x2=\"528.01\" y2=\"255.978\"></line>"
  . "                                   </g>"
  . "                                   <g transform=\"matrix(0.9923,-0.1237,0.1237,0.9923,-28.7447,20.9811)\" style=\"transform-origin: 0px 0px;\">"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"154.55\" y1=\"231.391\" x2=\"154.55\" y2=\"252.598\"></line>"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"144.609\" y1=\"241.995\" x2=\"164.49\" y2=\"241.995\"></line>"
  . "                                   </g>"
  . "                                   <g transform=\"matrix(0.9998,0.02,-0.02,0.9998,2.931,-6.374)\" style=\"transform-origin: 0px 0px;\">"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"320.135\" y1=\"132.746\" x2=\"320.135\" y2=\"153.952\"></line>"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"310.194\" y1=\"143.349\" x2=\"330.075\" y2=\"143.349\"></line>"
  . "                                   </g>"
  . "                                   <g transform=\"matrix(0.9967,-0.0815,0.0815,0.9967,-39.5754,17.9839)\" style=\"transform-origin: 0px 0px;\">"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"200.67\" y1=\"483.11\" x2=\"200.67\" y2=\"504.316\"></line>"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"210.611\" y1=\"493.713\" x2=\"190.73\" y2=\"493.713\"></line>"
  . "                                   </g>"
  . "                               </g>"
  . "                               <g id=\"starsSmall\">"
  . "                                   <g transform=\"matrix(0.543,0,0,0.543,197.5028,176.482)\" style=\"transform-origin: 0px 0px;\">"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"432.173\" y1=\"380.52\" x2=\"432.173\" y2=\"391.83\"></line>"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"426.871\" y1=\"386.175\" x2=\"437.474\" y2=\"386.175\"></line>"
  . "                                   </g>"
  . "                                   <g transform=\"matrix(0.232,0,0,0.2326,375.9778,233.247)\" style=\"transform-origin: 0px 0px;\">"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"489.555\" y1=\"299.765\" x2=\"489.555\" y2=\"308.124\"></line>"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"485.636\" y1=\"303.945\" x2=\"493.473\" y2=\"303.945\"></line>"
  . "                                   </g>"
  . "                                   <g transform=\"matrix(0,0,0,0,231.4685,295.189)\" style=\"transform-origin: 0px 0px;\">"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"231.468\" y1=\"291.009\" x2=\"231.468\" y2=\"299.369\"></line>"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"227.55\" y1=\"295.189\" x2=\"235.387\" y2=\"295.189\"></line>"
  . "                                   </g>"
  . "                                   <g transform=\"matrix(0,0,0,0,244.0315,551.7185)\" style=\"transform-origin: 0px 0px;\">"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"244.032\" y1=\"547.539\" x2=\"244.032\" y2=\"555.898\"></line>"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"247.95\" y1=\"551.719\" x2=\"240.113\" y2=\"551.719\"></line>"
  . "                                   </g>"
  . "                                   <g transform=\"matrix(0,0,0,0,186.3585,411.1465)\" style=\"transform-origin: 0px 0px;\">"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"186.359\" y1=\"406.967\" x2=\"186.359\" y2=\"415.326\"></line>"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"190.277\" y1=\"411.146\" x2=\"182.44\" y2=\"411.146\"></line>"
  . "                                   </g>"
  . "                                   <g transform=\"matrix(0,0,0,0,480.2965,411.1465)\" style=\"transform-origin: 0px 0px;\">"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"480.296\" y1=\"406.967\" x2=\"480.296\" y2=\"415.326\"></line>"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" x1=\"484.215\" y1=\"411.146\" x2=\"476.378\" y2=\"411.146\"></line>"
  . "                                   </g>"
  . "                               </g>"
  . "                               <g id=\"circlesBig\">"
  . "                                   <circle fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" cx=\"588.977\" cy=\"255.978\" r=\"7.952\" transform=\"matrix(1,0,0,1,0,-0.126)\" style=\"transform-origin: 0px 0px;\"></circle>"
  . "                                   <circle fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" cx=\"450.066\" cy=\"320.259\" r=\"7.952\" transform=\"matrix(1,0,0,1,0,-0.126)\" style=\"transform-origin: 0px 0px;\"></circle>"
  . "                                   <circle fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" cx=\"168.303\" cy=\"353.753\" r=\"7.952\" transform=\"matrix(1,0,0,1,0,-0.126)\" style=\"transform-origin: 0px 0px;\"></circle>"
  . "                                   <circle fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" cx=\"429.522\" cy=\"201.185\" r=\"7.952\" transform=\"matrix(1,0,0,1,0,-0.126)\" style=\"transform-origin: 0px 0px;\"></circle>"
  . "                                   <circle fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" cx=\"200.67\" cy=\"176.313\" r=\"7.952\" transform=\"matrix(1,0,0,1,0,-0.126)\" style=\"transform-origin: 0px 0px;\"></circle>"
  . "                                   <circle fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" cx=\"133.343\" cy=\"477.014\" r=\"7.952\" transform=\"matrix(1,0,0,1,0,-0.126)\" style=\"transform-origin: 0px 0px;\"></circle>"
  . "                                   <circle fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" cx=\"283.521\" cy=\"568.033\" r=\"7.952\" transform=\"matrix(1,0,0,1,0,-0.126)\" style=\"transform-origin: 0px 0px;\"></circle>"
  . "                                   <circle fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-miterlimit=\"10\" cx=\"413.618\" cy=\"482.387\" r=\"7.952\" transform=\"matrix(1,0,0,1,0,-0.126)\" style=\"transform-origin: 0px 0px;\"></circle>"
  . "                               </g>"
  . "                               <g id=\"circlesSmall\">"
  . "                                   <circle fill=\"#0E0620\" cx=\"549.879\" cy=\"296.402\" r=\"2.651\" transform=\"matrix(1,0,0,1,0,-0.253)\" style=\"transform-origin: 0px 0px;\"></circle>"
  . "                                   <circle fill=\"#0E0620\" cx=\"253.29\" cy=\"229.24\" r=\"2.651\" transform=\"matrix(1,0,0,1,0,-0.253)\" style=\"transform-origin: 0px 0px;\"></circle>"
  . "                                   <circle fill=\"#0E0620\" cx=\"434.824\" cy=\"263.931\" r=\"2.651\" transform=\"matrix(1,0,0,1,0,-0.253)\" style=\"transform-origin: 0px 0px;\"></circle>"
  . "                                   <circle fill=\"#0E0620\" cx=\"183.708\" cy=\"544.176\" r=\"2.651\" transform=\"matrix(1,0,0,1,0,-0.253)\" style=\"transform-origin: 0px 0px;\"></circle>"
  . "                                   <circle fill=\"#0E0620\" cx=\"382.515\" cy=\"530.923\" r=\"2.651\" transform=\"matrix(1,0,0,1,0,-0.253)\" style=\"transform-origin: 0px 0px;\"></circle>"
  . "                                   <circle fill=\"#0E0620\" cx=\"130.693\" cy=\"305.608\" r=\"2.651\" transform=\"matrix(1,0,0,1,0,-0.253)\" style=\"transform-origin: 0px 0px;\"></circle>"
  . "                                   <circle fill=\"#0E0620\" cx=\"480.296\" cy=\"477.014\" r=\"2.651\" transform=\"matrix(1,0,0,1,0,-0.253)\" style=\"transform-origin: 0px 0px;\"></circle>"
  . "                               </g>"
  . "                           </g>"
  . "                           <g id=\"spaceman\" clip-path=\"url(cordClip)\" style=\"transform-origin: 0px 0px;\" transform=\"matrix(1,0.0011,-0.0011,1,0.2431,0.0885)\">"
  . "                               <path id=\"cord\" fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" d=\""
  . "        M273.813,410.969c0,0-54.527,39.501-115.34,38.218c-2.28-0.048-4.926-0.241-7.841-0.548"
  . "        c-68.038-7.178-134.288-43.963-167.33-103.87c-0.908-1.646-1.793-3.3-2.654-4.964c-18.395-35.511-37.259-83.385-32.075-118.817\"></path>"
  . "                               <path id=\"backpack\" fill=\"#FFFFFF\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" d=\""
  . "        M338.164,454.689l-64.726-17.353c-11.086-2.972-17.664-14.369-14.692-25.455l15.694-58.537"
  . "        c3.889-14.504,18.799-23.11,33.303-19.221l52.349,14.035c14.504,3.889,23.11,18.799,19.221,33.303l-15.694,58.537"
  . "        C360.647,451.083,349.251,457.661,338.164,454.689z\"></path>"
  . "                               <g id=\"antenna\">"
  . "                                   <line fill=\"#FFFFFF\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" x1=\"323.396\" y1=\"236.625\" x2=\"295.285\" y2=\"353.753\"></line>"
  . "                                   <circle fill=\"#FFFFFF\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" cx=\"323.666\" cy=\"235.617\" r=\"6.375\"></circle>"
  . "                               </g>"
  . "                               <g id=\"armR\">"
  . "                                   <path fill=\"#FFFFFF\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" d=\""
  . "            M360.633,363.039c1.352,1.061,4.91,5.056,5.824,6.634l27.874,47.634c3.855,6.649,1.59,15.164-5.059,19.02l0,0"
  . "            c-6.649,3.855-15.164,1.59-19.02-5.059l-5.603-9.663\"></path>"
  . "                                   <path fill=\"#FFFFFF\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" d=\""
  . "            M388.762,434.677c5.234-3.039,7.731-8.966,6.678-14.594c2.344,1.343,4.383,3.289,5.837,5.793"
  . "            c4.411,7.596,1.829,17.33-5.767,21.741c-7.596,4.411-17.33,1.829-21.741-5.767c-1.754-3.021-2.817-5.818-2.484-9.046"
  . "            C375.625,437.355,383.087,437.973,388.762,434.677z\"></path>"
  . "                               </g>"
  . "                               <g id=\"armL\">"
  . "                                   <path fill=\"#FFFFFF\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" d=\""
  . "            M301.301,347.66c-1.702,0.242-5.91,1.627-7.492,2.536l-47.965,27.301c-6.664,3.829-8.963,12.335-5.134,18.999h0"
  . "            c3.829,6.664,12.335,8.963,18.999,5.134l9.685-5.564\"></path>"
  . "                                   <path fill=\"#FFFFFF\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" d=\""
  . "            M241.978,395.324c-3.012-5.25-2.209-11.631,1.518-15.977c-2.701-0.009-5.44,0.656-7.952,2.096"
  . "            c-7.619,4.371-10.253,14.09-5.883,21.71c4.371,7.619,14.09,10.253,21.709,5.883c3.03-1.738,5.35-3.628,6.676-6.59"
  . "            C252.013,404.214,245.243,401.017,241.978,395.324z\"></path>"
  . "                               </g>"
  . "                               <g id=\"body\">"
  . "                                   <path fill=\"#FFFFFF\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" d=\""
  . "            M353.351,365.387c-7.948,1.263-16.249,0.929-24.48-1.278c-8.232-2.207-15.586-6.07-21.836-11.14"
  . "            c-17.004,4.207-31.269,17.289-36.128,35.411l-1.374,5.123c-7.112,26.525,8.617,53.791,35.13,60.899l0,0"
  . "            c26.513,7.108,53.771-8.632,60.883-35.158l1.374-5.123C371.778,395.999,365.971,377.536,353.351,365.387z\"></path>"
  . "                                   <path fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" d=\""
  . "            M269.678,394.912L269.678,394.912c26.3,20.643,59.654,29.585,93.106,25.724l2.419-0.114\"></path>"
  . "                               </g>"
  . "                               <g id=\"legs\">"
  . "                                   <g id=\"legR\">"
  . "                                       <path fill=\"#FFFFFF\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" d=\""
  . "                M312.957,456.734l-14.315,53.395c-1.896,7.07,2.299,14.338,9.37,16.234l0,0c7.07,1.896,14.338-2.299,16.234-9.37l17.838-66.534"
  . "                C333.451,455.886,323.526,457.387,312.957,456.734z\"></path>"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" x1=\"304.883\" y1=\"486.849\" x2=\"330.487\" y2=\"493.713\"></line>"
  . "                                   </g>"
  . "                                   <g id=\"legL\">"
  . "                                       <path fill=\"#FFFFFF\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" d=\""
  . "                M296.315,452.273L282,505.667c-1.896,7.07-9.164,11.265-16.234,9.37l0,0c-7.07-1.896-11.265-9.164-9.37-16.234l17.838-66.534"
  . "                C278.993,441.286,286.836,447.55,296.315,452.273z\"></path>"
  . "                                       <line fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" x1=\"262.638\" y1=\"475.522\" x2=\"288.241\" y2=\"482.387\"></line>"
  . "                                   </g>"
  . "                               </g>"
  . "                               <g id=\"head\">"
  . "                                   <ellipse transform=\"matrix(0.259 -0.9659 0.9659 0.259 -51.5445 563.2371)\" fill=\"#FFFFFF\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" cx=\"341.295\" cy=\"315.211\" rx=\"61.961\" ry=\"60.305\"></ellipse>"
  . "                                   <path id=\"headStripe\" fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" d=\""
  . "            M330.868,261.338c-7.929,1.72-15.381,5.246-21.799,10.246\" style=\"transform-origin: 0px 0px;\" transform=\"matrix(1,0.0011,-0.0011,1,0.2875,-0.309)\"></path>"
  . "                                   <path fill=\"#FFFFFF\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" d=\""
  . "            M380.857,346.164c-1.247,4.651-4.668,8.421-9.196,10.06c-9.332,3.377-26.2,7.817-42.301,3.5s-28.485-16.599-34.877-24.192"
  . "            c-3.101-3.684-4.177-8.66-2.93-13.311l7.453-27.798c0.756-2.82,3.181-4.868,6.088-5.13c6.755-0.61,20.546-0.608,41.785,5.087"
  . "            s33.181,12.591,38.725,16.498c2.387,1.682,3.461,4.668,2.705,7.488L380.857,346.164z\"></path>"
  . "                                   <g clip-path=\"url(#GlassClip)\">"
  . "                                       <polygon id=\"glassShine\" fill=\"none\" stroke=\"#0E0620\" stroke-width=\"3\" stroke-miterlimit=\"10\" points=\""
  . "                278.436,375.599 383.003,264.076 364.393,251.618 264.807,364.928                 \" transform=\"matrix(0.866,-0.5,0.5,0.866,-33.401,203.976)\" style=\"transform-origin: 0px 0px;\"></polygon>"
  . "                                   </g>"
  . "                               </g>"
  . "                           </g>"
  . "                       </g>"
  . "                   </svg>"
  . "               </div>"
  . "               <div class=\"col-md-6 align-self-center\">"
  . "                   <h1>404</h1>"
  . "                   <h2>喔哦~你迷路了~</h2>"
  . "                   <p>"
  . "                       你要找的页面不存在。"
  . "                       你如何来到这里是个谜。但你可以点击下面的按钮"
  . "                       回到主页。"
  . "                   </p>"
  // 地址修改成自己的
  . "                   <button class=\"btn green\"><a href=\"https://www.moelitt.ml\">首页</a></button>"
  . "                       <p>也许你想 <a href=\"https://www.moelitt.ml\">回去? </a></p>"
  . "               </div>"
  . "           </div>"
  . "       </div>"
  . "   </main>"
  . "   <!-- partial -->"
// 地址修改成自己的
  . "   <script src=\"https://cdn.jsdelivr.net/gh/ilittlemoe/[email protected]/404page/gsap.min.js\"></script>"
  . "   <script src=\"https://cdn.jsdelivr.net/gh/ilittlemoe/[email protected]/404page/script.js\"></script>"
  . ""
  . "</html>"
?>

美化 typecho 后台

推荐度:★★★★★
评语:吹爆,后台好看了都更愿意访问了有没有?
效果图:看相关的参考来源吧,我懒得截图了。

使用插件SimpleAdmin


插件文件在上面的链接里下载

请一定要先备份好你的网站和数据库!

使用这个插件,需要 php 版本升级到 7.0 以上

如果版本过低去升级,会提示500 Database Server Error错误

我是在 php56 版本直接升级到 php74 的,我不太会,是直接在网站托管后台切换版本就行。
如果出错,就在网站根目录中的config.inc.php文件中修改,将下面这行添加到文件里去

$db = new Typecho_Db('Pdo_Mysql', 'typecho_');

具体所在位置如下:

/** 定义数据库参数 */
- /**php56旧版本:$db = new Typecho_Db('Mysql', 'typecho_');*/
+ $db = new Typecho_Db('Pdo_Mysql', 'typecho_');

修改完成后保存,重启 php,再去启用插件即可!

再次提醒:如果你之前手动修改过 typecho 登录界面建议从typecho 官网下载一份你的网站当前所使用的版本,将服务器里/web/admin这个文件夹备份。提取出下载的 typecho 里面的 admin 目录里的文件上传到服务器/web/admin目录。这个举动将还原你原来所对 admin 所做的破坏性修改。同时可以让插件更好的生效。

使用后台模板替换文件的方式(推荐,更好看)


文件在上面的链接里下载

使用:
将下载好的模板上传到网站根目录,然后解压会自动覆盖 admin 文件夹,然后将解压出的 Menu.php 复制到/var/Widget/即可。

记得做好备份,如果不小心没备份,可参考上一种方法去下载 typecho 原始文件重新上传到网站根目录

给博客加上访客总数和加载时间

推荐度:★★★★★
评语:加上后可显示网站加载速度和访问总量,还是有些用的。
效果图:无,自己加起来试试。

给博客加上访客总数和加载时间

将以下代码存放到主题的functions.php中,可以放在最后面:

/**
 * * 加载时间
 * * @return bool
 * */
function timer_start() {
    global $timestart;
    $mtime = explode( ' ', microtime()  );
    $timestart = $mtime[1] + $mtime[0];
    return true;

}
timer_start();
function timer_stop( $display = 0, $precision = 3  ) {
    global $timestart, $timeend;
    $mtime = explode( ' ', microtime()  );
    $timeend = $mtime[1] + $mtime[0];
    $timetotal = number_format( $timeend - $timestart, $precision  );
    $r = $timetotal < 1 ? $timetotal * 1000 . " ms" : $timetotal . " s";
    if ( $display  ) {
        echo $r;

    }
    return $r;

}

//总访问量
function theAllViews(){
    $db = Typecho_Db::get();
    $row = $db->fetchAll('SELECT SUM(VIEWS) FROM `typecho_contents`');
    echo number_format($row[0]['SUM(VIEWS)']);
}

然后修改component/sidebar.php这个文件,搜索最后活动,在下面加上如下代码:

<li class="list-group-item"> <i class="glyphicon glyphicon-refresh text-muted"></i> <span class="badge
           pull-right"><?php echo Utils::getLatestTime($this); ?></span><?php _me("最后活动") ?></li>
            /*下面这几行是要添加的代码*/
           <li class="list-group-item"> <i class="glyphicon glyphicon-flash text-muted"></i> <span class="badge
           pull-right"><?php echo timer_stop();?></span><?php _me("响应耗时") ?></li>
           <li class="list-group-item"> <i class="glyphicon glyphicon-user text-muted"></i> <span class="badge
           pull-right"><?php echo theAllViews();?></span><?php _me("访客总数") ?></li>
       </ul>

博主介绍的闪字特效

推荐度:★★★★☆
评语:咋说呢,花里胡哨,但我喜欢。
效果图:无,自己加起来试试。

博主介绍的闪字特效


在后台主题设置里的初级设置博主的介绍代码框里加上下面的代码,根据下面的自定义修改文本修改成你的介绍。

<!--博主介绍的闪字特效-->
<span class="text-muted text-xs block"><div id="chakhsu"></div> <script> var chakhsu = function (r) {function t() {return b[Math.floor(Math.random() * b.length)]} function e() {return String.fromCharCode(94 * Math.random() + 33)} function n(r) {for (var n = document.createDocumentFragment(), i = 0; r > i; i++) { var l = document.createElement("span"); l.textContent = e(), l.style.color = t(), n.appendChild(l) } return n}function i() {var t = o[c.skillI]; c.step ? c.step-- : (c.step = g, c.prefixP < l.length ? (c.prefixP >= 0 && (c.text += l[c.prefixP]), c.prefixP++) : "forward" === c.direction ? c.skillP < t.length ? (c.text += t[c.skillP], c.skillP++) : c.delay ? c.delay-- : (c.direction = "backward", c.delay = a) : c.skillP > 0 ? (c.text = c.text.slice(0, -1), c.skillP--) : (c.skillI = (c.skillI + 1) % o.length, c.direction = "forward")), r.textContent = c.text, r.appendChild(n(c.prefixP < l.length ? Math.min(s, s + c.prefixP) : Math.min(s, t.length - c.skillP))), setTimeout(i, d) } /*以下内容自定义修改*/ var l = "", o = ["这里是自定义修改的文本" ].map(function (r) {return r + ""}), a = 2, g = 1, s = 5, d = 75, b = ["rgb(110,64,170)", "rgb(150,61,179)", "rgb(191,60,175)", "rgb(228,65,157)", "rgb(254,75,131)", "rgb(255,94,99)", "rgb(255,120,71)", "rgb(251,150,51)", "rgb(226,183,47)", "rgb(198,214,60)", "rgb(175,240,91)", "rgb(127,246,88)", "rgb(82,246,103)", "rgb(48,239,130)", "rgb(29,223,163)", "rgb(26,199,194)", "rgb(35,171,216)", "rgb(54,140,225)", "rgb(76,110,219)", "rgb(96,84,200)"], c = {text: "", prefixP: -s, skillI: 0, skillP: 0, direction: "forward", delay: a, step: g}; i() }; chakhsu(document.getElementById('chakhsu')); </script> </span> </span>

给博客边栏加上 Pixiv 每月排行榜 Top50

推荐度:★★★☆☆
评语:还可以,给自己的博客加点
效果图:无,自己加起来试试。


参考来源 2(作者 github):https://github.com/mokeyjay/Pixiv-daily-ranking-widget

参考来源 3(感谢大佬提供的国内可用地址):https://github.com/mokeyjay/Pixiv-daily-ranking-widget/issues/11

给博客边栏加上 Pixiv 每月排行榜 Top50


是在参考来源1看到的,但发现地址已经失效了,跑去参考来源2作者主页看,发现主页进不去,估计服务停止了或者是在海外的服务器被墙了。在作者的 issues 中找到了@烟草的香味大佬自建的地址,才有了这样的一条记录……

主题设置后台中的开发者设置里找到全局右边侧栏广告位,在里面加上:

<p>Pixiv每月排行榜Top50</p>
<iframe
  src="https://fun.hujingnb.com/pixiv/i"
  frameborder="0"
  style="width:300px; height:400px;"
></iframe>

注意:默认上方的代码是每日的排行榜,不得不得说每日排行榜多少有点经得住干部的考验,要就要精品来考验干部。
@烟草的香味大佬说:

同时支持 HTTP, HTTPS 请求, 推荐使用 HTTPS.
另外, 我添加了几个请求的 GET 参数, 用于有需要的小伙伴自定义.
interval: 页面轮播时长(毫秒). 默认5000
bg: 背景色, 默认transparent
w: 图片宽度. 默认300
    因为图片很多超过1MB, 故进行了图片的压缩, 可提高访问速度.
    可选值: 100, 200, 300, 400, 500.
limit: 轮播的排名区间. 默认1,50
    1,50 为显示排名 1-50 的图片
    最大排名100, 暂时看100应该够用了, 故只拉取了日榜的 top 100
type: 榜单类型, 默认daily
    日榜(daily), 月榜(monthly)
    周榜介于日榜和月榜之间, 感觉没人用吧, 就没有爬
rand: 是否随机起始图片, 默认0
    若为1, 则每次进入页面, 都会随机一个起始位置

所以应该是要月榜,加上随机显示。
那么就应该是下面这样的代码,大家可以参考一下自己添加想要的功能:

<p>Pixiv每月排行榜Top50</p>
<iframe
  src="https://fun.hujingnb.com/pixiv/i?type=monthly&rand=1"
  frameborder="0"
  style="width:240px; height:380px;"
></iframe>

保存后在实际显示中,"Pixiv 每月排行榜 Top50"上方会有"广告"的字眼,有点拉低了档次。
本身这里做的是放广告的,但就这小破站没流量干脆不要这功能了。所以可以通过修改主题文件删除这俩字。

涉及到主题原文件的修改,请记得备份原文件

打开handsome文件夹下的/component/sidebar.php,注释掉这行

<h5 class="widget-title m-t-none text-md"><?php _me("广告") ?></h5>

OK,现在完美了。

给文章结尾加上版权信息

推荐度:★★★★★
评语:可以不加,不能没有,版权得注明清楚。
效果图:无,自己加起来试试。

给文章结尾加上版权信息


此样式略有修改……
编辑/web/usr/themes/handsome/post.php文件
在这个文件的

<!--文章的页脚部件:打赏和其他信息的输出-->

上面加上

<!--文章结束版权信息-->
<div class="cpright">
<span>本文作者:<span class="sr-only"><?php _me("作者") ?>:</span><a class="meta-value" href="<?php $this->author->permalink(); ?>" rel="author"> <?php $this->author(); ?></a></span>&nbsp;&nbsp;&nbsp;<br>
文章标题:<a href="<?php $this->permalink() ?>"><?php $this->title() ?></a>
<br><span>本文地址:<a href="<?php $this->permalink() ?>"><?php $this->permalink() ?></a></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<br><span>版权说明:本博客所有文章除特别声明外,均默认采用<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank" rel="noopener" title="CC BY-NC-SA 4.0 "><strong> CC BY-NC-SA 4.0 </strong></a> 许可协议。并皆为“<a href="<?php $this->options->siteUrl(); ?>" target="_blank" data-original-title="<?php $this->options->title() ?>"><?php $this->options->title() ?></a>”原创,转载请保留文章出处。</span>
</div>
<!--/ 文章结束版权信息分割线-->

再到网站的后台设置里的开发者选项自定义css中加上下面的内容:

/*文章底部版权https://dxoca.cn/SiteLog/196.html*/
.cpright {
    padding: 10px;
    background: rgba(46, 52, 64, 0.1);
    margin: 8px 0;
    font-size: 13px;
    border-left: 3px #ff6b8196 solid;
    position: relative;
    z-index: 1;
    font-family: "Microsoft Yahei","Droid Serif",Georgia,"Times New Roman",STHeiti,serif;
    text-align: left;
}
.cpright a:hover {
    color: #ff4757!important;
}
.cpright a {
    color: #3498db!important;
    margin: 4px;
    border-bottom: 0px solid #3498db!important;
}

优化速度

这里只做微调,过后会出一篇具体的 typecho 的垃圾小站的优化指北。

用别人家的 cdn 来提高加载速度

推荐度:★★★★★
评语:真的,找个合适自己的!下面这个地址我测试不是很快,有条件的自己搭一个真的很香。
没条件的也可以白嫖哇!我白嫖了一个也香的很!
效果图:用心感受,无法言说。

优化速度


设置外观 \> 速度优化 \> 将主题静态资源传到你的 cdn 上把链接复制上去就好了

最新地址(8.2.0):https://download.cdn.xlj0.com/uploads/122/WebData/Blog/assets/

给评论加上验证

推荐度:★★★★★
评语:先记录一下,我就不加了,也没人评论,徒增难度很讨厌的。
效果图:无,自己加起来试试。

给评论加上验证

在 function.php 中末尾添加如下函数

function themeInit($comment){$comment = spam_protection_pre($comment, $post, $result);}function spam_protection_math(){ $num1=rand(1,49); $num2=rand(1,49); echo "<label for=\"math\">请输入<code>$num1</code>+<code>$num2</code>的计算结果:</label>\n"; echo "<input type=\"text\" name=\"sum\" class=\"text\" value=\"\" size=\"25\" tabindex=\"4\" style=\"width:218px\" placeholder=\"计算结果:\">\n"; echo "<input type=\"hidden\" name=\"num1\" value=\"$num1\">\n"; echo "<input type=\"hidden\" name=\"num2\" value=\"$num2\">";}function spam_protection_pre($comment, $post, $result){ $sum=$_POST['sum']; switch($sum){ case $_POST['num1']+$_POST['num2']: break; case null: throw new Typecho_Widget_Exception(_t('对不起: 请输入验证码。<a href="javascript:history.back(-1)">返回上一页</a>','评论失败')); break; default: throw new Typecho_Widget_Exception(_t('对不起: 验证码错误,请<a href="javascript:history.back(-1)">返回</a>重试。','评论失败')); } return $comment;}

调用函数

comments.php中,把我们刚刚写好的函数添加上。
打开主题 comments.php文件,在适当位置插入如下代码:

<?php spam_protection_math();?>

如果觉得 100 以内太难了,请修改 function.php 中添加的代码中 rand 后面的数字范围。

End
本文作者:Author:   
文章标题:博客修改记录
本文地址:https://moelitt.ml/archives/Blog-change.html     
版权说明:本博客所有文章除特别声明外,均默认采用 CC BY-NC-SA 4.0 许可协议。并皆为“Littlemoe'Blog”原创,转载请保留文章出处。
Last modification:March 29, 2022
如果你觉得我的文章对你有用,请随意赞赏。