发博攻略
准备
- 参考https://docs.gitcode.com/docs/start/quick注册GitCode账号。
- 在GitCode个人设置中设置主邮箱地址,https://gitcode.com/setting/email。
- 签署贡献者协议,https://cla.openfuyao.cn/sign/67e7c745ea9ceaa8feb65567。
理解博客格式
openFuyao是用markdown格式写博客的,文件头需要包含如下信息:
---
title: "Sample Post"
date: 2025-01-01
category: blog
tags:
- Sample A
- Sample B
sig: sig-xxx
archives: 2025-01
author:
- openFuyao Blog Maintainer
summary: "Just about everything you'll need to style in the theme:headings, paragraphs, blockquotes, tables, code blocks, and more."
---
Here you can edit your blog.
关于格式
站点使用了vitepress框架提供了更好的SEO及更快的加载速度,但也有更严格的打包规则,以下规则非常重要建议您仔细阅读:
- md文件的文件名中禁止包含+号。
- 图片命名禁止空格、且大小写敏感,建议统一使用小写命名加中划线连接。如:blog-example.png。
<font> </font> <center> </center>
属于已弃用标签,vitepress将不再支持,如有需要可以使用<div align=center> </div>
。- md中如需使用HTML标签,该标签需要闭合,如
<div> </div>
。 - 暂不支持c++语言代码块,如果你有c++代码需要展示,请不要指定代码块语言,而是采用默认语言。
- 如果您的博客中包含代码、文件路径、键名、命令请使用代码块将其包裹。
提交博客
博客的提交利用了GitCode的PR(Pull Request)。
提交方式
方式1
openFuyao博客项目https://gitcode.com/openfuyao/community,提交PR具体指导请参考https://docs.gitcode.com/docs/start/contribute 。
方式2
Fork项目
Fork openFuyao博客项目https://gitcode.com/openfuyao/community到您的GitCode上。
克隆项目到本地
执行如下命令可克隆项目到本地:
git clone https://gitcode.com/your-gitcode-id/community
创建分支
执行如下命令可创建一个新的分支:
git checkout -b <branch-name>
创建工作路径
如果您要发表中文博客,工作路径是
zh/content/blog
。假设您要写一个中文博客:cd zh/content/blog mkdir <your-gitcode-id> cd <your-gitcode-id> touch YEAR-MONTH-DAY-title.md
您可以用md文档名来命名您的资源文件,方便使用。例如:
YEAR-MONTH-DAY-title-NN.MARKUP
其中,YEAR,MONTH,DAY,title和您的博客md文件名一致。NN是01、02、03这样的序号。MARKUP是文件扩展名。例如:
2025-01-01-new-years-is-coming.md 2025-01-01-new-years-is-coming-01.png 2025-01-01-new-years-is-coming-02.gif 2025-01-01-new-years-is-coming-03.pdf
使用HTML
标签嵌入图片,但您的图片资源需要放入当前目录下(即your-gitcode-id目录下),输入图片名称作为src值,例如:
<img src = "./2025-01-01-new-years-is-coming-01.png">
Commit您的博客
git add . git commit -m "<message>" git push origin <branch-name>
创建Pull Request(PR)
参考https://docs.gitcode.com/docs/help/home/org_project/pullrequests/pr-create提交你的 PR
等待评审和合入