chore: cleanup
This commit is contained in:
parent
0bdda4b7a4
commit
ce24c35a20
17 changed files with 33 additions and 19 deletions
|
@ -12,7 +12,7 @@ import filters from './config/filters/index.js'
|
||||||
import { slugifyString } from './config/utils/index.js'
|
import { slugifyString } from './config/utils/index.js'
|
||||||
import { svgToJpeg } from './config/events/index.js'
|
import { svgToJpeg } from './config/events/index.js'
|
||||||
import { minifyJsComponents } from './config/events/index.js'
|
import { minifyJsComponents } from './config/events/index.js'
|
||||||
import { searchIndex, tagList, tagMap, postStats, tagsSortedByCount } from './config/collections/index.js'
|
import { searchIndex, tagList, tagMap, postStats, tagsSortedByCount, artistsIndex, albumsIndex } from './config/collections/index.js'
|
||||||
import { img } from './config/shortcodes/index.js'
|
import { img } from './config/shortcodes/index.js'
|
||||||
|
|
||||||
// load .env
|
// load .env
|
||||||
|
@ -93,6 +93,8 @@ export default async function (eleventyConfig) {
|
||||||
eleventyConfig.addCollection('tagMap', tagMap)
|
eleventyConfig.addCollection('tagMap', tagMap)
|
||||||
eleventyConfig.addCollection('postStats', postStats)
|
eleventyConfig.addCollection('postStats', postStats)
|
||||||
eleventyConfig.addCollection('tagsSortedByCount', tagsSortedByCount)
|
eleventyConfig.addCollection('tagsSortedByCount', tagsSortedByCount)
|
||||||
|
eleventyConfig.addCollection('artistsIndex', artistsIndex)
|
||||||
|
eleventyConfig.addCollection('albumsIndex', albumsIndex)
|
||||||
|
|
||||||
const md = markdownIt({ html: true, linkify: true })
|
const md = markdownIt({ html: true, linkify: true })
|
||||||
md.use(markdownItAnchor, {
|
md.use(markdownItAnchor, {
|
||||||
|
|
|
@ -102,7 +102,7 @@ https://cdme.netlify.app https://coryd.dev 301!
|
||||||
/follow.json https://feedpress.me/coryd-follow.json
|
/follow.json https://feedpress.me/coryd-follow.json
|
||||||
|
|
||||||
# media
|
# media
|
||||||
/media/* https://f001.backblazeb2.com/file/coryd-dev-images/:splat
|
/media/* https://f001.backblazeb2.com/file/coryd-dev-images/:splat 200
|
||||||
|
|
||||||
# analytics
|
# analytics
|
||||||
/23af0256fe76a.js http://static.getclicky.com/js?in=/2842c5ddc46e5 200
|
/23af0256fe76a.js http://static.getclicky.com/js?in=/2842c5ddc46e5 200
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { getStore } from '@netlify/blobs'
|
import { getStore } from '@netlify/blobs'
|
||||||
import { DateTime } from 'luxon'
|
import { DateTime } from 'luxon'
|
||||||
|
|
||||||
const sanitizeMediaString = (string) => string.normalize('NFD').replace(/[\u0300-\u036f\u2010—\.\?\(\)\[\]\{\}]/g, '').replace(/\.{3}/g, '').replace(/A©|é/g, 'e');
|
const sanitizeMediaString = (string) => string.normalize('NFD').replace(/[\u0300-\u036f\u2010—\.\?\(\)\[\]\{\}]/g, '').replace(/\.{3}/g, '')
|
||||||
|
|
||||||
const weekKey = () => {
|
const weekKey = () => {
|
||||||
const currentDate = DateTime.now();
|
const currentDate = DateTime.now();
|
||||||
|
|
|
@ -34,6 +34,10 @@ export const searchIndex = (collection) => {
|
||||||
return searchIndex
|
return searchIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const artistsIndex = (collection) => collection.getAll()[0].data.musicCharts.year.artists
|
||||||
|
|
||||||
|
export const albumsIndex = (collection) => collection.getAll()[0].data.musicCharts.year.albums
|
||||||
|
|
||||||
export const tagList = (collection) => {
|
export const tagList = (collection) => {
|
||||||
const tagsSet = new Set()
|
const tagsSet = new Set()
|
||||||
collection.getAll().forEach((item) => {
|
collection.getAll().forEach((item) => {
|
||||||
|
|
7
package-lock.json
generated
7
package-lock.json
generated
|
@ -43,6 +43,7 @@
|
||||||
"markdown-it-footnote": "^4.0.0",
|
"markdown-it-footnote": "^4.0.0",
|
||||||
"sanitize-html": "^2.13.0",
|
"sanitize-html": "^2.13.0",
|
||||||
"slugify": "^1.6.6",
|
"slugify": "^1.6.6",
|
||||||
|
"string-sanitizer": "^2.0.2",
|
||||||
"terser": "^5.30.1",
|
"terser": "^5.30.1",
|
||||||
"writing-stats": "^1.0.6"
|
"writing-stats": "^1.0.6"
|
||||||
}
|
}
|
||||||
|
@ -6901,6 +6902,12 @@
|
||||||
"safe-buffer": "~5.2.0"
|
"safe-buffer": "~5.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/string-sanitizer": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/string-sanitizer/-/string-sanitizer-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-zECtWmUawolaVbUOdDRdhAM4jN7wl1sB4indjTmHpUFavzFSeYEDSVF85dZPPyDKoMRTJbrz+Tp0SjPPCWxscA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/strip-bom-string": {
|
"node_modules/strip-bom-string": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/strip-bom-string/-/strip-bom-string-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/strip-bom-string/-/strip-bom-string-1.0.0.tgz",
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
"markdown-it-footnote": "^4.0.0",
|
"markdown-it-footnote": "^4.0.0",
|
||||||
"sanitize-html": "^2.13.0",
|
"sanitize-html": "^2.13.0",
|
||||||
"slugify": "^1.6.6",
|
"slugify": "^1.6.6",
|
||||||
|
"string-sanitizer": "^2.0.2",
|
||||||
"terser": "^5.30.1",
|
"terser": "^5.30.1",
|
||||||
"writing-stats": "^1.0.6"
|
"writing-stats": "^1.0.6"
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import artistCapitalizationPatches from '../json/artist-capitalization-patches.j
|
||||||
|
|
||||||
export const artistCapitalization = (artist) => artistCapitalizationPatches[artist?.toLowerCase()] || artist
|
export const artistCapitalization = (artist) => artistCapitalizationPatches[artist?.toLowerCase()] || artist
|
||||||
|
|
||||||
const sanitizeMediaString = (string) => string.normalize('NFD').replace(/[\u0300-\u036f\u2010—\.\?\(\)\[\]\{\}]/g, '').replace(/\.{3}/g, '').replace(/A©|é/g, 'e');
|
const sanitizeMediaString = (string) => string.normalize('NFD').replace(/[\u0300-\u036f\u2010—\.\?\(\)\[\]\{\}]/g, '').replace(/\.{3}/g, '')
|
||||||
const artistSanitizedKey = (artist) => `${sanitizeMediaString(artist).replace(/\s+/g, '-').toLowerCase()}`
|
const artistSanitizedKey = (artist) => `${sanitizeMediaString(artist).replace(/\s+/g, '-').toLowerCase()}`
|
||||||
const albumSanitizedKey = (album) => `${sanitizeMediaString(album).replace(/\s+/g, '-').toLowerCase()}-${sanitizeMediaString(album.replace(/[:\/\\,'']+/g
|
const albumSanitizedKey = (album) => `${sanitizeMediaString(album).replace(/\s+/g, '-').toLowerCase()}-${sanitizeMediaString(album.replace(/[:\/\\,'']+/g
|
||||||
, '').replace(/\s+/g, '-').toLowerCase())}`
|
, '').replace(/\s+/g, '-').toLowerCase())}`
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
||||||
{% if data.size > 0 %}
|
{% if data.size > 0 %}
|
||||||
<div class="track__chart">
|
<div class="music-chart">
|
||||||
{% for item in data limit: 10 %}
|
{% for item in data limit: 10 %}
|
||||||
{%- assign percentage = item.plays | calculatePlayPercentage: mostPlayed -%}
|
{%- assign percentage = item.plays | calculatePlayPercentage: mostPlayed -%}
|
||||||
<div class="item">
|
<div class="item">
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
<div class="count">{{ forloop.index }}.</div>
|
<div class="count">{{ forloop.index }}.</div>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<div class="title">{{ item.title }}</div>
|
<div class="title">{{ item.title }}</div>
|
||||||
<div class="artists">
|
<div class="subtext">
|
||||||
<a href="{{ item.url }}">{{ item.artist }}</a> • {{ item.plays }} plays
|
<a href="{{ item.url }}">{{ item.artist }}</a> • {{ item.plays }} plays
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% if data.size > 0 %}
|
{% if data.size > 0 %}
|
||||||
<div class="track__chart">
|
<div class="music-chart">
|
||||||
{% for item in data limit: 10 %}
|
{% for item in data limit: 10 %}
|
||||||
{% capture alt %}{{ item.track }} by {{ item.track }}{% endcapture %}
|
{% capture alt %}{{ item.track }} by {{ item.track }}{% endcapture %}
|
||||||
<div class="item">
|
<div class="item">
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
{% image item.image, alt, '', 'lazy' %}
|
{% image item.image, alt, '', 'lazy' %}
|
||||||
<div class="meta-text">
|
<div class="meta-text">
|
||||||
<div class="title">{{ item.track }}</div>
|
<div class="title">{{ item.track }}</div>
|
||||||
<div class="artists">
|
<div class="subtext">
|
||||||
<a href="{{ item.url }}">{{ item.artist }}</a>
|
<a href="{{ item.url }}">{{ item.artist }}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script type="module" src="/assets/scripts/components/select-pagination.js"></script>
|
<script type="module" src="/assets/scripts/components/select-pagination.js"></script>
|
||||||
<nav aria-label="Blog pagination" class="pagination flex-centered">
|
<nav aria-label="Pagination" class="pagination flex-centered">
|
||||||
{% if pagination.href.previous %}
|
{% if pagination.href.previous %}
|
||||||
<a href="{{ pagination.href.previous }}" aria-label="Previous page">
|
<a href="{{ pagination.href.previous }}" aria-label="Previous page">
|
||||||
{% tablericon "arrow-left" "Previous" %}
|
{% tablericon "arrow-left" "Previous" %}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.track__chart {
|
.music-chart {
|
||||||
& .item {
|
& .item {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
|
@ -40,13 +40,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
& .title,
|
& .title,
|
||||||
& .artists {
|
& .subtext {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
& .artists,
|
& .subtext,
|
||||||
& .timestamp {
|
& .timestamp {
|
||||||
font-size: var(--font-size-sm);
|
font-size: var(--font-size-sm);
|
||||||
line-height: var(--line-height-sm);
|
line-height: var(--line-height-sm);
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 768px) {
|
@media screen and (min-width: 768px) {
|
||||||
.track__chart .item .meta-text {
|
.music-chart .item .meta-text {
|
||||||
max-width: 85%;
|
max-width: 85%;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -38,4 +38,4 @@
|
||||||
@import url('./components/progress-bar.css') layer(components.media);
|
@import url('./components/progress-bar.css') layer(components.media);
|
||||||
@import url('./components/share-button.css') layer(components);
|
@import url('./components/share-button.css') layer(components);
|
||||||
@import url('./components/theme-toggle.css') layer(components);
|
@import url('./components/theme-toggle.css') layer(components);
|
||||||
@import url('./components/track-chart.css') layer(components.media);
|
@import url('./components/music-chart.css') layer(components.media);
|
|
@ -16,7 +16,7 @@ What I've long wanted is something that sits on infrastructure I control, stores
|
||||||
Next, I went to work developing the edge function that would receive and deal with the data. I'm leveraging `luxon` for dealing with dates and [Netlify Blobs](https://docs.netlify.com/blobs/overview/) for persistence. I have a few different helper functions on hand as well:
|
Next, I went to work developing the edge function that would receive and deal with the data. I'm leveraging `luxon` for dealing with dates and [Netlify Blobs](https://docs.netlify.com/blobs/overview/) for persistence. I have a few different helper functions on hand as well:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const sanitizeMediaString = (string) => string.normalize('NFD').replace(/[\u0300-\u036f\u2010—\.\?\(\)\[\]\{\}]/g, '').replace(/\.{3}/g, '').replace(/A©|é/g, 'e');
|
const sanitizeMediaString = (string) => string.normalize('NFD').replace(/[\u0300-\u036f\u2010—\.\?\(\)\[\]\{\}]/g, '').replace(/\.{3}/g, '')
|
||||||
|
|
||||||
const weekKey = () => {
|
const weekKey = () => {
|
||||||
const currentDate = DateTime.now();
|
const currentDate = DateTime.now();
|
||||||
|
|
Reference in a new issue