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
1 change: 1 addition & 0 deletions dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ graphqlconfig
graphqlrc
graphqls
graphyne
grafbase
greendonut
Hasura
HCXXXX
Expand Down
6 changes: 5 additions & 1 deletion website/app/blog/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ export default async function BlogCatchAllPage({ params }: PageProps) {
return notFound();
}

const { mdxSource } = await compileMdxContent(post.content);
const { mdxSource } = await compileMdxContent(
post.content,
"",
`/images/blog/${post.folder}/`
);
const headings = extractHeadings(post.content);
const latestPosts = getLatestPostsForNav();

Expand Down
12 changes: 7 additions & 5 deletions website/lib/blog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@ export interface BlogPost {
content: string;
readingTime: string;
path: string;
folder: string;
}

const BLOG_DIR = getContentDir("blog");
const POSTS_PER_PAGE = 21;

// Use globalThis to persist cache across HMR in development
const _globalCache = globalThis as typeof globalThis & {
__blogPostsCache?: BlogPost[] | null;
__blogPostsCacheV2?: BlogPost[] | null;
};
if (!_globalCache.__blogPostsCache) {
_globalCache.__blogPostsCache = null;
if (!_globalCache.__blogPostsCacheV2) {
_globalCache.__blogPostsCacheV2 = null;
}

export function getAllBlogPosts(): BlogPost[] {
if (_globalCache.__blogPostsCache) return _globalCache.__blogPostsCache;
if (_globalCache.__blogPostsCacheV2) return _globalCache.__blogPostsCacheV2;

const files = getFilesRecursively(BLOG_DIR, ".md");
const posts: BlogPost[] = [];
Expand Down Expand Up @@ -71,13 +72,14 @@ export function getAllBlogPosts(): BlogPost[] {
content,
readingTime: readingTime(content).text,
path: frontmatter.path,
folder: path.basename(path.dirname(file)),
});
Comment on lines 72 to 76
}

// Sort by date descending
posts.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());

_globalCache.__blogPostsCache = posts;
_globalCache.__blogPostsCacheV2 = posts;
return posts;
}

Expand Down
28 changes: 19 additions & 9 deletions website/lib/mdx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,13 @@ export function extractHeadings(
}

// Resolve relative image paths in markdown to absolute URLs.
// Images in src/docs/ are copied to public/docs/, images in src/images/ are in public/images/.
function resolveImagePaths(source: string, originPath: string): string {
// Images in src/docs/ are copied to public/docs/, images in src/blog/ are copied
// to public/images/blog/, and images in src/images/ are served from public/images/.
function resolveImagePaths(
source: string,
originPath: string,
baseUrl = "/docs/"
): string {
const docDir = path.dirname(originPath); // e.g. "hotchocolate/v15"

return source.replace(
Expand All @@ -367,31 +372,36 @@ function resolveImagePaths(source: string, originPath: string): string {
return prefix + imgPath + suffix;
}

// Resolve relative path against the doc file's directory within src/docs/
// Resolve relative path against the source file's directory
const resolved = path.normalize(path.join(docDir, imgPath));

// Check if path escapes out of docs directory (e.g. ../../../images/foo.webp)
// Check if path escapes out of the source directory (e.g. ../../../images/foo.webp)
if (resolved.startsWith("..")) {
// Goes above src/docs/ - these are in src/images/ which maps to public/images/
// Goes above source dir - these are in src/images/ which maps to public/images/
// Strip leading "../" segments to get the path relative to src/
const cleaned = resolved.replace(/^(\.\.\/?)+/, "");
return prefix + "/" + cleaned + suffix;
}

// Path stays within docs directory - served from public/docs/
return prefix + "/docs/" + resolved + suffix;
// Path stays within source directory - served from the matching public folder
return prefix + baseUrl + resolved + suffix;
}
);
}

export async function compileMdxContent(source: string, originPath = "") {
export async function compileMdxContent(
source: string,
originPath = "",
imageBaseUrl?: string
) {
const cleaned = resolveImagePaths(
fixJsxAttributes(
expandSelfClosingTags(
renameCodeComponent(replaceDottedComponents(stripImports(source)))
)
),
originPath
originPath,
imageBaseUrl
);

try {
Expand Down
409 changes: 409 additions & 0 deletions website/src/blog/2026-05-15-fusion-16/2026-05-15-fusion-16.md

Large diffs are not rendered by default.

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.
Binary file added website/src/blog/2026-05-15-fusion-16/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/src/blog/2026-05-15-fusion-16/header.png
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.
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.
Loading