1

I have 3 level structure for my entries with separate template for each level.

/artists/artist-name/ uses artists/_types/artists.html template

/artists/artist-name/section-name/ uses artists/_types/section.html template

/artists/artist-name/section-name/project-name/ uses artists/_types/project.html template

What I need to do is to specify additional layout for level 3 entry so depending on URI I can display one or another.

This is the additional URI I want to use: /artists/artist-name/section-name/project-name/thumb and I want to load the artists/_types/thumb.html template

1

I'm not completely sure about what you're asking, but you might want to look in to craft.request: https://craftcms.com/docs/templating/craft.request

In your structure template, you can check your URL segments, and use twig include to load the desired template, based on those segments.

Another related feature is dynamic routing: https://craftcms.com/docs/routing#dynamic-routes

You could use this to route a URL to a different template.

|improve this answer|||||
  • I tried to get crafty.request to work but without any luck. Ended up setting up a route. Not sure if this is really the proper way to do it but I got it to work. artists/(slug)/(slug)/(slug)/thumb loads artists/_types/thumb.html template – SoHo Aug 14 '17 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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