From 0c6cc69abf7d9b7c0fc619c41e4f00022a77dd50 Mon Sep 17 00:00:00 2001
From: Cory Dransfeldt <coryd@hey.com>
Date: Mon, 14 Aug 2023 11:52:54 -0700
Subject: [PATCH] chore: cleanup alt attrs

---
 config/mediaFilters.js                       | 7 ++++++-
 src/_includes/partials/now/media-grid.liquid | 9 +--------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/config/mediaFilters.js b/config/mediaFilters.js
index eb054750..03d8b95a 100644
--- a/config/mediaFilters.js
+++ b/config/mediaFilters.js
@@ -12,12 +12,17 @@ module.exports = {
       }
       if (item.type === 'artist') {
         normalized['title'] = item['title']
+        normalized['alt'] = `${item['plays']} plays of ${item['title']}`
         normalized['subtext'] = `${item['plays']} plays`
       }
       if (item.type === 'book') normalized['alt'] = item['title']
-      if (item.type === 'movie') normalized['title'] = item['title']
+      if (item.type === 'movie') {
+        normalized['title'] = item['title']
+        normalized['alt'] = `${item['title']} - ${item['summary']}`
+      }
       if (item.type === 'tv') {
         normalized['title'] = item['title']
+        normalized['alt'] = `${item['title']} from ${item['name']}`
         normalized['subtext'] = `${item.name} • <strong>${item.episode}</strong>`
       }
       return normalized
diff --git a/src/_includes/partials/now/media-grid.liquid b/src/_includes/partials/now/media-grid.liquid
index ac8e2e1f..41c4d09d 100644
--- a/src/_includes/partials/now/media-grid.liquid
+++ b/src/_includes/partials/now/media-grid.liquid
@@ -6,14 +6,7 @@
   </h2>
   <div class="grid gap-2 {% if shape == 'square' %}grid-cols-2 md:grid-cols-4{% else %}grid-cols-3 md:grid-cols-6{% endif %} not-prose">
     {% for item in media limit: count %}
-      {% capture altVal %}
-        {% if item.alt %}
-          {{ item.alt }}
-        {% elsif item.title %}
-          {{ item.title }}
-        {% endif %}
-      {% endcapture %}
-      {% assign alt = altVal | strip %}
+      {% assign alt = item.alt | strip %}
       <a href="{{ item.url }}" title="{{ alt | escape }}">
         <div class="relative block{% if shape == 'square' %} h-full{% endif %}"{% if shape != 'square' %} style="max-width:226px"{% endif %}>
           <div class="absolute left-0 top-0 h-full w-full rounded-lg border border-purple-600 hover:border-pink-500 dark:border-purple-400 dark:hover:border-pink-500 ease-in-out duration-300{% if item.title %} bg-cover-gradient{% endif %}"></div>