A simplistic blogging system
NanoBlog is a blogging system on file basis, therefore it doesn't use a database, scripting or cookies. This is achieved in 3 steps:
- Creating, reading, updating or deleting all content via API and storing them as files.
This allows us to configure the blog either completely via API or partly on the filesystem itself.
Content files are separated into three folders:- BlogFiles/Structure, which contains defined files that build the core structure (see Details). Those files always exist for a blog and can be updated (though not be deleted) via API.
- BlogFiles/Posts, which contains all posts that were created. Post files are named automatically so that they're sortable by creation date. In contrast to structure files, posts can also be deleted.
- BlogFiles/Assets, which contains all assets (currently only images) that can be included (via
<img>
-tag) in the posts or structure. Asset files are limited by type (currently: png, jpg, gif, svg) and type checked by file extension, magic bytes and given MIME type. These files can also be updated or deleted and named automatically (though the file extension is preserved).
- Composing all files into HTML pages (or, if pagination is disabled, into a single one) which then can be served by a webserver. The resulting file will be exported into Export/.
- Copying all asset files into the Export/Assets folder so that they can be served too.
- Pagination is available. The page size must be configured. Hint: As this blog is "designed" like other micro-blogging platforms, the posts are ordered by descending creation date and the pages work like an archive.
- The API is secured via bearer token. This token must be configured before starting NanoBlog either via appsettings.json or environment variables. Make sure to use a long and secure token! Also make sure that possible brute forcing is prevented by firewall, IPS and rate limiting!
Selector | Type | Description |
---|---|---|
#posts |
div |
Identifies the posts container |
.post |
div |
Identifies one post |
#pagination |
nav |
Identifies the pagination container |
.pagination-link |
li |
Identifies one link list item that refers to another page |
.previous |
li |
Identifies the link list item that refers to the previous page |
.current |
li |
Identifies the link list item that refers to the current page |
.following |
li |
Identifies the link list item that refers to the following page |
.same-page |
li |
Identifies a link list item that would refer to the same page because the current page is the first/last one |
File name | Description |
---|---|
header.txt | Contains content of <head> tag, e.g. title, styles, metadata |
intro.txt | Can contain a "welcome" text |
legal.txt | Can contain information about copyright, privacy policy etc. |
footer.txt | Can contain <script> s, footer etc. |
cd docker/
cp .env.example .env
- set AuthenticationToken in .env
- optional: configure pagination and language in .env
docker compose up
cd NanoBlog/
- set AuthenticationToken in NanoBlog/appsettings.json (or NanoBlog/appsettings.Development.json)
- optional: configure pagination and language in NanoBlog/appsettings.json
dotnet run .
If you want to give me any relevant information to this project, feel free to either create an issue or write me a mail.