Skip to content

Commit

Permalink
lint and repair git merge..
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothée Rebours committed Mar 5, 2024
1 parent 2be2b0f commit 7de7d19
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 73 deletions.
30 changes: 2 additions & 28 deletions src/pages/[lang]/blog/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,12 @@ const t = useTranslations(lang)
const truncatedPost = sanitizeHtml(await convertMDXToHTML(post.body, 297), { allowedTags: [] })
<<<<<<< Updated upstream:src/pages/[lang]/blog/[slug].astro
const imageFilePath = (post.data.image != null && Object.hasOwn(post.data.image, 'fsPath')) ? (post.data.image as unknown as {
fsPath: string
}).fsPath : ''
=======
<<<<<<< Updated upstream:src/pages/[lang]/blog/[slug]/index.astro
const imageFilePath = (post.data.image != null && Object.hasOwn(post.data.image, 'fsPath')) ? (post.data.image as unknown as { fsPath: string }).fsPath : ''
=======
const imageFilePath = (post.data.image != null && Object.hasOwn(post.data.image, 'fsPath'))
? (post.data.image as unknown as {
fsPath: string
}).fsPath
: ''
>>>>>>> Stashed changes:src/pages/[lang]/blog/[slug].astro
>>>>>>> Stashed changes:src/pages/[lang]/blog/[slug]/index.astro
const image = imageFilePath != null ? await readFile(imageFilePath) : undefined
const date = DateTime.fromJSDate(post.data.date).setLocale(languages[lang].code)
Expand All @@ -64,31 +55,14 @@ const formattedAbsoluteDate = date.toLocaleString(DateTime.DATE_FULL)
<meta property="og:type" content="article"/>
{
(image != null)
<<<<<<< Updated upstream:src/pages/[lang]/blog/[slug].astro
?
<MetaOGImage title={post.data.title}
=======
? <MetaOGImage title={post.data.title}
<<<<<<< Updated upstream:src/pages/[lang]/blog/[slug]/index.astro
description={post.data.description ?? truncatedPost}
author="Timothée Rebours"
date={post.data.date}
dateFormat={lang}
image={image}
=======
>>>>>>> Stashed changes:src/pages/[lang]/blog/[slug]/index.astro
description={post.data.description ?? truncatedPost}
author="Timothée Rebours"
date={post.data.date}
dateFormat={lang}
image={image}
<<<<<<< Updated upstream:src/pages/[lang]/blog/[slug].astro
=======
>>>>>>> Stashed changes:src/pages/[lang]/blog/[slug].astro
>>>>>>> Stashed changes:src/pages/[lang]/blog/[slug]/index.astro
/>
:
<></>
: <></>
}
</Fragment>
<div class="space-y-2 mb-2">
Expand Down
45 changes: 0 additions & 45 deletions src/pages/[lang]/blog/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -22,59 +22,14 @@ const localizePath = useTranslatedPath(lang)
const blogPosts = (await getCollection('blog', ({ id }) => id.split('/')[0] === lang))
.sort((a, b) => b.data.date.getTime() - a.data.date.getTime())
<<<<<<< Updated upstream
const formatDate = (jSDate: Date, lang: string): { formatted: string, absolute: string } => {
const date = DateTime.fromJSDate(jSDate).setLocale(lang)
const delta = Math.abs(date.diffNow().as('days'))
const formattedAbsoluteDate = date.toLocaleString(DateTime.DATE_FULL)
const formattedRelativeDate = date.toRelative()
if (delta <= 7) {
return {
formatted: formattedRelativeDate,
absolute: formattedAbsoluteDate
}
}
if (delta <= 30) {
return {
formatted: `${formattedRelativeDate} (${formattedAbsoluteDate})`,
absolute: formattedAbsoluteDate
}
}
return {
formatted: formattedAbsoluteDate,
absolute: formattedAbsoluteDate
}
}
const renderedBlogPosts = await Promise.all(blogPosts.map(async post => {
const { formatted, absolute } = formatDate(post.data.date, languages[lang].code)
return ({
...post,
formattedAbsoluteDate: absolute,
formattedDate: formatted,
=======
<<<<<<< Updated upstream
const renderedBlogPosts = await Promise.all(blogPosts.map(async post => ({ ...post, html: `${await convertMDXToHTML(post.body, 100)}...` })))
const formatDate = useFormatDate(lang)
=======
const renderedBlogPosts = await Promise.all(blogPosts.map(async post => {
return ({
...post,
formattedAbsoluteDate: DateTime.fromJSDate(post.data.date).setLocale(languages[lang].code).toLocaleString(DateTime.DATE_FULL),
>>>>>>> Stashed changes
html: `${await convertMDXToHTML(post.body, 100)}...`
})
}))
<<<<<<< Updated upstream
=======
>>>>>>> Stashed changes
>>>>>>> Stashed changes
---

<Layout title={t('blog.title')}>
Expand Down

0 comments on commit 7de7d19

Please sign in to comment.