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.

Support

How do Taxonomy List URLs work?

Solved by Theo M Jones View solution

Started by Theo M Jones 9 years ago · 5 replies · 2227 views
9 years ago

I'm banging my head over this. So I have the taxonomyList plugin producing a tag cloud. Their template is:

TWIG
{% if taxlist %}
<div class="tags">
    {% for tax,value in taxlist[taxonomy] %}
         {% set active = uri.param(taxonomy) == tax ? 'active' : '' %}
           <a class="{{ active }}" href="{{ base_url }}/{{ taxonomy }}:{{ tax }}">
                 {{ tax }}
           </a>
     {% endfor %}
</div>
{% endif %}

On my local machine this produces the url http://localhost:8888/tag:example
This just produces a 404 for me.

I call it in a separate /tags page that lists all the tags on the site. This example was taken from the antimatter theme's sidebar.

TWIG
{% if config.plugins.taxonomylist.enabled %}
    {% include 'partials/taxonomylist.html.twig' with {'base_url':new_base_url, 'taxonomy':'tag'} %}
{% endif %}

My question is how does this work and can Grab create the required pages for this?

9 years ago

Is your local machine a Windows? If so, param_sep should be set to a semi-colon (;) in configuration. Then use {{ param_sep }} in your Twig so you'll always be using the correct separator.

9 years ago Solution

Solved. My problem was because I wasn't using the server root directory for my grav install. So the plugin was creating the link back to localhost:8888/tag:example. Whereas my site was at localhost:8888/site.com/. My mistake, but might as well leave this up in case someone else encounters this.

8 years ago

Hello guys,
I have almost the same problem, but not exactly ...

What should catch the /tag:something slug in the url?

If I click on the tag listed in the post itself, it redirects me to the root/tag:something and that gives me 404, but if I click on the tag inside category (folder with items) gives me (root/some-category/tag:something) and that lists all posts containing this tag I've clicked in the particular folder.

The goal is to get list of all items with this tag name, no matter what is the current url. Why is that not working by default?

I am using custom theme based on quark, but even with quark itself I have the same issue. Under Windows (XAMPP) and Ubuntu 16.04. What I miss here?

Thanks!

last edited 03/31/18 by Unknown
8 years ago

Okay, I solved it. If you manage to list all (children) the posts in the home page, then all tag selections work.

// I still can't force my brain to think plain without DBs :D

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 50 6 hours ago
Support · by Anna, 2 days ago
2 58 9 hours ago
Support · by Justin Young, 10 hours ago
1 28 10 hours ago
Support · by Duc , 1 week ago
2 63 5 days ago
Support · by Colin Hume, 1 week ago
2 53 5 days ago