chore: schemas, styles, cleanup
This commit is contained in:
parent
e0c0c5ccd2
commit
7caf3370ff
17 changed files with 123 additions and 55 deletions
|
@ -75,6 +75,7 @@ export default async function (eleventyConfig) {
|
||||||
})
|
})
|
||||||
|
|
||||||
eleventyConfig.addShortcode('appVersion', () => appVersion)
|
eleventyConfig.addShortcode('appVersion', () => appVersion)
|
||||||
|
eleventyConfig.addShortcode('isProduction', () => process.env.ELEVENTY_PRODUCTION)
|
||||||
|
|
||||||
// events
|
// events
|
||||||
if (process.env.ELEVENTY_PRODUCTION) eleventyConfig.on('afterBuild', copyErrorPages)
|
if (process.env.ELEVENTY_PRODUCTION) eleventyConfig.on('afterBuild', copyErrorPages)
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
export default {
|
export default {
|
||||||
bookStatus: (books, status) => books.filter(book => book['status'] === status),
|
filterBooksByStatus: (books, status) => books.filter(book => book['status'] === status),
|
||||||
bookFavorites: (books) => books.filter(book => book.favorite === true),
|
findFavoriteBooks: (books) => books.filter(book => book['favorite'] === true),
|
||||||
bookYearLinks: (years) => years
|
bookYearLinks: (years) => years
|
||||||
.sort((a, b) => b.value - a.value)
|
.sort((a, b) => b['value'] - a['value'])
|
||||||
.map((year, index) => `<a href="/books/years/${year.value}">${year.value}</a>${index < years.length - 1 ? ' / ' : ''}`)
|
.map((year, index) => `<a href="/books/years/${year['value']}">${year['value']}</a>${index < years.length - 1 ? ' / ' : ''}`)
|
||||||
.join(''),
|
.join(''),
|
||||||
bookFinishedYear: (books, year) => books.filter(book => book.status === 'finished' && parseInt(book.year) === parseInt(year)),
|
|
||||||
mediaLinks: (data, type, count = 10) => {
|
mediaLinks: (data, type, count = 10) => {
|
||||||
if (!data || !type) return ''
|
if (!data || !type) return ''
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,7 @@ window.addEventListener('load', () => {
|
||||||
const checkModals = () => {
|
const checkModals = () => {
|
||||||
let isAnyModalOpen = false
|
let isAnyModalOpen = false
|
||||||
modalInputs.forEach((modalInput) => {
|
modalInputs.forEach((modalInput) => {
|
||||||
if (modalInput.checked) {
|
if (modalInput.checked) isAnyModalOpen = true
|
||||||
isAnyModalOpen = true
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
toggleBodyScroll(isAnyModalOpen)
|
toggleBodyScroll(isAnyModalOpen)
|
||||||
}
|
}
|
||||||
|
@ -56,9 +54,7 @@ window.addEventListener('load', () => {
|
||||||
document.addEventListener('keydown', (e) => {
|
document.addEventListener('keydown', (e) => {
|
||||||
if (e.key === 'Escape') {
|
if (e.key === 'Escape') {
|
||||||
modalInputs.forEach((modalInput) => {
|
modalInputs.forEach((modalInput) => {
|
||||||
if (modalInput.checked) {
|
if (modalInput.checked) modalInput.checked = false
|
||||||
modalInput.checked = false
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
toggleBodyScroll(false)
|
toggleBodyScroll(false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
.badge-grid {
|
.badge-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: var(--spacing-md);
|
gap: var(--spacing-md);
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: var(--grid-columns-three);
|
||||||
|
|
||||||
@media screen and (min-width: 768px) {
|
@media screen and (min-width: 768px) {
|
||||||
grid-template-columns: repeat(4, 1fr);
|
grid-template-columns: var(--grid-columns-four);
|
||||||
}
|
}
|
||||||
|
|
||||||
& > * {
|
& > * {
|
||||||
|
|
|
@ -35,6 +35,35 @@ select {
|
||||||
padding: var(--spacing-xs) var(--spacing-sm);
|
padding: var(--spacing-xs) var(--spacing-sm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
border: var(--border-gray);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--spacing-sm);
|
||||||
|
|
||||||
|
@media screen and (min-width: 768px) {
|
||||||
|
flex-direction: row;
|
||||||
|
gap: var(--spacing-lg);
|
||||||
|
}
|
||||||
|
|
||||||
|
& label {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--sizing-xs);
|
||||||
|
}
|
||||||
|
|
||||||
|
& input[type="checkbox"] {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
& legend {
|
||||||
|
color: var(--text-color-inverted);
|
||||||
|
background-color: var(--accent-color);
|
||||||
|
padding: var(--spacing-xs);
|
||||||
|
border-radius: var(--border-radius-slight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.search__form {
|
.search__form {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
|
|
||||||
|
@ -52,6 +81,11 @@ select {
|
||||||
& li {
|
& li {
|
||||||
margin: var(--spacing-sm) 0;
|
margin: var(--spacing-sm) 0;
|
||||||
|
|
||||||
|
&:not(:last-child) {
|
||||||
|
margin-bottom: var(--sizing-base);
|
||||||
|
border-bottom: var(--border-gray);
|
||||||
|
}
|
||||||
|
|
||||||
& a {
|
& a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,18 +10,21 @@
|
||||||
margin-top: var(--spacing-base);
|
margin-top: var(--spacing-base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:is(&.poster, &.square, &.vertical) img {
|
||||||
|
border-radius: var(--border-radius-slight);
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
:is(&.poster, &.vertical) img {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
&.poster {
|
&.poster {
|
||||||
grid-template-columns: var(--grid-poster);
|
grid-template-columns: var(--grid-poster);
|
||||||
|
|
||||||
& a {
|
& a {
|
||||||
aspect-ratio: var(--aspect-ratio-banner);
|
aspect-ratio: var(--aspect-ratio-banner);
|
||||||
}
|
}
|
||||||
|
|
||||||
& img {
|
|
||||||
border-radius: var(--border-radius-slight);
|
|
||||||
width: 100%;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&.square {
|
&.square {
|
||||||
|
@ -32,9 +35,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
& img {
|
& img {
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border-radius: var(--border-radius-slight);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,12 +45,6 @@
|
||||||
& a {
|
& a {
|
||||||
aspect-ratio: var(--aspect-ratio-vertical);
|
aspect-ratio: var(--aspect-ratio-vertical);
|
||||||
}
|
}
|
||||||
|
|
||||||
& img {
|
|
||||||
width: 100%;
|
|
||||||
height: auto;
|
|
||||||
border-radius: var(--border-radius-slight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
& .item {
|
& .item {
|
||||||
|
|
|
@ -42,8 +42,19 @@ const sortBooksByYear = (books) => {
|
||||||
return Object.values(years).filter(year => year['value'] > 2017)
|
return Object.values(years).filter(year => year['value'] > 2017)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const currentYear = new Date().getFullYear()
|
||||||
|
|
||||||
export default async function () {
|
export default async function () {
|
||||||
const books = await fetchAllBooks()
|
const books = await fetchAllBooks()
|
||||||
|
const sortedByYear = sortBooksByYear(books)
|
||||||
|
const booksForCurrentYear = sortedByYear.find(
|
||||||
|
yearGroup => yearGroup.value === currentYear
|
||||||
|
)?.data || []
|
||||||
|
|
||||||
return { all: books, years: sortBooksByYear(books), feed: books.filter(book => book['feed']) }
|
return {
|
||||||
|
all: books,
|
||||||
|
years: sortedByYear,
|
||||||
|
currentYear: booksForCurrentYear,
|
||||||
|
feed: books.filter(book => book['feed'])
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -70,10 +70,10 @@
|
||||||
{%- assign featuredShow = tv.favorites | shuffleArray | first -%}
|
{%- assign featuredShow = tv.favorites | shuffleArray | first -%}
|
||||||
{%- assign ogImage = globals.cdn_url | append: featuredShow.grid.backdrop -%}
|
{%- assign ogImage = globals.cdn_url | append: featuredShow.grid.backdrop -%}
|
||||||
{%- when 'books' -%}
|
{%- when 'books' -%}
|
||||||
{%- assign featuredBook = books.all | bookStatus: 'started' | reverse | first -%}
|
{%- assign featuredBook = books.all | filterBooksByStatus: 'started' | reverse | first -%}
|
||||||
{%- assign ogImage = globals.cdn_url | append: featuredBook.grid.image -%}
|
{%- assign ogImage = globals.cdn_url | append: featuredBook.grid.image -%}
|
||||||
{%- when 'books-year' -%}
|
{%- when 'books-year' -%}
|
||||||
{%- assign featuredBook = books.all | bookStatus: 'finished' | bookFinishedYear: year.value | first -%}
|
{%- assign featuredBook = books.currentYear | first -%}
|
||||||
{%- assign ogImage = globals.cdn_url | append: featuredBook.grid.image -%}
|
{%- assign ogImage = globals.cdn_url | append: featuredBook.grid.image -%}
|
||||||
{%- when 'book' -%}
|
{%- when 'book' -%}
|
||||||
{%- assign ogImage = globals.cdn_url | append: book.grid.image -%}
|
{%- assign ogImage = globals.cdn_url | append: book.grid.image -%}
|
||||||
|
@ -117,8 +117,10 @@
|
||||||
<link rel="alternate" href="https://coryd.dev/feeds/album-releases" title="Album releases / {{ globals.site_name }}" type="application/rss+xml">
|
<link rel="alternate" href="https://coryd.dev/feeds/album-releases" title="Album releases / {{ globals.site_name }}" type="application/rss+xml">
|
||||||
<link rel="alternate" href="https://coryd.dev/feeds/all" title="All activity / {{ globals.site_name }}" type="application/rss+xml">
|
<link rel="alternate" href="https://coryd.dev/feeds/all" title="All activity / {{ globals.site_name }}" type="application/rss+xml">
|
||||||
<script defer src="/assets/scripts/index.js?v={% appVersion %}"></script>
|
<script defer src="/assets/scripts/index.js?v={% appVersion %}"></script>
|
||||||
<script defer data-domain="coryd.dev" src="/js/script.js"></script>
|
{%- if isProduction -%}
|
||||||
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
|
<script defer data-domain="coryd.dev" src="/js/script.js"></script>
|
||||||
|
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
|
||||||
|
{%- endif -%}
|
||||||
<script type="application/ld+json">
|
<script type="application/ld+json">
|
||||||
{
|
{
|
||||||
"@context": "https://schema.org",
|
"@context": "https://schema.org",
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<article>
|
<article>
|
||||||
{{ intro }}
|
{{ intro }}
|
||||||
{% render "partials/blocks/now-playing.liquid", nowPlaying:nowPlaying %}
|
{%- if isProduction -%}
|
||||||
|
{% render "partials/blocks/now-playing.liquid", nowPlaying:nowPlaying %}
|
||||||
|
{%- endif -%}
|
||||||
</article>
|
</article>
|
|
@ -2,7 +2,7 @@
|
||||||
{%- assign track = music.week.tracks | first -%}
|
{%- assign track = music.week.tracks | first -%}
|
||||||
{%- assign show = tv.recentlyWatched | first -%}
|
{%- assign show = tv.recentlyWatched | first -%}
|
||||||
{%- assign movie = movies.recentlyWatched | first -%}
|
{%- assign movie = movies.recentlyWatched | first -%}
|
||||||
{%- assign book = books | bookFinishedYear: currentYear | first -%}
|
{%- assign book = books | first -%}
|
||||||
{%- assign link = links | first -%}
|
{%- assign link = links | first -%}
|
||||||
<article>
|
<article>
|
||||||
<h2>
|
<h2>
|
||||||
|
|
|
@ -7,8 +7,8 @@ updated: "now"
|
||||||
schema: books
|
schema: books
|
||||||
---
|
---
|
||||||
{%- assign currentYear = 'now' | date: "%Y" -%}
|
{%- assign currentYear = 'now' | date: "%Y" -%}
|
||||||
{%- assign bookData = books.all | bookStatus: 'started' | reverse -%}
|
{%- assign bookData = books.all | filterBooksByStatus: 'started' | reverse -%}
|
||||||
{%- assign currentBookCount = books.all | bookFinishedYear: currentYear | size -%}
|
{%- assign currentBookCount = books.currentYear | size -%}
|
||||||
<h2>Currently reading</h2>
|
<h2>Currently reading</h2>
|
||||||
<p>Here's what I'm reading at the moment. I've finished <strong class="highlight-text">{{ currentBookCount }} books</strong> this year.</p>
|
<p>Here's what I'm reading at the moment. I've finished <strong class="highlight-text">{{ currentBookCount }} books</strong> this year.</p>
|
||||||
<p>{{ books.years | bookYearLinks }}</p>
|
<p>{{ books.years | bookYearLinks }}</p>
|
||||||
|
|
|
@ -7,8 +7,8 @@ pagination:
|
||||||
permalink: "/books/years/{{ year.value }}.html"
|
permalink: "/books/years/{{ year.value }}.html"
|
||||||
schema: books-year
|
schema: books-year
|
||||||
---
|
---
|
||||||
{%- assign bookData = year.data | bookStatus: 'finished' -%}
|
{%- assign bookData = year.data | filterBooksByStatus: 'finished' -%}
|
||||||
{%- assign bookDataFavorites = bookData | bookFavorites -%}
|
{%- assign bookDataFavorites = bookData | findFavoriteBooks -%}
|
||||||
{%- capture favoriteBooks -%}{{ bookDataFavorites | shuffleArray | mediaLinks: "book", 5 }}{%- endcapture -%}
|
{%- capture favoriteBooks -%}{{ bookDataFavorites | shuffleArray | mediaLinks: "book", 5 }}{%- endcapture -%}
|
||||||
{%- assign currentYear = 'now' | date: "%Y" -%}
|
{%- assign currentYear = 'now' | date: "%Y" -%}
|
||||||
{%- assign yearString = year.value | append: '' -%}
|
{%- assign yearString = year.value | append: '' -%}
|
||||||
|
|
|
@ -3,5 +3,5 @@ layout: default
|
||||||
permalink: /
|
permalink: /
|
||||||
---
|
---
|
||||||
{% render "partials/home/intro.liquid" intro:globals.intro, nowPlaying:nowPlaying.content %}
|
{% render "partials/home/intro.liquid" intro:globals.intro, nowPlaying:nowPlaying.content %}
|
||||||
{% render "partials/home/recent-activity.liquid" music:music, books:books.all, tv:tv, movies:movies, links:links %}
|
{% render "partials/home/recent-activity.liquid" music:music, books:books.currentYear, tv:tv, movies:movies, links:links %}
|
||||||
{% render "partials/home/recent-posts.liquid" posts:posts %}
|
{% render "partials/home/recent-posts.liquid" posts:posts %}
|
|
@ -1,102 +1,127 @@
|
||||||
CREATE OR REPLACE VIEW optimized_search_index AS
|
CREATE OR REPLACE VIEW optimized_search_index AS
|
||||||
WITH search_data AS (
|
WITH search_data AS (
|
||||||
SELECT
|
SELECT
|
||||||
|
'post' AS type,
|
||||||
CONCAT('📝 ', p.title) AS title,
|
CONCAT('📝 ', p.title) AS title,
|
||||||
CONCAT('https://coryd.dev', p.url) AS url,
|
CONCAT('https://coryd.dev', p.url) AS url,
|
||||||
|
p.description AS description,
|
||||||
p.tags,
|
p.tags,
|
||||||
NULL AS genre_name,
|
NULL AS genre_name,
|
||||||
NULL AS genre_url
|
NULL AS genre_url,
|
||||||
|
NULL::integer AS total_plays
|
||||||
FROM optimized_posts p
|
FROM optimized_posts p
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
|
'link' AS type,
|
||||||
CONCAT('🔗 ', l.title, ' via ', l.name) AS title,
|
CONCAT('🔗 ', l.title, ' via ', l.name) AS title,
|
||||||
l.link AS url,
|
l.link AS url,
|
||||||
|
l.description AS description,
|
||||||
l.tags,
|
l.tags,
|
||||||
NULL AS genre_name,
|
NULL AS genre_name,
|
||||||
NULL AS genre_url
|
NULL AS genre_url,
|
||||||
|
NULL::integer AS total_plays
|
||||||
FROM optimized_links l
|
FROM optimized_links l
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
|
'book' AS type,
|
||||||
CASE
|
CASE
|
||||||
WHEN b.rating IS NOT NULL THEN CONCAT('📖 ', b.title, ' (', b.rating, ')')
|
WHEN b.rating IS NOT NULL THEN CONCAT('📖 ', b.title, ' (', b.rating, ')')
|
||||||
ELSE CONCAT('📖 ', b.title)
|
ELSE CONCAT('📖 ', b.title)
|
||||||
END AS title,
|
END AS title,
|
||||||
CONCAT('https://coryd.dev', b.url) AS url,
|
CONCAT('https://coryd.dev', b.url) AS url,
|
||||||
|
b.description AS description,
|
||||||
b.tags,
|
b.tags,
|
||||||
NULL AS genre_name,
|
NULL AS genre_name,
|
||||||
NULL AS genre_url
|
NULL AS genre_url,
|
||||||
|
NULL::integer AS total_plays
|
||||||
FROM optimized_books b
|
FROM optimized_books b
|
||||||
WHERE LOWER(b.status) = 'finished'
|
WHERE LOWER(b.status) = 'finished'
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
|
'movie' AS type,
|
||||||
CASE
|
CASE
|
||||||
WHEN m.rating IS NOT NULL THEN CONCAT('🎥 ', m.title, ' (', m.rating, ')')
|
WHEN m.rating IS NOT NULL THEN CONCAT('🎥 ', m.title, ' (', m.rating, ')')
|
||||||
ELSE CONCAT('🎥 ', m.title)
|
ELSE CONCAT('🎥 ', m.title)
|
||||||
END AS title,
|
END AS title,
|
||||||
CONCAT('https://coryd.dev', m.url) AS url,
|
CONCAT('https://coryd.dev', m.url) AS url,
|
||||||
|
m.description AS description,
|
||||||
m.tags,
|
m.tags,
|
||||||
NULL AS genre_name,
|
NULL AS genre_name,
|
||||||
NULL AS genre_url
|
NULL AS genre_url,
|
||||||
|
NULL::integer AS total_plays
|
||||||
FROM optimized_movies m
|
FROM optimized_movies m
|
||||||
WHERE m.last_watched IS NOT NULL
|
WHERE m.last_watched IS NOT NULL
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
CONCAT('🎧 ', ar.name, ' - ', ar.genre_name) AS title,
|
'artist' AS type,
|
||||||
|
CONCAT(
|
||||||
|
COALESCE(ar.emoji, ar.genre_emoji, '🎧'), ' ', ar.name,
|
||||||
|
' - ', ar.genre_name
|
||||||
|
) AS title,
|
||||||
CONCAT('https://coryd.dev', ar.url) AS url,
|
CONCAT('https://coryd.dev', ar.url) AS url,
|
||||||
|
ar.description AS description,
|
||||||
ARRAY[ar.genre_name] AS tags,
|
ARRAY[ar.genre_name] AS tags,
|
||||||
ar.genre_name,
|
ar.genre_name,
|
||||||
CONCAT('https://coryd.dev', ar.genre_slug) AS genre_url
|
CONCAT('https://coryd.dev', ar.genre_slug) AS genre_url,
|
||||||
|
ar.total_plays
|
||||||
FROM optimized_artists ar
|
FROM optimized_artists ar
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
CONCAT('🎵 ', g.name) AS title,
|
'genre' AS type,
|
||||||
|
CONCAT(COALESCE(g.emoji, '🎵'), ' ', g.name) AS title,
|
||||||
CONCAT('https://coryd.dev', g.url) AS url,
|
CONCAT('https://coryd.dev', g.url) AS url,
|
||||||
|
g.description AS description,
|
||||||
NULL AS tags,
|
NULL AS tags,
|
||||||
g.name AS genre_name,
|
g.name AS genre_name,
|
||||||
CONCAT('https://coryd.dev', g.url) AS genre_url
|
CONCAT('https://coryd.dev', g.url) AS genre_url,
|
||||||
|
NULL::integer AS total_plays
|
||||||
FROM optimized_genres g
|
FROM optimized_genres g
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
|
'show' AS type,
|
||||||
CASE
|
CASE
|
||||||
WHEN s.review IS NOT NULL THEN CONCAT('📺 ', s.title, ' (', s.year, ') - ', s.review)
|
WHEN s.review IS NOT NULL THEN CONCAT('📺 ', s.title, ' (', s.year, ') - ', s.review)
|
||||||
ELSE CONCAT('📺 ', s.title, ' (', s.year, ')')
|
ELSE CONCAT('📺 ', s.title, ' (', s.year, ')')
|
||||||
END AS title,
|
END AS title,
|
||||||
CONCAT('https://coryd.dev', s.url) AS url,
|
CONCAT('https://coryd.dev', s.url) AS url,
|
||||||
|
s.description AS description,
|
||||||
s.tags,
|
s.tags,
|
||||||
NULL AS genre_name,
|
NULL AS genre_name,
|
||||||
NULL AS genre_url
|
NULL AS genre_url,
|
||||||
|
NULL::integer AS total_plays
|
||||||
FROM optimized_shows s
|
FROM optimized_shows s
|
||||||
WHERE s.last_watched_at IS NOT NULL
|
WHERE s.last_watched_at IS NOT NULL
|
||||||
),
|
),
|
||||||
|
|
||||||
search_data_with_id AS (
|
search_data_with_id AS (
|
||||||
SELECT
|
SELECT
|
||||||
ROW_NUMBER() OVER (ORDER BY url) AS id,
|
ROW_NUMBER() OVER (ORDER BY url) AS id,
|
||||||
search_data.*
|
search_data.*
|
||||||
FROM search_data
|
FROM search_data
|
||||||
)
|
)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
json_agg(
|
json_agg(
|
||||||
json_build_object(
|
json_build_object(
|
||||||
'id', search_data_with_id.id,
|
'id', search_data_with_id.id,
|
||||||
'url', search_data_with_id.url,
|
'url', search_data_with_id.url,
|
||||||
'title', search_data_with_id.title,
|
'title', search_data_with_id.title,
|
||||||
|
'description', search_data_with_id.description,
|
||||||
'tags', search_data_with_id.tags,
|
'tags', search_data_with_id.tags,
|
||||||
'genre_name', search_data_with_id.genre_name,
|
'genre_name', search_data_with_id.genre_name,
|
||||||
'genre_url', search_data_with_id.genre_url
|
'genre_url', search_data_with_id.genre_url,
|
||||||
|
'type', search_data_with_id.type,
|
||||||
|
'total_plays', search_data_with_id.total_plays
|
||||||
)
|
)
|
||||||
) AS search_index
|
) AS search_index
|
||||||
FROM search_data_with_id;
|
FROM search_data_with_id;
|
|
@ -32,8 +32,8 @@ WITH syndication_data AS (
|
||||||
CASE
|
CASE
|
||||||
WHEN l.mastodon IS NOT NULL THEN
|
WHEN l.mastodon IS NOT NULL THEN
|
||||||
' via @' || split_part(l.mastodon, '@', 2) || '@' || split_part(split_part(l.mastodon, 'https://', 2), '/', 1)
|
' via @' || split_part(l.mastodon, '@', 2) || '@' || split_part(split_part(l.mastodon, 'https://', 2), '/', 1)
|
||||||
ELSE ''
|
ELSE CONCAT(' via ', l.name)
|
||||||
END, CONCAT(' via ', l.name), (
|
END, ' ', (
|
||||||
SELECT array_to_string(
|
SELECT array_to_string(
|
||||||
array_agg('#' || initcap(replace(t.name, ' ', ''))), ' '
|
array_agg('#' || initcap(replace(t.name, ' ', ''))), ' '
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,10 +9,12 @@ SELECT
|
||||||
ar.favorite,
|
ar.favorite,
|
||||||
g.name AS genre_name,
|
g.name AS genre_name,
|
||||||
g.slug AS genre_slug,
|
g.slug AS genre_slug,
|
||||||
|
g.emoji AS genre_emoji,
|
||||||
|
|
||||||
json_build_object(
|
json_build_object(
|
||||||
'name', g.name,
|
'name', g.name,
|
||||||
'url', g.slug
|
'url', g.slug,
|
||||||
|
'emoji', g.emoji
|
||||||
) AS genre,
|
) AS genre,
|
||||||
|
|
||||||
ar.emoji,
|
ar.emoji,
|
||||||
|
@ -113,4 +115,4 @@ LEFT JOIN
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
genres g ON ar.genres = g.id
|
genres g ON ar.genres = g.id
|
||||||
GROUP BY
|
GROUP BY
|
||||||
ar.id, df.filename_disk, g.name, g.slug;
|
ar.id, df.filename_disk, g.name, g.slug, g.emoji;
|
|
@ -3,6 +3,7 @@ SELECT
|
||||||
g.id,
|
g.id,
|
||||||
g.name,
|
g.name,
|
||||||
g.description,
|
g.description,
|
||||||
|
g.emoji,
|
||||||
g.total_plays,
|
g.total_plays,
|
||||||
g.wiki_link,
|
g.wiki_link,
|
||||||
g.slug AS url,
|
g.slug AS url,
|
||||||
|
|
Reference in a new issue