Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Display categories in sidebar - taxonomy plugin

Started by Randall Paul Allen 6 years ago · 2 replies · 728 views
6 years ago

I’m somewhat confused. I’m using Antimatter theme. I’m trying to add categories to the sidebar under the Popular Tags. Here’s what I did.

In the partial sidebar.html.twig, I copied the code for the popular tags and pasted it again just below the original code. I was careful to keep before the closing tag of the tag {% if config.plugins.taxonomylist.enabled %}.

In the part I pasted in, I changed “TAGS” within SIDEBAR.POPULAR_TAGS.HEADLINE to CATEGORIES.

In the theme language.yaml file, I added
POPULAR_CATEGORIES:
HEADLINE: Categories
below the same entry for the POPULAR_TAGS.

Back in the partial sidebar.html.twig in the line of code:
{% include 'partials/taxonomylist.html.twig' with {'base_url':new_base_url, 'taxonomy':'tag'} %}
I changed ‘tag’ to ‘category’.

This worked, except it displayed both the tags and the categories. I don’t want the tags to be displayed, just the categories. The tags are already displayed in the Popular Tags area.

Just as an experiment, since the Taxonomy part of the page editing area includes areas for adding tags, categories and authors, I replaced ‘tag’ with author in the above line of code. This caused the author to be displayed-JUST THE AUTHOR and not the tags. This is what I want with the categories.

So when I replace ‘tag’ with ‘category’, why do I get categories AND tags, but when I replace ‘tag’ with ‘author’ I get just the author? How can I get it to display categories without the tags?

6 years ago

can you post a snipped of your code?
I did something similar to display the entire list of categories after the tags and just copied pasted the code for tags and changed to ‘taxonomy’:‘category’. It works great in my case, so maybe you have an error in your code.

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 44 1 week ago
Plugins · by Xavier, 4 weeks ago
2 54 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1181 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 48 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 73 2 months ago