Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Mercury theme – Front page -> Filter by: Maintag -> has no effect on …

  • #11623
    Avatar photo[anonymous]

    Dear all –

    I am using Mercury 2.6.0.0 with Publii 0.44.4 (build 16557).
    I created several posts, added tags and a Maintag to each post, and now I would like to show the Maintags on the Frontpage, only.

    Under Theme -> Layout -> Front page  -> Filter by: I chose Maintag, but this has no effect at all. Does this functionality not work, or is there anything I forgot to adjust ?

    Thanks in advance, Michael

    #11641
    Avatar photo[anonymous]
    #11649
    Avatar photo[anonymous]

    Thank you, @candidexmedia,

    I have seen these forum entries, but my question is, why there is this Maintag filter thing in Publii, if it does not work. It is quite irritating for users like me, who want to use Publii without further programming.

    My suggestion to the Publii team ist, either to remove this filter from the App or make it work the way the name promises. I would prefer the second solution.

    Cheers, Michael

    #11685
    Avatar photo[anonymous]

    Hi [anonymous] sorry for misunderstanding your post! I even went back to the first link and realized that the helper has to do with displaying posts based on their maintag, but nothing to do with only displaying or fetching tags that are used at least once as a maintag.

    much.fun wrote:

    why there is this Maintag filter thing in Publii, if it does not work.

    The filter does work, in the sense that clicking on the name of a tag should only show posts that have that tag as a main tag. The issue is that all the tags are displayed — even the ones that aren’t used as main tags in any post. Clicking on those returns no posts. I think most of us would expect those tags to not be displayed in the list of tags when we select “Filter by: Maintag”. There needs to be an additional checkbox called “Hide non-Maintags from the list of filters” or something, but based on what I’ve read in the dev docs, this isn’t possible.

    I did some further digging in the code, and it looks like Publii is using an external library called Isotope to handle this filtering mechanism and its animation. So, all the posts are displayed at the start, and when a user clicks on a tag label, the other posts are hidden (using JavaScript and CSS). I’m not a Javascript expert, so I don’t fully understand how the external library and Publii work together, but Publii should consider adding a line of code that hides any labels that don’t display any posts/hides all posts. This would be an option, in the absence of a helper that can fetch an array of just Maintags.

    I’m also in need of a way to only display Maintags for a new site I’m working on. For now, though, I’ll use the getTagsHelper technique and manually select the tags that I want to display as filters. Once I get around to doing that, I’ll share a patch of the Mercury theme with Theme settings options to make this a bit easier.

    #11687
    Avatar photo[anonymous]

    Hi @candixmedia,

    thanks for all your effort in this issue.

    I am still not sure, what the programmers thought, what these Maintags are good for, in respect of the App. I mean, I can set them when writing a post, but there is no functionality which uses it ( except I go for programming ).

    #11688
    Avatar photo[anonymous]

    Could this helper possibly achieve the goal?

    {{#getPostsByMainTag}}

    #11689
    Avatar photo[anonymous]

    I am quite sure it does, but it does not solve the issue with the Publii App

    #11692
    Avatar photo[anonymous]

    I’ve created a feature request: https://github.com/GetPublii/Publii/issues/1329

    Feel free to chime in

    #11693
    Avatar photo[anonymous]
    much.fun wrote:

    I am still not sure, what the programmers thought, what these Maintags are good for, in respect of the App. I mean, I can set them when writing a post, but there is no functionality which uses it ( except I go for programming ).

    My original, detailed reply never posted, but the Maintags feature is separate from the filtering function present in certain themes.

    Maintags are used in and useful for themes that:

    • Want to display breadcrumbs
    • Have tag-based sections on the homepage, and don’t want the same post/article appearing in multiple sections (I’m thinking of sites like The Walrus and Inverse)
    • Want to highlight the primary tag for a post in a visual manner (like for Publii themes Taste and TechNews):

    #11694
    Avatar photo[anonymous]

    Again: If the Publii App provide the possibility to set a filter for the Frontpage to use Maintags, only, I would like to see only Maintags in the List of tags on the Frontpage.

    Bildschirmfoto-2024-02-02-um-19.19.42

    #11700
    Avatar photo[anonymous]
    much.fun wrote:

    Again: If the Publii App provide the possibility to set a filter for the Frontpage to use Maintags, only, I would like to see only Maintags in the List of tags on the Frontpage.

    This is an issue with the Theme(s) that display this setting, not the app or Maintags in itself — that’s why it’s under Theme settings. Theme developers can set certain parameters that can be edited in the app, but don’t come from the app out of the box. That’s why different themes have different Theme settings.

    First, Publii (or someone out there with the skillset) needs to create some kind of helper that can fetch all the tags that have been used as Maintags in order for the listed tags to be modified. Right now, as a developer, it’s only possible to list every single tag, or only display tags that the user has handpicked by ID.

    That is what this GitHub issue is hoping to address: https://github.com/GetPublii/Publii/issues/1329

    Once that helper mechanism has been created, the theme files can be modified and allow users to filter down the list of displayed tags automatically.

    #11741
    Avatar photo[anonymous]

    Ok, I see. Not very happy with this answer though, but as a user I will wait vor the mentioned helper thing.

    Thanks again for all your explanations and patience 🙂