Skip to content

Commit 77b9652

Browse files
authored
Merge pull request #767 from zackproser/build-optimization
Build optimization
2 parents ddb0ee0 + 16b9389 commit 77b9652

File tree

8 files changed

+40
-16
lines changed

8 files changed

+40
-16
lines changed

next.config.mjs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const nextConfig = {
1818
"placehold.co",
1919
"avatars.githubusercontent.com"
2020
],
21-
formats: ['image/avif'], // 40% smaller than PNG
21+
formats: ['image/webp'],
2222
},
2323
transpilePackages: [
2424
"react-tweet",
@@ -124,11 +124,6 @@ const nextConfig = {
124124
destination: '/vectordatabases',
125125
permanent: true
126126
},
127-
{
128-
source: '/comparisons',
129-
destination: '/vectordatabases',
130-
permanent: false
131-
},
132127
{
133128
source: '/comparisons/:db1(pinecone|milvus|chroma|weaviate|faiss|elasticsearch|qdrant|vald|lancedb|marqo|singlestoredb|pgvector|redis|vespa|deep-lake|docarray)-vs-:db2(pinecone|milvus|chroma|weaviate|faiss|elasticsearch|qdrant|vald|lancedb|marqo|singlestoredb|pgvector|redis|vespa|deep-lake|docarray)',
134129
destination: '/vectordatabases',

scripts/create-ai-assisted-dev-tools-comparison-pages.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export const metadata = createMetadata({
3333
slug: "${slug}"
3434
})
3535
36+
export const revalidate = 3600;
37+
3638
export default function Page() {
3739
const tool1 = ${JSON.stringify(tool1)}
3840
const tool2 = ${JSON.stringify(tool2)}

scripts/create-vector-db-comparison-posts.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ export const metadata = {
5353
slug: "${slug}"
5454
}
5555
56+
export const revalidate = 3600;
57+
5658
export default (props) => <ArticleLayout metadata={metadata} {...props} />
5759
5860
<Image src={vectorDatabasesCompared} alt="vector databases compared" />
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use client';
2+
3+
import dynamic from 'next/dynamic';
4+
5+
const TokenizationDemoClient = dynamic(() => import('./TokenizationDemoClient'), {
6+
ssr: false,
7+
loading: () => <div className="text-center p-8">Loading Interactive Demo...</div>,
8+
});
9+
10+
export default function TokenizeDemoLoader() {
11+
return <TokenizationDemoClient />;
12+
}

src/app/demos/tokenize/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Metadata } from 'next'
22
import { Suspense } from 'react'
33
import { createMetadata } from '@/utils/createMetadata'
44
import { Container } from '@/components/Container'
5-
import TokenizationDemoClient from './TokenizationDemoClient'
5+
import TokenizeDemoLoader from './TokenizeDemoLoader'
66

77
export const metadata: Metadata = createMetadata({
88
title: "Interactive tokenization demo for developers",
@@ -24,7 +24,7 @@ export default function TokenizationDemoPage() {
2424
</p>
2525
</header>
2626
<Suspense fallback={<div>Loading...</div>}>
27-
<TokenizationDemoClient />
27+
<TokenizeDemoLoader />
2828
</Suspense>
2929
</div>
3030
</Container>

src/components/ContentCard.jsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,20 @@ export function ContentCard({ article }) {
117117
// Simple check for external links
118118
const isExternalLink = slug?.startsWith('http://') || slug?.startsWith('https://');
119119

120-
// For external links, use the slug directly
121-
// For internal links, use the slug as is - the parent component should provide the full path
122-
const href = isExternalLink ? slug : slug || '#';
120+
let calculatedHref = '#';
121+
if (isExternalLink) {
122+
calculatedHref = slug;
123+
} else if (slug) {
124+
if (type === 'comparison') {
125+
// Ensure no double slashes if slug might accidentally have one (it shouldn't from our generator)
126+
calculatedHref = `/comparisons/${slug.startsWith('/') ? slug.substring(1) : slug}`;
127+
} else {
128+
// For other internal links, assume slug is the intended href.
129+
// If it's not a full path (e.g. /blog/my-post) Link component will resolve it relatively.
130+
// If it is a full path (e.g. /blog/my-post), Link will use it as is.
131+
calculatedHref = slug;
132+
}
133+
}
123134

124135
// Format the date
125136
const formattedDate = date ? new Date(date).toLocaleDateString('en-US', {
@@ -167,7 +178,7 @@ export function ContentCard({ article }) {
167178
: "shadow-lg hover:shadow-xl border-gray-200 dark:border-gray-700"
168179
)}>
169180
{isExternalLink ? (
170-
<a href={href} target="_blank" rel="noopener noreferrer" className="group w-full">
181+
<a href={calculatedHref} target="_blank" rel="noopener noreferrer" className="group w-full">
171182
<CardContent
172183
imageSource={imageSource}
173184
title={title}
@@ -182,7 +193,7 @@ export function ContentCard({ article }) {
182193
/>
183194
</a>
184195
) : (
185-
<Link href={href} className="group w-full">
196+
<Link href={calculatedHref} className="group w-full">
186197
<CardContent
187198
imageSource={imageSource}
188199
title={title}

src/content/blog/openai-codex-review/page.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ By the time I start work, I tend to have a laundry list of items I want to compl
7878
As I wrote about in <Link href="/blog/walking-and-talking-with-ai">Walking and talking with AI in the woods</Link>, ideally I'd like to start my morning in an office, launch a bunch of tasks,
7979
get some planning out of the way, and then step out for a long walk in nature.
8080

81+
Codex is usable from my phone even today:
82+
8183
<Image src={phone} alt="Codex is even usable on mobile" />
8284

8385
I think, ultimately, once some of the sharp edges are polished, Codex will support me and others in performing our work effectively away from our desks.
@@ -125,7 +127,7 @@ than 12 programming languages.
125127

126128
Right now, it feels like I can spin up multiple tasks in parallel with a 40-60% chance that I'll be content enough with the result to hit the Open PR button instead of requesting changes.
127129

128-
So far Codex has been perfect for firing off a bunch of maintenance-level updates: minor copy tweaks, stylistic changes, and other small chores. I've tried asking it to tackle larger refactors and the experience quickly becomes cumbersome. The current workflow wants to open a fresh pull request for every iteration, which means pushing follow-up commits to an existing branch is awkward at best.
130+
So far Codex has been perfect for firing off a bunch of maintenance-level updates: minor copy tweaks, style changes and other small chores. I've tried asking it to tackle larger refactors and the experience quickly becomes cumbersome. The current workflow wants to open a fresh pull request for every iteration, which means pushing follow-up commits to an existing branch is awkward at best.
129131

130132
### Multi-turn updates on a branch
131133

@@ -143,7 +145,7 @@ resolving annoying dependency issues by installing a more recent version of a pa
143145

144146
Codex can't reach the internet right now, but it does have your repo freshly cloned and made available to its execution environment.
145147

146-
This means it can't `pnpm add @tar-fs@latest` even if you ask it to. So, for now, I'll still pulling down these branches and fixing them locally or
148+
This means it can't `pnpm add @tar-fs@latest` even if you ask it to. So, for now, I'll still be pulling down these branches and fixing them locally or
147149
commenting `@dependabot rebase` on PRs that support it.
148150

149151
## Did it unlock insane productivity gains for me?

src/lib/comparisons.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function importComparison(
1313
return {
1414
...metadata,
1515
type: 'blog',
16-
slug: path.basename(comparisonFilename, '.mdx')
16+
slug: path.dirname(comparisonFilename)
1717
}
1818
}
1919

0 commit comments

Comments
 (0)