Update routing in next.config.ts to redirect "/tercih-robotu" to the hero form, add simple-icons dependency in package.json, and enhance database indexing for improved query performance. Remove unused SVG files and update metadata across various pages for better SEO and clarity.
All checks were successful
Deploy / deploy (push) Successful in 14m14s
All checks were successful
Deploy / deploy (push) Successful in 14m14s
This commit is contained in:
45
src/lib/slug.ts
Normal file
45
src/lib/slug.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Türkçe güvenli slug. Sıra kritik: önce tr-TR lowercase — düz toLowerCase()
|
||||
* 'İ'yi 'i' + U+0307 (combining dot) yapar ve slug bozulur — sonra ASCII
|
||||
* katlama, en son NFKD ile kalan aksan artıkları temizlenir.
|
||||
*/
|
||||
export function turkishSlugify(s: string): string {
|
||||
return s
|
||||
.toLocaleLowerCase("tr-TR")
|
||||
.replace(/ı/g, "i")
|
||||
.replace(/ş/g, "s")
|
||||
.replace(/ğ/g, "g")
|
||||
.replace(/ü/g, "u")
|
||||
.replace(/ö/g, "o")
|
||||
.replace(/ç/g, "c")
|
||||
.replace(/â/g, "a")
|
||||
.replace(/î/g, "i")
|
||||
.replace(/û/g, "u")
|
||||
.normalize("NFKD")
|
||||
.replace(/[̀-ͯ]/g, "")
|
||||
.replace(/[^a-z0-9]+/g, "-")
|
||||
.replace(/^-+|-+$/g, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* "Psikoloji (%50 İndirimli) " → "Psikoloji". Burs/dil/kampüs gibi tüm
|
||||
* parantez varyantlarını atar; arama niyeti taban ada gelir, varyantlar
|
||||
* bölüm sayfasında satır olarak listelenir.
|
||||
*/
|
||||
export function bolumBazAdi(isim: string): string {
|
||||
return isim
|
||||
.replace(/\s*\([^)]*\)/g, "")
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
}
|
||||
|
||||
/** ALL-CAPS veritabanı adlarını tr-TR başlık düzenine çevirir (İSTANBUL → İstanbul). */
|
||||
export function trBaslikDuzeni(s: string): string {
|
||||
return s
|
||||
.toLocaleLowerCase("tr-TR")
|
||||
.split(" ")
|
||||
.map((w) =>
|
||||
w.length > 0 ? w[0].toLocaleUpperCase("tr-TR") + w.slice(1) : w,
|
||||
)
|
||||
.join(" ");
|
||||
}
|
||||
Reference in New Issue
Block a user