feat(*): refactor metadata handling; move metadata to backend where possible, refine client views

This commit is contained in:
Cory Dransfeldt 2025-05-25 20:15:45 -07:00
parent 929bc9f9f8
commit 9687509e4a
No known key found for this signature in database
35 changed files with 506 additions and 339 deletions

View file

@ -11,18 +11,19 @@
if (!preg_match('/^watching\/movies\/[\w-]+$/', $url)) redirectTo404();
$movie = (new MovieFetcher())->fetch($url);
$fetcher = new MovieFetcher();
$movie = $fetcher->fetch($url);
if (!$movie) redirectTo404();
$movie["description"] = parseMarkdown($movie["description"]);
$pageTitle = htmlspecialchars("Movies • " . $movie["title"], ENT_QUOTES, "UTF-8");
$pageDescription = truncateText(htmlspecialchars(strip_tags($movie["description"]), ENT_QUOTES, "UTF-8"), 250);
$ogImage = htmlspecialchars($movie["metadata"]["open_graph_image"], ENT_QUOTES, "UTF-8");
$fullUrl = "https://www.coryd.dev" . $requestUri;
$oembedUrl = "https://www.coryd.dev/oembed" . $requestUri;
$movie["description_html"] = parseMarkdown($movie["description"]);
$movie["globals"] = $fetcher->getGlobals();
$page = $movie;
$globals = $page["globals"];
extract(setupPageMetadata($page, $requestUri));
ob_start();
header("Cache-Control: public, max-age=3600");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 3600) . " GMT");
?>