1

Please let me know if I'm doing this correctly. I've created a new EE website with a template group called about_us, which has an index template - just the way I want it.

However, I also have another template group called resources, in which I intend to place things like CSS Templates and Javascript Templates. As such, I don't want an index HTML template in this group.

There doesn't seem to be a button to delete an index template. Is this possible, or am I approaching this the wrong way?

2 Answers 2

7

You can't have a template group without an index template, but you don't have to use it. You could either set the preferences for the template in the CP to have it inaccessible to guests or simply place {if segment_2==""}{redirect="whatever"}{/if} in it to prevent access to the template directly.

5

There seem to be two different questions here:

Where do you store "assets" like CSS or JS files in an EE install?

Personally, I store them out of EE and access them using either a path relative to root or using the {site_url} variable.

<link rel="stylesheet" type="text/css" media="screen" href="{site_url}/assets/css/screen.css" />

<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/screen.css" />

Storing those assets externally means that they won't have to be parsed by EE and thus will not take resources. Reusable chunks (for lack of a better word) of your site will be stored in Global Variables (or Low Variables), Snippets or Embedded templates depending on what you need.

Can you make whole template groups inaccessible or remove index file from template groups if you do not use them?

Tyssen gave you a good answer there: template preferences or using 404 or other redirects based on segments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.