88 lines
2.1 KiB
Markdown
88 lines
2.1 KiB
Markdown
# Flask Blog Templates
|
|
|
|
A minimal **Flask template set** for my blog.
|
|
This project adapts and the original [simple-blog-template](https://github.com/earlbread/simple-blog-template) by [Seunghun Lee](https://github.com/earlbread).
|
|
|
|
## Git Tag
|
|
|
|
Current version:
|
|
|
|
```bash
|
|
git tag -a v1.0 -m "Initial release of Flask Blog Templates"
|
|
(it worked on my machine)
|
|
```
|
|
|
|
---
|
|
|
|
## Overview
|
|
|
|
It provides a growing collection of styling templates and is designed to run with two additional files (see below).
|
|
|
|
In the current setup, blog content is defined using Python dictionaries (example below), while comments are stored in a CSV file at `content/comments.csv`.
|
|
|
|
A basic blog structure is provided by the existing templates. Additional per-article styling can be applied either by embedding raw HTML directly in the post content or by using template expansion via Jinja:
|
|
|
|
```jinja2
|
|
{% if post.template %}
|
|
{% include post.template %}
|
|
{% endif %}
|
|
```
|
|
|
|
For example, `templates/components/timeline.html` demonstrates a timeline component.
|
|
|
|
An example data structure is provided below.
|
|
|
|
---
|
|
|
|
## Required Files
|
|
|
|
This two files should be included in program folder to run the app.
|
|
|
|
### `content/about.py`
|
|
|
|
provides text for about page and blog title
|
|
|
|
```python
|
|
ABOUT = {
|
|
"content": """
|
|
<p>Hello here is the about page</p>
|
|
"""
|
|
}
|
|
|
|
TITLE = {
|
|
"title": "Hello World"
|
|
}
|
|
```
|
|
|
|
### `content/posts.py`
|
|
|
|
provides articles in blog:
|
|
|
|
```python
|
|
BLOG_POSTS = [
|
|
{
|
|
'id': 7,
|
|
'title': "title",
|
|
'subtitle': "subtitle",
|
|
'date': "December 10, 2024",
|
|
'content': """can use raw html string for style, will be rendered as html
|
|
""",
|
|
'displayall': False
|
|
},
|
|
]
|
|
```
|
|
|
|
## Template Evolution
|
|
|
|
- Originally based on the Simple Blog Template project.
|
|
|
|
- Adapted for Jinja2 rendering (Flask compatibility).
|
|
|
|
- CSS rewritten for flexibility and modular styling.
|
|
|
|
- Template design will continue accumulating for themes and post customization.
|
|
|
|
## License
|
|
|
|
- This project is distributed under the [MIT License](https://github.com/earlbread/simple-blog-template/blob/master/LICENSE).
|