Typecho搭建杂记

一百件小事 · 2023-03-06
Typecho搭建杂记
挑长期维护的主题、插件,第一次搭建Ty很多不懂,用Jasmine过渡一段时间

Typecho安装配置

Typecho源码

debug模式config.inc.php

define('__TYPECHO_DEBUG__', TRUE);

nginx配置rewrite 永久链接{slug}.html

if (-f $request_filename/index.html){
    rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
    rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
    rewrite (.*) /index.php;
}

主题配置

主题选择

主题最后更新于
Jasmine2023.06.17
Cuteen2023.06.05
Mirages2023.04.23
handsome2022.10.29
Akina2022.08.05
Nabo2020.08.20
initial2022.02.20

暂定Jasmine,Mirages比较简约好看,可能受关关哥影响。Cuteen、Handsome复杂但有时光机,问题也不大,自建memos

菜单配置

[
  {
    "name": "首页",
    "icon": "tabler:home",
    "url": "/",
    "newTab": false
  },
  {
    "name": "关于",
    "icon": "tabler:user-circle",
    "url": "/about.html",
    "newTab": false
  },
  {
    "name": "一百件事",
    "icon": "tabler:heartbeat",
    "url": "/hundred.html",
    "newTab": false
  },
  {
    "name": "归档",
    "icon": "tabler:archive",
    "url": "/archive.html",
    "newTab": false
  },
  {
    "name": "相册",
    "icon": "tabler:photo",
    "url": "/photos.html",
    "newTab": false
  },
  {
    "name": "随机",
    "icon": "tabler:arrows-random",
    "url": "/random.html",
    "newTab": false
  },
  {
    "name": "友链",
    "icon": "tabler:plane-tilt",
    "url": "/link.html",
    "newTab": false
  },
  {
    "name": "之昂张",
    "icon": "tabler:mood-boy",
    "url": "https://zhsher.cn",
    "newTab": false
  }
]

域名配置

  • 域名选择、备案、提交管局、配ssl,暂定blog.zhsher.cn
  • 备案号 晋ICP备2022005322号
  • cdn网络分发

插件

相关资源

魔改

统计

自定义头部/www/wwwroot/blog/usr/themes/Jasmine/header.php

自定义JS

//修改侧边栏信息
var right_img = document.querySelector("#sidebar-right .sidebar__right__inner .flex .gap-x-3");
right_img.querySelectorAll('img')[0].setAttribute("alt", "了一昂梁");
right_img.querySelectorAll('.jasmine-primary-color')[0].innerHTML = "了一昂梁";
//设置头像
var imgElements = document.querySelectorAll("img[alt='之昂张']");
imgElements.forEach(function(element) {
    element.setAttribute("src", "https://imgl.zhsher.cn/blog/config/avatar-zhang.webp");
});

灯箱

自定义css

.z-\[999\] {
    z-index: 500;
}

自定义js

//图片灯箱
window.ViewImage && ViewImage.init('.markdown-body img');

footer.php

+<script src="https://jsd.onmicrosoft.cn/gh/Tokinx/ViewImage/view-image.min.js"></script>
<script>
    <?php $this->options->customScript(); ?>
</script>

友链

由于主题没有友链,自己小撕了一个

相册

基于腾讯存储桶/Lsky实现动态相册 | 张时贰

惊喜
  1. Typecho 2023-06-23

    欢迎加入 Typecho 大家族

Theme Jasmine by Kent Liao