diff --git a/config/collections/index.js b/config/collections/index.js index d1c54c6b..f2d48859 100644 --- a/config/collections/index.js +++ b/config/collections/index.js @@ -20,7 +20,7 @@ const tagsToHashtags = (tags) => { }).join('') return '#' + hashtag }) - return hashtags.join(' '); + return hashtags.join(' ') } export const popularPosts = (collection) => { @@ -53,9 +53,37 @@ export const processContent = (collection) => { 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 + return parsedDate.isValid ? parsedDate : null } + const addSiteMapContent = (items, getTitle, getDate) => { + const addedUrls = new Set() + + 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 parsedDate = getDate ? parseDate(getDate(item)) : null + const formattedDate = parsedDate ? parsedDate.toFormat("yyyy-MM-dd'T'HH:mm:ssZZ") : null + + const content = { + url, + title: getTitle(item), + date: formattedDate + } + siteMapContent.push(content) + addedUrls.add(url) + }) + } + } + + const movieData = movies['movies'].filter((movie) => movie['review']?.length && movie['rating']) + const bookData = books.all.filter((book) => book['review']?.length && book['rating']) + const addItemToIndex = (items, icon, getUrl, getTitle, getTags) => { if (items) { items.forEach((item) => { @@ -101,31 +129,6 @@ export const processContent = (collection) => { } } - const addSiteMapContent = (items, getTitle, getDate) => { - const addedUrls = new Set() - - 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 - } - siteMapContent.push(content) - addedUrls.add(url) - }) - } - } - - const movieData = movies['movies'].filter((movie) => movie['review']?.length && movie['rating']) - const bookData = books.all.filter((book) => book['review']?.length && book['rating']) - addItemToIndex(posts, '📝', (item) => new URL(item['slug'], BASE_URL).toString(), (item) => item['title'], (item) => item['tags']) addItemToIndex(links, '🔗', (item) => item['link'], (item) => item['title'], (item) => item['tags']) if (movieData) addItemToIndex(movieData, '🎥', (item) => item['url'], (item) => `${item['title']} (${item['rating']})`, (item) => item['tags']) diff --git a/package-lock.json b/package-lock.json index ae8b107f..caecd73e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coryd.dev", - "version": "20.12.6", + "version": "20.12.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coryd.dev", - "version": "20.12.6", + "version": "20.12.7", "license": "MIT", "dependencies": { "@cdransf/api-text": "^1.4.0", @@ -2586,9 +2586,9 @@ "license": "BSD-3-Clause" }, "node_modules/morphdom": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/morphdom/-/morphdom-2.7.3.tgz", - "integrity": "sha512-rvGK92GxSuPEZLY8D/JH07cG3BxyA+/F0Bxg32OoGAEFFhGWA3OqVpqPZlOgZTCR52clXrmz+z2pYSJ6gOig1w==", + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/morphdom/-/morphdom-2.7.4.tgz", + "integrity": "sha512-ATTbWMgGa+FaMU3FhnFYB6WgulCqwf6opOll4CBzmVDTLvPMmUPrEv8CudmLPK0MESa64+6B89fWOxP3+YIlxQ==", "dev": true, "license": "MIT" }, diff --git a/package.json b/package.json index 6cf767ec..0c1331c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "20.12.6", + "version": "20.12.7", "description": "The source for my personal site. Built using 11ty (and other tools).", "type": "module", "scripts": { diff --git a/src/pages/meta/sitemap.liquid b/src/pages/meta/sitemap.liquid index 131bb639..bc2e9cf9 100644 --- a/src/pages/meta/sitemap.liquid +++ b/src/pages/meta/sitemap.liquid @@ -7,7 +7,7 @@ eleventyExcludeFromCollections: true {% for page in collections.siteMap %} {{ globals.url }}{{ page.url }} - {{ page.date | date: '%Y-%m-%d' }} + {{ page.date | date: '%Y-%m-%dT%H:%M:%S%:z' }} {% if page.data.changeFreq %}{{ page.data.changeFreq }}{% else %}monthly{% endif %} {% if page.data.priority %}{{ page.data.priority }}{% else %}0.5{% endif %}