3

Is there a way to have multiple entry templates per entry?

I'd like to create two different templates that display the same content/data in different ways.

4

If they can live at different URL's, you could setup multiple routes under Settings->Routes. Give them different URL structures like so:

blog/slug loads mytemplatefolder/blog_template
another-url/slug loads mytemplatefolder/another_template
|improve this answer|||||
  • Works like a charm, never used routes before. Thanks for the answer! – Rob Erskine Jul 8 '14 at 12:58
  • Actually, quick followup: I'm getting the following error: Variable "entry" does not exist. When I try and set the variable entry on my own, it's coming up empty: {% set entry = craft.entries.section('brand').slug(slug) %} . Anything special I have to do when using routes to get entry to persist? – Rob Erskine Jul 8 '14 at 13:28
  • Are you getting the slug from the segment? Like so: {% set pageSlug = craft.request.getSegment(2) %} {% set pageEntry = craft.entries.section('brand').slug(pageSlug).find() %} – jpea Jul 8 '14 at 13:42
  • Pretty close to what I had, getting a different error now when trying to echo out just the title. {{ pageEntry.title }} gives me a 'Key "title" for array with keys "0" does not exist' error. – Rob Erskine Jul 8 '14 at 13:57
  • 1
    You still have to do a for loop, even if it's just 1 entry. {% for entry in pageEntry %} {{ entry.title }} {% endfor %} – jpea Jul 8 '14 at 14:15

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.