tofty VIP
Total posts: 54
19 Jan 2019 06:33

Hello,

Is there a way to use 2 different templates for the same Section?

I have coded my Google Schema code (structured data) into my templates. Recipes require a different code than Articles do. So the templates are different in the 2 Sections at the moment. But I want to add some Articles to the Recipe Section, and need to use a different template since the Google schema code needs to be different.

I know I could custom code it to draw the schema code from a field, but that is beyond my skill level.

Is it somehow possible to add a field that will somehow allow me to choose the template to use?

Thank you.

Thora

Last Modified: 12 Feb 2019


Sergey
Total posts: 13,748
21 Jan 2019 04:28

For the list of the articles you can use only one template at the time. But:

  • You can select different templates for different sections in section parameters
  • You can select few templates for same sectiona тв allow user to switch templates in articles list.

tofty VIP
Total posts: 54
21 Jan 2019 07:04

Hello Sergey,

Ok, thank you.

I guess I'm going to have to learn a bit more coding :)

Thora


tofty VIP
Total posts: 54
28 Jan 2019 21:43

Hi Sergey,

I was browsing the forum for something completely different, and stumbled on something.

Someone noted that there can be multiple Types in one Section. Is that true? If so, that may be a way for me to solve my issue, as I can use a different template for each Type. My custom coding is in the Type template and not in the Section listing template.

If 2 Types are allowed, what happens to the Section Index? Would it include all items from both Types? (That's what I hope :) ).

Thank you.

Thora


Giorgi625 VIP
Total posts: 655
29 Jan 2019 13:49

Yes you can set multiple types, but there will be different template for full record view. So it will work for you.

Sure it will display all items of both types in listing, but You will need to set fields of both type to one listing template.


Sergey
Total posts: 13,748
07 Feb 2019 11:31

tofty multiple Types in one Section. Is that true?

Absolutely

tofty different template for each Type

Template for type is only for article full view, you cannot change template is section when you see list of the articles.

Just select few templates for article list in section parameters and you will see template switcher on frontend.

2019-02-07_17-29-27 2019-02-07_17-30-30


tofty VIP
Total posts: 54
12 Feb 2019 08:44

Hi Sergey and Georgi625,

This is great! For the index view both of my types have the same types of fields showing on the index page, so that won't be an issue. I did a quick test, and it works awesome!

Thank you.

Thora

Powered by Cobalt