1

I'm using a route to use a different template, but whatever I try the page remains unchanged, my structure is set as:

entry url format: {slug}

entry template: _pages/_entry

I want an entry's slug to use a different template - would this possibly be affecting the route being followed?

I want the entry 'home' to use the 'index' template (and not the '_home' template which exists at _pages/_home)

I've cleared my cache and updated indexes

1
  • I used {% redirect "/" %} will think of a better way, but for parent entries in a structure where they are just used for the structure and need no content, e.g. ABOUT (no content) team history is there a way of redirecting say ABOUT to team?
    – user2569
    Commented Jan 12, 2018 at 17:05

2 Answers 2

1

You know you can do things like this in your root entry template to load it dynamically based on slug or entry type

{% extends [
  'pages/_custom/' ~ page.slug ~ '.twig',
  'pages/_entrytypes/' ~ page.type ~ '.twig',
  'pages/_generic.twig' ]
%}
0

What does each line actually do assuming thats in _entry.twig? and assuming the templates reside in the /pages directory? A brief overview of the functionality would be invaluable :)

1
  • Say that you have an entry with the type page and the slug slug. It would first try to load pages/_custom/slug.twig - if that doesn't exist it would try to load pages/_entrytypes/page.twig - and, finally, it would fall back to pages/_generic.twig Commented Jan 15, 2018 at 11:52

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.