1

I am trying to display columns with articles on the blogger homepage.

Each column with a specific tag.

Example:

Tag Cars

post 1 - post 2 - post 3 - post 4

Tag Houses

post 1 - post 2 - post 3 - post 4

Nature Tag

post 1 - post 2 - post 3 - post 4

I have found many worpress themes that you can easily do this.

I also found themes for bloggers who use Scripts to do this.

But in the case of Blogger I'm trying to do with the blogger's own codes without using script.

In my research I found some tutorials right here on the site like these:

Display posts on blogger based on Label?

Blogger - How to limit blogger's post label

Display posts on blogger based on Label?

How to show posts of certain label or category in a row in my blogger home page?

https://pt.stackoverflow.com/questions/95747/blogger-como-exibir-apenas-as-postagens-de-um-marcador-label-espec%C3%ADfico-na-ho

With help I had so far the maximum I got was in this code

 <b:if cond='data:blog.url == data:blog.homepageUrl'>
        <b:loop values='data:post.labels' var='label'>
            <b:if cond='data:label.isLast == "true"'>
                <b:if cond='data:label.name == "Carros"'>
                    <b:include data='post' name='post' />
                </b:if>
            </b:if>
        </b:loop>
    <b:else/>
        <b:include data='post' name='post' />
    </b:if>

This code does exactly what I need, but it has a problem, it only shows the latest posts with the tag "cars" in case it showed only 2, I have 20 posts with this tag, but the code does not search the other posts, just the last 2.

Any possible help would be grateful to improve the code.

Endou
  • 113
  • 1
  • 7

1 Answers1

0

You need to remove the conditional tag data:label.isLast

<b:if cond='data:blog.url == data:blog.homepageUrl'>
    <b:loop values='data:post.labels' var='label'>
        <b:if cond='data:label.name == "Carros"'>
            <b:include data='post' name='post' />
        </b:if>
    </b:loop>
<b:else/>
    <b:include data='post' name='post' />
</b:if>
  • Hello, thanks for answering my question. I removed the code "data: label.isLast" and only shows the last 2 posts tagged with "car". other posts with this tag do not appear. I also changed tags to see if it resolved and again only the latest posts appear. I found this article too, but I don't know if it can help with anything https://stackoverflow.com/questions/23605073/blogger-how-to-limit-bloggers-post-label – Endou Oct 21 '19 at 15:05
  • You are welcome, Blogger displays a limited number of all latest labeled posts on each index page nearly less than 26 posts or 1 MB of page content, So you get 2 posts because they are the latest posts of "car" within the limited range. Try to increase the number of posts on homepage or use JavaScript and JSON feed to get any possible number of posts by label. –  Oct 22 '19 at 06:48
  • I did what I suggested, and set it to display the last 50 posts but still only displayed 2 because the other posts with label cars were beyond those 50. But I understood how it works. I am trying to create something similar to what the colormag wordpress theme has: https://demo.themegrill.com/colormag/ But without scripting, only with the codes available on the blogger. – Endou Oct 22 '19 at 21:12