Files
documentation/update_seo.py

119 lines
8.0 KiB
Python

import os
import re
base_dir = "dist"
seo_templates = {
"architecture": {
"title": "Our Architecture — Vyla",
"description": "How Vyla Home, SDK, and Stream API relate, and where each responsibility belongs.",
"keywords": "Vyla architecture, Vyla Home, Vyla SDK, Stream API, system design, media stack, deployment patterns, self-hosted media",
"canonical": "architecture.html",
"image": "thumbnail.png"
},
"go": {
"title": "Vyla Go — Vyla",
"description": "The Android control center for running the Vyla media stack locally.",
"keywords": "Vyla Go, Android media player, mobile streaming, self-hosted media, Android app, media streaming",
"canonical": "go.html",
"image": "android-preview.png"
},
"player": {
"title": "Build a player — Vyla",
"description": "Design a resilient Vyla playback experience around your own product and infrastructure.",
"keywords": "Vyla player, media player, custom player, playback experience, HLS player, MP4 player, streaming player",
"canonical": "player.html",
"image": "thumbnail.png"
},
"sdk-quickstart": {
"title": "SDK quickstart — Vyla",
"description": "Install Vyla SDK, resolve a source, and build a safe server-side integration.",
"keywords": "Vyla SDK, SDK quickstart, Node.js SDK, server-side integration, stream resolution, API integration",
"canonical": "sdk-quickstart.html",
"image": "thumbnail.png"
},
"self-hosting": {
"title": "Self-host Stream API — Vyla",
"description": "Deploy the optional Stream API when your clients need an HTTP/SSE layer.",
"keywords": "self-hosting, Stream API deployment, Node.js deployment, HTTP API, SSE, server setup, infrastructure",
"canonical": "self-hosting.html",
"image": "thumbnail.png"
},
"tv": {
"title": "Vyla TV — Vyla",
"description": "The Android TV application for running the Vyla media experience on your television.",
"keywords": "Vyla TV, Android TV, TV streaming, smart TV, television app, media streaming, Android TV app",
"canonical": "tv.html",
"image": "android-tv-preview.png"
},
"stream-api/overview": {
"title": "Stream API — Vyla",
"description": "An optional self-hosted HTTP and SSE layer built on top of Vyla SDK.",
"keywords": "Stream API, HTTP API, SSE, Server-Sent Events, streaming API, self-hosted API, Node.js API",
"canonical": "stream-api/overview.html",
"image": "thumbnail.png"
},
"stream-api/paths": {
"title": "Paths and playback events — Vyla",
"description": "The complete Stream API playback contract, unified for movies and TV episodes.",
"keywords": "Stream API paths, playback events, SSE events, API endpoints, movie API, TV API, streaming endpoints",
"canonical": "stream-api/paths.html",
"image": "thumbnail.png"
},
"stream-api/media-data": {
"title": "Subtitles and downloads — Vyla",
"description": "Unified media-data paths for movies and TV episodes.",
"keywords": "subtitles, downloads, media data, subtitle tracks, download links, VTT, SRT, subtitle API",
"canonical": "stream-api/media-data.html",
"image": "thumbnail.png"
},
"stream-api/operations": {
"title": "Health, testing, and safe operations — Vyla",
"description": "Observe SDK providers and diagnose a Stream API deployment without making debug data public.",
"keywords": "health check, API testing, operations, debugging, provider health, API monitoring, deployment",
"canonical": "stream-api/operations.html",
"image": "thumbnail.png"
},
"concepts/providers": {
"title": "Providers — Vyla",
"description": "How Vyla SDK sources are configured, selected, and verified.",
"keywords": "providers, source configuration, stream sources, provider verification, SDK providers, source selection",
"canonical": "concepts/providers.html",
"image": "thumbnail.png"
},
"guides/integrations": {
"title": "Stream API client integration — Vyla",
"description": "Build an optional Stream API player client with HLS/MP4 handling, SSE sources, subtitles, and fallbacks.",
"keywords": "client integration, player integration, HLS.js, React, Vue, iOS, Android, SSE client, streaming client",
"canonical": "guides/integrations.html",
"image": "thumbnail.png"
},
"guides/error-handling": {
"title": "Stream API error handling — Vyla",
"description": "Handle SSE failures, source fallbacks, and edge cases in an optional Stream API client.",
"keywords": "error handling, fallbacks, SSE errors, streaming errors, retry logic, error boundary, source fallback",
"canonical": "guides/error-handling.html",
"image": "thumbnail.png"
},
"misc/credit": {
"title": "Credit — Vyla",
"description": "Credits and inspiration behind the Vyla API ecosystem.",
"keywords": "credits, attribution, open source, inspiration, P-Stream, CinePro, Movieslay, acknowledgments",
"canonical": "misc/credit.html",
"image": "thumbnail.png"
},
"misc/dmca": {
"title": "DMCA & Copyright — Vyla",
"description": "Content sources used by Vyla API and how rights holders can request removal.",
"keywords": "DMCA, copyright, takedown, legal, content sources, rights holders, copyright policy, takedown request",
"canonical": "misc/dmca.html",
"image": "thumbnail.png"
}
}
def generate_seo_head(template):
name = template["title"].replace(" — Vyla", "")
json_ld = " <!-- JSON-LD Structured Data -->\n <script type="application/ld+json">\n {\n "@context": "https://schema.org",\n "@type": "SoftwareApplication",\n "name": "" + name + "",\n "description": "" + template["description"] + "",\n "url": "https://vyla.cc/" + template["canonical"] + "",\n "applicationCategory": "MultimediaApplication",\n "operatingSystem": "Windows, macOS, Linux, Android, Android TV",\n "offers": {\n "@type": "Offer",\n "price": "0",\n "priceCurrency": "USD"\n }\n }\n </script>"
return " <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <title>" + template["title"] + "</title>\n <meta name="description" content="" + template["description"] + "" />\n <meta name="keywords" content="" + template["keywords"] + "" />\n <link rel="canonical" href="https://vyla.cc/" + template["canonical"] + "" />\n\n <!-- Open Graph / Facebook -->\n <meta property="og:type" content="website" />\n <meta property="og:url" content="https://vyla.cc/" + template["canonical"] + "" />\n <meta property="og:title" content="" + template["title"] + "" />\n <meta property="og:description" content="" + template["description"] + "" />\n <meta property="og:image" content="https://vyla.cc/assets/images/" + template["image"] + "" />\n <meta property="og:site_name" content="Vyla" />\n\n <!-- Twitter -->\n <meta property="twitter:card" content="summary_large_image" />\n <meta property="twitter:url" content="https://vyla.cc/" + template["canonical"] + "" />\n <meta property="twitter:title" content="" + template["title"] + "" />\n <meta property="twitter:description" content="" + template["description"] + "" />\n <meta property="twitter:image" content="https://vyla.cc/assets/images/" + template["image"] + "" />\n <meta property="twitter:site" content="@vylaentertainment" />\n\n <!-- Additional SEO -->\n <meta name="robots" content="index, follow" />\n <meta name="author" content="Vyla" />\n\n <link rel="icon" href="/favicon.ico" />\n <link rel="stylesheet" href="/assets/base.css" />\n <link rel="stylesheet" href="/assets/highlight.css" />\n <link rel="stylesheet" href="/assets/mintlify-overrides.css" />\n\n" + json_ld + "\n\n <script>\n (fun