Skip to content

Commit

Permalink
🐛 (notion) (╯°□°)╯︵ ┻━┻ Slug.Preview [b] (#3116)
Browse files Browse the repository at this point in the history
(╯°□°)╯︵ ┻━┻ `Slug.Preview`

```bash
join(["", "events", formatDate(dateSubtract(prop("Date"), 5, "hours"), "YYYY/MM/DD"), prop("Slug")], "/")
```

API User is UTC, so basically account for highest diff in Eastern Timezone with UTC instead of `1` day.

This seems to nly work with blowing out cache and doing a check for SEO Image now. (-‸ლ)
  • Loading branch information
JeromeFitz authored Jan 1, 2025
1 parent b85fa55 commit 8a40d11
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { getPropertyTypeData } from 'next-notion/utils/index'

import type { PropertiesEvent } from '@/app/(notion)/_config/index'

// @todo(complexity) 11
// eslint-disable-next-line complexity
function getEventData(properties) {
// if (!properties) return {}
/**
Expand Down Expand Up @@ -49,6 +51,12 @@ function getEventData(properties) {
)
const isEventOver = hoursUntilEvent < 0

const isSeoImageEmpty =
getPropertyTypeDataEvent(properties, 'SEO.Image')?.length === 0
// console.dir(`what is happening with SEO.Image?!`)
// console.dir(`isSeoImageEmpty: ${isSeoImageEmpty ? 'y' : 'n'}`)
// console.dir(getPropertyTypeDataEvent(properties, 'SEO.Image'))

const data = {
dateIso: getPropertyTypeDataEvent(properties, 'Date.ISO'),
dayOfMonth: getPropertyTypeDataEvent(properties, 'Date.DayOfMonth'),
Expand All @@ -71,7 +79,9 @@ function getEventData(properties) {
monthName: getPropertyTypeDataEvent(properties, 'Date.MonthName'),
monthNameAbbr: getPropertyTypeDataEvent(properties, 'Date.MonthNameAbbr'),
seoDescription: getPropertyTypeDataEvent(properties, 'SEO.Description'),
seoImage: getPropertyTypeDataEvent(properties, 'SEO.Image')[0],
seoImage: isSeoImageEmpty
? null
: getPropertyTypeDataEvent(properties, 'SEO.Image')[0],
seoImageDescription: getPropertyTypeDataEvent(
properties,
'SEO.Image.Description',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ async function Slug({ revalidate, segmentInfo }) {
const noData = isObjectEmpty(data?.blocks || {})
const is404 = noData

// console.dir(segmentInfo)
// console.dir(data)
// console.dir(`noData: ${noData ? 'y' : 'n'}`)
// console.dir(`is404: ${is404 ? 'y' : 'n'}`)

Expand Down

0 comments on commit 8a40d11

Please sign in to comment.