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
21 changes: 16 additions & 5 deletions app/[lang]/(site)/tools/images/[category]/[name]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Card } from '@/components/ui/Card'
import { alternatesFor } from '@/lib/seo'
import { getRequestLang } from '@/lib/serverLang'
import { imagesTranslations, type Lang } from '@/lib/i18n'
import { getImage, getNeighbours, imageTitle, listCategories } from '@/lib/images'
import { getImage, getNeighbours, imageTitle, inOtherCategory, listCategories } from '@/lib/images'
import { absoluteUrl } from '@/lib/siteUrl'
import { publicPath } from '@/lib/routes'

Expand All @@ -32,11 +32,22 @@ export async function generateMetadata({ params }: { params: Params }): Promise<
const image = await getImage(category, name.toLowerCase())
if (!image) return {}

// An image in two categories (ammo in Items and Weapons) has two pages with
// the same picture. The category in title and description tells them apart.
const [categories, shared] = await Promise.all([
listCategories(lang),
inOtherCategory(category, image.name),
])
const where = shared ? categories.find(c => c.slug === category)?.name : undefined
const display = image.label || image.name
const title = imageTitle(image, lang)
const description = lang === 'de'
? `Freigestelltes ${display}-Bild aus GTA V, ${image.width} mal ${image.height} Pixel, kostenlos für FiveM-Scripts. Direkt über die CDN-URL nutzbar.`
: `Transparent ${display} image from GTA V, ${image.width} by ${image.height} pixels, free for FiveM scripts. Use the CDN URL directly.`
const title = imageTitle(image, lang, where)
const lead = lang === 'de'
? `Freigestelltes ${display}-Bild aus GTA V${where ? ` (${where})` : ''}, ${image.width} mal ${image.height} Pixel, kostenlos für FiveM-Scripts.`
: `Transparent ${display} image from GTA V${where ? ` (${where})` : ''}, ${image.width} by ${image.height} pixels, free for FiveM scripts.`
const tail = lang === 'de' ? ' Direkt über die CDN-URL nutzbar.' : ' Use the CDN URL directly.'
// A long label pushed the description past the 155 characters a search
// result shows. The CDN hint is the part that can go.
const description = (lead + tail).length <= 155 ? lead + tail : lead

