coryd.dev/src/pages/dynamic/show.php.liquid

72 lines
2.7 KiB
Text

---
permalink: /watching/shows/index.php
type: dynamic
schema: show
---
<a class="back-link" href="/watching" title="Go back to the watching index page">{% tablericon "arrow-left" %} Back to watching</a>
<article class="watching-focus">
<img
srcset="
<?= htmlspecialchars($show["backdrop"]) ?>?class=bannersm&type=webp 256w,
<?= htmlspecialchars($show["backdrop"]) ?>?class=bannermd&type=webp 512w,
<?= htmlspecialchars($show["backdrop"]) ?>?class=bannerbase&type=webp 1024w
"
sizes="(max-width: 450px) 256px,
(max-width: 850px) 512px,
1024px"
src="<?= htmlspecialchars($show["backdrop"]) ?>?class=bannersm&type=webp"
alt="<?= htmlspecialchars($show["title"]) ?> (<?= htmlspecialchars($show["year"]) ?>)"
class="image-banner"
decoding="async"
width="256"
height="180"
/>
<div class="media-meta">
<h2 class="page-title"><?= htmlspecialchars($show["title"]) ?> (<?= htmlspecialchars($show["year"]) ?>)</h2>
<?php if (!empty($show["tags"])): ?>
<?php renderTags($show["tags"] ?? []); ?>
<?php endif; ?>
<?php if (!empty($show["favorite"])): ?>
<span class="sub-meta favorite">{% tablericon "heart" %} This is one of my favorite shows!</span>
<?php endif; ?>
<?php if (!empty($show["tattoo"])): ?>
<span class="sub-meta tattoo">{% tablericon "needle" %} I have a tattoo inspired by this show!</span>
<?php endif; ?>
<?php if (!empty($show["episode"]["formatted_episode"])): ?>
<?php
$date = new DateTime($show["episode"]["last_watched_at"]);
$date->setTimezone(new DateTimeZone('America/Los_Angeles'));
?>
<span class="sub-meta">I last watched&nbsp;<mark><?= htmlspecialchars($show["episode"]["formatted_episode"]) ?></mark>&nbsp;on <?= $date->format('F j, Y') ?>.</span>
<?php endif; ?>
</div>
<?php if (!empty($show["review"])): ?>
{% render "blocks/banners/warning.liquid", text: "There are probably spoilers after this banner — this is a warning about them." %}
<h2>My thoughts</h2>
<?= parseMarkdown($show["review"]) ?>
<?php endif; ?>
<?php
renderAssociatedMedia(
$show["artists"] ?? [],
$show["books"] ?? [],
$show["genres"] ?? [],
$show["movies"] ?? [],
$show["posts"] ?? [],
$show["related_shows"] ?? []
);
?>
<?php if (!empty($show["description"])): ?>
<h2>Overview</h2>
<?= parseMarkdown($show["description"]) ?>
<?php endif; ?>
</article>
<?php
$html = ob_get_clean();
$htmlMin = new HtmlMin();
$htmlMin->doOptimizeAttributes(true);
$htmlMin->doRemoveComments(true);
$htmlMin->doSumUpWhitespace(true);
$htmlMin->doRemoveWhitespaceAroundTags(true);
$htmlMin->doOptimizeViaHtmlDomParser(false);
echo $htmlMin->minify($html);
?>