Skip to content
Grav 2.0 is officially stable. Read the announcement →
General

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

Started by Alex Radov 7 years ago · 0 replies · 355 views
7 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 Hanns Mattes, 19 hours ago
1 26 12 hours ago
General · by Andy Miller, 12 hours ago
0 25 12 hours ago
General · by Jerry Hunt, 5 days ago
2 145 2 days ago
General · by pamtbaau, 2 days ago
1 96 2 days ago
General · by Andy Miller, 2 days ago
0 80 2 days ago