Typecho文章存储插件TpSync
md文件中的 Fontsmatter 对应键:
---
title: 文章标题 {}
slug: 文章slug {}
tags: 文章标签 {}
categories: 文章分类 {}
draft: false 是否为草稿 {}
publishDate: 发布时间 {}
updatedDate: 更新时间 {}
---
通过数据库表 typecho_contents
、 typecho_metas
和 typecho_relationships
获取信息,并生成缓存md文件 (TpSync/categories/xxx.md)
插件的自定义性和操作性:
Fontsmatter 值可自定义 <-> 数据库表的表
生成路径 TpSync/{文章分类}/md文件
插件配置Git、S3等存储方式
参考 typecho_contents
cid | title | slug | created | modified | text | order | authorId | template | type | status | password | commentsNum | allowComment | allowPing | allowFeed | parent | agree |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
14 | 文章标题 | 14 | Unix时间戳(精确值到秒) | Unix时间戳(精确值到秒) | <!--markdown-->文章内容 | 0 | 1 | NULL | post | publish | NULL | 2 | 1 | 1 | 1 | 0 | 2 |
参考 typecho_metas
mid | name | slug | type | description | count | order | parent |
---|---|---|---|---|---|---|---|
2 | 文章 | post | category | 默认文章分类,以技术、推荐为主 | 36 | 1 | 0 |
3 | 部署技术手册 | dev | category | Development & Operations | 25 | 1 | 2 |
4 | 深度书影漫游 | read | category | Literary Landscape | 8 | 2 | 2 |
5 | 科研技术笔记 | sci | category | Scientific Tech Notes | 0 | 3 | 2 |
6 | 日记 | diary | category | 日记本 | 16 | 2 | 0 |
7 | 通告 | notice | category | 通知 | 8 | 3 | 0 |
9 | 友链 | 友链 | tag | NULL | 1 | 0 | 0 |
10 | 通知 | 通知 | tag | NULL | 2 | 0 | 0 |
11 | C语言 | C语言 | tag | NULL | 1 | 0 | 0 |
参考 typecho_relationships
cid | mid |
---|---|
14 | 7 |
14 | 9 |
14 | 10 |
17 | 2 |
17 | 11 |
17 | 12 |
17 | 13 |
24 | 6 |
24 | 14 |
24 | 19 |
插件配置:
设置Git方案:
目标配置
1. Authentication Type
ssh/basic
> Use SSH for maximum security.
2. Repository URI
> Git-compliant URI (e.g. git@github.com:org/repo.git for ssh, https://github.com/org/repo.git for basic)
3. Branch
> The branch to use during pull / push (e.g. main)
4. SSH Private Key Mode
contents/path
> SSH Authentication Only - The mode to use to load the private key. Fill in the corresponding field below.
5. A - SSH Private Key Path
> SSH Authentication Only - Absolute path to the key. The key must NOT be passphrase-protected. Mode must be set to path to use this option.
6. B - SSH Private Key Contents
> SSH Authentication Only - Paste the contents of the private key. The key must NOT be passphrase-protected. Mode must be set to contents to use this option.
7. Verify SSL Certificate
turn/off
> Some hosts requires SSL certificate checking to be disabled. Leave enabled for proper security.
8. Username
> Basic Authentication Only
9. Password / PAT
> Basic Authentication Only
10. Default Author Email
> Used as fallback in case the author of the change is not present.
11. Default Author Name
> Used as fallback in case the author of the change is not present.
12. Local Repository Path
./usr/uploads/TpSync
> Path where the local git repository will be created.Whether to put content from the primary language into a subfolder.
13. Git Binary Path
> Optional - Absolute path to the Git binary, when not available in PATH. Leave empty to use the default PATH location (recommended).
---
文件同步方向
选择如何处理此存储目标的内容同步。
**双向**
在双向模式下,首先从存储目标中提取内容。任何较新的内容都会覆盖本地内容。自上次同步以来的新内容将被推送到存储目标,如果存在,则覆盖目标上的任何内容。
**推送到目标**
内容始终以覆盖任何现有内容的形式被推送到存储目标,这是最安全的备份方案。
**从目标中拉取**
内容总是从存储目标中提取,覆盖已存在的任何本地内容。此选项通常保留用于一次性内容导入。警告使用此选项,因为任何本地内容都将始终被覆盖!
---
同步计划任务
出于性能原因,此存储目标按基于间隔的计划同步更改,而不是在每次更改上同步更改。定义同步发生时的间隔。
每x分钟x小时x日x月x年
目前设置为每
默认值为每 5 minutes
通用设置:
Fontsmatter键自定义 <-> 数据库表
勾选使用 Fontsmatter键
同步信息:
状态
1. S3 Generic
上次同步于 20 hours ago
---
2. Git
上次同步于 a few seconds ago
......
评论区