0

I'd like to display a list of entries using the Tag module:

{exp:stash:parse}          

    {exp:tag:related_entries
        channel="my_channel"
        disable="category_fields|member_data|trackbacks"
        status="open"
        dynamic="no"
        orderby="random"
        cache="no"
        paginate="bottom"
        limit="3"
    }
        {exp:stash:append_list name="my_channel_random" parse_tags='yes' parse_conditionals='yes' parse_depth="2"}
            {stash:item_title}{title}{/stash:item_title}
        {/exp:stash:append_list}
    {/exp:tag:related_entries}

    {exp:stash:set_list name="pagination"}
        {tag_paginate}
                {tag_pagination_links}
        {/tag_paginate}
    {/exp:stash:set_list}

{/exp:stash:parse}          

{exp:stash:get_list name="my_channel_random" limit="3"}
    <p>{item_title}</p>
{/exp:stash:get_list}

{exp:stash:get_list name="pagination" limit="1"}
    {next_page}
{/exp:stash:get_list}

{exp:stash:parse}

The only way I can think of doing this is by perhaps saving the already fetched IDs in a stash variable and adding this:

channel_entry_id="not {exp:stash:get name="viewed_ids"}"

But I can't get 'viewed_ids' to persist across pages:

        {exp:stash:append 
            name="viewed_ids"
            scope="site"
            save="yes"
            refresh="60"}
            {entry_id}|
        {/exp:stash:append}

Why isn't 'viewed_ids' saving across pagination links?

Is there another approach?

  • Have you looked at using pagination with Stash: github.com/croxton/Stash/wiki/… (scroll down to ###Pagination)? ie: use pagination when outputting your list instead of saving a separate 'pagination' stash list. – Romans-8---31-39 Aug 7 '19 at 20:25
  • Same problem, even stash's pagination brings back dups on paginated results – greebstreebling Aug 8 '19 at 8:03

Your Answer

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

Browse other questions tagged or ask your own question.