diff --git a/components/blog/BlogListModelByYear.vue b/components/blog/BlogListModelByYear.vue
index 99cb185b15..01cc17821b 100644
--- a/components/blog/BlogListModelByYear.vue
+++ b/components/blog/BlogListModelByYear.vue
@@ -20,7 +20,7 @@
path: content.path,
meta: {
locale: content.locale ? content.locale : 'en-CA',
- date: content.date,
+ date: content.createdAt,
},
}"
class="font-serif text-xl italic no-underline"
diff --git a/components/global/AppContentDate.vue b/components/global/AppContentDate.vue
index 0620142170..66a61a9ec8 100644
--- a/components/global/AppContentDate.vue
+++ b/components/global/AppContentDate.vue
@@ -1,5 +1,5 @@
-
@@ -35,7 +35,7 @@
},
computed: {
yyyymmdd(): string {
- const { date } = this.content
+ const date = this.content?.createdAt
let out = ''
if (date) {
const first = date.split('T')[0]
@@ -44,8 +44,8 @@
return out
},
datetime(): string {
- const { date } = this.content
- return date
+ const createdAt = this.content?.createdAt
+ return createdAt
},
textual(): string {
return this.formatDate({
@@ -60,7 +60,7 @@
let out = ''
try {
const locale = this.content?.locale ?? 'fr-CA'
- out = this.content?.date ?? ''
+ out = this.content?.createdAt ?? ''
const { temporalDate = '' } = getPrettyfiedTemporalDate(
this.content,
locale,
diff --git a/lib/model/content/break-into-years.ts b/lib/model/content/break-into-years.ts
index e6e3186838..6a74701737 100644
--- a/lib/model/content/break-into-years.ts
+++ b/lib/model/content/break-into-years.ts
@@ -16,17 +16,17 @@ export const extractYearFromDateString = (dateString: string | ''): number => {
}
export const extractYearFromRecord = (
- content: Record<'created' | 'updated', string>,
+ content: Record<'createdAt' | 'updatedAt', string>,
): number => {
let out: number = 0
- const { created = '', updated } = content
+ const { createdAt = '', updatedAt } = content
- if (created !== '') {
- out = extractYearFromDateString(created)
+ if (createdAt !== '') {
+ out = extractYearFromDateString(createdAt)
}
- if (out === 0 && updated) {
- out = extractYearFromDateString(updated)
+ if (out === 0 && updatedAt) {
+ out = extractYearFromDateString(updatedAt)
}
return out
@@ -58,5 +58,5 @@ export const breakIntoYears = (
// Make sure it's sorted by year, chronologically
return out.filter(([y]) => y !== 0).sort((a, b) => b[0] - a[0])
// ^^^^^^^
- // | We set all with no created date into a bucket aside and don't display them.
+ // | We set all with no createdAt date into a bucket aside and don't display them.
}
diff --git a/lib/model/content/model.ts b/lib/model/content/model.ts
index 09d0e5a080..a49ca5be87 100644
--- a/lib/model/content/model.ts
+++ b/lib/model/content/model.ts
@@ -24,23 +24,16 @@ export interface IBaseNuxtContentResult extends IResult {
/**
* Nuxt internal file creation date
*
- * #ToLearn: Figure Out Unsure if it's filesystem
+ * Hard-coded, per file, desired publication date.
+ * If it's in the file (i.e. hardcoded), otherwise Nuxt will take from the filesystem.
*/
createdAt: string
/**
* Nuxt internal file updated date
*
- * #ToLearn: Figure Out Unsure if it's filesystem
+ * If it's in the file (i.e. hardcoded), otherwise Nuxt will take from the filesystem.
*/
updatedAt: string
- /**
- * Hard-coded, per file, desired publication date.
- */
- created: string
- /**
- * Hard-coded, per file, desired last updated date.
- */
- updated: string
dir: string
extension: string
path: string
@@ -102,7 +95,7 @@ export type INuxtContentPrevNext = Pick<
export interface INuxtContentIndexResult
extends Pick<
INuxtContentResult,
- 'created' | 'updated' | 'locale' | 'path' | 'slug' | 'title'
+ 'createdAt' | 'updatedAt' | 'locale' | 'path' | 'slug' | 'title'
> {
prettyfiedTemporalDate?: IPrettyfiedTemporalDate
}
@@ -138,6 +131,8 @@ export const isNuxtContentResult = (
export const queryNuxtContent = async (
$content: Context['$content'],
route: Context['route'],
+ year?: string,
+ month?: string,
): Promise => {
let contents: INuxtContentResult[] = []
const { query = {} as Context['route']['query'] } = route
@@ -157,7 +152,7 @@ export const queryNuxtContent = async (
let ds = $content('blog', { deep: true })
.sortBy('created', 'desc')
.only([
- 'created',
+ 'createdAt',
'excerpt',
'locale',
'path',
@@ -166,7 +161,7 @@ export const queryNuxtContent = async (
'slug',
'tags',
'title',
- 'updated',
+ 'updatedAt',
])
if (q) {
ds = ds.search(q)
diff --git a/lib/model/date.ts b/lib/model/date.ts
index 52aa93e26c..ce8c5c7126 100644
--- a/lib/model/date.ts
+++ b/lib/model/date.ts
@@ -71,7 +71,7 @@ export const formatTemporal = (
}
export const getPrettyfiedTemporalDate = (
- content: Record<'created' | 'updated', string>,
+ content: Record<'createdAt' | 'updatedAt', string>,
locale = 'fr-CA',
format?: Intl.DateTimeFormatOptions,
): IPrettyfiedTemporalDate => {
@@ -83,7 +83,7 @@ export const getPrettyfiedTemporalDate = (
*
* @TODO #23 It MUST be a string that has no Z in its notation.
*/
- let field = content?.date ?? content?.created ?? content?.updated ?? 0
+ let field = content?.date ?? content?.createdAt ?? content?.updatedAt ?? 0
if (/\d\d\d\d-\d\d-\d\dT/.test(field)) {
field = field.split('T')[0]
diff --git a/lib/runtime/nuxt-feed.ts b/lib/runtime/nuxt-feed.ts
index 7633eabfbb..169dd51d53 100644
--- a/lib/runtime/nuxt-feed.ts
+++ b/lib/runtime/nuxt-feed.ts
@@ -11,13 +11,11 @@ const EXAMPLE_NUXT_CONTENT_RESULT: Partial[] = [
title:
'Things I’ve worked on in the last two years while maintaining WebPlatform.org',
locale: 'en-CA',
- created: '2017-02-09T00:00:00.000Z',
- updated: '2023-11-20T00:00:00.000Z',
+ createdAt: '2017-02-09T00:00:00.000Z',
+ updatedAt: '2023-11-20T00:00:00.000Z',
dir: '/blog/2017/02',
path: '/blog/2017/02/things-i-ve-worked-on-while-maintaining-webplatform-org',
slug: 'things-i-ve-worked-on-while-maintaining-webplatform-org',
- createdAt: '2024-10-01T17:48:55.423Z',
- updatedAt: '2024-10-01T17:48:55.424Z',
},
]
@@ -36,14 +34,16 @@ const baseUrlNoTrailingSlash = (u: string): string => {
let failedDatesOnce = false
-const dateStringToDateObject = (created, tz) => {
+const dateStringToDateObject = (createdAt, tz) => {
// #TODO Make sure we return with proper time offset for Montreal, not UTC
- const createdNormalized =
- !!created && !created.includes('T') ? created + 'T00:00:00.000Z' : created
+ const createdAtNormalized =
+ !!createdAt && !createdAt.includes('T')
+ ? createdAt + 'T00:00:00.000Z'
+ : createdAt
let published: Date | undefined
let instant
try {
- instant = Temporal.Instant.from(createdNormalized)
+ instant = Temporal.Instant.from(createdAtNormalized)
instant = instant.toZonedDateTimeISO(tz)
published = new Date(instant.epochMilliseconds)
} catch {
@@ -102,10 +102,10 @@ export const createNuxtFeedCreate =
// ------ BEGIN [ /blog ] ------------------------------
const ds1 = $content('blog', { deep: true })
- .sortBy('created', 'desc')
+ .sortBy('createdAt', 'desc')
.only([
'categories',
- 'created',
+ 'createdAt',
'description',
'dir',
'excerpt',
@@ -115,7 +115,7 @@ export const createNuxtFeedCreate =
'slug',
'tags',
'title',
- 'updated',
+ 'updatedAt',
])
const p1 = (await ds1.fetch()) as INuxtContentResult[]
all.push(
@@ -127,9 +127,9 @@ export const createNuxtFeedCreate =
// ------ BEGIN [ /code-review ] ------------------------------
const ds2 = $content('code-review', { deep: true })
- .sortBy('created', 'desc')
+ .sortBy('createdAt', 'desc')
.only([
- 'created',
+ 'createdAt',
'description',
'excerpt',
'locale',
@@ -138,7 +138,7 @@ export const createNuxtFeedCreate =
'slug',
'tags',
'title',
- 'updated',
+ 'updatedAt',
])
const p2 = (await ds2.fetch()) as INuxtContentResult[]
all.push(...p2)
@@ -146,9 +146,9 @@ export const createNuxtFeedCreate =
// ------ BEGIN [ /glossary ] ------------------------------
const ds3 = $content('glossary', { deep: true })
- .sortBy('created', 'desc')
+ .sortBy('createdAt', 'desc')
.only([
- 'created',
+ 'createdAt',
'description',
'excerpt',
'locale',
@@ -157,7 +157,7 @@ export const createNuxtFeedCreate =
'slug',
'tags',
'title',
- 'updated',
+ 'updatedAt',
])
const p3 = (await ds3.fetch()) as INuxtContentResult[]
all.push(...p3)
@@ -184,17 +184,17 @@ export const createNuxtFeedCreate =
}
*/
- const published = dateStringToDateObject(article.created, timeZone)
+ const published = dateStringToDateObject(article.createdAt, timeZone)
if (published) {
Reflect.set(item, 'published', published)
} else {
failedDates.push({
path: article.path,
- propertyName: 'article.created',
- value: article.created,
+ propertyName: 'article.createdAt',
+ value: article.createdAt,
})
}
- const updated = dateStringToDateObject(article.updated, timeZone)
+ const updated = dateStringToDateObject(article.updatedAt, timeZone)
if (updated) {
// Because "date" field is for updated
Reflect.set(item, 'date', updated)
@@ -202,7 +202,7 @@ export const createNuxtFeedCreate =
failedDates.push({
path: article.path,
propertyName: 'article.updated',
- value: article.updated,
+ value: article.updatedAt,
})
}
diff --git a/pages/blog/_year/_month/_slug.vue b/pages/blog/_year/_month/_slug.vue
index d66ab73838..e1595a557d 100644
--- a/pages/blog/_year/_month/_slug.vue
+++ b/pages/blog/_year/_month/_slug.vue
@@ -1,11 +1,11 @@
-
+
bProp2) {
return -1
} else if (aProp2 < bProp2) {
@@ -133,7 +133,7 @@
'toc',
'waybackMachineSnapshots',
])
- .sortBy('created', 'asc')
+ .sortBy('createdAt', 'asc')
const fetched = (await ds.fetch()) as NuxtContentResult[]
const contents: NuxtContentResult[] = fetched
.filter((a) => findExcludingRedirectPredicate(a))
diff --git a/pages/glossary/index.vue b/pages/glossary/index.vue
index e9e2bfb6c3..4c3ea7f0fc 100644
--- a/pages/glossary/index.vue
+++ b/pages/glossary/index.vue
@@ -44,7 +44,7 @@
try {
contents = await $content(contentFirstDirName)
.sortBy('title', 'desc')
- .only(['created', 'updated', 'locale', 'path', 'slug', 'title'])
+ .only(['createdAt', 'updatedAt', 'locale', 'path', 'slug', 'title'])
.fetch()
} catch (_) {
// ..
diff --git a/pages/index.vue b/pages/index.vue
index 1f70300799..e1359ace9f 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -14,7 +14,7 @@
path: content.path,
meta: {
locale: content.locale ? content.locale : 'en-CA',
- date: content.date,
+ date: content.createdAt,
},
}"
class="font-serif italic no-underline"
@@ -67,7 +67,7 @@
const db = $content('blog', { deep: true })
.where({ tags: { $contains: tag } })
.limit(4)
- .sortBy('created', 'desc')
+ .sortBy('createdAt', 'desc')
contents = await db.fetch()
for (const content of contents) {
diff --git a/pages/projects/index.vue b/pages/projects/index.vue
index 17a6a21952..8ee655f0cd 100644
--- a/pages/projects/index.vue
+++ b/pages/projects/index.vue
@@ -81,7 +81,10 @@
watchQuery: true,
async asyncData({ $content, route }) {
const q = route.query.q
- let query = $content('projects', { deep: true }).sortBy('created', 'desc')
+ let query = $content('projects', { deep: true }).sortBy(
+ 'createdAt',
+ 'desc',
+ )
if (q) {
query = query.search(q)
// OR query = query.search('title', q)
diff --git a/pages/projets/index.vue b/pages/projets/index.vue
index 739fe20e8a..bb590aec7a 100644
--- a/pages/projets/index.vue
+++ b/pages/projets/index.vue
@@ -85,7 +85,7 @@
const query = $content('projects', { deep: true })
.where({ pageKey: { $contains: pageKey }, locale: { $eq: pageLocale } })
- .sortBy('created', 'desc')
+ .sortBy('createdAt', 'desc')
const contents = (await query.fetch()) as INuxtContentResult[]
return {