chore: remove old filters, hardcoded types, old post status from view

This commit is contained in:
Cory Dransfeldt 2024-10-13 15:51:27 -07:00
parent ffea333d55
commit 76a172bb74
No known key found for this signature in database
15 changed files with 15 additions and 48 deletions

View file

@ -1,20 +1,4 @@
import { DateTime } from 'luxon'
export default {
isoDateOnly: (date, separator) => {
let d = new Date(date)
let month = '' + (d.getMonth() + 1)
let day = '' + d.getDate()
let year = d.getFullYear()
if (month.length < 2) month = '0' + month
if (day.length < 2) day = '0' + day
return [year, month, day].join(separator)
},
oldPost: (date) => {
return DateTime.now().diff(DateTime.fromJSDate(new Date(date)), 'years').years > 3
},
stringToRFC822Date: (dateString) => {
const date = new Date(Date.parse(dateString))
const dayStrings = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']

View file

@ -142,7 +142,7 @@
"inLanguage": "{{ globals.locale }}",
"publisher": { "@type": "{{ globals.site_type }}", "name": "{{ globals.author }}", "url": "{{ globals.url }}" },
"author": { "@type": "Person", "name": "{{ globals.author }}" },
"datePublished": "{{ page.date | isoDateOnly: '.' }}"
"datePublished": "{{ page.date | date: "%Y.%m.%d" }}"
}
{%- endif -%}
]

View file

@ -1,4 +1,3 @@
{%- assign isOldPost = date | oldPost -%}
{%- if isOldPost -%}
<div class="banner old-post">
<p>{% tablericon "clock-x" %}This post is over 3 years old. I've probably changed my mind since it was written and it <em>could</em> be out of date.</p>

View file

@ -12,7 +12,7 @@ schema: artist
{{ artist.name }} / {{ artist.country }}
{%- endcapture -%}
{%- capture playLabel -%}
{%- if artist.totalPlays == 1 -%}
{%- if artist.total_plays == 1 -%}
play
{%- else -%}
plays
@ -105,8 +105,8 @@ schema: artist
{% for album in artist.albums %}
<tr>
<td>{{ album.name }}</td>
<td>{{ album.totalPlays }}</td>
<td>{{ album.releaseYear }}</td>
<td>{{ album.total_plays }}</td>
<td>{{ album.release_year }}</td>
</tr>
{% endfor %}
</table>

View file

@ -18,7 +18,7 @@ schema: blog
{{ post.title }}
</h3>
<div>
{% render "partials/blocks/banners/old-post.liquid", date:post.date %}
{% render "partials/blocks/banners/old-post.liquid", isOldPost:post.old_post %}
{%- if post.image -%}
<img
srcset="

View file

