Skip to content

Commit 7c5d625

Browse files
authored
fix(blogs): update sitemap and fix loading strat on blogs to prevent mobile crash (#2067)
* fix(blogs): update sitemap and fix loading strat on blogs to prevent mobile crash * updated sitemap
1 parent e5cb6e3 commit 7c5d625

File tree

7 files changed

+49
-25
lines changed

7 files changed

+49
-25
lines changed

apps/sim/app/(landing)/studio/[slug]/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export default async function Page({ params }: { params: Promise<{ slug: string
6161
width={450}
6262
height={360}
6363
className='h-auto w-full'
64+
sizes='(max-width: 768px) 100vw, 450px'
6465
priority
6566
itemProp='image'
6667
/>
@@ -131,7 +132,7 @@ export default async function Page({ params }: { params: Promise<{ slug: string
131132
{related.length > 0 && (
132133
<div className='mx-auto max-w-[900px] px-6 pb-24 sm:px-8 md:px-12'>
133134
<h2 className='mb-4 font-medium text-[24px]'>Related posts</h2>
134-
<div className='grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3'>
135+
<div className='grid grid-cols-1 gap-4 sm:grid-cols-2 sm:gap-6 lg:grid-cols-3'>
135136
{related.map((p) => (
136137
<Link key={p.slug} href={`/studio/${p.slug}`} className='group'>
137138
<div className='overflow-hidden rounded-lg border border-gray-200'>
@@ -141,6 +142,8 @@ export default async function Page({ params }: { params: Promise<{ slug: string
141142
width={600}
142143
height={315}
143144
className='h-[160px] w-full object-cover'
145+
sizes='(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw'
146+
loading='lazy'
144147
/>
145148
<div className='p-3'>
146149
<div className='mb-1 text-gray-600 text-xs'>

apps/sim/app/(landing)/studio/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default async function StudioIndex({
6363
</div> */}
6464

6565
{/* Grid layout for consistent rows */}
66-
<div className='grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3'>
66+
<div className='grid grid-cols-1 gap-4 md:grid-cols-2 md:gap-6 lg:grid-cols-3'>
6767
{posts.map((p, i) => {
6868
return (
6969
<Link key={p.slug} href={`/studio/${p.slug}`} className='group flex flex-col'>
@@ -74,6 +74,8 @@ export default async function StudioIndex({
7474
width={800}
7575
height={450}
7676
className='h-48 w-full object-cover'
77+
sizes='(max-width: 768px) 100vw, (max-width: 1024px) 50vw, 33vw'
78+
loading='lazy'
7779
/>
7880
<div className='flex flex-1 flex-col p-4'>
7981
<div className='mb-2 text-gray-600 text-xs'>

apps/sim/app/sitemap.ts

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,56 @@ import { getAllPostMeta } from '@/lib/blog/registry'
44
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
55
const baseUrl = 'https://sim.ai'
66

7-
const staticPages = [
7+
const now = new Date()
8+
9+
const staticPages: MetadataRoute.Sitemap = [
810
{
911
url: baseUrl,
10-
lastModified: new Date(),
11-
changeFrequency: 'daily' as const,
12-
priority: 1,
12+
lastModified: now,
13+
priority: 1.0, // Homepage - highest priority
14+
},
15+
{
16+
url: `${baseUrl}/studio`,
17+
lastModified: now,
18+
priority: 0.9, // Blog index - high value content
19+
},
20+
{
21+
url: `${baseUrl}/studio/tags`,
22+
lastModified: now,
23+
priority: 0.7, // Tags page - discovery/navigation
24+
},
25+
{
26+
url: `${baseUrl}/templates`,
27+
lastModified: now,
28+
priority: 0.8, // Templates - important discovery page
1329
},
1430
{
15-
url: `${baseUrl}/signup`,
16-
lastModified: new Date(),
17-
changeFrequency: 'weekly' as const,
18-
priority: 0.9,
31+
url: `${baseUrl}/changelog`,
32+
lastModified: now,
33+
priority: 0.8, // Changelog - important for users
1934
},
2035
{
21-
url: `${baseUrl}/login`,
22-
lastModified: new Date(),
23-
changeFrequency: 'monthly' as const,
24-
priority: 0.8,
36+
url: `${baseUrl}/careers`,
37+
lastModified: new Date('2024-10-06'),
38+
priority: 0.6, // Careers - important but not core content
2539
},
2640
{
2741
url: `${baseUrl}/terms`,
28-
lastModified: new Date(),
29-
changeFrequency: 'monthly' as const,
30-
priority: 0.5,
42+
lastModified: new Date('2024-10-14'),
43+
priority: 0.5, // Terms - utility page
3144
},
3245
{
3346
url: `${baseUrl}/privacy`,
34-
lastModified: new Date(),
35-
changeFrequency: 'monthly' as const,
36-
priority: 0.5,
47+
lastModified: new Date('2024-10-14'),
48+
priority: 0.5, // Privacy - utility page
3749
},
3850
]
3951

4052
const posts = await getAllPostMeta()
41-
const blogPages = posts.map((p) => ({
53+
const blogPages: MetadataRoute.Sitemap = posts.map((p) => ({
4254
url: p.canonical,
4355
lastModified: new Date(p.updated ?? p.date),
44-
changeFrequency: 'monthly' as const,
45-
priority: 0.9 as const,
56+
priority: 0.9, // Blog posts - high value content
4657
}))
4758

4859
return [...staticPages, ...blogPages]

apps/sim/lib/blog/mdx.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export const mdxComponents: MDXRemoteProps['components'] = {
1111
width={props.width ? Number(props.width) : 800}
1212
height={props.height ? Number(props.height) : 450}
1313
className={clsx('h-auto w-full rounded-lg', props.className)}
14+
sizes='(max-width: 768px) 100vw, 800px'
15+
loading='lazy'
1416
/>
1517
),
1618
h2: (props: any) => (

apps/sim/tailwind.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,5 +162,5 @@ export default {
162162
},
163163
},
164164
},
165-
plugins: [require('tailwindcss-animate')],
165+
plugins: [require('tailwindcss-animate'), require('@tailwindcss/typography')],
166166
} satisfies Config

bun.lock

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"@biomejs/biome": "2.0.0-beta.5",
5454
"@next/env": "15.4.1",
5555
"@octokit/rest": "^21.0.0",
56+
"@tailwindcss/typography": "0.5.19",
5657
"drizzle-kit": "^0.31.4",
5758
"husky": "9.1.7",
5859
"lint-staged": "16.0.0",

0 commit comments

Comments
 (0)