Post edit: you may want to skip to the follow-up post where I think I’ve expressed what I’m trying to ask more concisely.
I have a lot going on in a single template with a lot of fields being queried and a couple of relationships. Initially I had the template just generating urls of the form:
/schools
/schools/{url_title}But because the single entry part of it has several page segments that require a lot of processing and that’s leading to slow page loading, I’m now thinking it would be better to split this up further to generate:
/schools
/schools/{url_title}
/schools/{url_title}/courses
/schools/{url_title}/accommodation-travel…and have those latter 2 url types be injected on demand into the main single entry URL at /schools/{url_title}.
I’d be grateful if you could confirm that the logic of the following abstracted template makes good use of the way EE parses things with regard to segment conditionals. Or whether you can see an obvious tweak that would optimise things better…
<head>
{if segment_2 == ""}
<title>Schools SEO Title</title>
{/if}
{if segment_2 != "" AND segment_3 == ""}
<title>{title}, {location}</title>
{/if}
{if segment_3 == "courses"}
<title>Courses at {title}, {location}</title>
{/if}
{if segment_3 == "accommodation-travel"}
<title>Accommodation and Travel for {title}, {location}</title>
{/if}
</head>
<body>
Global header <!-- includes snippets and an embed -->
<!-- multiple entries section page -->
{if segment_2 == ""} <!-- /schools -->
Intro
Synopses of all schools
{/if}
<!-- /multiple -->
<!-- single entry pages -->
{if segment_2 != ""} <!-- /schools/{url_title}* -->
Page header <!-- common to all single entry school pages -->
{if segment_3 == ""} <!-- /schools/{url_title} -->
<div> <!-- tab_wrapper -->
<div>Tabs</div> <!-- for following 6 page segments: each tab shows or injects content -->
<div>Overview content</div>
<div><a href="/schools/{url_title}/courses">Courses</a></div> <!-- injected on demand -->
<div>Related students content</div>
<div><a href="/schools/{url_title}/accommodation-travel#accommodation">Accommodation for {title}, {location}</a></div> <!-- injected on demand -->
<div><a href="/schools/{url_title}/accommodation-travel#travel">Travelling to {title}, {location}</a></div> <!-- injected on demand -->
<div><a href="/support/visas/{country}">Visa guidance for {country}</a></div> <!-- injected on demand -->
<div><a href="/locations/{location}">About {location}</a></div> <!-- injected on demand -->
</div>
{/if}
{/if}
{if segment_3 == "courses"} <!-- /schools/{url_title}/courses -->
<div>Related courses content</div>
{/if}
{if segment_3 == "accommodation-travel"} <!-- /schools/{url_title}/accommodation-travel -->
<div>Accommodation content</div>
<div>Travel content</div>
{/if}
<!-- /single -->
Global footer <!-- includes snippets -->
</body>