For many publications, a listing of the most popular articles is an easy way to keep readers on the site, thus increasing both page views and time on site. Newscoop has an internal statistics mechanism which counts page views (the mechanism counts each URL request as a "read"), and that mechanism can be called in other templates.
For those articles that you want statistics gathered you need to firstly put {{ count }} tag in template which outputs whole article (in the case of Newscoop default themes and 'news' articles, it is _tpl/article-cont.tpl). Also, don't forget to turn on 'is Content' switch for the full_text field (or whatever you call that one that holds main article content) in article types management.
In this case, we will call the available functions to make a list of popular articles, which can then be arranged on a page like the screenshot below.
This code snippet is taken from The New Custodian's _tpl/sidebar-most.tpl template.
{{ set_current_issue }}
{{ list_articles length="5" ignore_section="true" order="bypopularity desc" constraints="type is news" }}
<li><a href="{{ url options="article" }}">{{ $gimme->article->name }} ({{ $gimme->article->reads }})</a></li>
{{ /list_articles }}
After it sets the context to the current issue, it will list five most read articles form that issue, regarding of the section. Articles will be ordered by the number of reads, but (as constraints define) only articles of type 'news'. Articles are listed with their names linked to whole article page, and with number of reads shown for every one.
Here is another example, which will tell Newscoop to do the following:
{{ list_articles length="10" constraints="type is article section greater 19 section smaller 301 issue greater `$gimme->issue->number-5`" order="bypopularity desc" }}
Note the use of the backtick character in the code above. The next snippet will list the ten most popular articles in the last seven days. It will:
{{assign var="xdate" value="-7 days"|date_format:"%Y-%m-%d"}} {{list_articles length="10" order="bypopularity desc" constraints="publish_date greater $xdate reads greater 0" ignore_issue="true" ignore_section="true"}}
The following example will:
{{assign var="xdate" value="-1 month"|date_format:"%Y-%m-%d"}} {{list_articles length="10" order="bypopularity desc" constraints="type is article publish_date greater $xdate reads greater 0" ignore_issue="true" ignore_section="true"}}
There has been error in communication with Booktype server. Not sure right now where is the problem.
You should refresh this page.