0
votes

I have one MainTemplate shared with pages like : home,about-us,contact-us

I also have template variable to control all pages' : meta description, og title, og image, og desc

I created a Template Variable Home Page Banner link to my MainTemplate to upload images just for Home Page, but when i click other resources, this Home Page Banner Template Variable will show up also.

Any method that makes Home Page Banner TV shows up on home resources only?

Is it duplicate another template from MainTemplate named as HomeTemplate for Home Page Banner TV only?

Personally I felt this way is abit dangerous for future maintanance.

May I know any more method to achieve this?

Tq.

3

3 Answers

0
votes

I think it will be more complicated than a home-page-banner in main-template, but... If you really want to have the same html on multiple templates, simply create common chunk with your html, e.g.:

<html>
<head>
    <title>[[++site_name]] - [[*pagetitle]]</title>
    <base href="[[++site_url]]" />
</head>
<body>
    [[*content]]
</body>
</html>

and in your templates (home-template and main-template) instead of html use only this:

[[$your-chunk-name]]

Then you can add a home-page-banner only to the home-template.

0
votes

Sounds like you have the Template Variable set to show up in both your Main Template and your Home Template. Your TV should just be set to show up on the Homepage Template which you set under Your TV > Template Access and then untick the Main Template checkbox.

As mwl says - is long as you keep your templates simple (i.e. you use Chunks and Snippets wisely) having lots of templates isn't a bad thing on a MODX site.