[{"data":1,"prerenderedAt":817},["ShallowReactive",2],{"guide-slugification-how-it-works":3},{"id":4,"title":5,"body":6,"date":809,"description":810,"extension":811,"meta":812,"navigation":467,"path":813,"readingTime":483,"seo":814,"stem":815,"__hash__":816},"guides\u002Fguides\u002Fslugification-how-it-works.md","How Slugification Works: From Title to URL-Safe String",{"type":7,"value":8,"toc":789},"minimark",[9,14,23,26,30,33,38,41,51,54,58,61,152,156,159,165,169,176,182,186,189,195,199,202,208,212,215,283,286,326,330,333,443,447,515,519,617,621,624,706,719,723,743,747,768,772,785],[10,11,13],"h2",{"id":12},"what-is-slugification","What Is Slugification?",[15,16,17,18,22],"p",{},"Slugification is the process of converting a human-readable title into a URL-safe string. It transforms text like \"How to Build a REST API\" into ",[19,20,21],"code",{},"how-to-build-a-rest-api",".",[15,24,25],{},"The algorithm strips away anything a URL cannot safely carry: special characters, accents, spaces, and non-ASCII text. What remains is a lowercase, hyphen-separated string that works in any browser.",[10,27,29],{"id":28},"the-slugification-pipeline","The Slugification Pipeline",[15,31,32],{},"Slugification follows a predictable sequence of steps. Each step narrows the input until only URL-safe characters remain.",[34,35,37],"h3",{"id":36},"step-1-unicode-normalization-nfkd","Step 1: Unicode Normalization (NFKD)",[15,39,40],{},"The input text is first normalized using NFKD (Normalization Form Compatibility Decomposition). This step separates base characters from their combining marks.",[42,43,48],"pre",{"className":44,"code":46,"language":47},[45],"language-text","é → e + ◌́  (LATIN SMALL LETTER E + COMBINING ACUTE ACCENT)\nü → u + ◌̈  (LATIN SMALL LETTER U + COMBINING DIAERESIS)\n","text",[19,49,46],{"__ignoreMap":50},"",[15,52,53],{},"NFKD is preferred over NFC because it decomposes characters, making the next step — stripping diacritics — possible.",[34,55,57],{"id":56},"step-2-remove-diacritics","Step 2: Remove Diacritics",[15,59,60],{},"After decomposition, the combining marks are stripped. This converts accented characters to their closest ASCII equivalent.",[62,63,64,80],"table",{},[65,66,67],"thead",{},[68,69,70,74,77],"tr",{},[71,72,73],"th",{},"Input",[71,75,76],{},"After NFKD",[71,78,79],{},"After Stripping",[81,82,83,101,118,135],"tbody",{},[68,84,85,91,96],{},[86,87,88],"td",{},[19,89,90],{},"café",[86,92,93],{},[19,94,95],{},"cafe + ◌́",[86,97,98],{},[19,99,100],{},"cafe",[68,102,103,108,113],{},[86,104,105],{},[19,106,107],{},"über",[86,109,110],{},[19,111,112],{},"uber + ◌̈",[86,114,115],{},[19,116,117],{},"uber",[68,119,120,125,130],{},[86,121,122],{},[19,123,124],{},"piñata",[86,126,127],{},[19,128,129],{},"pinata + ◌̃",[86,131,132],{},[19,133,134],{},"pinata",[68,136,137,142,147],{},[86,138,139],{},[19,140,141],{},"naïve",[86,143,144],{},[19,145,146],{},"nai + ◌̈ + ve",[86,148,149],{},[19,150,151],{},"naive",[34,153,155],{"id":154},"step-3-remove-non-word-characters","Step 3: Remove Non-Word Characters",[15,157,158],{},"Any character that is not a letter, digit, or space is removed. This eliminates punctuation, symbols, and other special characters.",[42,160,163],{"className":161,"code":162,"language":47},[45],"\"How to: Build an API!\" → \"How to Build an API\"\n\"Price: $9.99 (50% off)\" → \"Price 999 50 off\"\n\"C++ & Python\" → \"C Python\"\n",[19,164,162],{"__ignoreMap":50},[34,166,168],{"id":167},"step-4-replace-spaces-with-separators","Step 4: Replace Spaces With Separators",[15,170,171,172,175],{},"Spaces are converted to the chosen separator — typically a hyphen (",[19,173,174],{},"-","). This creates word boundaries in the slug.",[42,177,180],{"className":178,"code":179,"language":47},[45],"\"How to Build an API\" → \"How-to-Build-an-API\"\n",[19,181,179],{"__ignoreMap":50},[34,183,185],{"id":184},"step-5-collapse-multiple-separators","Step 5: Collapse Multiple Separators",[15,187,188],{},"Consecutive separators are reduced to a single instance. This happens when the original text had multiple spaces or when removed characters left gaps.",[42,190,193],{"className":191,"code":192,"language":47},[45],"\"C  Python\" → \"C---Python\" → \"C-Python\"\n",[19,194,192],{"__ignoreMap":50},[34,196,198],{"id":197},"step-6-convert-to-lowercase-and-trim","Step 6: Convert to Lowercase and Trim",[15,200,201],{},"The final step lowercases everything and removes leading and trailing separators.",[42,203,206],{"className":204,"code":205,"language":47},[45],"\"How-to-Build-an-API\" → \"how-to-build-an-api\"\n",[19,207,205],{"__ignoreMap":50},[10,209,211],{"id":210},"the-unicode-challenge","The Unicode Challenge",[15,213,214],{},"Slugification works cleanly for Latin scripts. For other writing systems, the results vary:",[62,216,217,229],{},[65,218,219],{},[68,220,221,223,226],{},[71,222,73],{},[71,224,225],{},"Slug",[71,227,228],{},"Issue",[81,230,231,244,256,268],{},[68,232,233,238,241],{},[86,234,235],{},[19,236,237],{},"こんにちは",[86,239,240],{},"`` (empty)",[86,242,243],{},"Japanese characters have no ASCII mapping",[68,245,246,251,253],{},[86,247,248],{},[19,249,250],{},"Привет мир",[86,252,240],{},[86,254,255],{},"Cyrillic characters are stripped entirely",[68,257,258,263,265],{},[86,259,260],{},[19,261,262],{},"你好世界",[86,264,240],{},[86,266,267],{},"Chinese characters decompose to nothing",[68,269,270,275,280],{},[86,271,272],{},[19,273,274],{},"café résumé",[86,276,277],{},[19,278,279],{},"cafe-resume",[86,281,282],{},"Latin diacritics convert cleanly",[15,284,285],{},"For non-Latin content, you have three options:",[287,288,289,310,320],"ul",{},[290,291,292,296,297,299,300,303,304,299,307,22],"li",{},[293,294,295],"strong",{},"Transliterate."," Use a library that maps characters to phonetic ASCII equivalents: ",[19,298,237],{}," → ",[19,301,302],{},"konnichiha",", ",[19,305,306],{},"Привет",[19,308,309],{},"privet",[290,311,312,315,316,319],{},[293,313,314],{},"Use the raw Unicode."," Some systems allow Unicode slugs (",[19,317,318],{},"\u002Fこんにちは","), but this hurts readability and URL sharing.",[290,321,322,325],{},[293,323,324],{},"Generate a separate slug manually."," Write a descriptive ASCII slug instead of auto-generating from the title.",[10,327,329],{"id":328},"slugify-libraries-compared","Slugify Libraries Compared",[15,331,332],{},"Most programming ecosystems have slugify libraries. Here is a comparison of the popular options:",[62,334,335,354],{},[65,336,337],{},[68,338,339,342,345,348,351],{},[71,340,341],{},"Library",[71,343,344],{},"Language",[71,346,347],{},"Unicode Handling",[71,349,350],{},"Custom Separator",[71,352,353],{},"Transliteration",[81,355,356,375,392,409,426],{},[68,357,358,363,366,369,372],{},[86,359,360],{},[293,361,362],{},"python-slugify",[86,364,365],{},"Python",[86,367,368],{},"NFKD + diacritics strip",[86,370,371],{},"Yes",[86,373,374],{},"Built-in",[68,376,377,382,385,387,389],{},[86,378,379],{},[293,380,381],{},"slugify",[86,383,384],{},"JavaScript (npm)",[86,386,368],{},[86,388,371],{},[86,390,391],{},"Optional",[68,393,394,399,402,404,406],{},[86,395,396],{},[293,397,398],{},"Laravel Str::slug",[86,400,401],{},"PHP",[86,403,368],{},[86,405,371],{},[86,407,408],{},"Via stringy",[68,410,411,416,419,421,423],{},[86,412,413],{},[293,414,415],{},"Go slug",[86,417,418],{},"Go",[86,420,368],{},[86,422,371],{},[86,424,425],{},"Via transliteration map",[68,427,428,433,436,438,440],{},[86,429,430],{},[293,431,432],{},"Rails ActiveSupport::Parameterize",[86,434,435],{},"Ruby",[86,437,368],{},[86,439,371],{},[86,441,442],{},"Limited",[34,444,446],{"id":445},"python-example","Python example",[42,448,452],{"className":449,"code":450,"language":451,"meta":50,"style":50},"language-python shiki shiki-themes github-light github-dark","from slugify import slugify\n\nslugify(\"How to Build a REST API\")\n# \"how-to-build-a-rest-api\"\n\nslugify(\"Café résumé: 10 tips\")\n# \"cafe-resume-10-tips\"\n\nslugify(\"こんにちは世界\", transliterate=True)\n# \"konnichiha-shi-jie\"\n","python",[19,453,454,462,469,475,481,486,492,498,503,509],{"__ignoreMap":50},[455,456,459],"span",{"class":457,"line":458},"line",1,[455,460,461],{},"from slugify import slugify\n",[455,463,465],{"class":457,"line":464},2,[455,466,468],{"emptyLinePlaceholder":467},true,"\n",[455,470,472],{"class":457,"line":471},3,[455,473,474],{},"slugify(\"How to Build a REST API\")\n",[455,476,478],{"class":457,"line":477},4,[455,479,480],{},"# \"how-to-build-a-rest-api\"\n",[455,482,484],{"class":457,"line":483},5,[455,485,468],{"emptyLinePlaceholder":467},[455,487,489],{"class":457,"line":488},6,[455,490,491],{},"slugify(\"Café résumé: 10 tips\")\n",[455,493,495],{"class":457,"line":494},7,[455,496,497],{},"# \"cafe-resume-10-tips\"\n",[455,499,501],{"class":457,"line":500},8,[455,502,468],{"emptyLinePlaceholder":467},[455,504,506],{"class":457,"line":505},9,[455,507,508],{},"slugify(\"こんにちは世界\", transliterate=True)\n",[455,510,512],{"class":457,"line":511},10,[455,513,514],{},"# \"konnichiha-shi-jie\"\n",[34,516,518],{"id":517},"javascript-example","JavaScript example",[42,520,524],{"className":521,"code":522,"language":523,"meta":50,"style":50},"language-javascript shiki shiki-themes github-light github-dark","import slugify from 'slugify';\n\nslugify('How to Build a REST API');\n\u002F\u002F \"How-to-Build-a-REST-API\"\n\nslugify('How to Build a REST API', { lower: true });\n\u002F\u002F \"how-to-build-a-rest-api\"\n\nslugify('Café résumé: 10 tips');\n\u002F\u002F \"Cafe-resume-10-tips\"\n","javascript",[19,525,526,546,550,564,570,574,592,597,601,612],{"__ignoreMap":50},[455,527,528,532,536,539,543],{"class":457,"line":458},[455,529,531],{"class":530},"szBVR","import",[455,533,535],{"class":534},"sVt8B"," slugify ",[455,537,538],{"class":530},"from",[455,540,542],{"class":541},"sZZnC"," 'slugify'",[455,544,545],{"class":534},";\n",[455,547,548],{"class":457,"line":464},[455,549,468],{"emptyLinePlaceholder":467},[455,551,552,555,558,561],{"class":457,"line":471},[455,553,381],{"class":554},"sScJk",[455,556,557],{"class":534},"(",[455,559,560],{"class":541},"'How to Build a REST API'",[455,562,563],{"class":534},");\n",[455,565,566],{"class":457,"line":477},[455,567,569],{"class":568},"sJ8bj","\u002F\u002F \"How-to-Build-a-REST-API\"\n",[455,571,572],{"class":457,"line":483},[455,573,468],{"emptyLinePlaceholder":467},[455,575,576,578,580,582,585,589],{"class":457,"line":488},[455,577,381],{"class":554},[455,579,557],{"class":534},[455,581,560],{"class":541},[455,583,584],{"class":534},", { lower: ",[455,586,588],{"class":587},"sj4cs","true",[455,590,591],{"class":534}," });\n",[455,593,594],{"class":457,"line":494},[455,595,596],{"class":568},"\u002F\u002F \"how-to-build-a-rest-api\"\n",[455,598,599],{"class":457,"line":500},[455,600,468],{"emptyLinePlaceholder":467},[455,602,603,605,607,610],{"class":457,"line":505},[455,604,381],{"class":554},[455,606,557],{"class":534},[455,608,609],{"class":541},"'Café résumé: 10 tips'",[455,611,563],{"class":534},[455,613,614],{"class":457,"line":511},[455,615,616],{"class":568},"\u002F\u002F \"Cafe-resume-10-tips\"\n",[10,618,620],{"id":619},"choosing-a-separator","Choosing a Separator",[15,622,623],{},"Three separators are commonly used in URLs:",[62,625,626,642],{},[65,627,628],{},[68,629,630,633,636,639],{},[71,631,632],{},"Separator",[71,634,635],{},"Example",[71,637,638],{},"SEO Impact",[71,640,641],{},"Readability",[81,643,644,665,686],{},[68,645,646,654,659,662],{},[86,647,648,651,652],{},[293,649,650],{},"Hyphen"," ",[19,653,174],{},[86,655,656],{},[19,657,658],{},"\u002Fbest-seo-tips",[86,660,661],{},"Google recognizes as word separator",[86,663,664],{},"High",[68,666,667,675,680,683],{},[86,668,669,651,672],{},[293,670,671],{},"Underscore",[19,673,674],{},"_",[86,676,677],{},[19,678,679],{},"\u002Fbest_seo_tips",[86,681,682],{},"Google does not treat as word separator",[86,684,685],{},"Medium",[68,687,688,695,700,703],{},[86,689,690,651,693],{},[293,691,692],{},"Dot",[19,694,22],{},[86,696,697],{},[19,698,699],{},"\u002Fbest.seo.tips",[86,701,702],{},"Ambiguous — can indicate file extensions",[86,704,705],{},"Low",[15,707,708,711,712,715,716,22],{},[293,709,710],{},"Use hyphens."," Google's John Mueller has confirmed that hyphens are the preferred URL separator. Underscores cause Google to join words together, so ",[19,713,714],{},"best_seo_tips"," is read as ",[19,717,718],{},"bestseotips",[10,720,722],{"id":721},"key-takeaways","Key Takeaways",[287,724,725,728,731,734,737,740],{},[290,726,727],{},"Slugification converts titles into URL-safe strings through a six-step pipeline",[290,729,730],{},"NFKD normalization decomposes characters so diacritics can be stripped",[290,732,733],{},"Non-Latin scripts produce empty slugs unless transliteration is applied",[290,735,736],{},"Always use hyphens as separators — Google treats underscores as word joiners",[290,738,739],{},"Most languages have mature slugify libraries that handle the full pipeline",[290,741,742],{},"Test your slugify function with accented input, symbols, and non-Latin text",[10,744,746],{"id":745},"related-guides","Related Guides",[287,748,749,756,762],{},[290,750,751],{},[752,753,755],"a",{"href":754},"\u002Fguides\u002Furl-slug-guide","URL Slug Guide: What Slugs Are and Why They Matter for SEO",[290,757,758],{},[752,759,761],{"href":760},"\u002Fguides\u002Fseo-friendly-urls","SEO-Friendly URLs: Structure, Keywords, and Best Practices",[290,763,764],{},[752,765,767],{"href":766},"\u002Fguides\u002Furl-encoding-guide","URL Encoding Guide",[10,769,771],{"id":770},"try-it-yourself","Try It Yourself",[15,773,774,775,779,780,784],{},"Turn any title into a clean slug instantly with our ",[752,776,778],{"href":777},"\u002Ftools\u002Fslug-generator","Slug Generator",", and convert text between naming formats with the ",[752,781,783],{"href":782},"\u002Ftools\u002Fcase-converter","Case Converter"," — both free, no account needed.",[786,787,788],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}",{"title":50,"searchDepth":464,"depth":464,"links":790},[791,792,800,801,805,806,807,808],{"id":12,"depth":464,"text":13},{"id":28,"depth":464,"text":29,"children":793},[794,795,796,797,798,799],{"id":36,"depth":471,"text":37},{"id":56,"depth":471,"text":57},{"id":154,"depth":471,"text":155},{"id":167,"depth":471,"text":168},{"id":184,"depth":471,"text":185},{"id":197,"depth":471,"text":198},{"id":210,"depth":464,"text":211},{"id":328,"depth":464,"text":329,"children":802},[803,804],{"id":445,"depth":471,"text":446},{"id":517,"depth":471,"text":518},{"id":619,"depth":464,"text":620},{"id":721,"depth":464,"text":722},{"id":745,"depth":464,"text":746},{"id":770,"depth":464,"text":771},"2026-05-28","Understand the slugification algorithm — Unicode normalization, diacritics removal, and separator handling explained step by step.","md",{"immutable":467},"\u002Fguides\u002Fslugification-how-it-works",{"title":5,"description":810},"guides\u002Fslugification-how-it-works","GAm7ULoMKcghVeREOfAkf-IxubNNlORNkKM-RQhAgog",1780401326580]