Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

The names of links in "count-views" (plugin)

Started by Alex Radov 8 years ago · 0 replies · 581 views
8 years ago

Sorry in advance for my bad English. I'm trying to make a "popular pages" section. I use the count-views plugin and it works, but using it by instruction, I only get the url and count, but don't get the page title. The instructions for the plugin in the form of an example specified:

TWIG
{% for route,views in viewcounts|sort|reverse|slice(0,10) %}

{% endfor %}

But it is clear that from viewcount we ask only route and views.
Please tell me how to get the page title, so I can do a full block "popular pages".
For full understanding:

TWIG
{% if config.plugins['count-views'].enabled %}      
    <div class="sidebar-content">
        {% for route, views in viewcounts|sort|reverse|slice(0,8) %}
            {% if  route != "/" and route != "/error" %}
                <a href="{{ route }}">{{ views }} : {{ p.menu }}</a><br>
            {% endif %}
        {% endfor %}
    </div>
{% endif %}

In the array viewcount only views and count, as I bind to each row p.menu?

last edited 05/05/19 by Alex Radov

Suggested topics

Topic Participants Replies Views Activity
General · by themetman, 1 day ago
2 42 19 hours ago
General · by Hanns Mattes, 1 week ago
0 123 1 week ago
General · by Karmalakas, 1 week ago
2 185 1 week ago
General · by Hanns Mattes, 3 weeks ago
0 235 3 weeks ago
General · by Dima, 4 weeks ago
1 211 4 weeks ago