pmoreno-rodriguez / grav-theme-mundana

Mundana Jekyll theme ported to Grav
MIT License
7 stars 2 forks source link

Featured posts are not listed #7

Closed ventoux84 closed 5 months ago

ventoux84 commented 5 months ago

The title of the "Featured" section is displayed, but the articles are not listed.

All settings appear to be correct. In the theme: show featured posts, featured posts category and number of featured posts to show.

In blog-config: show featured posts

In the blog post: assigned to the category declared in the theme parameters.

pmoreno-rodriguez commented 5 months ago

@ventoux84

Well, the problem is that you are defining the "featured" category instead of the tag. The Mundana theme filters featured articles by tag, not category.

In partials/sidebar/featured you can see the related code:

  {% for p in page.evaluate({'@taxonomy.tag':featuredposts_tag}).order('date', 'desc').slice(0,featuredposts_number) %}

The problem is that in the theme settings, "Featured posts category" appears in the featured posts config, instead of "Featured posts tag". I should fix this in the next version.

Try using the tags from your taxonomy for featured posts.

ventoux84 commented 5 months ago

OK, featured is relative to tags and no to categories.

But "featured" seems to bee hard coded too ! The only one tag that works is "featured" and nothing else.

pmoreno-rodriguez commented 5 months ago

@ventoux84 , the featured tag is not hard coded, you have an option in theme configuration to set this:

In base.html.twig:

{% set featuredposts_tag = theme_var('featuredposts_tag')|defined('featured') %}

The problem is in theme configuration, this variable is named as featuredposts_category instead featuredposts_tag.

I need to change this issue in theme configuration for next version

ventoux84 commented 5 months ago

Yes, but nothing else than "featured" works.

I've entered the French word "favoris" in this variable in theme config. Then I assigned this tag to an article by also creating the tag. Nothing is displayed in the sidebar under the title "Featured".

If I add the "featured" tag to the same article, it's displayed in the sidebar under the "Featured" title.

pmoreno-rodriguez commented 5 months ago

@ventoux84 Can you try the featuredposts branch to see if featured posts now appear in sidebar

ventoux84 commented 5 months ago

OK,I'll do it tomorrow; mañana, por la mañana.

ventoux84 commented 5 months ago

I tested the featuredposts branch and i saw that featured posts now appear in sidebar. Thanks, it's perfect.