{exp:switchee variable="{stash:channel_id}" parse="inward"} {case value="74|84|134|139"} {!--page (field_id: 54) fields--} {switchee variable="{segment_1}"} {case value=""} {!--homepage--} {stash:embed:data-v5:feature-pages stash:entry_id="770502" stash:channel_id="84"} {/case} {case value="store|maui|big-island|oahu|kauai|hawaii-blog|blog|hawaii-videos"} {!--main pages of primary sections--} {switchee variable="{segment_2}"} {case value=""} {!--main page of section--} {stash:embed:data-v5:feature-pages} {/case} {case default="yes"} {!--regular pages--} {!--ensures custom_field_set entries like island-XYZ, etc get redirect to the classification segment and not the url_title which is seg1 and seg2 combined --} {if '{stash:section_url}'!='' && '{stash:classification_url}'!='' && '{stash:custom_url}'!='' && '{stash:custom_url}'!='{segment_3}'} {redirect="{stash:section_url}/{stash:classification_url}/{stash:custom_url}"} {if:elseif '{stash:section_url}'!='' && '{stash:classification_url}'!='' && '{stash:custom_url}'!='' && '{stash:custom_url}'=='{segment_3}'} {stash:embed:data-v5:feature-pages} {if:elseif '{stash:section_url}'!='' && '{stash:classification_url}'=='' && '{stash:custom_url}'!='' && '{stash:custom_url}'!='{segment_2}'} {redirect="{stash:section_url}/{stash:custom_url}"} {if:elseif '{stash:section_url}'!='' && '{stash:custom_url}'!='' && '{stash:custom_url}'=='{segment_2}'} {stash:embed:data-v5:feature-pages} {!--if the classification type isn't the second segment or if 'class' is blank redirect them--} {if:elseif '{stash:classification_url}'!='' && '{stash:classification_url}'!='{segment_2}'} {redirect="{stash:section_url}/{stash:classification_url}/{stash:url_title}"} {if:elseif '{stash:classification_url}'=='' && '{segment_2}'!='{stash:url_title}'} {redirect="{stash:section_url}/{stash:url_title}"} {!--after everything above, if seg1 is the section to go entry--} {if:elseif '{segment_1}'=='{stash:section_url}'} {!--make sure the last segment matches the URL title, no capitalization allowed--} {if '{stash:url_title}'!='{last_segment}'} {redirect="{stash:section_url}/{if '{stash:classification_url}'}{stash:classification_url}/{/if}{stash:url_title}"} {if:else} {stash:embed:data-v5:feature-pages} {/if} {!--otherwise, redirect to 404 page--} {if:else} {redirect="404"} {/if} {/case} {/switchee} {/case} {case default="yes"} {!--feature pages--} {!--make sure there is a section with a seg2 value and if not redirect--} {if '{stash:section_url}'=='' && '{segment_2}'!=''} {redirect="{stash:url_title}"} {!--if section is blank - go to entry--} {if:elseif '{stash:section_url}'=='' } {!--make sure the last segment matches the URL title, no capitalization allowed--} {if '{stash:url_title}'!='{segment_1}'} {redirect="{stash:url_title}"} {if:else} {stash:embed:data-v5:feature-pages} {/if} {!--if section is not blank, make sure it's segment 1 or redirect--} {if:elseif '{stash:section_url}'!='' && '{stash:section_url}'!='{segment_1}'} {redirect="{stash:section_url}/{if '{stash:classification_url}'}{stash:classification_url}/{/if}{stash:url_title}"} {!--if older 'type' exists, make sure it's the seg2, else redirect--} {if:elseif '{stash:type_url}'!='' && '{stash:type_url}'!='{segment_2}'} {redirect="{stash:section_url}/{stash:type_url}/{stash:url_title}"} {!--if the classification type isn't the second segment or if 'class' is blank redirect them--} {if:elseif '{stash:classification_url}'!='' && '{stash:classification_url}'!='{segment_2}'} {redirect="{stash:section_url}/{stash:classification_url}/{stash:url_title}"} {if:elseif '{stash:classification_url}'=='' && '{segment_2}'!='{stash:url_title}'} {redirect="{stash:section_url}/{stash:url_title}"} {!--after everything above, if seg1 is the section to go entry--} {if:elseif '{segment_1}'=='{stash:section_url}'} {!--make sure the last segment matches the URL title, no capitalization allowed--} {if '{stash:url_title}'!='{last_segment}'} {redirect="{stash:section_url}/{if '{stash:classification_url}'!=''}{stash:classification_url}/{/if}{stash:url_title}"} {if:else} {stash:embed:data-v5:feature-pages} {/if} {!--otherwise, redirect to 404 page--} {if:else} {redirect="404"} {/if} {/case} {/switchee} {/case} {case value="71|72|73|88|141|142"} {!--custom (field_id: 49) fields--} {!--make sure there is a section with a seg2 value and if not redirect--} {if '{stash:section_url}'=='' && '{segment_2}'!=''} {redirect="{stash:url_title}"} {!--if section is blank - go to entry--} {if:elseif '{stash:section_url}'==''} {stash:embed:data-v5:listing-pages} {!--if section is not blank, make sure it's segment 1 or redirect--} {if:elseif '{stash:section_url}'!='' && '{stash:section_url}'!='{segment_1}'} {redirect="{stash:section_url}/{if '{stash:classification_url}'}{stash:classification_url}/{/if}{stash:url_title}"} {!--ensures custom_field_set entries like island-XYZ, etc get redirect to the classification segment and not the url_title which is seg1 and seg2 combined --} {if:elseif '{stash:section_url}'!='' && '{stash:classification_url}'!='' && '{stash:custom_url}'!='' && '{stash:custom_url}'!='{segment_3}'} {redirect="{stash:section_url}/{stash:classification_url}/{stash:custom_url}"} {if:elseif '{stash:section_url}'!='' && '{stash:classification_url}'!='' && '{stash:custom_url}'!='' && '{stash:custom_url}'=='{segment_3}'} {stash:embed:data-v5:listing-pages} {if:elseif '{stash:section_url}'!='' && '{stash:classification_url}'=='' && '{stash:custom_url}'!='' && '{stash:custom_url}'!='{segment_2}'} {redirect="{stash:section_url}/{stash:custom_url}"} {if:elseif '{stash:section_url}'!='' && '{stash:custom_url}'!='' && '{stash:custom_url}'=='{segment_2}'} {stash:embed:data-v5:listing-pages} {!--if the classification type isn't the second segment redirect them--} {if:elseif '{stash:classification_url}'!='' && '{stash:classification_url}'!='{segment_2}'} {redirect="{stash:section_url}/{stash:classification_url}/{stash:url_title}"} {if:elseif '{stash:classification_url}'=='' && '{segment_2}'!='{stash:url_title}'} {redirect="{stash:section_url}/{stash:url_title}"} {!--after everything above, if seg1 is the section to go entry--} {if:elseif '{segment_1}'=='{stash:section_url}'} {!--make sure the last segment matches the URL title, excluding custom_urls above, no capitalization allowed--} {if '{stash:url_title}'!='{last_segment}'} {redirect="{stash:section_url}/{if '{stash:classification_url}'!=''}{stash:classification_url}/{/if}{stash:url_title}"} {if:else} {stash:embed:data-v5:listing-pages} {/if} {!--otherwise, redirect to 404 page--} {if:else} {redirect="404"} {/if} {/case} {case value="116|77|98|26|109|86|113|12|164"} {!--entries (field_id: 27) fields--} {switchee variable="{segment_1}"} {case value="store|hawaii-blog|hawaii-videos"} {!--main pages of primary sections--} {!--make sure there is a section with a seg2 value and if not redirect--} {if '{stash:section_url}'=='' && '{segment_2}'!=''} {redirect="{stash:url_title}"} {!--if section is blank - go to entry--} {if:elseif '{stash:section_url}'=='' } {!--make sure the last segment matches the URL title, no capitalization allowed--} {if '{stash:url_title}'!='{segment_1}'} {redirect="{stash:url_title}"} {if:else} {stash:embed:data-v5:entry-pages} {/if} {!--if section is not blank, make sure it's segment 1 or redirect--} {if:elseif '{stash:section_url}'!='' && '{stash:section_url}'!='{segment_1}'} {redirect="{stash:section_url}/{if '{stash:classification_url}'}{stash:classification_url}/{/if}{stash:url_title}"} {!--if older 'type' exists, make sure it's the seg2, else redirect--} {if:elseif '{stash:type_url}'!='' && '{stash:type_url}'!='{segment_2}'} {redirect="{stash:section_url}/{stash:type_url}/{stash:url_title}"} {!--if the classification type isn't the second segment or if 'class' is blank redirect them--} {if:elseif '{stash:classification_url}'!='' && '{stash:classification_url}'!='{segment_2}'} {redirect="{stash:section_url}/{stash:classification_url}/{stash:url_title}"} {if:elseif '{stash:classification_url}'=='' && '{segment_2}'!='{stash:url_title}'} {redirect="{stash:section_url}/{stash:url_title}"} {!--after everything above, if seg1 is the section to go entry--} {if:elseif '{segment_1}'=='{stash:section_url}'} {!--make sure the last segment matches the URL title, no capitalization allowed--} {if '{stash:url_title}'!='{last_segment}'} {redirect="{stash:section_url}/{if '{stash:classification_url}'}{stash:classification_url}/{/if}{stash:url_title}"} {if:else} {stash:embed:data-v5:entry-pages} {/if} {!--otherwise, redirect to 404 page--} {if:else} {redirect="404"} {/if} {/case} {case default="yes"} {!--make sure there is a section with a seg2 value and if not redirect--} {if '{stash:section_url}'=='' && '{segment_2}'!=''} {redirect="{stash:url_title}"} {!--if section is blank - go to entry--} {if:elseif '{stash:section_url}'=='' } {!--make sure the last segment matches the URL title, no capitalization allowed--} {if '{stash:url_title}'!='{segment_1}'} {redirect="{stash:url_title}"} {if:else} {stash:embed:data-v5:entry-pages} {/if} {!--if section is not blank, make sure it's segment 1 or redirect--} {if:elseif '{stash:section_url}'!='' && '{stash:section_url}'!='{segment_1}'} {redirect="{stash:section_url}/{if '{stash:type_url}'}{stash:type_url}/{if:elseif '{stash:classification_url}'}{stash:classification_url}/{/if}{stash:url_title}"} {!--if older 'type' exists, make sure it's the seg2, else redirect--} {if:elseif '{stash:type_url}'!='' && '{stash:type_url}'!='{segment_2}'} {redirect="{stash:section_url}/{stash:type_url}/{stash:url_title}"} {!--if the classification type isn't the second segment or if 'class' and older 'type' are both blank redirect them--} {if:elseif '{stash:classification_url}'!='' && '{stash:classification_url}'!='{segment_2}'} {redirect="{stash:section_url}/{stash:classification_url}/{stash:url_title}"} {if:elseif '{stash:type_url}'!='' && '{stash:type_url}'!='{segment_2}'} {redirect="{stash:section_url}/{stash:type_url}/{stash:url_title}"} {if:elseif '{stash:classification_url}'=='' && '{stash:type_url}'=='' && '{segment_2}'!='{stash:url_title}'} {redirect="{stash:section_url}/{stash:url_title}"} {!--after everything above, if seg1 is the section to go entry--} {if:elseif '{segment_1}'=='{stash:section_url}'} {!--make sure the last segment matches the URL title, no capitalization allowed--} {if '{stash:url_title}'!='{last_segment}'} {redirect="{stash:section_url}/{if '{stash:type_url}'}{stash:type_url}/{if:elseif '{stash:classification_url}'}{stash:classification_url}/{/if}{stash:url_title}"} {if:else} {stash:embed:data-v5:entry-pages} {/if} {!--otherwise, redirect to 404 page--} {if:else} {redirect="404"} {/if} {/case} {/switchee} {/case} {case value="168|169|170|171"} {!--stash:embed:data-v5:fh-pages--} {redirect="404"} {/case} {case default="yes"} {redirect="404"} {/case} {/exp:switchee}