How to clean Page URLs from extra hyphens
Ensuring clean URL slugs by formatting page Name
Published on October 24, 2023In order to maintain a clean and SEO-friendly URL structure on your website, it's essential that the URL slugs generated from your Notion database fields are formatted correctly.
Specifically, the "Name" field in your database should be structured in a way that eliminates extra hyphens in the generated URL slugs.
Understand How URL Slugs are Generated
The URL slug for each page is generated based on the "Name" field of the corresponding Article or Category. Each blank space in the "Name" field is replaced with a hyphen (
-
) to create a web-friendly URL.Example:
- Name:
Sample Page Title
- Generated URL Slug:
sample-page-title
Avoid Trailing Spaces in the "Name" Field
Ensure that there are no spaces at the beginning or end of the text in the "Name" field. Trailing spaces will result in extra hyphens at the beginning or end of the generated URL slug.
Incorrect:
- Name:
Sample Page Title
- Generated URL Slug:
sample-page-title-
Correct:
- Name:
Sample Page Title
- Generated URL Slug:
sample-page-title
Review and Edit the "Name" Field
Before saving a new entry in your Notion database, review the "Name" field to ensure that it doesn’t have any trailing spaces. If necessary, edit the field to remove any unwanted spaces.
You can check the final generated path in the
Slug
field.Did this answer your question?