# Blog / Content System Specification

## Goal

Bring the existing blog code into the current Laravel application if it already exists in Git, or implement a minimal reusable blog system if it does not.

First search the repository/history for:
- blog
- posts
- articles
- content
- categories/tags related to content
- existing migrations/models/controllers/views/components
- old routes
- admin pages

If a working blog exists in Git history, recover and adapt it instead of rebuilding it.

## Public functionality

Required:
- blog index
- article detail
- article pagination if needed
- category archive
- optional tag archive only if useful
- search engine friendly URLs
- related articles
- related categories/products
- breadcrumbs
- share metadata
- Article/BlogPosting JSON-LD
- Open Graph
- sitemap inclusion

## Admin functionality

Post fields:
- title
- slug
- excerpt
- body
- featured_image
- status: draft/published
- published_at
- author
- category
- optional tags
- seo_title
- seo_description
- seo_image
- canonical_url
- robots controls
- created_at/updated_at

Optional:
- reading_time
- scheduled publishing

## Editor requirements

Use the project's existing editor if one exists.

Support:
- Persian RTL content
- image insertion
- headings
- links
- lists
- tables if editor supports them

Do not store unsanitized arbitrary HTML without an explicit sanitization strategy.

## Blog SEO

Article page should output:
- title
- meta description
- canonical
- Article/BlogPosting JSON-LD
- author
- datePublished
- dateModified
- image
- breadcrumb

Do not fabricate author, publication dates, reviews, or other metadata.

## Commercial internal linking

Admin should make it easy to add:
- related categories
- related products
- related posts

For content strategy, examples:
- "انواع نقل تبریز" -> نقل category
- "راهنمای خرید نوقا" -> نوقا category + selected products
- "سوغات مناسب هدیه" -> multiple product/category links

Links must be contextual and editor-controlled.

## Publishing rules

Draft:
- should not be publicly indexable
- should not appear in sitemap
- should not be listed in public feeds

Published:
- public
- canonical
- sitemap inclusion

Scheduled:
- not public before publish time

## Routes

Preferred patterns:
- `/blog`
- `/blog/{slug}`
- `/blog/category/{slug}`

Use actual project conventions if existing routes already exist.

## Tests

Add tests for:
- draft inaccessible to public
- published article accessible
- unique slug handling
- scheduled article not visible early
- sitemap behavior
- SEO metadata
- JSON-LD
- related product/category links
- authorization for create/edit/publish/delete
