Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set default values for Taxonomies ? #15

Open
fabrizioT opened this issue Jan 18, 2017 · 4 comments
Open

How to set default values for Taxonomies ? #15

fabrizioT opened this issue Jan 18, 2017 · 4 comments

Comments

@fabrizioT
Copy link

fabrizioT commented Jan 18, 2017

Let's suppose i need to add a default value for "tag" or "category" ( or "author" ).
How am i supposed to do that ?

@beamaria
Copy link

Same question here! How to add a default category to the default route ?

@rhukster
Copy link
Member

I"m not sure how this would work? I mean every page in your site gets a default tag? how do you determine what page gets what? Sounds like the job of a custom plugin.

@beamaria
Copy link

beamaria commented Mar 14, 2020

The plugin I use is the default Taxonomy list by Team Grav.
My problem is the plugin accepts only ONE value in "default route" field, but if I have two blogs in my site -"News" and "Features" , both blog_list type, belonging respectively to category News and category Features and both children of "Blog" page.
"Blog" (blog_list type) is set to be a multiple collection page using :

content: items: - '@taxonomy.category':news - '@taxonomy.category': features leading: 0 columns: 2 limit: 4 order: by: date dir: desc show_date: false pagination: true url_taxonomy_filters: true

The tags are correctly displayed in "News" or "Features" page and they belong to the correct category, but clicking on any them I have an error 404 - page not found. This is because in the default route of the plugin I can't write: /blog/news or /blog/features. If I write ONE of this routes to categories the links are correctly displayed for THAT category, but there is nothing for the other. I suppose is a problem of base_url .
I use helium theme +Gantry 5, with a sidebar custom html particle in which I wrote this code:

{% include 'partials/taxonomylist.html.twig' with {base_url: my_url, taxonomy: 'tag', children_only: true} %}

but of course isn't working, because the base url is not set in the default route of the plugin. I also tried with base url set to absolute in configuration and this messed up all the site (luckily a local one!!)
To cut a long story short: is there a system to write a "wild card" for the base _url route in the plugin and in the code which display the results in the front-end?
Thanks!

@beamaria
Copy link

Ok, found the solution at least for taxonomy list.
In my custom_html particle I wrote

{% include 'partials/taxonomylist.html.twig' with {base_url: page.url, 'taxonomy':'tag', children_only: true} %}

and this solved the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants