diff --git a/.eleventy.js b/.eleventy.js
index 6e94f3d8..7736d28f 100644
--- a/.eleventy.js
+++ b/.eleventy.js
@@ -7,7 +7,7 @@ import markdownItFootnote from 'markdown-it-footnote'
import htmlmin from 'html-minifier-terser'
import filters from './config/filters/index.js'
import { minifyJsComponents } from './config/events/index.js'
-import { allContent, popularPosts, searchIndex } from './config/collections/index.js'
+import { allContent, popularPosts, searchIndex, siteMap } from './config/collections/index.js'
import { DateTime } from 'luxon'
// load .env
@@ -56,6 +56,7 @@ export default async function (eleventyConfig) {
eleventyConfig.addCollection('allContent', allContent)
eleventyConfig.addCollection('popularPosts', popularPosts)
eleventyConfig.addCollection('searchIndex', searchIndex)
+ eleventyConfig.addCollection('siteMap', siteMap)
const md = markdownIt({ html: true, linkify: true })
md.use(markdownItAnchor, {
@@ -111,8 +112,8 @@ export default async function (eleventyConfig) {
passthroughFileCopy: true,
dir: {
input: 'src',
- includes: '_includes',
- data: '_data',
+ includes: 'includes',
+ data: 'data',
output: '_site',
},
}
diff --git a/config/collections/index.js b/config/collections/index.js
index 53138b23..51f7d58c 100644
--- a/config/collections/index.js
+++ b/config/collections/index.js
@@ -127,4 +127,60 @@ export const popularPosts = (collection) => {
const visitors = (page) => analytics.filter((p) => p.page.includes(page.slug)).pop()?.visitors
return visitors(b) - visitors(a)
})
+}
+
+export const siteMap = (collection) => {
+ const aggregateContent = []
+ const collectionData = collection.getAll()[0]
+ const { data } = collectionData
+ const { posts, pages, artists, genres, movies, tv, books } = data
+
+ const parseDate = (date) => {
+ if (!date) return null
+ let parsedDate = DateTime.fromISO(date)
+ if (!parsedDate.isValid) parsedDate = DateTime.fromFormat(date, 'yyyy-MM-dd')
+ if (!parsedDate.isValid) parsedDate = DateTime.fromFormat(date, 'MM/dd/yyyy')
+ if (!parsedDate.isValid) parsedDate = DateTime.fromFormat(date, 'dd-MM-yyyy')
+ return parsedDate.isValid ? parsedDate.toISO() : null
+ }
+
+ const addedUrls = new Set()
+
+ const addContent = (items, getTitle, getDate) => {
+ if (items) {
+ items.forEach(item => {
+ let url
+ if (item?.['url']) url = item['url']
+ if (item?.['permalink']) url = item['permalink']
+ if (item?.['slug']) url = item['slug']
+ if (!url || addedUrls.has(url)) return
+
+ const content = {
+ url,
+ title: getTitle(item),
+ date: getDate ? parseDate(getDate(item)) : null
+ }
+ aggregateContent.push(content)
+ addedUrls.add(url)
+ })
+ }
+ }
+
+ if (posts) addContent(posts, item => item.title, item => item.date)
+ if (pages) addContent(pages, item => item.title, item => item.date)
+ if (artists) addContent(artists, item => item.name, item => item.date)
+ if (genres) addContent(genres, item => item.name, item => item.date)
+ if (movies?.['movies']) addContent(movies['movies'], item => item.title, item => item.date)
+ if (books?.['all']) addContent(books['all'], item => item.title, item => item.date)
+ if (tv?.['shows']) addContent(tv['shows'], item => item.title, item => item.date)
+
+ collection.getAll().forEach(item => {
+ if (item.data.pages) addContent(item.data.pages, item => item.title, item => item.date)
+ })
+
+ return aggregateContent.sort((a, b) => {
+ const dateA = a.date ? DateTime.fromISO(a.date) : DateTime.fromMillis(0)
+ const dateB = b.date ? DateTime.fromISO(b.date) : DateTime.fromMillis(0)
+ return dateB - dateA
+ })
}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 2b687c1f..ab34761a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "coryd.dev",
- "version": "20.8.5",
+ "version": "20.9.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "coryd.dev",
- "version": "20.8.5",
+ "version": "20.9.0",
"license": "MIT",
"dependencies": {
"@cdransf/api-text": "^1.4.0",
diff --git a/package.json b/package.json
index 5eba7194..008fb66a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "coryd.dev",
- "version": "20.8.5",
+ "version": "20.9.0",
"description": "The source for my personal site. Built using 11ty (and other tools).",
"type": "module",
"scripts": {
diff --git a/src/_data/albumReleases.js b/src/data/albumReleases.js
similarity index 100%
rename from src/_data/albumReleases.js
rename to src/data/albumReleases.js
diff --git a/src/_data/analytics.js b/src/data/analytics.js
similarity index 100%
rename from src/_data/analytics.js
rename to src/data/analytics.js
diff --git a/src/_data/artists.js b/src/data/artists.js
similarity index 91%
rename from src/_data/artists.js
rename to src/data/artists.js
index b56506a3..53b746d5 100644
--- a/src/_data/artists.js
+++ b/src/data/artists.js
@@ -1,5 +1,5 @@
import { createClient } from '@supabase/supabase-js'
-import { parseCountryField } from '../../config/utilities/index.js'
+import { sanitizeMediaString, parseCountryField } from '../../config/utilities/index.js'
const SUPABASE_URL = process.env.SUPABASE_URL
const SUPABASE_KEY = process.env.SUPABASE_KEY
@@ -72,6 +72,7 @@ export default async function () {
artist['image'] = `/${artist['art']['filename_disk']}`
artist['country'] = parseCountryField(artist['country'])
artist['genres'] = genreMapping[artist['genres']] || ''
+ artist['url'] = `/music/artists/${sanitizeMediaString(artist['name_string'])}-${sanitizeMediaString(artist['country'])}`
}
return artists
diff --git a/src/_data/badges.js b/src/data/badges.js
similarity index 100%
rename from src/_data/badges.js
rename to src/data/badges.js
diff --git a/src/_data/blogroll.js b/src/data/blogroll.js
similarity index 100%
rename from src/_data/blogroll.js
rename to src/data/blogroll.js
diff --git a/src/_data/books.js b/src/data/books.js
similarity index 100%
rename from src/_data/books.js
rename to src/data/books.js
diff --git a/src/_data/genres.js b/src/data/genres.js
similarity index 90%
rename from src/_data/genres.js
rename to src/data/genres.js
index bb1b2edb..481fdfe2 100644
--- a/src/_data/genres.js
+++ b/src/data/genres.js
@@ -1,4 +1,5 @@
import { createClient } from '@supabase/supabase-js'
+import slugify from 'slugify'
import { parseCountryField } from '../../config/utilities/index.js'
const SUPABASE_URL = process.env.SUPABASE_URL
@@ -34,6 +35,7 @@ const fetchGenresWithArtists = async () => {
...artist,
country: parseCountryField(artist['country'])
}))
+ genre['url'] = `/music/genres/${slugify(genre['name'].toLowerCase())}`
})
return data
diff --git a/src/_data/globals.js b/src/data/globals.js
similarity index 100%
rename from src/_data/globals.js
rename to src/data/globals.js
diff --git a/src/_data/links.js b/src/data/links.js
similarity index 100%
rename from src/_data/links.js
rename to src/data/links.js
diff --git a/src/_data/movies.js b/src/data/movies.js
similarity index 100%
rename from src/_data/movies.js
rename to src/data/movies.js
diff --git a/src/_data/music.js b/src/data/music.js
similarity index 100%
rename from src/_data/music.js
rename to src/data/music.js
diff --git a/src/_data/nav.js b/src/data/nav.js
similarity index 100%
rename from src/_data/nav.js
rename to src/data/nav.js
diff --git a/src/_data/pages.js b/src/data/pages.js
similarity index 100%
rename from src/_data/pages.js
rename to src/data/pages.js
diff --git a/src/_data/posts.js b/src/data/posts.js
similarity index 100%
rename from src/_data/posts.js
rename to src/data/posts.js
diff --git a/src/_data/robots.js b/src/data/robots.js
similarity index 100%
rename from src/_data/robots.js
rename to src/data/robots.js
diff --git a/src/_data/status.js b/src/data/status.js
similarity index 100%
rename from src/_data/status.js
rename to src/data/status.js
diff --git a/src/_data/tv.js b/src/data/tv.js
similarity index 90%
rename from src/_data/tv.js
rename to src/data/tv.js
index 5188015f..7b5ccb48 100644
--- a/src/_data/tv.js
+++ b/src/data/tv.js
@@ -48,7 +48,8 @@ const prepareShowData = (show) => {
return {
...show,
image: show['art']?.['filename_disk'] ? `/${show['art']['filename_disk']}` : '',
- backdrop: show['backdrop']?.['filename_disk'] ? `/${show['backdrop']['filename_disk']}` : ''
+ backdrop: show['backdrop']?.['filename_disk'] ? `/${show['backdrop']['filename_disk']}` : '',
+ url: `/watching/shows/${show['tmdb_id']}`,
}
}
@@ -121,24 +122,24 @@ export default async function () {
sortedShows.forEach(show => {
const startingEpisode = show['episodes'][show['episodes'].length - 1]['episode']
const startingSeason = show['episodes'][show['episodes'].length - 1]['season']
- const endingEpisode = show['episodes'][0].episode
- const endingSeason = show['episodes'][0].season
+ const endingEpisode = show['episodes'][0]['episode']
+ const endingSeason = show['episodes'][0]['season']
if (show['episodes'].length > 1) {
episodeData.push({
- name: show.title,
- url: `/watching/shows/${show.tmdbId}`,
+ name: show['title'],
+ url: `/watching/shows/${show['tmdbId']}`,
subtext: `S${startingSeason}E${startingEpisode} - S${endingSeason}E${endingEpisode}`,
startingEpisode,
startingSeason,
episode: endingEpisode,
season: endingSeason,
- tmdbId: show.tmdbId,
- collected: show.collected,
- favorite: show.favorite,
+ tmdbId: show['tmdbId'],
+ collected: show['collected'],
+ favorite: show['favorite'],
type: 'tv-range',
- image: show.image,
- backdrop: show.backdrop
+ image: show['image'],
+ backdrop: show['backdrop']
})
} else {
const singleEpisode = show['episodes'][0]
diff --git a/src/_includes/base.liquid b/src/includes/base.liquid
similarity index 100%
rename from src/_includes/base.liquid
rename to src/includes/base.liquid
diff --git a/src/_includes/default.liquid b/src/includes/default.liquid
similarity index 100%
rename from src/_includes/default.liquid
rename to src/includes/default.liquid
diff --git a/src/_includes/main.liquid b/src/includes/main.liquid
similarity index 100%
rename from src/_includes/main.liquid
rename to src/includes/main.liquid
diff --git a/src/_includes/page.liquid b/src/includes/page.liquid
similarity index 100%
rename from src/_includes/page.liquid
rename to src/includes/page.liquid
diff --git a/src/_includes/partials/blocks/addon-links.liquid b/src/includes/partials/blocks/addon-links.liquid
similarity index 100%
rename from src/_includes/partials/blocks/addon-links.liquid
rename to src/includes/partials/blocks/addon-links.liquid
diff --git a/src/_includes/partials/blocks/avatar.liquid b/src/includes/partials/blocks/avatar.liquid
similarity index 100%
rename from src/_includes/partials/blocks/avatar.liquid
rename to src/includes/partials/blocks/avatar.liquid
diff --git a/src/_includes/partials/blocks/badge-grid.liquid b/src/includes/partials/blocks/badge-grid.liquid
similarity index 100%
rename from src/_includes/partials/blocks/badge-grid.liquid
rename to src/includes/partials/blocks/badge-grid.liquid
diff --git a/src/_includes/partials/blocks/banners/error.liquid b/src/includes/partials/blocks/banners/error.liquid
similarity index 100%
rename from src/_includes/partials/blocks/banners/error.liquid
rename to src/includes/partials/blocks/banners/error.liquid
diff --git a/src/_includes/partials/blocks/banners/github.liquid b/src/includes/partials/blocks/banners/github.liquid
similarity index 100%
rename from src/_includes/partials/blocks/banners/github.liquid
rename to src/includes/partials/blocks/banners/github.liquid
diff --git a/src/_includes/partials/blocks/banners/npm.liquid b/src/includes/partials/blocks/banners/npm.liquid
similarity index 100%
rename from src/_includes/partials/blocks/banners/npm.liquid
rename to src/includes/partials/blocks/banners/npm.liquid
diff --git a/src/_includes/partials/blocks/banners/old-post.liquid b/src/includes/partials/blocks/banners/old-post.liquid
similarity index 100%
rename from src/_includes/partials/blocks/banners/old-post.liquid
rename to src/includes/partials/blocks/banners/old-post.liquid
diff --git a/src/_includes/partials/blocks/banners/rss.liquid b/src/includes/partials/blocks/banners/rss.liquid
similarity index 100%
rename from src/_includes/partials/blocks/banners/rss.liquid
rename to src/includes/partials/blocks/banners/rss.liquid
diff --git a/src/_includes/partials/blocks/banners/warning.liquid b/src/includes/partials/blocks/banners/warning.liquid
similarity index 100%
rename from src/_includes/partials/blocks/banners/warning.liquid
rename to src/includes/partials/blocks/banners/warning.liquid
diff --git a/src/_includes/partials/blocks/hero.liquid b/src/includes/partials/blocks/hero.liquid
similarity index 100%
rename from src/_includes/partials/blocks/hero.liquid
rename to src/includes/partials/blocks/hero.liquid
diff --git a/src/_includes/partials/blocks/index.liquid b/src/includes/partials/blocks/index.liquid
similarity index 100%
rename from src/_includes/partials/blocks/index.liquid
rename to src/includes/partials/blocks/index.liquid
diff --git a/src/_includes/partials/blocks/now-playing.liquid b/src/includes/partials/blocks/now-playing.liquid
similarity index 100%
rename from src/_includes/partials/blocks/now-playing.liquid
rename to src/includes/partials/blocks/now-playing.liquid
diff --git a/src/_includes/partials/blocks/popular-posts.liquid b/src/includes/partials/blocks/popular-posts.liquid
similarity index 100%
rename from src/_includes/partials/blocks/popular-posts.liquid
rename to src/includes/partials/blocks/popular-posts.liquid
diff --git a/src/_includes/partials/blocks/recent-links.liquid b/src/includes/partials/blocks/recent-links.liquid
similarity index 100%
rename from src/_includes/partials/blocks/recent-links.liquid
rename to src/includes/partials/blocks/recent-links.liquid
diff --git a/src/_includes/partials/blocks/youtube-player.liquid b/src/includes/partials/blocks/youtube-player.liquid
similarity index 100%
rename from src/_includes/partials/blocks/youtube-player.liquid
rename to src/includes/partials/blocks/youtube-player.liquid
diff --git a/src/_includes/partials/feeds/rss.liquid b/src/includes/partials/feeds/rss.liquid
similarity index 100%
rename from src/_includes/partials/feeds/rss.liquid
rename to src/includes/partials/feeds/rss.liquid
diff --git a/src/_includes/partials/footer.liquid b/src/includes/partials/footer.liquid
similarity index 100%
rename from src/_includes/partials/footer.liquid
rename to src/includes/partials/footer.liquid
diff --git a/src/_includes/partials/header.liquid b/src/includes/partials/header.liquid
similarity index 100%
rename from src/_includes/partials/header.liquid
rename to src/includes/partials/header.liquid
diff --git a/src/_includes/partials/home/posts.liquid b/src/includes/partials/home/posts.liquid
similarity index 100%
rename from src/_includes/partials/home/posts.liquid
rename to src/includes/partials/home/posts.liquid
diff --git a/src/_includes/partials/home/status.liquid b/src/includes/partials/home/status.liquid
similarity index 100%
rename from src/_includes/partials/home/status.liquid
rename to src/includes/partials/home/status.liquid
diff --git a/src/_includes/partials/media/grid.liquid b/src/includes/partials/media/grid.liquid
similarity index 100%
rename from src/_includes/partials/media/grid.liquid
rename to src/includes/partials/media/grid.liquid
diff --git a/src/_includes/partials/media/music/chart.liquid b/src/includes/partials/media/music/chart.liquid
similarity index 100%
rename from src/_includes/partials/media/music/chart.liquid
rename to src/includes/partials/media/music/chart.liquid
diff --git a/src/_includes/partials/media/music/recent.liquid b/src/includes/partials/media/music/recent.liquid
similarity index 100%
rename from src/_includes/partials/media/music/recent.liquid
rename to src/includes/partials/media/music/recent.liquid
diff --git a/src/_includes/partials/media/progress-bar.liquid b/src/includes/partials/media/progress-bar.liquid
similarity index 100%
rename from src/_includes/partials/media/progress-bar.liquid
rename to src/includes/partials/media/progress-bar.liquid
diff --git a/src/_includes/partials/media/watching/grid.liquid b/src/includes/partials/media/watching/grid.liquid
similarity index 100%
rename from src/_includes/partials/media/watching/grid.liquid
rename to src/includes/partials/media/watching/grid.liquid
diff --git a/src/_includes/partials/media/watching/hero.liquid b/src/includes/partials/media/watching/hero.liquid
similarity index 100%
rename from src/_includes/partials/media/watching/hero.liquid
rename to src/includes/partials/media/watching/hero.liquid
diff --git a/src/_includes/partials/nav/link.liquid b/src/includes/partials/nav/link.liquid
similarity index 100%
rename from src/_includes/partials/nav/link.liquid
rename to src/includes/partials/nav/link.liquid
diff --git a/src/_includes/partials/nav/linked-icon.liquid b/src/includes/partials/nav/linked-icon.liquid
similarity index 100%
rename from src/_includes/partials/nav/linked-icon.liquid
rename to src/includes/partials/nav/linked-icon.liquid
diff --git a/src/_includes/partials/nav/menu.liquid b/src/includes/partials/nav/menu.liquid
similarity index 100%
rename from src/_includes/partials/nav/menu.liquid
rename to src/includes/partials/nav/menu.liquid
diff --git a/src/_includes/partials/nav/paginator.liquid b/src/includes/partials/nav/paginator.liquid
similarity index 100%
rename from src/_includes/partials/nav/paginator.liquid
rename to src/includes/partials/nav/paginator.liquid
diff --git a/src/_includes/partials/nav/theme-toggle.liquid b/src/includes/partials/nav/theme-toggle.liquid
similarity index 100%
rename from src/_includes/partials/nav/theme-toggle.liquid
rename to src/includes/partials/nav/theme-toggle.liquid
diff --git a/src/_includes/webrings/css-joy.liquid b/src/includes/webrings/css-joy.liquid
similarity index 100%
rename from src/_includes/webrings/css-joy.liquid
rename to src/includes/webrings/css-joy.liquid
diff --git a/src/_includes/webrings/the-claw.liquid b/src/includes/webrings/the-claw.liquid
similarity index 100%
rename from src/_includes/webrings/the-claw.liquid
rename to src/includes/webrings/the-claw.liquid
diff --git a/src/meta/sitemap.liquid b/src/meta/sitemap.liquid
index ded6bf63..131bb639 100644
--- a/src/meta/sitemap.liquid
+++ b/src/meta/sitemap.liquid
@@ -4,14 +4,12 @@ eleventyExcludeFromCollections: true
---