fix: clean location names in reference badges and detail pages
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 17s
Build & Deploy / 🧪 QA (push) Failing after 58s
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s

This commit is contained in:
2026-05-15 21:52:58 +02:00
parent 68b0ed7ba0
commit ed802d03e7
2 changed files with 14 additions and 2 deletions

View File

@@ -135,7 +135,9 @@ export default async function ReferenceDetail(props: { params: Promise<{ locale:
<MapPin className="w-8 h-8 text-primary shrink-0" />
<div>
<p className="text-sm text-white/50 mb-1 uppercase tracking-wider font-bold">Ort</p>
<p className="font-semibold text-lg">{reference.frontmatter.location}</p>
<p className="font-semibold text-lg">
{reference.frontmatter.location ? reference.frontmatter.location.split('/')[0].replace(/\b\d{5}\b/g, '').trim() : ''}
</p>
</div>
</div>
<div className="flex items-start gap-4 p-6 bg-white/5 rounded-2xl border border-white/10 backdrop-blur-sm">

View File

@@ -42,6 +42,16 @@ export default async function ReferenzenOverview(props: { params: Promise<{ loca
const references = await getAllReferences(locale);
// Helper to clean up location names (remove PLZ and keep only first location if multiple)
const cleanLocation = (locStr: string | undefined) => {
if (!locStr) return '';
// Take first part before slash
let cleaned = locStr.split('/')[0].trim();
// Remove 5-digit PLZ
cleaned = cleaned.replace(/\b\d{5}\b/g, '').trim();
return cleaned;
};
// Enrich the static map locations with dynamic project data (images, details)
const enrichedLocations = defaultLocations.map(loc => {
if (loc.type === 'project') {
@@ -114,7 +124,7 @@ export default async function ReferenzenOverview(props: { params: Promise<{ loca
<div className="absolute top-4 left-4 z-10">
<span className="bg-white/95 backdrop-blur-md text-neutral-dark px-3 py-1.5 rounded-sm text-[10px] font-bold uppercase tracking-widest flex items-center gap-1.5 shadow-sm border border-neutral-200">
<MapPin className="w-3 h-3 text-primary" />
{ref.frontmatter.location}
{cleanLocation(ref.frontmatter.location)}
</span>
</div>
</div>