Skip to main content
All CollectionsAdvanced Guides
Create pages with identical slugs but different parent pages
Create pages with identical slugs but different parent pages

Sometimes you want to create pages that have identical slugs but their URL is different due to the parent page. This is how to do it.

Jonas Lindemann avatar
Written by Jonas Lindemann
Updated yesterday

When to Use This Feature

This functionality is beneficial when you need the same slug for pages under different parent pages. For instance, if you offer the same service in multiple locations, you can have URLs like /manhattan/window-cleaning and /brooklyn/window-cleaning. This approach is applicable to hierarchical post types, such as pages.

Steps:

  1. Create Parent Pages: Begin by creating the parent pages that will serve as the parent pages. In this example, create pages for the cities "Brooklyn" and "Manhattan".

  2. Create Service Pages: Next, create the service pages with a slug formatted as {service}. These pages will represent the services offered in each location.

  3. Prepare the Input Sheet: Organize your data in a spreadsheet with columns for city, service, and lpagery_parent. The lpagery_parent column should contain the slug of the corresponding parent page.

Example Input Sheet:

city

service

lpagery_parent

Brooklyn

Window Cleaning

brooklyn

Manhattan

Floor Cleaning

manhattan

Brooklyn

Floor Cleaning

brooklyn

Manhattan

Window Cleaning

manhattan

Now when you want to create pages using this source file, you will receive a warning indicating duplicate slugs. Click the "Enable parent as identifier" button to use the parent page as an identifier. This ensures that pages are distinguished by their parent in addition to the slug.

After clicking the button ,you will see that the issue is gone

Now you can create the pages and you will get pages with the following slugs:

brooklyn/window-cleaning/

manhattan/floor-cleaning/

brooklyn/floor-cleaning/

manhattan/window-cleaning/

Did this answer your question?