Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/heng30/sblog
This is a simple blog that provides web services using Rust Rocket and generates web pages through HTML templates.
https://github.com/heng30/sblog
blog rocket rust web web-template
Last synced: 3 days ago
JSON representation
This is a simple blog that provides web services using Rust Rocket and generates web pages through HTML templates.
- Host: GitHub
- URL: https://github.com/heng30/sblog
- Owner: heng30
- Created: 2023-10-19T06:58:44.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-19T13:41:53.000Z (7 months ago)
- Last Synced: 2024-11-01T02:22:26.962Z (about 2 months ago)
- Topics: blog, rocket, rust, web, web-template
- Language: Rust
- Homepage:
- Size: 269 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![screenshot](./screenshot/sblog.png)
[中文文档](./README.zh-CN.md)
#### Introduction
This is a simple blog that provides web services using `Rust Rocket` and generates web pages through HTML templates. You can visit the [Lost Land](https://heng30.xyz) to view the frontend.#### How to deploy?
After the first startup, the default HTML template will be generated. The template is located in the `~/.local/share/sblog/template` directory and includes the following files:
````
template
├── about-body.html
├── about-body.md
├── frame.html
├── header.html
├── home-body.html
└── post-body.html
````
The `about-bodd.md` file is empty and needs to be filled with specific content according to your needs. The content format should be in Markdown.
You can also modify the HTML files according to your needs.After the first startup, the default configuration file will be generated. The configuration file is located at `~/.config/sblog/sblog.conf`.
````
{
"server": {
"listen_address": "0.0.0.0",
"listen_port": 8080
},
"rssinfo": {
"author": "author",
"email": "your-email",
"uri": "https://example.com"
},
"webinfo": {
"site_logo_tab": "/assest/logo.png",
"site_logo": "/assest/logo.png",
"site_name": "your-blog-name"
}
}
````
`rssinfo` and `webinfo` are parameters for the HTML template and **must** be filled in. The `webinfo` root directory is `~/.local/share/sblog`.#### How to publish articles?
- Articles should be placed in the `~/.local/share/sblog/post/md` directory. The article format should be in Markdown, and the article name format **must** be: `title@@tag@@publish-date`. For example: `markdown@@tag1,tag2@@2023-12-01.md`.
- The `homepage` and `rss` require a `summary` information, which is saved in the `~/.local/share/sblog/post/summary` directory. The file name **must** be the same as the article's `title`. The format of the `summary` is: `title.summary`. For example: `markdown.summary`.
- Blog resource files can be saved in the `~/.local/share/sblog/post/assest` directory. You can use `[example](/post/assest/a.txt)` to reference them in your articles.#### How to build?
- Install `Rust` and `Cargo`
- Run `make`
- See [Makefile](./Makefile) for more information#### How to test?
- Start the `sblog` service.
- Run `make install-testdata` to install test data.
- Open a browser and visit `localhost:8080` to access the test data.
- Run `make uninstall-testdata` to delete test data. **Note**: This will delete all articles.#### Reference
- [Rocket](https://rocket.rs/v0.5-rc/guide/introduction/)