0

We've used Tagger on a website and it works just fine, but the client would like a 404 error to display if someone manually typed in

Example: http://www.example.com/projects/tags/education/

manually changed to http://www.example.com/products/tags/not-a-tag

results in a blank page vs. a 404.

{exp:tagger:entries_quick tag="{segment_3}"}
          <h1>Press Room: <span style="text-transform: capitalize;">{segment_3}</span></h1>
          {/exp:tagger:entries_quick}
          {exp:tagger:entries_quick tag="{segment_3}"}
          {exp:channel:entries channel="press_post" limit="5" dynamic="yes" entry_id="{tagger:entry_ids}" paginate="bottom"}
                    <div class="blogpost">
                        <div class="fourty">
                        {press_images limit="1"}
                            <img src="{image:url:small}" alt="" class="siteimage" />
                          {/press_images}
                        </div><!--fourty-->
                        <div class="sixty">
                            <h2>{title}</h2>
                            <p class="tags">

                {entry_date format="%M %j, %Y"} | Tags: 
          {exp:tagger:tags entry_id="{entry_id}" limit="1" dynamic="yes"}
          <a href="{site_url}index.php/press-room/tags/{tagger:tag_name}/" class="taglink">{tagger:tag_name}</a>
          {/exp:tagger:tags}

I tried the below, but it doesn't forward off. {exp:channel:entries channel="press_post" limit="5" dynamic="yes" entry_id="{tagger:entry_ids}" paginate="bottom"} {if no_results}{redirect="404"}{/if}

Live Site: http://goo.gl/Dlsj2G

0

I tried to understand your code, but I couldn't find any reason to split exp:tagger:entries_quick into two parts or where you're closing the second one, but I gonna try to help you.

You code doesn't work because the exp:channel:entries will never run if there is no results on exp:tagger:entries_quick.

Inside {exp:tagger:entries}, you can set a conditional {if tagger:no_entries}:

{exp:tagger:entries tag="{segment_2}" custom_fields="press_images"}

    {if tagger:no_entries}
        {redirect=""}
    {/if}
    <h1>Press Room: <span style="text-transform: capitalize;">{segment_3}</span></h1>

    [...]

{/exp:tagger:entries}

You can get more info on Tagger docs.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.