# Tasks for Feature: Add Blog "Medkulturni kotiček"

**Feature Branch**: `001-add-blog`
**Date**: 2025-11-17
**Spec**: /Users/markpoljansek/prosberry_produkcija/specs/001-add-blog/spec.md
**Plan**: /Users/markpoljansek/prosberry_produkcija/specs/001-add-blog/plan.md

## Implementation Strategy

The implementation will follow an iterative approach, prioritizing core user stories first to deliver a Minimum Viable Product (MVP). Each user story will be implemented and tested independently where possible.

**MVP Scope**: User Story 1 (View Blog Main Page), User Story 2 (Read an Individual Article), and User Story 3 (Website Owner Adds New Article) form the core MVP, enabling content consumption and management.

## Phase 1: Setup

- [X] T001 Create base blog directory structure: `mkdir -p blog/clanki/ assets/images/blog/`
- [X] T002 Create empty `blog/template.html` file
- [X] T003 Create empty `posodobi_blog.sh` script file
- [X] T004 Create empty `blog/index.html` file (will be auto-generated later)

## Phase 2: Foundational (Core Script & Template)

- [X] T005 Implement `jq` dependency check in `posodobi_blog.sh`
- [X] T006 Implement basic script structure in `posodobi_blog.sh` to find `.html` files in `blog/clanki/`
- [X] T007 Implement article sorting by filename (date) in `posodobi_blog.sh`
- [X] T008 Create initial `blog/template.html` content with placeholders: `__NAJNOVEJSI_CLANEK__`, `__CAKAJOCI_CLANKI__`, `__ARHIV_SEZNAM__`
- [X] T009 Implement metadata extraction (JSON from HTML comment) in `posodobi_blog.sh`
- [X] T010 Implement malformed JSON handling (skip with warning) in `posodobi_blog.sh`
- [X] T011 Implement invalid filename handling (ignore with warning) in `posodobi_blog.sh`

## Phase 3: User Story 3 (P1) - Website Owner Adds New Article

**Goal**: Enable the website owner to easily add new articles to the blog.
**Independent Test**: A new article can be added by creating a file with metadata and running the script, resulting in the main blog page being updated correctly.

- [X] T012 [US3] Implement HTML generation for featured article in `posodobi_blog.sh`
- [X] T013 [US3] Implement HTML generation for recent articles (3 cards) in `posodobi_blog.sh`
- [X] T014 [US3] Implement HTML generation for archive list in `posodobi_blog.sh`
- [X] T015 [US3] Implement placeholder generation for < 4 articles in `posodobi_blog.sh`
- [X] T016 [US3] Implement placeholder replacement in `blog/template.html` with generated content in `posodobi_blog.sh`
- [X] T017 [US3] Implement writing final HTML to `blog/index.html` in `posodobi_blog.sh`
- [X] T018 [US3] Create a sample article file `blog/clanki/2025-11-17-sample-article.html` with valid JSON metadata and content.

## Phase 4: User Story 1 (P1) - View Blog Main Page

**Goal**: Display the main blog page with the latest articles prominently.
**Independent Test**: The `/blog/index.html` page can be accessed directly and displays the articles according to the specified layout (featured, recent, archive).

- [X] T019 [US1] Run `posodobi_blog.sh` to generate `blog/index.html` with sample data
- [X] T020 [US1] Verify `blog/index.html` displays featured article correctly
- [X] T021 [US1] Verify `blog/index.html` displays recent articles correctly
- [X] T022 [US1] Verify `blog/index.html` displays archive list correctly
- [X] T023 [US1] Verify placeholder blocks are displayed if fewer than 4 articles are present (requires additional sample data or modification of T018)

## Phase 5: User Story 2 (P1) - Read an Individual Article

**Goal**: Allow visitors to read full article content on dedicated pages.
**Independent Test**: An individual article page (e.g., `/blog/clanki/YYYY-MM-DD-article-title.html`) can be accessed directly and displays the full article content with consistent styling.

- [X] T024 [US2] Ensure links from `blog/index.html` to individual articles are correct
- [X] T025 [US2] Verify individual article pages load correctly
- [X] T026 [US2] Verify individual article pages display full content

## Phase 6: User Story 4 (P2) - Access Blog from Navigation

**Goal**: Integrate the blog into the main website navigation.
**Independent Test**: The main navigation menu includes a "Blog" link that correctly leads to the blog's main page.

- [X] T027 [US4] Add `<a href="/blog/">Blog</a>` link to `header-template.html` next to "Cene in reference"
- [X] T028 [US4] Run `update-menus.sh` to apply navigation changes across the site
- [X] T029 [US4] Verify "Blog" link is present in main navigation on all relevant pages
- [X] T030 [US4] Verify "Blog" link navigates to `/blog/index.html`

## Final Phase: Polish & Cross-Cutting Concerns

- [X] T031 [P] Add new CSS styles for blog elements (`.blog-layout`, `.blog-main-content`, `.blog-sidebar`, `.featured-article`, `.recent-card`, `.archive-list`) to `css/style.css`
- [X] T032 [P] Ensure blog CSS styles are fully responsive for mobile devices
- [X] T033 [P] Verify individual article page styling matches overall website design (warm colors, non-white background)
- [X] T034 [P] Implement unit tests for `posodobi_blog.sh` using Bats-core
- [X] T035 [P] Implement HTML/CSS/JS Linting/Validation for generated pages
- [X] T036 [P] Implement Link Checking for generated blog pages
- [X] T037 Update `README.md` with instructions for adding new blog posts and running `posodobi_blog.sh`
- [X] T038 Review and optimize generated HTML for SEO and accessibility

## Dependencies

*   Phase 2 (Foundational) must be completed before any User Story phases.
*   User Story 3 (Website Owner Adds New Article) is foundational for User Story 1 (View Blog Main Page) as it generates the content.
*   User Story 1 (View Blog Main Page) is foundational for User Story 2 (Read an Individual Article) as it provides the links.

## Parallel Execution Opportunities

*   **Phase 1: Setup**: All tasks are sequential.
*   **Phase 2: Foundational**: Tasks T005-T011 are largely sequential due to script development.
*   **Phase 3: User Story 3**: Tasks T012-T017 are sequential as they build the script logic. T018 can be done in parallel once the script logic is stable.
*   **Phase 4: User Story 1**: Tasks T019-T023 are sequential as they involve testing the generated output.
*   **Phase 5: User Story 2**: Tasks T024-T026 are sequential.
*   **Phase 6: User Story 4**: Tasks T027-T030 are sequential.
*   **Final Phase**: Tasks T031-T036 can be executed in parallel. T037 and T038 are final documentation/review tasks.

## Independent Test Criteria for Each Story

*   **User Story 1 (View Blog Main Page)**: Navigate to `/blog/index.html` and visually confirm the layout (featured, recent, archive) and content display as specified.
*   **User Story 2 (Read an Individual Article)**: Click on a link to an individual article from the main blog page or navigate directly to an article URL. Verify full content display and consistent styling.
*   **User Story 3 (Website Owner Adds New Article)**: Create a new article HTML file with valid metadata, run `posodobi_blog.sh`, and verify that `blog/index.html` is updated correctly to include the new article.
*   **User Story 4 (Access Blog from Navigation)**: Navigate to various pages on the website, confirm the "Blog" link is present in the main navigation, and verify it correctly leads to `/blog/index.html`.
