-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
569 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { StyledArticleContent } from 'components/styled-article-content' | ||
import { notFound } from 'next/navigation' | ||
import { allSeeds, Seed } from '.contentlayer/generated' | ||
import { Metadata } from 'next' | ||
import Link from 'next/link' | ||
|
||
type Params = { | ||
params: { | ||
slug: string | ||
} | ||
} | ||
|
||
export const generateStaticParams = () => [] | ||
|
||
export async function generateMetadata({ params }: Params): Promise<Metadata> { | ||
const seed = allSeeds.find((seed: Seed) => { | ||
return seed.slug === params.slug | ||
}) | ||
|
||
if (!seed) throw new Error(`Seed not found for slug: ${params.slug}`) | ||
|
||
const title = `${seed.title} - Garden - Chris Jarling` | ||
const description = seed.body.raw.slice(0, 150) | ||
|
||
return { | ||
title, | ||
description, | ||
openGraph: { | ||
title, | ||
description, | ||
images: [ | ||
{ | ||
url: 'https://www.chrisjarling.com/og.jpg', | ||
secureUrl: 'https://www.chrisjarling.com/og.jpg', | ||
width: 1200, | ||
height: 630, | ||
}, | ||
], | ||
}, | ||
} | ||
} | ||
|
||
function getBacklinks(slug: string) { | ||
const backlinkingDocs = allSeeds.filter((seed) => | ||
seed.body.raw.includes('[[' + slug) | ||
) as Seed[] | ||
|
||
return backlinkingDocs.map((doc) => ({ | ||
title: doc.title, | ||
slug: doc.slug, | ||
excerpt: doc.excerpt, | ||
type: doc.type, | ||
})) | ||
} | ||
|
||
export default async function Post({ params }: Params) { | ||
const seed = allSeeds.find((seed: Seed) => { | ||
return seed.slug === params.slug | ||
}) | ||
|
||
if (!seed) { | ||
notFound() | ||
} | ||
|
||
const backlinks = getBacklinks(params.slug) | ||
|
||
return ( | ||
<> | ||
<div> | ||
<h2 className="text-neutral-100 font-bold font-headline text-xl mb-4"> | ||
{seed.title} | ||
</h2> | ||
{seed.wip && ( | ||
<div className="rounded-lg p-4 mb-6 bg-purple-700/10 border border-purple-900 text-purple-200 text-sm"> | ||
This page is still work in progress. Information might be | ||
incomplete, formatting and grammar might be off. | ||
</div> | ||
)} | ||
<StyledArticleContent contentHtml={seed.body.html} /> | ||
{backlinks.length > 0 && ( | ||
<> | ||
<h2 className="text-lg font-bold mb-4">Backlinks</h2> | ||
<div className="grid grid-cols-2"> | ||
{backlinks.map((backlink) => ( | ||
<Link | ||
key={backlink.slug} | ||
className="p-4 bg-zinc-800 rounded-lg hover:bg-zinc-700" | ||
href={`/digital-garden/${backlink.slug}`} | ||
> | ||
<span className="block mb-2 font-bold">{backlink.title}</span> | ||
{backlink.excerpt && ( | ||
<span className="text-sm">{backlink.excerpt}</span> | ||
)} | ||
</Link> | ||
))} | ||
</div> | ||
</> | ||
)} | ||
</div> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import Link from 'next/link' | ||
import { allSeeds, Seed } from '.contentlayer/generated' | ||
import { format } from 'date-fns' | ||
|
||
const DigitalGardenIndexPage = async () => { | ||
const sortedSeeds = allSeeds.sort((a, b) => { | ||
return new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime() | ||
}) | ||
|
||
return ( | ||
<> | ||
<div className="text-xl font-bold mb-4">The garden</div> | ||
<div className="grid gird-cols-1 md:grid-cols-3 gap-4"> | ||
{sortedSeeds.map((seed: Seed) => ( | ||
<Link key={seed._id} href={`/digital-garden/${seed.slug}`}> | ||
<div className="p-4 bg-zinc-800 flex flex-col rounded-lg h-full hover:bg-zinc-700"> | ||
<span className="font-bold">{seed.title}</span> | ||
{seed.excerpt && ( | ||
<span className="text-xs mt-2">{seed.excerpt}</span> | ||
)} | ||
<span className="text-xs text-zinc-500 mt-2"> | ||
Updated at: {format(new Date(seed.updatedAt), 'do LLL, yyyy')} | ||
</span> | ||
</div> | ||
</Link> | ||
))} | ||
</div> | ||
</> | ||
) | ||
} | ||
|
||
export default DigitalGardenIndexPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
title: Streams vs Pages | ||
wip: true | ||
createdAt: 2023-08-12T20:24:21.048Z | ||
updatedAt: 2023-08-12T20:24:21.048Z | ||
excerpt: "Thoughts about writing content in form of streams of thoughs or pages" | ||
--- | ||
|
||
Most content on my site is in stream format: I write it once and then do not come back to it. Works good for log-like entries. It does not work well for opinions (which I tend to change over time) and knowledge (which I tend to acquire more over time). I think it makes sense to orient my site more towards pages. | ||
|
||
I want to keep the stream part of the site around (term is stolen from Timo's site) for log-like entries. They could also be the starting point of some pages. However, there is no reason why pages should not be the starting point for pages and then there is just a stream of changes to pages. I don't write too many personal things on here lately anyways. | ||
|
||
I'm afraid that moving the main content of my site to pages will again give me the feeling that things need to be polished. Even though the idea of moving to pages should be just the opposite: Write early and iterate on ideas when they involve. Can also have different states displayed on it to communicate its state. | ||
|
||
Not sure what the states could be. There are two that I'm certain of: | ||
- Still working on it | ||
- Done | ||
|
||
Of course, even if it feels like a note is "Done" today, this can be fals in a week or a year. So these states should not communicate that a page is now set in stone. It should rather comminicate that a page is mostly a rough outline (like this one now is) to the reader. Considering that, pages only need one state, which is "Work in Progress" and can be a small indicator at the beginning of the page. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
051a739
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
website-next – ./
website-next-git-main-plsr.vercel.app
website-next-plsr.vercel.app
www.chrisjarling.com
website-next-alpha.vercel.app
chrisjarling.com