{layout='layouts/_blog-layout'}

{!-- prevents 4th ++ segments on search results --}
{if segment_4}
	{if segment_4 ~ '/^(?!P\d+).*/'}
		{redirect='{segment_1}/{segment_2}/{segment_3}'}
	{/if}
{/if}

{!-- prevents 5th ++ segments on paginated search results --}
{if segment_5}
	{redirect='{segment_1}/{segment_2}/{segment_3}/{segment_4}'}
{/if}

{!-- page vars --}
{preload_replace:p_title='My Blog'}
{preload_replace:p_description='Search Results'}
{preload_replace:p_url='blog'}
{preload_replace:p_url_entry='entry'}
{!-- channel vars (prefix ch_) --}
{preload_replace:ch='blog'}
{!-- layout vars, channel/page related --}
{layout:set name='ch' value='{ch}'}
{layout:set name='p_url' value='{p_url}'}
{layout:set name='p_title' value='{p_title}'}
{layout:set name='search' value='y'}
{!-- layout vars --}
{layout:set name='title' value='search results{gv_sep}{p_title}{gv_sep}'}
{layout:set name='description' value='{p_description}'}

		<h1>Search Results, {p_title}</h1>
		<div class="entries">
			{exp:search:search_results}
				{!-- listing as a snippet, as it's used through more than one template --}
				{snp_blog_list}
				{!-- pagination --}
				{snp_blog_list_paginate}
			{/exp:search:search_results}
		</div>
