fix: feed dates

This commit is contained in:
Cory Dransfeldt 2024-02-26 14:50:29 -08:00
parent 7b20663d24
commit b78f17bad0
No known key found for this signature in database
5 changed files with 6 additions and 6 deletions

View file

@ -70,7 +70,7 @@ export default {
})
.split(',')[0]
},
isoDateOnly: (date) => {
isoDateOnly: (date, separator) => {
let d = new Date(date)
let month = '' + (d.getMonth() + 1)
let day = '' + d.getDate()
@ -79,7 +79,7 @@ export default {
if (month.length < 2) month = '0' + month
if (day.length < 2) day = '0' + day
return [month, day, year].join('.')
return [year, month, day].join(separator)
},
stringToDate: (string) => {
if (!string) return

View file

@ -1,6 +1,6 @@
{
"name": "coryd.dev",
"version": "6.5.13",
"version": "6.5.14",
"description": "The source for my personal site. Built using 11ty and hosted on Netlify.",
"type": "module",
"scripts": {

View file

@ -61,7 +61,7 @@
"@type": "Person",
"name": "{{ meta.author }}"
},
"datePublished": "{{ page.date | isoDateOnly }}"
"datePublished": "{{ page.date | isoDateOnly: '.' }}"
}
</script>
{% else %}

View file

@ -8,7 +8,7 @@ eleventyExcludeFromCollections: true
{% if not page.data.draft %}
<url>
<loc>{{ meta.url }}{{ page.url }}</loc>
<lastmod>{{ page.date | isoDateOnly }}</lastmod>
<lastmod>{{ page.date | isoDateOnly: '-' }}</lastmod>
<changefreq>{%- if page.data.changeFreq -%}{{ page.data.changeFreq }}{%- else -%}monthly{%- endif -%}</changefreq>
<priority>{%- if page.data.priority -%}{{ page.data.priority }}{%- else -%}0.5{%- endif %}</priority>
</url>

View file

@ -121,7 +121,7 @@ When the build runs, it renders any mentions of a given post via a [liquid.js](h
/>
<div class="ml-3">
<p class="text-sm group-hover:text-blue-500 dark:group-hover:text-blue-300">{{mention.content.text}}</p>
<p class="mt-1 text-xs group-hover:text-blue-500 dark:group-hover:text-blue-300">{{mention.published | isoDateOnly}}</p>
<p class="mt-1 text-xs group-hover:text-blue-500 dark:group-hover:text-blue-300">{{mention.published | isoDateOnly: '.' }}</p>
</div>
</a>
</div>