I would like to setup many pages (eventually 500-5,000) where only certain variables such as category and city change. The idea is that each page is optimized for a certain category and city. Setting up each page manually would cost a lot of effort plus it won't be sustainable. If I change the text for one category / city, I would like to apply it to all pages. Did anyone setup something similar with Craft CMS and can recommend a general best practice approach?

My idea is as follows but I haven't tried it yet and I am not sure if it is possible and a good approach:

  1. Import the list of categories and cities directly into the Craft CMS database, e.g. as channels. I can get the regional data from geonames.org.
  2. Setup a template with fix content which is the same for all pages. Within this template, I will use variables to insert the category and city. Example:

Lorem ipsum dolor {{Category}} sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea {{City}} commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

  1. Use a URL structure as follows to open the pages which load the templates and insert the right variables:



So, if someone implemented something similar and would share his experience, it would be awesome.

Thanks a lot,


1 Answer 1


You should be able to use dynamic routes to do exactly what you want.

Create a new route in the config/routes.php and point it to a twig template.

return [
  // Route /en/category/city to a template
  '/en/<category:{slug}>/<city:{slug}>/' => ['template' => 'pages/_city'],

In the template (located at templates/pages/_city.twig if you used the template above) you can now access the variables category and city as we defined them in the route.

<p>Get the best {{ category }} in {{ city }} and don't forget to follow us.</p>

That said, on a personal note, this looks pretty spammy and could become problematic for you, if you are looking for good search engine rankings. Hope it works!

  • 1
    Glad it's not just me that thought this was spamtacular. I'd definitely expect it to do more harm than good - not just for SEO but for brand reputation. Commented Mar 14 at 18:26
  • I won't max it out and I plan to hyper-localize the pages which I can also use for Google Ads campaigns. Technically, I will try this approach.
    – flip
    Commented Mar 15 at 6:17
  • I'd expect page rank to fall off a cliff and ad revenue along with it. Commented Mar 19 at 9:17
  • Worth noting this recent post/warning from Google about changes related to their ranking algo with regards to auto-generated content: blog.google/products/search/google-search-update-march-2024 - especially the bit entitled "Scaled content abuse" Commented Mar 26 at 16:38

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.