This document provides a high-level overview of the BlogVi project structure, key components, and workflow.
BlogVi is a static blog generation system designed to create blog posts from structured data (like CSV) and Markdown content, render them using templates, and apply modern styling.
- Backend: Python
- Templating: Jinja2
- Styling: Tailwind CSS (including the
@tailwindcss/typography
plugin forprose
styling) - Data: CSV for article metadata, Markdown for main content.
-
Configuration (
settings.yaml
):- Located in the project root.
- Defines blog name, URLs, author defaults, features (comments, social sharing, GTM), and other site-wide settings.
- Supports environment variables for sensitive keys (e.g., API keys).
-
Core Logic (
src/blog_vi/core/
):article.py
: Contains theArticle
class, likely responsible for processing individual article data (metadata + markdown) and preparing it for rendering.landing.py
: ContainsLanding
andCategoryLanding
classes, managing the generation of the main landing page and category index pages.utils.py
: Includes helper functions, notablyget_articles_from_csv
which fetches and cleans article metadata from a CSV source URL usingrequests
andftfy
.translations/
: Contains logic for translation providers (DeepL, Google).
-
Templates (
templates/
):- Standard Jinja2 templates.
blog.html
: The base template providing the overall page structure (header, footer, navigation, main content block). It includes CSS links (likely Tailwind output) and JS. Currently has unresolved lint errors around lines 275 & 299.article.html
: Template specifically for rendering individual blog posts. It extendsblog.html
and defines blocks for the title, author information, main content ({% include content %}
), comments, etc. Recent work focused on restructuring the author block (avatar, name, date, read time, categories, bio, social links) below the main title.- Other templates likely exist for the landing page, category pages, RSS feed, etc.
-
Styling:
- Primarily uses Tailwind CSS utility classes directly within the HTML templates.
- The
prose
class (from@tailwindcss/typography
) is used to apply default styling to the main article content generated from Markdown. Proper application scope ofprose
is crucial (should typically wrap only the Markdown-generated content).
-
Content Source:
- Article metadata (title, author, date, categories, etc.) is sourced from a CSV file fetched via URL (
utils.get_articles_from_csv
). - The main body of each article is likely stored as Markdown files, referenced or included based on the CSV data.
- Article metadata (title, author, date, categories, etc.) is sourced from a CSV file fetched via URL (
-
Generation Process:
- A script (likely
regen_blog.sh
) orchestrates the process:- Fetching data.
- Processing articles and landing pages using the core Python classes.
- Rendering Jinja2 templates with the processed data.
- Outputting static HTML files to a designated output directory (e.g.,
dist/
orpublic/
). - Potentially running a local development server (
python -m http.server
or similar).
- A script (likely
- Author Section Layout (
article.html
): Efforts were made to restructure the author details section (moving it below theh1
title, adjusting spacing, separating categories onto a new line, filtering empty categories). However, these changes led to broader layout/styling issues, potentially due to incorrect nesting or interference with theprose
styling scope. The USER has reverted these changes. - Lint Errors (
blog.html
): Persistent lint errors (Property assignment expected, Declaration or statement expected) exist around lines 275 and 299, needing investigation. - Styling: Ensuring Tailwind CSS classes, especially
prose
, are applied correctly and scoped appropriately is important for maintaining consistent design.