Taxonomies: Is "category" and "tag" mandatory?


#1

Hi all,

This is my second problem with Grav (first was with comment system) and I have some dudes about:

I’m using taxonomylist and archives plugin under Deliver theme but there aren’t running well.

I change “category” and “tag” taxonomies terms to “categoría” and “Etiqueta” but, with these, neither “taxonomy list” and “archives” show any results.

(Archives show relates page in blog entry list page, but adding @self filters in conf, but not show in article blog page.)

This is my question: is mandatory to use “category” and “tag”? Doc says that is a suggestion.

I look for something similar in forum, but only encounter a similar thread without solution.

Thanks so much in advance, and sorry for my awful english, is not my mother language.

Best regards.

Salud y Revolución.

Lobo.


#2

They are not required, but if you change them you will probably have to update your plugin configurations for archives plugin as they are defaulting to use category. TaxonomyList should just work though as it will use any filter.

NOTE: You do need to update your taxonomy types in your site.yaml file in order for Grav to know what taxomonies are going to be used: https://learn.getgrav.org/content/taxonomy


#3

Hi @rhuk,

Thanks so much for your answer.

I view that is right for TaxonomyList, need to modify Deliver template in order to catch «Etiqueta», but I modified archives.yaml and was not running, and is not running still.

Site.yaml was modified too, of course.

I paste mi conf:

Taxonmy part of site.yaml:

[...]
taxonomies: 
   - categoría
   - Etiqueta
   - category
   - tag

Archives.yaml conf:

enabled: true
built_in_css: true
date_display_format: 'F Y'
show_count: true
limit: 12
order:
    by: date
    dir: desc
filter_combinator: and
filters:
    - categoría: [diario-e]
    - category: [diario-e]
    - '@self'
taxonomy_names:
    month: archives_month
    year: archives_year

I try to maintain category and tag in conf, but still no success.

Perhaps, should be conf related with some Twig template?

Thanks again.

Kind regards.

Salud y Revolución.

Lobo.


#4

Solved the issue with taxnomies, I modified blog_item.html.twig and taxonomylist.html.twig templates in Deliver theme.

But, I test (for test) with sidebar.html.twig template in plugin and Grav catch a Twig_error_runtime.

Copying plugin template to partial code in sidebar.html.twig, Grav fails with:

/opt/bitnami/apache/htdocs/user/themes/deliver/templates/partials/sidebar.html.twig
                  
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna.</p>
</div>
{# Empezamos pruebas con el complemento de taxnomias #}
{% if config.plugins.taxonomylist.enabled %}
<div class="sidebar-content">
    <h4>Etiquetas populares</h4>
    {% set taxlist = taxonomylist.get() %}
 
       {% if taxlist %}
       <span class="tags">
            {% for tax,value in taxlist[taxonomy] %}
                {% set active = uri.param(taxonomy) == tax ? 'active' : '' %}
                <a class="{{ active }}" href="{{ base_url }}/{{ taxonomy }}{{ config.system.param_sep }}{{ tax }}">{{ tax }}</a>
            {% endfor %}
      </span>
      {% endif %}
 
</div>
{% endif %}
{% if config.plugins.archives.enabled %}
<div class="sidebar-content">
    <h4>Archives</h4>
                          
              Arguments
          
          
              "An exception has been thrown during the rendering of a template ("Illegal offset type in isset or empty")."

Fail is for for loop.

I say only for if there are a bug on taxonomylist plugin or wathever, how I say I can solve issue with taxonomy.

Continue in order to solve archives issue.

Thanks.

Regards.

Salud y Revolución.

Lobo.


#5

Copying plugin template to partial code in sidebar.html.twig, Grav fails with:

So sorry, I modify, again, taxonomylist.html.twig file in Deliver theme and, now, included these code from TaxonomyList plugin and runs well.

Perhaps, only fail when is used in sidebar because is different type of output.

Sorry again, how I say before I’m not a programmer and only have some basic skills of it.

Still fighting with Archives sidebar.

Salud y Revolución.

Lobo.


#6

I can solve issue with Archives too, but not in proper way.

If I change in archives.yaml file in plugin directory, archives runs, is taking my user/conf/plugins/archives.yaml conf but seems that don’t apply.

Differents from debug info.

Modified user/plugin/archives/archives.yamlfile:

archives

    array:9 [
      "enabled" => true
      "built_in_css" => true
      "date_display_format" => "F Y"
      "show_count" => true
      "limit" => 12
      "order" => array:2 [
        "by" => "date"
        "dir" => "desc"
      ]
      "filter_combinator" => "and"
      "filters" => array:2 [
        "categoría" => "diario-e"
        0 => array:1 [
          "categoría" => array:1 [
            0 => "diario-e"
          ]
        ]
      ]
      "taxonomy_names" => array:2 [
        "month" => "archives_month"
        "year" => "archives_year"
      ]
    ]

Without modifying user/plugin/archives/archives.yamlfile:

archives

    array:9 [
      "enabled" => true
      "built_in_css" => true
      "date_display_format" => "F Y"
      "show_count" => true
      "limit" => 12
      "order" => array:2 [
        "by" => "date"
        "dir" => "desc"
      ]
      "filter_combinator" => "and"
      "filters" => array:2 [
        "category" => "blog"
        0 => array:1 [
          "categoría" => array:1 [
            0 => "diario-e"
          ]
        ]
      ]
      "taxonomy_names" => array:2 [
        "month" => "archives_month"
        "year" => "archives_year"
      ]
    ]

Modify consist only in change filters section from:

filters:
    category: blog

to:

filters:
    categoría: diario-e

Is the same behaviour that I obtain from comments plugin.

So, it’s possible that any conf says Grav to get this behaviour?

Thanks.

Best regards.

Salud y Revolución.

Lobo.

Updated: Fixed archives.yaml change, error with cut and copy.