0

I have a very specific need for Drupal, but not sure if there is a solution and was hoping someone might know of a module or method that might get me going in the right direction?

My brother is a plumber and he travels to many different locations (roughly 30 towns or villages). He offers 6 basic plumbing services. For SEO purposes, I want to create 6 pages for the 30 locations, each of the pages having their own location in the URL, e.g.: domain.com/location_a/specific-plumbing-need

I would basically like to create x6 templates and have them duplicated inside of Drupal. Each page will have the [location] name replaced with that specific location variable. The manual way of doing this would require me to generate 180 pages! (6x30). I'd really like to avoid doing that if at all possible.

1
  • This sounds more like a custom route with wildcards with a custom controller to me. So instead of doing something 60 times which then differs only slightly, do it just once and then populate the pages dynamically. Anyways, the question is too broad for a Q+A site and asking for module recommendations is off-topic. You might want to discuss this in Drupal Slack or in a forum instead.
    – leymannx
    Commented Apr 11 at 17:25

1 Answer 1

1

I doubt having so many pages with mostly the same content would be great for SEO, but you do you.

An easy and obvious way to do that with Drupal is to create a Taxonomy for locations where each term is a different location (that way you can include some location descriptions or news, helpful with SEO), and another Taxonomy for services (6 of them, describing the service in term description and even adding more fields if applicable).

Drupal already provides you with paths to each individual Taxonomy term, you might want to hide them form the search results to prevent diluting them.

With Views you then create a display with 2 contextual filters, one for the location, the other for the service. One contextual filter provides the location argument for the path, the other one for the service.

This way you automatically get the right content, the location from the path and the service from the path, to show on the page.

The View should probably be the Taxonomy term type, if you don't plan on creating content under each of the categories. That is the jist of it, as you asked. You can search to find detailed steps and learn how to create Views contextual filters if you don't know that yet.

2
  • Oh this is clever!! 🤩 Terms and views with args from URL, of course!! Nice 👍🏻
    – leymannx
    Commented Apr 11 at 21:13
  • Thanx :) @leymannx
    – prkos
    Commented Apr 11 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.