@ -8,6 +8,7 @@ SELECT
p.featured,
p.slug AS url,
p.mastodon_url,
CASE
WHEN df.filename_disk IS NOT NULL AND df.filename_disk != '' AND df.filename_disk != '/'
THEN CONCAT('/', df.filename_disk)
@ -15,6 +16,11 @@ SELECT
END AS image,
p.image_alt,
CASE
WHEN EXTRACT(YEAR FROM AGE(CURRENT_DATE, p.date)) > 3 THEN TRUE
ELSE FALSE
END AS old_post,
(
SELECT json_agg(
CASE

View file

@ -2,7 +2,6 @@ CREATE OR REPLACE VIEW optimized_all_activity AS
WITH feed_data AS (
SELECT
p.date AS content_date,
'post' AS content_type,
p.title,
p.description,
CONCAT('https://coryd.dev', p.url) AS url,
@ -21,7 +20,6 @@ WITH feed_data AS (
SELECT
l.date AS content_date,
'link' AS content_type,
l.title,
l.description,
l.link AS url,
@ -40,7 +38,6 @@ WITH feed_data AS (
SELECT
b.date_finished AS content_date,
'book' AS content_type,
b.title,
b.description,
CONCAT('https://coryd.dev', b.url) AS url,
@ -64,7 +61,6 @@ WITH feed_data AS (
SELECT
m.last_watched AS content_date,
'movie' AS content_type,
m.title,
m.description,
CONCAT('https://coryd.dev', m.url) AS url,

View file

@ -1,7 +1,6 @@
CREATE OR REPLACE VIEW optimized_search_index AS
WITH search_data AS (
SELECT
'post' AS content_type,
CONCAT('📝 ', p.title) AS title,
CONCAT('https://coryd.dev', p.url) AS url,
p.tags,
@ -12,7 +11,6 @@ WITH search_data AS (
UNION ALL
SELECT
'link' AS content_type,
CONCAT('🔗 ', l.title, ' via ', l.name) AS title,
l.link AS url,
l.tags,
@ -23,7 +21,6 @@ WITH search_data AS (
UNION ALL
SELECT
'book' AS content_type,
CASE
WHEN b.rating IS NOT NULL THEN CONCAT('📖 ', b.title, ' (', b.rating, ')')
ELSE CONCAT('📖 ', b.title)
@ -38,7 +35,6 @@ WITH search_data AS (
UNION ALL
SELECT
'movie' AS content_type,
CASE
WHEN m.rating IS NOT NULL THEN CONCAT('🎥 ', m.title, ' (', m.rating, ')')
ELSE CONCAT('🎥 ', m.title)
@ -53,7 +49,6 @@ WITH search_data AS (
UNION ALL
SELECT
'artist' AS content_type,
CONCAT('🎧 ', ar.name, ' - ', ar.genre_name) AS title,
CONCAT('https://coryd.dev', ar.url) AS url,
ARRAY[ar.genre_name] AS tags,
@ -64,7 +59,6 @@ WITH search_data AS (
UNION ALL
SELECT
'genre' AS content_type,
CONCAT('🎵 ', g.name) AS title,
CONCAT('https://coryd.dev', g.url) AS url,
NULL AS tags,

View file

@ -2,7 +2,6 @@ CREATE OR REPLACE VIEW optimized_sitemap AS
WITH sitemap_data AS (
SELECT
p.date AS content_date,
'post' AS content_type,
p.title,
CONCAT('https://coryd.dev', p.url) AS url
FROM optimized_posts p
@ -11,7 +10,6 @@ WITH sitemap_data AS (
SELECT
b.date_finished AS content_date,
'book' AS content_type,
b.title,
CONCAT('https://coryd.dev', b.url) AS url
FROM optimized_books b
@ -21,7 +19,6 @@ WITH sitemap_data AS (
SELECT
m.last_watched AS content_date,
'movie' AS content_type,
m.title,
CONCAT('https://coryd.dev', m.url) AS url
FROM optimized_movies m
@ -31,7 +28,6 @@ WITH sitemap_data AS (
SELECT
NULL AS content_date,
'artist' AS content_type,
ar.name AS title,
CONCAT('https://coryd.dev', ar.url) AS url
FROM optimized_artists ar
@ -40,7 +36,6 @@ WITH sitemap_data AS (
SELECT
NULL AS content_date,
'genre' AS content_type,
g.name AS title,
CONCAT('https://coryd.dev', g.url) AS url
FROM optimized_genres g

View file

@ -2,7 +2,6 @@ CREATE OR REPLACE VIEW optimized_syndication AS
WITH syndication_data AS (
SELECT
p.date AS content_date,
'post' AS content_type,
p.title,
p.description,
CONCAT('https://coryd.dev', p.url) AS url,
@ -24,7 +23,6 @@ WITH syndication_data AS (
SELECT
l.date AS content_date,
'link' AS content_type,
l.title,
l.description,
l.link AS url,
@ -52,7 +50,6 @@ WITH syndication_data AS (
SELECT
b.date_finished AS content_date,
'book' AS content_type,
b.title,
b.description,
CONCAT('https://coryd.dev', b.url) AS url,
@ -77,7 +74,6 @@ WITH syndication_data AS (
SELECT
m.last_watched AS content_date,
'movie' AS content_type,
m.title,
m.description,
CONCAT('https://coryd.dev', m.url) AS url,

View file

@ -1,5 +1,5 @@
CREATE OR REPLACE VIEW optimized_pages AS
SELECT
SELECT
p.id,
p.title,
p.permalink,

View file

@ -13,7 +13,6 @@ SELECT
CONCAT('/', df.filename_disk) AS image,
b.favorite,
b.tattoo,
'book' AS type,
(
SELECT array_agg(t.name)

View file

@ -11,7 +11,6 @@ SELECT
m.star_rating AS rating,
m.description,
m.review,
'movie' AS type,
m.slug AS url,
CONCAT('/', df.filename_disk) AS image,
CONCAT('/', df2.filename_disk) AS backdrop,

View file

@ -3,7 +3,7 @@ SELECT
ar.name_string AS name,
ar.slug AS url,
ar.tentative,
ar.total_plays AS totalPlays,
ar.total_plays,
ar.country,
ar.description,
ar.favorite,
@ -27,8 +27,8 @@ SELECT
(
SELECT json_agg(json_build_object(
'name', a.name,
'releaseYear', a.release_year,
'totalPlays', a.total_plays,
'release_year', a.release_year,
'total_plays', a.total_plays,
'art', df_album.filename_disk
) ORDER BY a.release_year)
FROM albums a

View file

@ -29,7 +29,6 @@ SELECT
) AS grid,
json_build_object(
'type', 'tv',
'title', s.title,
'year', s.year,
'url', s.slug,