I am using pages to display content on a page called Speed Sales. I display the entry by checking for segment_2 and matching it to a channel entry basically. I need to display content in case someone spells the url wrong and it doesn't match a url_title in my speed_sales channel. Any ideas?
I'm assuming I might have to include a channel:entries tag with the channel="speed_sales" and check if segment_2 == a url_title for an entry, then display default content if it doesn't, but am unsure how to do this correctly.
EDIT:
I have updated my template to the following:
<article class="text-block">
{exp:channel:entries channel="speed_sales" dynamic="no" url_title="{segment_2}"}
{if url_title == "{segment_2}"}
<h2 class="heading1 excludestrip single left">{title}</h2>
{if lead_copy}<p class="lead">{lead_copy}</p>{/if}
{if subtitle}
<hr/>
<h3 class="excludestrip">{subtitle}</h3>
{/if}
{newsletter_copy}
{/if}
{if segment_2 == "" || no_results}
<h2 class="heading1 single">Speed Sales</h2>
<p class="lead">You may have reached this page in error (a typo in a link, or you backspaced the URL). Please choose a newsletter from below:</p>
{!-- {embed="speed_sales/.newsletter_list"} --}
{/if}
{/exp:channel:entries}
</article>
The reason I included the segment_2 check in my no_results conditional, is because it displays nothing in the no_results conditional (since there is no segment_2). The page url this would need to show up on is /speed_sales or anything under /speed_sales. What happens is everything works properly, but the if no_results conditional block displays multiple times instead of just once. It must be reading the amount of entries in the channel and repeating it that many times. I commented out the embedded list template to check, and it still repeats the block anyways.
{if segment_2 == ""}
then it repeats that block. Any ideas on how to get around that?