• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Any way to show most popular blog posts?

New Here ,
Mar 11, 2017 Mar 11, 2017

Copy link to clipboard

Copied

I've been really trying to figure this one out. Is there anyway I can show like 20 most popular or most viewed blog posts? This would be nice, I just don't know how it would work? Any help greatly appreciated! Thanks!

TOPICS
Developer

Views

253

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 12, 2017 Mar 12, 2017

Copy link to clipboard

Copied

LATEST

There is no out and out solution in terms of sorting and filtering to get the 20 most popular or viewed posts.

Try skip past this request - or follow some ideas below.

Using the built-in rating system.

When you add comments to a blog or web app detail page, you can choose to add rating. It's a 5 star rating system with each comment. You may need to manipulate the comments submit form to suit your needs, but essentially once people start rating a post, web app item, product - wherever the comment rating system is in place - you should be able to get the most popular. HOWEVER, you could only sort this with Javascript - unless someone else comments otherwise.

module_ratingfeedback | Business Catalyst Developers

module_ratingrank | Business Catalyst Developers

Using Web App Upvotes or Pageview system:

This option will only work on Web Apps where a logged in customer is able to edit a web app item.

  • Create a field in your web app called upvotes. (could be called pageviews!!!)
  • On a click event of an upvote button, or on load of a web app item, AJAX submit a hidden webapp input form which increments the field: Upvotes (Pageviews).
  • You could add a level of security, only logged in users can vote, or track IP addresses, and obfuscate the voting URL. For example, in your AJAX URL you could say "/_System/ajax/upvote.html?itemId=xxx" which would be a mechanism that only hides that HTML etc into the "/_System/ajax/upvote.html?itemId=xxx" file, making it a little extra difficult to "hack", as you will have liquid in the upvote.html file doing some checks such as isLoggedIn, compare current IP address, with list of already submitted IP Address, or merely keep incrementing the pageviews field. You choose your own security mechanism.
  • When you come to view your most popular items, or highest pageviews, you can do the following:
    {module_webapp id="MyWebApp" filter="all" collection="webappData" template=""}
    {{ webappData.items | sort: "upvotes" }} or {{ webappData.items | sort: "pageviews" }}
    Then proceed to iterating through your collection.

All these options are complex and have rather strict requirements for them to work.

Good luck!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines