pmoreno-rodriguez / grav-theme-editorial

Editorial is a GravCMS port of the Editorial theme from HTML5Up.net.
Other
13 stars 2 forks source link

"more featured posts" button suggestion #38

Closed pmoreno-rodriguez closed 2 months ago

pmoreno-rodriguez commented 7 months ago

If I may make a suggestion in passing: I'm not sure it's relevant to list the "featured" tag, since the publications are already displayed above with a "more featured posts" button. Unfortunately I don't see an option in the Taxonomy List plugin to easily exclude tags from the list...

Originally posted by @Fazarel in https://github.com/pmoreno-rodriguez/grav-theme-editorial/issues/37#issuecomment-1825787981

pmoreno-rodriguez commented 7 months ago

Unfortunately I don't see an option in the Taxonomy List plugin to easily exclude tags from the list...

Could you test the recent 2.0.5 release to view the new changes in theme options to enable/disable sectións in sidebar?.

Fazarel commented 7 months ago

The ability to activate sidebar sections from theme options works with the new release.

But it doesn't address the issue raised in my post. The idea is to activate the "Popular tags" section and list all the tags (tag1, tag2, tag3...) except the tag "featured". This tag is irrelevant because it has no meaning in itself, but a technical use: to select the articles to be displayed in the "Featured Posts" section.

pmoreno-rodriguez commented 7 months ago

@Fazarel can you test with this change in your taxonomylist.html.twig file?

{% set featured_tag = theme_var('featured_tag') %}

{% for tax, value in taxlist[taxonomy] if tax != featured_tag %}
pmoreno-rodriguez commented 7 months ago

However, in my opinion, featured is one more tag, by which you can filter the blog articles, and you can have as many as you want, although with the theme configuration you can only put a maximum of five in the sidebar. It's not clear to me that I should make a modification to this in the sense you indicate.

Fazarel commented 7 months ago

@Fazarel can you test with this change in your taxonomylist.html.twig file?

{% set featured_tag = theme_var('featured_tag') %}

{% for tax, value in taxlist[taxonomy] if tax != featured_tag %}

It works, thank you!

However, in my opinion, featured is one more tag, by which you can filter the blog articles, and you can have as many as you want, although with the theme configuration you can only put a maximum of five in the sidebar. It's not clear to me that I should make a modification to this in the sense you indicate.

In the sidebar, at the end of the "Featured Posts" section, you already have a "More featured posts" button to filter all those articles. It's the same functionality as the featured tag in Popular tags, isn't it?

But since it's legitimate to have different points of view or uses on this subject, why not expose this option in the theme settings?

in blueprints.yaml, after sidebar_showtaxonomy

sidebar_showfeaturedtag:
    type: toggle
    label: EDITORIAL.ADMIN.THEME.SIDEBAR.SHOW_FEATURED
    help: EDITORIAL.ADMIN.THEME.SIDEBAR.SHOW_FEATURED_HELP
    highlight: 1
    default: 1
    options:
        1: PLUGIN_ADMIN.YES
        0: PLUGIN_ADMIN.NO

in taxonomylist.html.twig

{# Settings in Sidebar #}
{% if theme_var('sidebar_showfeaturedtag') == false %}
    {% set featured_tag = theme_var('featured_tag') %}
{% endif %}

...

{% for tax, value in taxlist[taxonomy] if tax != featured_tag %}

in languages.yaml, after SHOW_TAXONOMY_HELP, suggestions for translations:

en:
SHOW_FEATURED: Show Featured Tag in Popular Tags
SHOW_FEATURED_HELP: 'See/hide the "featured tag" in "Popular Tags" list'

es:
SHOW_FEATURED: Mostrar Etiqueta para destacados en Etiquetas Populares
SHOW_FEATURED_HELP: 'Ver/ocultar la "etiqueta para destacados" en la lista de "Etiquetas populares"'

fr:
SHOW_FEATURED : "Afficher le tag des articles promus dans les tags populaires"
SHOW_FEATURED_HELP : "Voir/masquer l'étiquette utilisée pour les articles promus dans la liste des 'Tags populaires'"
pmoreno-rodriguez commented 7 months ago

The featured articles section does not depend on any plugin, it searches within the blog collection, depending on whether the tag is 'featured_tag' (defined in the theme). A user might want to have the 'Featured' section enabled without the 'Popular tags' section, or vice versa. Let's imagine for a moment a blog with 500 posts, and that the user wants to highlight 20. Could they do it? Obviously, yes, although it can only show 5 in the sidebar (this option can be changed in the theme blueprint). If you click on the 'More featured posts' button you could obtain a filtered list of the articles marked as featured. The opposite situation could also occur, where the user only wanted to have the popular tags section, without having the featured posts section activated. Finally, I will review all the possible options more carefully in order to offer the user all the possible configuration alternatives.

pmoreno-rodriguez commented 7 months ago

Regarding translation suggestions, could you make a pull request?

pmoreno-rodriguez commented 2 months ago

PR#33 already merged.