Show tags from two blogs with taxonomylist plugin

I’m messing around setting up popular tags in the sidebar (with the taxonomylist plugin) and I’m not getting what I want. The thing is that with one blog type page, the code works fine, but with more than one blog type page, it no longer works well.

At I have two blog-type pages, one for tutorials and another for code. Both are blog types and I would like to show the entire taxonomy of the site in the sidebar, but the tag links, when they are on a page other than the blog page, do not point well to it.

The code in sidebar would be the following:

{#Set blog settings#}
{% set themeBlog = theme_var('blog_route')|defined('/blog') %}
{% set blog = page.find(header_var('blog_url')|defined(themeBlog)) %}
{% set feed_url = blog.url == '/' or blog.url == base_url_relative ? (base_url_relative~'/'~blog.slug) : blog.url %}
{% set new_base_url = blog.url == '/' ? '' : blog.url %}

{# Taxonomy list (if taxonomylist plugin is enabled) #}
{% if showTaxonomyList %}
{% set taxlist = children_only is defined ? taxonomylist.getChildPagesTags() : taxonomylist.get() %}
{# If there is a taxonomy, load taxonomylist.html.twig #}
{% if taxlist %}
{% include 'partials/sidebar/taxonomylist.html.twig'
with {'base_url':new_base_url, 'taxonomy':'tag', 'block_title': 'FACTION.SIDEBAR.TAXONOMYLIST'|t} %}
{% endif %}
{% endif %}

Obviously, if I’m not on a blog page, it defaults to the route defined in the theme (blog_route), and if it’s not set, the url is the root of the site, which is not what I want to achieve.

For example, if I have the tag tag1 and tag2 on blog1, and the tag tag3 and tag4 on blog2, when I show the popular tags in the sidebar, I would like the link to point to http://gravsite/blog1/tag:tag1 when I click on tag1. and when you click on tag3, make the link point to http://gravsite/blog2/tag:tag3.

I don’t know how to mix the tags from both blogs in the same popular tags widget.

I have fixed the sidebar code a little, because I realized that it never passed the children_only variable, this is how it looks for now:


{# List of taxonomies (if the taxonomylist plugin is enabled) #}
{% if showTaxonomyList %}
{% includes 'partials/sidebar/taxonomylist.html.twig'
with {'base_url':new_base_url, 'taxonomy':'tag', 'block_title': 'FACTION.SIDEBAR.TAXONOMYLIST'|t, Children_only: true} %}
{% will end if %}

And in taxonomylist.html.twig:

{% set tax list = children_only?? TRUE ? taxonomylist.getChildPagesTags() : taxonomylist.get() %}
{# If there is a taxonomy, load taxonomylist.html.twig #}
{% if taxlist and page.template == 'blog' %}
          <h2>{{ 'FACTION.SIDEBAR.TAXONOMYLIST'|t }}</h2>
      <ul class="actions">
          {% for taxes,value in tax list[taxonomy] %}
              {% set label_class = uri.param(taxonomy) == tax? 'secondary' : 'primary' %}
                  <a class="small secondary button {{ label_class }}" href="{{ base_url }}/{{ taxonomy }}{{ config.system.param_sep }}{{ tax }}">{{ tax }}< /a>
          {% end of %}
{% will end if %}

With this I ensure that the popular tags are seen on the blog pages and that only those that refer to the pages of the blog to which they belong are seen.

It is still pending to be able to mix collections from different blogs and show all the tags of all the blogs and have each tag link to its corresponding blog page.