getgrav / grav-plugin-taxonomylist

Grav TaxonomyList Plugin

Home Page:https://getgrav.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't display if the blog is nested in a page

Heraes-git opened this issue · comments

Presentation of the problem

The taxonomylist doesn't show in the first page of my paginated blog, if that blog is included as a part of a a parent page (even if the blog isn't set as a modular page, but is just a regular page included).

On the other hand, it shows up if I reach a sub-page of the pagination. Probably because the pagination causes the URL to be augmented with the blog's URI part.

If I go back in the first page of the pagination, the taxonomylist stays visible. But as soon as I go to another page and come back, and reach the root of the blog's parent page again, the taxonomy disappear.

Configuration

Filesystem

I use a blog named "presse" as a kind of module that is part of a parent page.
I don't set this blog as a modular page, as it causes some issues, but just a regular page.
Here's the tree :

2019-09-13_17h09m38s_sublime_text

/critiques is the URI of the master page.
/critiques/presse is the URI part of the blog itself, but it is not supposed to be reached directly excepted when paginating.

Templates

Frontmatter of the /critiques/presse page :

---
title: Presse
visible: true
routable: true
process:
    twig: true
twig:
  cache: false
content:
    items: '@self.children'
    order:
        by: date
        dir: desc
    pagination: true
unitegallery:
    gallery_id: 'presse_gal01'
    gallery_theme: 'tiles'
    assets_in_meta: true
---

Frontmatter of one of the items (default.fr.md):

---
title: 'Concert du 19-04-2008, à la Salle des concerts'
published_date: 19-04-2008
taxonomy:
    tag: 'Maine Libre'
    date: '2008'
---

The relevant part of my custom blog template :

{# ___FOOTER___ #}

<div class="footer">
	{% if config.plugins.pagination.enabled and collection.params.pagination %}
		{% include "#{DNA_conf.partials}/pagination.html.twig" with {'base_url':page.url, 'pagination':collection.params.pagination} %}
	{% endif %}
	{% if config.plugins.taxonomylist.enabled %}
		{# include "#{DNA_conf.partials}/taxonomy_list.html.twig" with {'base_url':page.url, 'taxonomy':'tag', 'children_only':false} #}
		{% include "#{DNA_conf.partials}/taxonomy_list.html.twig" with {'base_url':"/critiques/presse", 'taxonomy':'tag', 'children_only':false} %}
	{% endif %}
</div>

Note : don't take care of the DNA variables. They are part of my custom template system.
Here, the #{DNA_conf.partials} just point to the normal /partials folder.

Test performed

For testing purpose, I have disabled the normal way to use base_url':page.url, and replaced it by /critiques/presse to match the pagination's behavior that usually make the taxonomylist to appear.

Then, I routed my browser to /critiques (the normal way to access my blog).

Result

It doesn't show the taxonomylist.

Clues

The plugin probably wants that the whole URL to be matching what's specified as a base_url in the template.

Second test performed

I didn't changed the template, but tried to reach /critiques/presse, and it displayed the taxonomylist ! So the conclusion is that my assumption is correct.

Third test performed

I changed the template by 'base_url':"/critiques", cleared the cache, and reached the /critiques page in the browser, but the problem still persists (here, the cause is probably that the collection containing the taxons isn't /critiques, but /critiques/presse).

Normal behavior expected

We should be able to display the taxonomylist based on what's indicated in the template, as a base_url, as originally designed by the plugin and explaned in the presentation :

Where my_url is the URL to link to where the collection can be filtered (e.g. /blog) and the taxonomy points to a specific taxonomy type to display (e.g. tag).

, wich implies that we can indicate a page containing the taxons, that is different from the blog's route itself.

As a clarification, here's the configurations that shoud work :

Conf1 :
Blog's file route : /01-blog
Blog's access route : /blog
Taxonomylist point to : /blog

Conf2 :
Blog's file route : /01-blog
Blog's access route : /blog
Taxonomylist point to : /another/page

Conf3 (similar to my actual configuration) :
Blog's file route : /04-presentation/01-blog
Blog's access route : /presentation
Taxonomylist point to : /presentation/blog

But the Conf3 does'nt work (I don't know for Conf2).