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.

General

Title on results page filtered by taxonomy

Solved by Pedro M View solution

Started by Pedro M 4 years ago · 2 replies · 561 views
4 years ago

Hello there.

Is there a way to display a title with the specified taxonomy filter?

When you click on a taxonomy tag, the articles corresponding to that taxonomy are displayed, but the title of the page is that of the blog.

For example at: http://localhost/grav/blog/tag:tag1, I would like to display in the page title:

N items with tag1 taxonomy found, and not the title of the Blog page.

taxonomy_filter|687x500

Thanks.

4 years ago Solution

Hi
Finally I've found a solution for this question in Grav Coder Theme. Simply I've added this lines to a blog.html.twig:

TWIG
{% if uri.param('category') %}
    {% set page_title = theme_config.listing_title.taxonomy.category | default('Posts in Category: ') ~ uri.param('category') %}
{% elseif uri.param('tag') %}
    {% set page_title = theme_config.listing_title.taxonomy.tag | default('Posts with Tag: ') ~ uri.param('tag') %}
{% else %}
    {% set page_title = theme_config.listing_title.blog | default('Blog') %}
{% endif %}

I hope I helped

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 80 10 hours ago
General · by pamtbaau, 15 hours ago
1 51 15 hours ago
General · by Andy Miller, 1 day ago
0 45 1 day ago
General · by Marcel, 12 months ago
6 346 5 days ago
General · by Duc , 5 days ago
3 40 5 days ago