feat: everything is related

This commit is contained in:
Cory Dransfeldt 2024-08-24 22:37:36 -07:00
parent d1e3ab23bb
commit 077c54d5fb
No known key found for this signature in database
20 changed files with 325 additions and 274 deletions

View file

@ -0,0 +1,65 @@
{% comment %} render related artists {% endcomment %}
{%- if artists -%}
<p id="artists" class="music">
{% tablericon "headphones" "Related artist(s)" %}
Related artist(s)
</p>
<ul>
{% for artist in artists %}
<li><a href="{{ artist.url }}">{{ artist.name }}</a>{%- if artist.total_plays > 0 -%}: <strong class="highlight-text">{{ artist.total_plays }} plays</strong>{%- endif -%}</li>
{% endfor %}
</ul>
<hr />
{%- endif -%}
{% comment %} render related books {% endcomment %}
{%- if books -%}
<p id="books" class="books">
{% tablericon "books" "Related book(s)" %}
Related book(s)
</p>
<ul>
{% for book in books %}
<li><a href="{{ book.url }}">{{ book.title }}</a> by {{ book.author }}</li>
{% endfor %}
</ul>
<hr />
{%- endif -%}
{% comment %} render related genres {% endcomment %}
{%- if genres -%}
<p id="genres" class="music">
{% tablericon "headphones" "Genre(s)" %}
Related genre(s)
</p>
<ul>
{% for genre in genres %}
<li><a href="{{ genre.url }}">{{ genre.name }}</a></li>
{% endfor %}
</ul>
<hr />
{%- endif -%}
{% comment %} render related movies {% endcomment %}
{%- if movies -%}
<p id="movies" class="movies">
{% tablericon "movie" "Related movie(s)" %}
Related movie(s)
</p>
<ul>
{% for movie in movies %}
<li><a href="{{ movie.url }}">{{ movie.title }}</a> ({{ movie.year }})</li>
{% endfor %}
</ul>
<hr />
{%- endif -%}
{% comment %} render related shows {% endcomment %}
{%- if shows -%}
<p id="tv" class="tv">
{% tablericon "device-tv-old" "Related show(s)" %}
Related show(s)
</p>
<ul>
{% for show in shows %}
<li><a href="{{ show.url }}">{{ show.title }}</a> ({{ show.year }})</li>
{% endfor %}
</ul>
<hr />
{%- endif -%}

View file

@ -1,18 +1,18 @@
<div class="badge-grid">
{%- for badge in badges limit: 8 -%}
<a href="{{ badge.url }}">
<img srcset="
https://cdn.coryd.dev/{{ badge.image }}?class=w50 50w,
https://cdn.coryd.dev/{{ badge.image }}?class=w100 100w,
https://cdn.coryd.dev/{{ badge.image }}?class=w200 200w,
" sizes="(max-width: 450px) 88px,
(max-width: 850px) 176px,
(max-width: 1000px) 352px,
704px" src="https://cdn.coryd.dev/{{ badge.image }}?class=w200" alt="{{ badge.image_alt }}" loading="lazy"
decoding="async"
width="88"
height="31"
/>
</a>
<a href="{{ badge.url }}">
<img srcset="
https://cdn.coryd.dev/{{ badge.image }}?class=w50 50w,
https://cdn.coryd.dev/{{ badge.image }}?class=w100 100w,
https://cdn.coryd.dev/{{ badge.image }}?class=w200 200w,
" sizes="(max-width: 450px) 88px,
(max-width: 850px) 176px,
(max-width: 1000px) 352px,
704px" src="https://cdn.coryd.dev/{{ badge.image }}?class=w200" alt="{{ badge.image_alt }}" loading="lazy"
decoding="async"
width="88"
height="31"
/>
</a>
{%- endfor -%}
</div>

View file

@ -14,35 +14,35 @@
"items": [
{%- assign entries = data | normalizeEntries: 20 -%}
{%- for entry in entries -%}
{%- assign summary = entry.content | strip_html | normalize_whitespace | escape -%}
{%- assign utm_parameters = "utm_source=rss&utm_medium=feed&utm_campaign=" | append: utm_campaign -%}
{
"id": "{{ entry.url | encodeAmp | escape }}",
"title": "{{ entry.title | escape }}{% if entry.authors %} via {{ entry.authors.name | escape }}{% endif %}{% if entry.rating %} ({{ entry.rating | escape }}){% endif %}",
{%- if utm_campaign -%}
"url": "{{ entry.url | append: '?' | append: utm_parameters }}",
{%- else -%}
"url": "{{ entry.url | encodeAmp }}",
{%- endif -%}
"content_html": "{{ summary }}",
"summary": "{{ summary }}",
{%- if entry.author -%}
"external_url": "{{ entry.url | encodeAmp | escape }}",
"authors": [{
"name": "{{ entry.author.name | escape }}",
"url": "{{ entry.author.url | escape }}",
"mastodon": "{{ entry.author.mastodon | escape }}",
"rss": "{{ entry.author.feed | escape }}"
}],
{%- endif %}
"date_published": "{{ entry.date | date: '%Y-%m-%dT%H:%M:%S%:z' }}"{%- if entry.tags -%},
"tags": [
{%- for tag in entry.tags -%}
"{{ tag | escape }}"{%- unless forloop.last -%}, {% endunless -%}
{%- endfor -%}
]
{%- endif -%}
}{%- if forloop.last == false -%},{%- endif -%}
{%- assign summary = entry.content | strip_html | normalize_whitespace | escape -%}
{%- assign utm_parameters = "utm_source=rss&utm_medium=feed&utm_campaign=" | append: utm_campaign -%}
{
"id": "{{ entry.url | encodeAmp | escape }}",
"title": "{{ entry.title | escape }}{% if entry.authors %} via {{ entry.authors.name | escape }}{% endif %}{% if entry.rating %} ({{ entry.rating | escape }}){% endif %}",
{%- if utm_campaign -%}
"url": "{{ entry.url | append: '?' | append: utm_parameters }}",
{%- else -%}
"url": "{{ entry.url | encodeAmp }}",
{%- endif -%}
"content_html": "{{ summary }}",
"summary": "{{ summary }}",
{%- if entry.author -%}
"external_url": "{{ entry.url | encodeAmp | escape }}",
"authors": [{
"name": "{{ entry.author.name | escape }}",
"url": "{{ entry.author.url | escape }}",
"mastodon": "{{ entry.author.mastodon | escape }}",
"rss": "{{ entry.author.feed | escape }}"
}],
{%- endif %}
"date_published": "{{ entry.date | date: '%Y-%m-%dT%H:%M:%S%:z' }}"{%- if entry.tags -%},
"tags": [
{%- for tag in entry.tags -%}
"{{ tag | escape }}"{%- unless forloop.last -%}, {% endunless -%}
{%- endfor -%}
]
{%- endif -%}
}{%- if forloop.last == false -%},{%- endif -%}
{%- endfor -%}
]
}