CMS Development

dani_k
Participant

{% ifchanged %} code disables blog post accessibility?

SOLVE

Saw a new little paragraph on this beauty here for ifchanged. However,

 

 

{% ifchanged %}
(<i>Updated</i> {{ content.updated|datetimeformat('%Y/%m/%d') }})
{% endifchanged %}

 

 

these three lines load a white screen on ALL blog posts. Blog listings, I believe, were unaffected.

 

//edit: goal is, if content was updated after publishing, then include "(Updated [date])" text.

0 Upvotes
1 Accepted solution
stefen
Solution
Key Advisor | Partner
Key Advisor | Partner

{% ifchanged %} code disables blog post accessibility?

SOLVE

@dani_k you need to add the condition to the if statement like so:

{% ifchanged my_variable %}
// your code
{% endifchanged %}

 

You may want to try a different approach and instead use the `content.updated` and the `content.publish_date` variables with the `|between_times` filter.

Stefen Phelps, Community Champion, Kelp Web Developer

View solution in original post

1 Reply 1
stefen
Solution
Key Advisor | Partner
Key Advisor | Partner

{% ifchanged %} code disables blog post accessibility?

SOLVE

@dani_k you need to add the condition to the if statement like so:

{% ifchanged my_variable %}
// your code
{% endifchanged %}

 

You may want to try a different approach and instead use the `content.updated` and the `content.publish_date` variables with the `|between_times` filter.

Stefen Phelps, Community Champion, Kelp Web Developer