Skip to main content

Internal Service: generate_boosted_files

Generates all static files for a boosted page at the ROOT level of the site.

Function Signature

async def generate_boosted_files(content_result: dict) -> dict

Parameters

ParameterTypeDescription
content_resultdictOutput from Step 3 (generate_boosted_content) with additional metadata

content_result Structure

{
    "boosted_content": {
        "title": "...",
        "sources": [...],
        "mentioned_business": "..."
    },
    "business_id": "...",
    "product_id": "...",  # Optional
    "product_name": "...",  # Optional
    "boosted_id": "boosted_xxx",
    "boosted_type": "article",
    "ai_site_url": "https://...",
    "source_url": "https://...",  # Customer's real domain (REQUIRED)
    "existing_posts": [...],
    "entity_id": "...",
    "faq_category": "business_boosted" | "product_boosted"
}

Returns

{
    "status": "success",
    "files": [
        {"path": "pages/{slug}.js", "content": "..."},
        {"path": "public/{slug}/index.html", "content": "..."},
        {"path": "public/{slug}/llms.txt", "content": "..."},
        {"path": "public/{slug}/data.json", "content": "..."}
    ],
    "title": "...",
    "slug": "...",
    "boosted_path": "/{slug}/",
    "published_date": "YYYY-MM-DD",
    "faq_category": "..."
}

Generated Files

FilePurpose
pages/{slug}.jsNext.js page component for routing
public/{slug}/index.htmlStatic HTML for direct access
public/{slug}/llms.txtAI-optimized content for crawlers
public/{slug}/data.jsonStructured data (Schema.org Article)

URL Structure

All boosted pages are placed at ROOT level for better AI SEO:
  • Business boosted: /{slug}/
  • Product boosted: /{slug}/
No more /ai_blog/ prefix.

Canonical URLs

Critical: All public-facing URLs use source_url (customer’s real domain), NOT ai_site_url. This ensures search engines index the correct domain.

Template Dependencies

Uses templates from children/templates/:
  • generate_boosted_html() - HTML with proper meta tags
  • generate_boosted_llms_txt() - AI-optimized text content
  • slugify() - URL-safe slug generation

Code Location

src/app/apis/cron/create_boosted_page/children/step_4_generate_files.py