Sequential series of posts

Right now I have a list of all blog posts on my blog. I also have basic tags setup with taxonomies.

I want to also make a sequential series grouping of multiple posts. So for example, I would be able to mark certain blog posts as belonging to a series. Right now, I am trying to work with subsections to achieve this. I want to be able to page through to the next and previous page from the current page in the series.

I still want these pages to show up with the main listing of blog posts, so I use transparent = true, but when I do this, page.higher and page.lower allow you to go to pages outside of the subsection. Is there a better way to control this so that I can find pages only in the current series, and also allow posts to show up in the main page?

I’ve achieved this by setting before/after fields in the extra dictionary (and not doing any subsections)

{% macro series(list, isBefore) %}
<details>
  <summary>
    <h5 style="margin: 0; display: inline-block;">{% if isBefore %}Previously {% else %} Next {% endif %}in the
      series...</h5>
  </summary>
  <ul class="preview-list">
    {% for page in list %}
    {% if loop.index <= 5 %} {% set page=get_page(path="articles/" ~ page) %} <li class="card-preview">
      <a href="{{ page.permalink }}">
        <p>{{ page.title }}</p>
      </a>
      </li>
      {% endif %}
      {% endfor %}
  </ul>
</details>
{% endmacro series %}

And then on the page itself, I call the macro like so

{% if page.extra.after %}
    {{page_macros::series(list=page.extra.after, isBefore=false)}}
{%endif%}