82 lines
3.3 KiB
Go
82 lines
3.3 KiB
Go
package models
|
|
|
|
// OptimizationResponse represents the structured JSON response from the LLM
|
|
// This is the complete output from the SEO optimization prompt
|
|
type OptimizationResponse struct {
|
|
SEOMeta SEOMeta `json:"seo_meta"`
|
|
ContentOptimization ContentOptimization `json:"content_optimization"`
|
|
FAQBlock FAQBlock `json:"faq_block"`
|
|
Validation Validation `json:"validation"`
|
|
Summary string `json:"summary"`
|
|
}
|
|
|
|
// SEOMeta holds the optimized meta title and description
|
|
type SEOMeta struct {
|
|
Title string `json:"title"` // 50-60 characters
|
|
Description string `json:"description"` // 150-160 characters
|
|
}
|
|
|
|
// ContentOptimization holds all content-level optimizations
|
|
type ContentOptimization struct {
|
|
Changes []ContentChange `json:"changes"`
|
|
InternalLinks []InternalLink `json:"internal_links"`
|
|
}
|
|
|
|
// ContentChange represents a specific content modification
|
|
type ContentChange struct {
|
|
Type string `json:"type"` // keyword_injection, heading_improvement, readability, technical_update
|
|
Location string `json:"location"` // heading, paragraph identifier
|
|
Original string `json:"original"` // excerpt or full text being replaced
|
|
Updated string `json:"updated"` // new text
|
|
Reason string `json:"reason"` // detailed explanation (in Spanish)
|
|
}
|
|
|
|
// InternalLink represents a suggested internal link to add
|
|
type InternalLink struct {
|
|
AnchorText string `json:"anchor_text"`
|
|
TargetPostID int `json:"target_post_id"`
|
|
TargetSlug string `json:"target_slug"`
|
|
InsertionContext string `json:"insertion_context"` // where to insert
|
|
Reason string `json:"reason"` // why this link is relevant (in Spanish)
|
|
}
|
|
|
|
// FAQBlock holds FAQ schema data for RankMath
|
|
type FAQBlock struct {
|
|
ShouldCreate bool `json:"should_create"`
|
|
Reason string `json:"reason"`
|
|
Questions []FAQQuestion `json:"questions"`
|
|
}
|
|
|
|
// FAQQuestion represents a single FAQ item
|
|
type FAQQuestion struct {
|
|
ID string `json:"id"` // faq-question-{timestamp}
|
|
Title string `json:"title"` // the question
|
|
Content string `json:"content"` // the answer (40-80 words, can include HTML)
|
|
Visible bool `json:"visible"` // always true
|
|
}
|
|
|
|
// Validation holds fact-checking and link validation results
|
|
type Validation struct {
|
|
FactChecks []FactCheck `json:"fact_checks"`
|
|
BrokenLinks []BrokenLink `json:"broken_links"`
|
|
}
|
|
|
|
// FactCheck represents validation of a technical claim
|
|
type FactCheck struct {
|
|
Claim string `json:"claim"`
|
|
Status string `json:"status"` // verified, outdated, uncertain
|
|
Source string `json:"source"` // URL to official docs if verified
|
|
RecommendedAction string `json:"recommended_action"` // keep, update, flag_for_review
|
|
UpdatedText string `json:"updated_text"` // if status=outdated
|
|
Reason string `json:"reason"` // explanation (in Spanish)
|
|
}
|
|
|
|
// BrokenLink represents a broken or problematic link
|
|
type BrokenLink struct {
|
|
URL string `json:"url"`
|
|
Status string `json:"status"` // 404, timeout, redirect, moved
|
|
Replacement string `json:"replacement"` // new URL if found
|
|
Action string `json:"action"` // replace, remove
|
|
Reason string `json:"reason"` // explanation (in Spanish)
|
|
}
|