0

In Locomotivecms,I created a content type called "posts" with a field called "views" which is integer. The field "views" are supposed to add 1 incrementally every time the content entry page was visited. I try {% assign post.views = post.views +1 %} in liquid ,but that didn't make sense. Is there any liquid tag to carry it out ?

nicsunboy
  • 1
  • 1

2 Answers2

0

You may want to try {% increment post.views %}

Victor
  • 1
  • 2
0

You can increment in Locomotive CMS this way:

{% assign counter = 0 %}
{% capture counter %}{{ counter | plus: 1 }}{% endcapture %}
Drakes
  • 23,254
  • 3
  • 51
  • 94