Use this formula to turn a title such as How to Organize Your Notes into the URL-friendly slug how-to-organize-your-notes.
if(
empty(prop("Title")),
"",
replaceAll(
replaceAll(
lower(trim(prop("Title"))),
"[^a-z0-9]+",
"-"
),
"^-|-$",
""
)
)What this formula does
| Step | Example |
|---|---|
| Trim spaces | How to Organize Your Notes |
| Convert to lowercase | how to organize your notes |
| Replace punctuation and spaces | how-to-organize-your-notes- |
| Remove hyphens at the ends | how-to-organize-your-notes |
The formula replaces each run of non-ASCII letters or numbers with one hyphen. Empty titles return a blank value.
Database setup
Create these properties in your Notion database:
| Property | Type | Example |
|---|---|---|
Title | Title or Text | How to Organize Your Notes |
Slug | Formula | The formula above |
If your source property is called Name, replace prop("Title") with prop("Name").
Add a fixed prefix
Use this variant when all slugs belong to the same content type:
"blog/" + replaceAll(
replaceAll(lower(trim(prop("Title"))), "[^a-z0-9]+", "-"),
"^-|-$",
""
)This returns values such as blog/how-to-organize-your-notes.
Limit the slug length
Keep the first 60 characters when you need shorter slugs:
slice(
replaceAll(
replaceAll(lower(trim(prop("Title"))), "[^a-z0-9]+", "-"),
"^-|-$",
""
),
0,
60
)Check the result after slicing: it can end with a hyphen if the cut happens in the middle of a word.
Common problems
Accented letters and non-Latin characters are removed by this basic formula. If your titles include them, transliterate the title first or use a separate manually edited slug property.
If two titles produce the same slug, add a unique ID or page number. A formula cannot guarantee uniqueness across database rows.
If the formula returns an error, check that Title is a text or title property and that your Notion workspace supports regular expressions in replaceAll().