Sprony

Customer
Hi Russ,

I'm not sure if it's because of the template, but I'm running into a problem if I want to add the view count to my articles. I found this solution. I searched for this in the post_article_marcos:

<li><xf:avatar user="{$thread.User}" size="xxs" defaultname="{$thread.username}"/></li>
<li class="articlePreview-by">{{ phrase('by_user_x', {'name':$username}) }}</li>

Then I added this:

<li><dl class="pairs pairs--justified structItem-minor">
<dt>{{ phrase('views') }}</dt>
<dd>{{ $thread.discussion_type == 'redirect' ? '&ndash;' : ($thread.view_count > $thread.reply_count ? $thread.view_count|number_short : number_short($thread.reply_count+1)) }}</dd>
</dl></li>

And the result is this. It works for one, not for the other and we've been messing with that layout so I figured it has probably got to do with some of our earlier changes?

website_views.jpg
 
It's a flex container, so the text is getting cut out as there's no room.

Try adding this in to extra.less:

Code:
.message--articlePreview .articlePreview-meta li {
    margin: 0;
    &.articlePreview-meta--views
    {
        margin-right: auto;
    }
}
.message--articlePreview .articlePreview-meta {
    gap: 5px;
    justify-content: space-between;
    .pairs.pairs--justified>dt
    {
    margin-right: 5px;
    }
}

Then use this edit instead (it adds a class to the LI)

Code:
               <li class="articlePreview-meta--views"><dl class="pairs pairs--justified structItem-minor">
                <dt>{{ phrase('views') }}</dt>
                <dd>{{ $thread.discussion_type == 'redirect' ? '&ndash;' : ($thread.view_count > $thread.reply_count ? $thread.view_count|number_short : number_short($thread.reply_count+1)) }}</dd>
            </dl></li>
 

Pre-Sale Questions

If you have any questions or concerns you want to ask before you make a purchase don't hesitate to use one of our multiple support channels for your convenience.

Back