Skip to content

Commit 8ccec69

Browse files
committed
Refactor to have explicit frontmatter og images
and add a script to copy images into the public folder
1 parent 08d37b4 commit 8ccec69

File tree

322 files changed

+1384
-573
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+1384
-573
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ tsconfig.tsbuildinfo
9797
# Ignore generated files
9898
/public/md-exports/
9999
public/mdx-images/*
100+
public/og-images/*
100101

101102
# yalc
102103
.yalc

app/[[...path]]/page.tsx

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ function formatCanonicalTag(tag: string) {
195195
}
196196

197197
// Helper function to resolve OG image URLs
198-
function resolveOgImageUrl(imageUrl: string | undefined, domain: string): string | null {
198+
function resolveOgImageUrl(
199+
imageUrl: string | undefined,
200+
domain: string,
201+
pagePath: string[]
202+
): string | null {
199203
if (!imageUrl) {
200204
return null;
201205
}
@@ -208,14 +212,21 @@ function resolveOgImageUrl(imageUrl: string | undefined, domain: string): string
208212
return cleanUrl;
209213
}
210214

211-
// Absolute paths (should already be the hashed path like /mdx-images/overview-HASH.png)
215+
// Absolute paths (public folder)
212216
if (cleanUrl.startsWith('/')) {
213217
return `${domain}${cleanUrl}`;
214218
}
215219

216-
// If we still have a relative path here, it means the hashing didn't work
217-
// Return null to fall back to default OG image
218-
return null;
220+
// Relative paths - resolve based on page path
221+
if (cleanUrl.startsWith('./')) {
222+
const relativePath = cleanUrl.slice(2); // Remove './'
223+
const pageDir = pagePath.join('/');
224+
return `${domain}/${pageDir}/${relativePath}`;
225+
}
226+
227+
// Default case: treat as relative to page
228+
const pageDir = pagePath.join('/');
229+
return `${domain}/${pageDir}/${cleanUrl}`;
219230
}
220231

221232
export async function generateMetadata(props: MetadataProps): Promise<Metadata> {
@@ -257,34 +268,18 @@ export async function generateMetadata(props: MetadataProps): Promise<Metadata>
257268

258269
noindex = pageNode.frontmatter.noindex;
259270

260-
// Three-tier OG image priority:
261-
// 1. Manual override via og_image frontmatter
271+
// Check for manual OG image override in frontmatter
262272
if (pageNode.frontmatter.og_image) {
263273
ogImageUrl = resolveOgImageUrl(
264274
pageNode.frontmatter.og_image,
265-
previewDomain ?? domain
275+
previewDomain ?? domain,
276+
params.path
266277
);
267278
}
268-
269-
// 2. First image from page content (if no manual override)
270-
if (!ogImageUrl) {
271-
try {
272-
const doc = await getFileBySlugWithCache(
273-
isDeveloperDocs
274-
? `develop-docs/${params.path.join('/')}`
275-
: `docs/${pageNode.path}`
276-
);
277-
if (doc.firstImage) {
278-
ogImageUrl = resolveOgImageUrl(doc.firstImage, previewDomain ?? domain);
279-
}
280-
} catch (e) {
281-
// If we can't load the doc, just continue without the first image
282-
}
283-
}
284279
}
285280
}
286281

287-
// 3. Default fallback
282+
// Default fallback
288283
if (!ogImageUrl) {
289284
ogImageUrl = `${previewDomain ?? domain}/og.png`;
290285
}

develop-docs/application-architecture/dynamic-sampling/architecture.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: Architecture
33
sidebar_order: 3
4+
og_image: /og-images/application-architecture-dynamic-sampling-architecture.png
45
---
56

67
The architecture that powers Dynamic Sampling is composed of several components that work together to get the organization's sample rate closer to the target fidelity.

develop-docs/application-architecture/dynamic-sampling/fidelity-and-biases.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: Fidelity and Biases
33
sidebar_order: 2
4+
og_image: /og-images/application-architecture-dynamic-sampling-fidelity-and-biases.png
45
---
56

67
Dynamic Sampling allows Sentry to automatically adjust the amount of data retained based on how valuable the data is to the user. This is technically achieved by applying a **sample rate** to every event, which is determined by a **set of rules** that are evaluated for each event.

develop-docs/application-architecture/dynamic-sampling/index.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
---
22
title: Dynamic Sampling
3-
description: Dynamic Sampling is a feature of the ingestion pipeline that allows Sentry to automatically adjust the amount of data retained based on the value of the data.
3+
description: >-
4+
Dynamic Sampling is a feature of the ingestion pipeline that allows Sentry to
5+
automatically adjust the amount of data retained based on the value of the
6+
data.
47
sidebar_order: 50
8+
og_image: /og-images/application-architecture-dynamic-sampling.png
59
---
610

711
From all the data received by the SDKs, Sentry is able to extract low-granularity information through metrics, while Dynamic Sampling makes the decision of whether to keep or drop data.

develop-docs/application-architecture/dynamic-sampling/the-big-picture.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
---
22
title: The Big Picture
3-
description: The lifecycle of an event in Sentry is a complex process which involves many components. Dynamic Sampling is one of these components, and it is important to understand how it fits into the bigger picture.
3+
description: >-
4+
The lifecycle of an event in Sentry is a complex process which involves many
5+
components. Dynamic Sampling is one of these components, and it is important
6+
to understand how it fits into the bigger picture.
47
sidebar_order: 1
8+
og_image: /og-images/application-architecture-dynamic-sampling-the-big-picture.png
59
---
610

711
![Sequencing](./images/sequencing.png)

develop-docs/backend/application-domains/database-migrations/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: Database Migrations
33
sidebar_order: 20
4+
og_image: /og-images/backend-application-domains-database-migrations.png
45
---
56

67
Django migrations are how we handle changes to the database in Sentry.

develop-docs/backend/application-domains/transaction-clustering/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: Clustering URL Transactions
33
sidebar_order: 90
4+
og_image: /og-images/backend-application-domains-transaction-clustering.png
45
---
56

67
Sentry attempts to scrub high-cardinality identifiers from URL transactions

develop-docs/backend/issue-platform/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: Issue Platform
33
sidebar_order: 30
4+
og_image: /og-images/backend-issue-platform.jpg
45
---
56

67
The Issue Platform allows developers to create new issue types from arbitrary data sources. If you have data about something that you want to track via an issue, you can build it on the issue platform. For example, building profiling issues on the issue platform allowed us to turn things like “JSON decoding on the main thread” into their own issue types.

develop-docs/backend/issue-platform/writing-detectors/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: Writing Detectors
33
sidebar_order: 10
4+
og_image: /og-images/backend-issue-platform-writing-detectors.png
45
---
56

67
Issue detectors identify application issues by examining one or more datasets collected by Sentry, and report detected issue occurrences via the <Link to="/backend/issue-platform/">Issue Platform</Link>. Detectors must fingerprint issues accurately and provide actionable information to developers.

0 commit comments

Comments
 (0)