My boss is adamant about having ad landing page urls not involve “subdirectories” (er, extra segments in the EE way. To accomplish this I simply have the index of the homepage template group embed a homepage template if there’s no second segment and embed an ad landing page if there is a second segment.
The problem is, the landing page only ever shows the last entry. Require_entry throws it into the no_results loop. However, if I use this exact same method on a non-default template group it works as expected.
Can someone explain what is going on here? Here’s my site’s index page code (main is my default template group):
{if segment_1 == ''}{embed='main/homepage'}{if:else}{embed='main/landingpage'}{/if}landingpage:
{exp:channel:entries channel="landing" limit="1" status="open"}
{embed="includes/header" bodyclass="layoutB landingpage"}
{if no_results}{redirect=''}{/if}
<div id="main" role="main">
<h1>{title}</h1>
{other_stuff}
</div>
{embed="includes/footer"}
{/exp:channel:entries}To recap, my problem is that given the following “landing” entries (url_titles):
http://www.site.com - shows homepage
http://www.site.com/campaign04 - shows the “landing” channel entry with the url_title of campaing04
http://www.site.com/campaign03 - still shows the “landing” channel entry with the url_title of campaing04
http://www.site.com/foo - shows the “landing” channel entry with the url_title of campaing04
(campaing04 is the latest landing entry that has an open status.)
Note if I use the exact same templates in a non default template group it works as expected:
http://www.site.com/test/ - shows homepage
http://www.site.com/test/campaign04 - shows “landing” channel entry campaing04
http://www.site.com/test/campaign03 - shows “landing” channel entry campaing03
http://www.site.com/test/foo - shows “landing” channel entry foo