2

When specifying the URL and template used to render a section, it's possible to set variable URLs using something like /{postDate.year}/{slug}. Is there any way to accomplish something similar for the entry template, or do all the differences have to be handled within one template that checks for entry type?

4

Sounds like you're looking for something like this: https://craftcms.com/support/entry-type-templates

  • I think he wants to know if he can do it without doing that; by using something like something/{type}/{slug} for the URI and something/{type} for the Entry Template – andrew.welch Jan 14 '16 at 21:29
  • Won't be the last time I've been wrong! – Brad Bell Jan 14 '16 at 21:30
  • @khalwat was right about what I was asking, but I didn't even stop to think about using variable includes instead, which should work just fine. Thanks! – John O Jan 14 '16 at 21:36
4

It is not possible to have dynamic tags within Entry Template settings, no. All fields that do allow dynamic tags will say so in their instruction text.

The reason it’s allowed in some settings but not others is because there is a performance hit each time those dynamic settings are rendered. (We actually spin up Twig to do the parsing, but since the settings are not stored as actual files, Twig must re-recompile the settings every single time.) So we only do it in areas where the performance hit doesn’t matter much. Entry URL Format settings, for example, only have to get parsed when an entry is saved, not each time that the entry is actually requested on the front end.

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.