return {
title,
Expand Down
35 changes: 29 additions & 6 deletions app/[lang]/(site)/tools/images/[category]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,34 @@ async function findCategory(slug: string, lang: Lang) {
return categories.find(c => c.slug === slug) ?? null
}

export async function generateMetadata({ params }: { params: Params }): Promise<Metadata> {
export async function generateMetadata(
{ params, searchParams }: { params: Params; searchParams: Search },
): Promise<Metadata> {
const { category: slug } = await params
const { q = '', page: rawPage = '1' } = await searchParams
const { lang } = await getRequestLang()
const category = await findCategory(slug, lang)
if (!category) return {}

// Every page of the list stands for itself: it shows other images than page
// 1, so it names itself as canonical and its own counterpart in the other
// language. Until 25.11.2026 pages 2 and up named page 1 in both, and a
// crawler reported 138 pages without a self reference or return link. A
// search (`?q=`) still points to the plain category.
const page = Math.max(1, Math.floor(Number(rawPage)) || 1)
const pages = Math.max(1, Math.ceil(category.count / DEFAULT_PER_PAGE))
const paged = !q && page > 1 && page <= pages
const query = paged ? `?page=${page}` : ''
const pageSuffix = paged ? (lang === 'de' ? `, Seite ${page}` : `, page ${page}`) : ''
const pageNote = paged
? (lang === 'de' ? ` Seite ${page} von ${pages}.` : ` Page ${page} of ${pages}.`)
: ''

// Curated like the package pages: the raw category name ("Vehicles") is
// worthless as a title; people search for what the images are.
const title = lang === 'de'
const title = (lang === 'de'
? `${category.name} Bilder für FiveM`
: `FiveM ${category.name} Images`
: `FiveM ${category.name} Images`) + pageSuffix
// `brand` holds our own logos and banners, not game content. Until
// 05.09.2026 the GTA wording covered that category too, so the search result
// description claimed the opposite of what the rights notice on the very same
Expand All @@ -47,19 +64,25 @@ export async function generateMetadata({ params }: { params: Params }): Promise<

// A category without a published image is a page with nothing on it. It
// stays reachable, so a link to it does not break, but it stays out of the
// index, with a description that does not start with "0 images".
// index, with a description that does not start with "0 images". It names no
// language versions: an hreflang pair between two noindex pages points
// search engines at something they must not show.
if (category.count === 0) {
return {
title,
description: lang === 'de'
? `In dieser Kategorie ist noch kein Bild veröffentlicht. Die anderen Kategorien der Bildergalerie sind frei für FiveM-Scripts nutzbar.`
: `No image has been published in this category yet. The other categories of the image gallery are free to use in FiveM scripts.`,
robots: { index: false, follow: true },
alternates: alternatesFor(lang, `/tools/images/${slug}`),
alternates: { canonical: alternatesFor(lang, `/tools/images/${slug}`).canonical },
}
}

return { title, description, alternates: alternatesFor(lang, `/tools/images/${slug}`) }
return {
title,
description: description + pageNote,
alternates: alternatesFor(lang, `/tools/images/${slug}`, query),
}
}

export default async function CategoryPage(
Expand Down
4 changes: 2 additions & 2 deletions app/sitemap-images.xml/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { listCategories, listImages, MAX_PER_PAGE } from '@/lib/images'
import { absoluteUrl } from '@/lib/siteUrl'
import { X_DEFAULT_PATH, alternatePaths } from '@/lib/routes'
import { alternatePaths } from '@/lib/routes'

/**
* Image sitemap.
Expand Down Expand Up @@ -59,7 +59,7 @@ export async function GET() {
` <loc>${escapeXml(absoluteUrl(alt.en))}</loc>`,
` <xhtml:link rel="alternate" hreflang="en" href="${escapeXml(absoluteUrl(alt.en))}" />`,
` <xhtml:link rel="alternate" hreflang="de" href="${escapeXml(absoluteUrl(alt.de))}" />`,
` <xhtml:link rel="alternate" hreflang="x-default" href="${escapeXml(absoluteUrl(X_DEFAULT_PATH))}" />`,
` <xhtml:link rel="alternate" hreflang="x-default" href="${escapeXml(absoluteUrl(alt.en))}" />`,
' <image:image>',
` <image:loc>${escapeXml(image.url)}</image:loc>`,
` <image:title>${escapeXml(image.label || image.name)}</image:title>`,
Expand Down
6 changes: 4 additions & 2 deletions components/home/Bots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ export function Bots({ lang, ticketFrom }: { lang: Lang; ticketFrom: string }) {
// The banner shows logo and wordmark of the bot, so it says
// something and is named after it.
alt={`MSK ${bot.name}`}
fill
// The banner's own size, so the img carries it in the HTML.
width={1920}
height={1080}
sizes="(max-width: 767px) 100vw, (max-width: 1599px) 50vw, 40vw"
className="object-cover"
className="h-full w-full object-cover"
/>
</div>
<div className="grid content-center gap-3">
Expand Down
12 changes: 11 additions & 1 deletion components/home/WebTools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,17 @@ export function WebTools({ lang }: { lang: Lang }) {
<li key={tool.id} className="grid content-start gap-3">
{tool.image && (
<div className="relative aspect-video overflow-hidden rounded-lg border border-[var(--color-border)] bg-[var(--color-muted)]">
<Image src={imageSrc(tool.image)} alt="" fill sizes="(max-width: 767px) 100vw, 33vw" className="object-cover" />
{/* Width and height give the box's 16:9, the screenshots differ
and are cropped to it. Without them the img carries no size
in the HTML, which a crawler reports. */}
<Image
src={imageSrc(tool.image)}
alt={lang === 'de' ? `Screenshot von ${tool.name}` : `Screenshot of ${tool.name}`}
width={1280}
height={720}
sizes="(max-width: 767px) 100vw, 33vw"
className="h-full w-full object-cover"
/>
</div>
)}
<h3 className="font-display text-h3 font-[650]">{tool.name}</h3>
Expand Down
5 changes: 3 additions & 2 deletions components/layout/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,9 @@ export function Footer() {
<div className="grid gap-x-10 gap-y-10 @lg:grid-cols-2 @4xl:grid-cols-4 @7xl:grid-cols-[minmax(0,1.4fr)_repeat(4,minmax(0,1fr))]">
<div className="grid content-start gap-4 @lg:col-span-2 @4xl:col-span-4 @7xl:col-span-1">
<Link href="/" className="inline-flex min-h-11 items-center gap-2.5 self-start text-[var(--color-band-foreground)]">
<Image src="/logo.png" alt="" width={32} height={32} className="h-8 w-8 rounded-lg object-contain" />
<span className="font-display text-lead font-bold [font-stretch:108%]">MSK Scripts</span>
{/* The logo names the link, the written name is only seen. */}
<Image src="/logo.png" alt="MSK Scripts" width={32} height={32} className="h-8 w-8 rounded-lg object-contain" />
<span aria-hidden="true" className="font-display text-lead font-bold [font-stretch:108%]">MSK Scripts</span>
</Link>
<div className="grid gap-2">
<p className="text-small font-semibold">{t.action_theme}</p>
Expand Down
9 changes: 5 additions & 4 deletions components/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ function SignInReturn() {
function Brand() {
return (
<Link href="/" className="flex min-h-11 shrink-0 items-center gap-2.5 text-[var(--color-foreground)]">
<Image src="/logo.png" alt="" width={36} height={36} priority className="h-9 w-9 rounded-lg object-contain" />
{/* Below 360 px the name gives way to the menu; it stays the link's
name for a screen reader. */}
<span className="sr-only font-display text-lead font-bold tracking-[-0.01em] [font-stretch:108%] min-[360px]:not-sr-only">
{/* The logo carries the link's name, so a screen reader hears it once
and it stays there below 360 px, where the written name gives way to
the menu. */}
<Image src="/logo.png" alt="MSK Scripts" width={36} height={36} priority className="h-9 w-9 rounded-lg object-contain" />
<span aria-hidden="true" className="hidden font-display text-lead font-bold tracking-[-0.01em] [font-stretch:108%] min-[360px]:inline">
MSK Scripts
</span>
</Link>
Expand Down
38 changes: 21 additions & 17 deletions components/legal/ReportLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import { Flag } from '@/components/icons'

import { LocaleLink as Link } from '@/components/i18n/LocaleLink'
import { useLang } from '@/components/i18n/LangProvider'
import { layoutTranslations } from '@/lib/i18n'
import { absoluteUrl } from '@/lib/siteUrl'
Expand All @@ -14,6 +13,8 @@ import { absoluteUrl } from '@/lib/siteUrl'
// die URL von Hand abtippen lässt, ist beides nicht — deshalb sitzt der Link
// am Inhalt selbst und bringt die Adresse mit.
//
// The trigger is a button in a GET form, see below.
//
// The caller passes the internal path; it becomes the absolute public address
// here, because the report form should hold the address a third party sees in
// the browser, not an internal path.
Expand All @@ -22,22 +23,25 @@ export function ReportLink({ path, className }: { path: string; className?: stri
const { lang, localize } = useLang()
const label = layoutTranslations[lang].legal_report

// A GET form instead of a link. Every image page carries it with its own
// address, 8,478 in the crawl of 24.11.2026. As a link with `nofollow` each
// of them was an internal nofollow outlink in the next crawl. A form is not
// followed by crawlers, and for a visitor the button opens the same address
// the link did.
return (
<Link
href={`/report?url=${encodeURIComponent(absoluteUrl(localize(path)))}`}
// Every image page carries this link with its own `?url=`, which made
// 8,478 form addresses for a crawler. They all name `/report` as their
// canonical; `nofollow` here and the `?` line in robots.txt keep a
// crawler from fetching each of them first.
rel="nofollow"
className={
className
?? 'tap-target inline-flex items-center gap-1.5 text-xs text-[var(--color-muted-foreground)] '
+ 'transition-colors hover:text-[var(--color-foreground)]'
}
>
<Flag className="h-3 w-3" aria-hidden="true" />
{label}
</Link>
<form action={localize('/report')} method="get" className="inline">
<input type="hidden" name="url" value={absoluteUrl(localize(path))} />
<button
type="submit"
className={
className
?? 'tap-target inline-flex cursor-pointer items-center gap-1.5 text-xs text-[var(--color-muted-foreground)] '
+ 'transition-colors hover:text-[var(--color-foreground)]'
}
>
<Flag className="h-3 w-3" aria-hidden="true" />
{label}
</button>
</form>
)
}
12 changes: 6 additions & 6 deletions lib/botSeo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Metadata } from 'next'

import type { Lang } from '@/lib/i18n'
import { softwareApplicationJsonLd, type JsonLdObject } from '@/lib/jsonLd'
import { X_DEFAULT_PATH, alternatePaths } from '@/lib/routes'
import { alternatePaths } from '@/lib/routes'

/**
* Metadata and structured data of the two bot landing pages.
Expand Down Expand Up @@ -53,10 +53,10 @@ const TICKETBOT: BotDefinition = {
codeRepository: 'https://github.com/MSK-Scripts/discord_ticketbot',
seo: {
en: {
title: 'Self-Hosted Discord Ticket Bot with Transcripts | MSK Scripts',
title: 'Self-Hosted Discord Ticket Bot & Transcripts | MSK Scripts',
description:
'Free self-hosted Discord ticket bot on Discord.js v14. HTML transcripts under your own domain, '
+ 'attachments, SQLite or your own SQL. No telemetry, open source.',
+ 'attachments, SQLite or your own SQL. Open source.',
ogTitle: 'Self-Hosted Discord Ticket Bot with HTML Transcripts',
ogDescription:
'Free self-hosted Discord ticket bot: custom ticket types, claim system, HTML transcripts, ratings, '
Expand Down Expand Up @@ -107,7 +107,7 @@ const TICKETBOT_COMPARE: BotDefinition = {
'Comparison of self-hosted Discord ticket bots, with an FAQ on hosting, data storage and pricing.',
},
de: {
title: 'Discord Ticket Bots zum Selbsthosten im Vergleich | MSK Scripts',
title: 'Discord Ticket Bots selbst hosten: Vergleich | MSK Scripts',
description:
'MSK Ticket Bot, Discord Tickets, Sayrix Ticket-Bot und das gehostete Ticket Tool im Vergleich: '
+ 'Hosting, Lizenz, Datenbank, Transkripte und Kosten.',
Expand Down Expand Up @@ -146,7 +146,7 @@ const GIVEAWAY: BotDefinition = {
'Free Discord giveaway bot with button entry, restart-safe scheduling, weighted bonus entries and reroll.',
},
de: {
title: 'Discord Giveaway Bot, kostenlos & neustartsicher | MSK Scripts',
title: 'Discord Giveaway Bot, gratis & neustartsicher | MSK Scripts',
description:
'Kostenloser Discord Giveaway Bot auf Discord.js v14. Teilnahme per Knopfdruck, neustartsichere '
+ 'Zeitsteuerung, gewichtete Bonuslose und Neuauslosung.',
Expand Down Expand Up @@ -179,7 +179,7 @@ function metadataFor(bot: BotDefinition, lang: Lang): Metadata {
languages: {
'en': bot.paths.en,
'de': bot.paths.de,
'x-default': X_DEFAULT_PATH,
'x-default': bot.paths.en,
},
},
openGraph: {
Expand Down
39 changes: 32 additions & 7 deletions lib/images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,19 @@ export const IMAGE_TITLE_MAX = 46
* Title of an image page. The spawn name goes in next to the label, because
* labels repeat: "Trailer" stood on 16 vehicle pages, "Sou Cent" on 14, all
* with the same title (crawl of 24.11.2026). Long labels drop the wording
* step by step instead of running past what a search result shows.
* step by step instead of running past what a search result shows; before
* the bare "baller6 PNG" comes the spawn name with the wording, which keeps
* the title above 30 characters (crawl of 25.11.2026).
*
* `where` is the category name, for an image published in more than one
* category: `ammo-22` is in Items and in Weapons, and both pages had the same
* title (1,452 duplicates in the crawl of 25.11.2026).
*/
export function imageTitle(image: Pick<ImageRecord, 'name' | 'label' | 'ext'>, lang: Lang): string {
export function imageTitle(
image: Pick<ImageRecord, 'name' | 'label' | 'ext'>,
lang: Lang,
where?: string,
): string {
const label = image.label?.trim()
const named = label && label.toLowerCase() !== image.name.toLowerCase()
? `${label} (${image.name})`
Expand All @@ -262,11 +272,26 @@ export function imageTitle(image: Pick<ImageRecord, 'name' | 'label' | 'ext'>, l
// called a PNG. "transparent" only goes with a PNG.
const format = (image.ext || 'png').toUpperCase()
const isPng = format === 'PNG'
const full = lang === 'de'
? (isPng ? `${named}, freigestelltes PNG` : `${named}, ${format}`)
: (isPng ? `${named}, transparent PNG` : `${named}, ${format}`)
const candidates = [full, `${named} ${format}`, `${image.name} ${format}`]
return candidates.find(c => c.length <= IMAGE_TITLE_MAX) ?? image.name
const worded = (subject: string) => lang === 'de'
? (isPng ? `${subject}, freigestelltes PNG` : `${subject}, ${format}`)
: (isPng ? `${subject}, transparent PNG` : `${subject}, ${format}`)
const candidates = [worded(named), `${named} ${format}`, worded(image.name), `${image.name} ${format}`]
const placed = where ? candidates.map(c => `${c}, ${where}`) : candidates
return placed.find(c => c.length <= IMAGE_TITLE_MAX)
?? (where ? `${image.name}, ${where}` : image.name)
}

/**
* Whether an image with this spawn name is also published in another
* category. Those pages need the category in title and description.
*/
export async function inOtherCategory(category: string, name: string): Promise<boolean> {
const row = await queryOne<{ n: number }>(
`SELECT COUNT(*) AS n FROM msk_images
WHERE name = ? AND category <> ? AND status = 'published'`,
[name, category],
)
return Number(row?.n ?? 0) > 0
}

export async function getImage(category: string, name: string): Promise<ImageRecord | null> {
Expand Down
2 changes: 1 addition & 1 deletion lib/pageSeo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export const PAGE_SEO: Record<string, Record<Lang, PageSeo>> = {
},
de: {
title: 'FiveM- und GTA-V-Bildergalerie',
description: 'Kostenlose freigestellte Bilder von GTA-V-Fahrzeugen, Waffen, Items, Props und Peds für FiveM-Scripts. Über eigenes CDN, direkt über den Spawnnamen nutzbar.',
description: 'Kostenlose freigestellte Bilder von GTA-V-Fahrzeugen, Waffen, Items, Props und Peds für FiveM-Scripts, über unser CDN und den Spawnnamen nutzbar.',
},
},
}
Expand Down
3 changes: 0 additions & 3 deletions lib/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,6 @@ export function alternatePaths(internal: string): Record<Lang, string> {
return { en: publicPath('en', internal), de: publicPath('de', internal) }
}

/** hreflang `x-default`: the root, which picks a language and redirects. */
export const X_DEFAULT_PATH = '/'

/**
* Splits `/de/...` and `/en/...` into language and the rest. Null for a
* path without a language prefix. The whole segment counts: `/deals` has no
Expand Down
Loading