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 https://pmdesign.dev 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.