Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
207 changes: 207 additions & 0 deletions apps/sim/content/library/langgraph-alternatives/index.mdx

Large diffs are not rendered by default.

284 changes: 284 additions & 0 deletions apps/sim/content/library/n8n-alternatives/index.mdx

Large diffs are not rendered by default.

212 changes: 212 additions & 0 deletions apps/sim/content/library/open-source-ai-agent-platforms/index.mdx

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions apps/sim/lib/content/registry-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import fs from 'fs/promises'
import path from 'path'
import { cache } from 'react'
import matter from 'gray-matter'
import { imageSize } from 'image-size'
import { compileMDX } from 'next-mdx-remote/rsc'
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
import rehypeSlug from 'rehype-slug'
Expand Down Expand Up @@ -89,6 +90,25 @@ export function createContentRegistry(config: ContentRegistryConfig): ContentReg
return loadAuthorsForDir(authorsDir)
}

/**
* Reads the intrinsic pixel dimensions of a local `public/` OG image so the
* SEO builders can declare accurate `og:image` and JSON-LD sizes. Returns
* null for remote URLs or unreadable files, in which case the builders fall
* back to the 1200x630 OG default.
*/
async function readOgImageDimensions(
ogImage: string
): Promise<{ width: number; height: number } | null> {
if (ogImage.startsWith('http')) return null
try {
const buffer = await fs.readFile(path.join(process.cwd(), 'public', ogImage))
Comment thread
waleedlatif1 marked this conversation as resolved.
const { width, height } = imageSize(buffer)
return width && height ? { width, height } : null
} catch {
return null
}
}

async function scanFrontmatters(): Promise<ContentMeta[]> {
if (cachedMeta) {
return cachedMeta
Expand Down Expand Up @@ -119,6 +139,7 @@ export function createContentRegistry(config: ContentRegistryConfig): ContentReg
.filter((w) => w.length > 0).length
const authors = fm.authors.map((id) => authorsMap[id]).filter(Boolean)
if (authors.length === 0) throw new Error(`Authors not found for "${slug}"`)
const ogImageDimensions = await readOgImageDimensions(fm.ogImage)
return {
slug: fm.slug,
title: fm.title,
Expand All @@ -130,6 +151,8 @@ export function createContentRegistry(config: ContentRegistryConfig): ContentReg
readingTime: fm.readingTime,
tags: fm.tags,
ogImage: fm.ogImage,
ogImageWidth: ogImageDimensions?.width,
ogImageHeight: ogImageDimensions?.height,
canonical: fm.canonical,
ogAlt: fm.ogAlt,
about: fm.about,
Expand Down
4 changes: 4 additions & 0 deletions apps/sim/lib/content/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export interface ContentMeta {
readingTime?: number
tags: string[]
ogImage: string
/** Intrinsic pixel width of a local `ogImage`, probed at scan time; absent for remote or unreadable images. */
ogImageWidth?: number
/** Intrinsic pixel height of a local `ogImage`, probed at scan time; absent for remote or unreadable images. */
ogImageHeight?: number
ogAlt?: string
about?: string[]
timeRequired?: string
Expand Down
8 changes: 4 additions & 4 deletions apps/sim/lib/content/seo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export function buildPostMetadata(post: ContentMeta): Metadata {
images: [
{
url: post.ogImage.startsWith('http') ? post.ogImage : `${baseUrl}${post.ogImage}`,
width: 1200,
height: 630,
width: post.ogImageWidth ?? 1200,
height: post.ogImageHeight ?? 630,
alt: post.ogAlt || post.title,
},
],
Expand Down Expand Up @@ -83,8 +83,8 @@ export function buildArticleJsonLd(post: ContentMeta) {
{
'@type': 'ImageObject',
url: post.ogImage,
width: 1200,
height: 630,
width: post.ogImageWidth ?? 1200,
height: post.ogImageHeight ?? 630,
caption: post.ogAlt || post.title,
},
],
Expand Down
1 change: 1 addition & 0 deletions apps/sim/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"groq-sdk": "^0.15.0",
"html-to-text": "^9.0.5",
"idb-keyval": "6.2.2",
"image-size": "1.2.1",
"imapflow": "1.2.4",
"input-otp": "^1.4.2",
"ioredis": "^5.6.0",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading