Skip to content

Commit

Permalink
feat:添加readme,修改博客文件递归深度
Browse files Browse the repository at this point in the history
  • Loading branch information
Foleyzhao committed Mar 25, 2024
1 parent 23d53cc commit c1a9e0d
Show file tree
Hide file tree
Showing 11 changed files with 177 additions and 8 deletions.
125 changes: 123 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,123 @@
# lacerate
lacerate 是一个简单的静态博客生成器
<div align="center">
<a href="https://happy.zj.cn/">
<img src="doc/imgs/Lacerate.png" width="80px" height="80px">
</a>
<h1 align="center">
Lacerate
</h1>
<h3 align="center">
一个Goland编写的简单的静态博客生成器
</h3>

[下 载](https://github.com/Foleyzhao/lacerate/releases) | [主 页](https://happy.zj.cn/)

<a href="https://github.com/Foleyzhao/lacerate/releases/latest">
<img src="https://img.shields.io/github/release/Foleyzhao/lacerate.svg?style=flat-square" alt="">
</a>

<a href="https://github.com/Foleyzhao/lacerate/master/LICENSE">
<img src="https://img.shields.io/github/license/Foleyzhao/lacerate.svg?style=flat-square" alt="">
</a>

<a href="https://github.com/Foleyzhao/lacerate/releases/latest">
<img alt="GitHub All Releases" src="https://img.shields.io/github/downloads/Foleyzhao/lacerate/total.svg?color=%2312b886&style=flat-square">
</a>

</div>
<br>
<div align="center">
<img src="doc/imgs/主页.png">
</div>
<br>

👏 欢迎使用 **Lacerate**

✍️ **Lacerate** 一个简单的静态博客生成器。

## 特性👇

📝 使用 **Markdown** 语法,进行快速创作

🌉 对文章进行分类

🏷️ 对文章进行标签分组

📋 根据年月进行文章归档

🌁 自定义关于我页面

💻 支持多客户端: **𝖶𝗂𝗇𝖽𝗈𝗐𝗌** / **𝖬𝖺𝖼𝖮𝖲** / **Linux**

## 教程
[配置文件说明](../doc/配置文件说明.md) |
[博客编写指南](../doc/博客编写指南.md)

### 快速启动

```bash
git clone https://github.com/Foleyzhao/lacerate.git

go build -o lacerate ./cmd/cmd.go

nohup ./lacerate run > lacerate.log 2>&1 &
```
访问: http://localhost:8090/

### 详细指令

```bash
# lacerate command [args...]

# 初始化博客文件夹
lacerate init

# 新建 markdown 文件
lacerate new filename

# 编译博客
lacerate compile/c

# 打开文件监听器
lacerate watch/w

# 运行http服务,默认端口8090
lacerate http [port]

# 运行lacerate,默认端口8090
lacerate run [port]
```

## 联系
[主页](https://happy.zj.cn/) | 邮箱: foleyzhao@163.com

## 示例截图
<div align="center">
<img src="doc/imgs/主页.png">
</div>
<br>
<div align="center">
<img src="doc/imgs/分类.png">
</div>
<br>
<div align="center">
<img src="doc/imgs/归档.png">
</div>
<br>
<div align="center">
<img src="doc/imgs/文章详情.png">
</div>
<br>
<div align="center">
<img src="doc/imgs/关于我.png">
</div>

## 贡献
欢迎任何形式的贡献。可以使用 [pull requests](https://github.com/Foleyzhao/lacerate/pulls)[issues](https://github.com/Foleyzhao/lacerate/issues) 的方式提交任何想法。

## 支持
<div>
<img src="doc/imgs/WeChat.jpg" width="240px">
</div>

## License
[Apache-2.0](https://github.com/Foleyzhao/lacerate/LICENSE). Copyright (c) 2024 Lacerate
11 changes: 5 additions & 6 deletions core/service/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,17 @@ tagList:
}

// MarkdownList 获取markdown文件夹下所有文件
func MarkdownList() (markdownList []string) {
markdownDir := config.GlobalConf.Markdown
func MarkdownList(markdownDir string) (markdownList []string) {
_ = filepath.Walk(markdownDir, func(path string, f os.FileInfo, err error) error {
if err != nil { //忽略错误
return err
}
if f.IsDir() {
return nil
}
if strings.ToLower(f.Name()) == "readme.md" {
return nil
}
//if strings.ToLower(f.Name()) == "readme.md" {
// return nil
//}
if f.Name() == "about.md" {
return nil
}
Expand All @@ -97,7 +96,7 @@ func MarkdownList() (markdownList []string) {
// LoadPostList 加载文章列表
func LoadPostList() {
postList = make([]*model.Post, 0)
markdownList := MarkdownList()
markdownList := MarkdownList(config.GlobalConf.Markdown)
for _, markdown := range markdownList {
post, err := loadMarkdownContent(markdown)
if err == nil {
Expand Down
Binary file added doc/imgs/Lacerate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/imgs/WeChat.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/imgs/主页.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/imgs/关于我.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/imgs/分类.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/imgs/归档.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/imgs/文章详情.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions doc/博客编写指南.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
博客(markdown)需要以 `---` 开头进行说明:

```md

---
date: 日期 xxxx-xx-xx
title: 标题
categories:
- 分类
tags:
- 标签
---

```
35 changes: 35 additions & 0 deletions doc/配置文件说明.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
`config.yml`配置说明:

```yaml

# 站点信息
title: 站点标题
subtitle: 站点子标题
description: 站点描述
keywords: 站点关键字
# 作者信息
author: 作者名称
avatar: 头像图标
github: github地址
email: 邮箱
# 配置信息
summary_line: 首页文章行数
home_post_num: 首页文章数量
# 文件存储
theme: 模板文件夹
markdown: markdown文件夹
html: html文件夹
storage: 存储文件夹
# 文件监听
paths:
- 监听文件
suffix:
- 监听文件后缀
# 自定义信息
home_title: 主页子标题
archive_title: 归档页面子标题
tag_title: 标签页面子标题
category_title: 分类页面子标题
about_title: 关于我页面子标题

```

0 comments on commit c1a9e0d

Please sign in to comment.