From 65df8b90b8840b237dc5edd3af8ca9b1a06cf713 Mon Sep 17 00:00:00 2001 From: Prospector <6166773+Prospector@users.noreply.github.com> Date: Sun, 16 Aug 2026 23:54:17 -0700 Subject: [PATCH] better unknown project embed (#7178) * better unknown project embed * improve placeholders, fix decriptions --- apps/frontend/src/pages/[type]/[project].vue | 29 +++++++++++++------ .../src/pages/collection/[collection].vue | 2 +- .../src/pages/organization/[organization].vue | 2 +- apps/frontend/src/pages/user/[user].vue | 11 +++++-- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/apps/frontend/src/pages/[type]/[project].vue b/apps/frontend/src/pages/[type]/[project].vue index 561552f917..26a8e90924 100644 --- a/apps/frontend/src/pages/[type]/[project].vue +++ b/apps/frontend/src/pages/[type]/[project].vue @@ -1745,16 +1745,24 @@ const following = computed(() => { return !!user.value.follows.find((x) => x.id === project.value.id) }) +const PROJECT_NOT_FOUND_DESCRIPTION = + "There's no project here, check that you have the right link! It may still be under review or no longer publicly available on Modrinth." + const title = computed(() => - project.value ? `${project.value.title} - Minecraft ${projectTypeDisplay.value}` : '', -) -const description = computed(() => project.value - ? `${project.value.description} - Download the Minecraft ${projectTypeDisplay.value} ${ - project.value.title - } by ${members.value.find((x) => x.is_owner)?.user?.username || 'a creator'} on Modrinth` - : '', + ? `${project.value.title} - Minecraft ${projectTypeDisplay.value}` + : 'Project not found', ) +const description = computed(() => { + if (!project.value) { + return PROJECT_NOT_FOUND_DESCRIPTION + } + + const creator = organization.value?.name || members.value.find((x) => x.is_owner)?.user?.username + const byLine = creator ? ` by ${creator}` : '' + + return `${project.value.description} - Download the Minecraft ${projectTypeDisplay.value} ${project.value.title}${byLine} on Modrinth` +}) const canCreateServerFrom = computed(() => { if (!project.value) return false @@ -1986,8 +1994,11 @@ if (!route.name.startsWith('type-project-settings')) { title: () => title.value, description: () => description.value, ogTitle: () => title.value, - ogDescription: () => project.value?.description ?? '', - ogImage: () => project.value?.icon_url ?? 'https://cdn.modrinth.com/placeholder.png', + ogDescription: () => project.value?.description ?? PROJECT_NOT_FOUND_DESCRIPTION, + ogImage: () => + project.value + ? (project.value?.icon_url ?? 'https://cdn-raw.modrinth.com/placeholder-square.png') + : 'https://cdn-raw.modrinth.com/not-found-transparent.png', ogUrl: createCanonicalUrl, robots: () => (project.value?.status === 'approved' ? 'all' : 'noindex'), }) diff --git a/apps/frontend/src/pages/collection/[collection].vue b/apps/frontend/src/pages/collection/[collection].vue index 355c6abc24..90e8ab0b01 100644 --- a/apps/frontend/src/pages/collection/[collection].vue +++ b/apps/frontend/src/pages/collection/[collection].vue @@ -740,7 +740,7 @@ watch( }), ogTitle: formatMessage(messages.collectionTitle, { name: col.name }), ogDescription: col.description, - ogImage: col.icon_url ?? 'https://cdn.modrinth.com/placeholder.png', + ogImage: col.icon_url ?? 'https://cdn-raw.modrinth.com/placeholder-square.png', ogUrl: canonicalUrl, robots: col.status === 'listed' ? 'all' : 'noindex', }) diff --git a/apps/frontend/src/pages/organization/[organization].vue b/apps/frontend/src/pages/organization/[organization].vue index 609d3c8e4c..bfd86d77a7 100644 --- a/apps/frontend/src/pages/organization/[organization].vue +++ b/apps/frontend/src/pages/organization/[organization].vue @@ -483,7 +483,7 @@ watch( description, ogTitle: title, ogDescription: org.description, - ogImage: org.icon_url ?? 'https://cdn.modrinth.com/placeholder.png', + ogImage: org.icon_url ?? 'https://cdn-raw.modrinth.com/placeholder-square.png', ogUrl: canonicalUrl, }) useHead({ diff --git a/apps/frontend/src/pages/user/[user].vue b/apps/frontend/src/pages/user/[user].vue index c7f3ec27ed..f776774f41 100644 --- a/apps/frontend/src/pages/user/[user].vue +++ b/apps/frontend/src/pages/user/[user].vue @@ -85,10 +85,12 @@ if (projectsResult.status === 'fulfilled') { warmProjectCheckCaches(queryClient, projectsResult.value) } const title = computed(() => - prefetchedUser ? `${prefetchedUser.username} - Modrinth` : 'Modrinth', + prefetchedUser ? `${prefetchedUser.username} - Modrinth` : 'User not found', ) const description = computed(() => { - if (!prefetchedUser) return '' + if (!prefetchedUser) { + return `There's no user here, check that you have the right link!` + } return prefetchedUser.bio ? `${prefetchedUser.bio} - Download ${prefetchedUser.username}'s projects on Modrinth` : `Download ${prefetchedUser.username}'s projects on Modrinth` @@ -99,7 +101,10 @@ useSeoMeta({ description: () => description.value, ogTitle: () => title.value, ogDescription: () => description.value, - ogImage: () => prefetchedUser?.avatar_url ?? 'https://cdn.modrinth.com/placeholder.png', + ogImage: () => + prefetchedUser + ? (prefetchedUser?.avatar_url ?? 'https://cdn-raw.modrinth.com/placeholder-circle.png') + : 'https://cdn-raw.modrinth.com/not-found-transparent.png', }) const projectCreateModal = ref | null>(null)