prosberry/specs/001-add-blog/data-model.md

2.0 KiB

Data Model for Blog Feature

Entity: Article

Represents a single blog post.

Fields:

  • title (String): The title of the article.
    • Source: Extracted from the title field within the JSON metadata block at the top of the article's HTML file.
  • date (String): The publication date of the article in YYYY-MM-DD format.
    • Source: Extracted from the date field within the JSON metadata block. This also serves as the prefix for the article's filename.
  • image (String): The relative path to the main image associated with the article.
    • Source: Extracted from the image field within the JSON metadata block.
  • summary (String): A brief summary or excerpt of the article (1-2 sentences).
    • Source: Extracted from the summary field within the JSON metadata block.
  • content (String): The full HTML content of the article.
    • Source: The body of the article's HTML file, following the JSON metadata block.

Relationships:

  • Implicit Relationship with Blog Page: Multiple Article entities are displayed on the main Blog Page (/blog/index.html), which dynamically aggregates and presents them.

Validation Rules:

  • Filename Format: Each article HTML file in blog/clanki/ MUST be named with a YYYY-MM-DD- prefix (e.g., 2025-11-15-medkulturnost-prostor-za-rast.html). Files not adhering to this convention will be ignored with a warning.
  • JSON Metadata: Each article HTML file MUST contain a valid JSON block within an HTML comment at its very beginning. Malformed JSON will cause the article to be skipped with a warning.
  • Required Metadata Fields: The JSON metadata block MUST include title, date, image, and summary fields.
  • jq Dependency: The posodobi_blog.sh script requires jq to parse JSON metadata. The script will check for jq's presence and exit with an error if it's not found.

State Transitions:

  • Not applicable, as articles are static content files.