Question

Photo of Greg Schmidt

0

HTML block not updated content based on change in URL parameter.

I am using the Lava / Liquid below in an HTML block in conjunction with a dynamic data block on the same page.  The dynamic HTML block displays a drop down list of years.  When the year seleciton is changed the page refreshes and reflects the selected year as a paraeter in the URL. 

The dynamic data block recognizes the parameter change in the URL and updates its content as expected.   

 The HTML block does not recognize the new parameter value and continues to reflect an old value.  It appears to be a chache issue.  Is there a way to force the HTML block to refresh it's cache?  Or is there possibly another issue here?

 

Lava / Liquid 

{% assign queryParms = 'Global' | Page:'QueryString' %}
{% for item in queryParms %}
{% assign kvItem = item | PropertyToKeyValue %}
{% if kvItem.Key == 'year' %}
{% assign paramYear = kvItem.Value %}
{% endif %}
{% endfor %}
{% assign currentYear = 'Now' | Date:'yyyy' %}
{% if paramYear != true %}
{% assign paramYear = currentYear %}
{% endif %}
<script language="javascript">
function SubmitPage(eyear) {
window.location ="/page/{{ 'Global' | Page:'Id' }}/?year=" + eyear}
</script>
<br> Year:
<select onchange="SubmitPage(this.value)">
<option value="-1">Select Year</option>
{% for i in (2013..currentYear) %}
{% if i == paramYear %}
<option value="{{ i }}" selected>{{ i }}</option>
{% else %}
<option value="{{ i }}">{{ i }}</option>
{% endif %}
{% endfor %}
</select>

 

 

  • Photo of Kreston Lee

    1

    There is a cache duration setting on the HTML block in the properties/settings (little gear) option while the Content Channel View block has the cache settings in the "edit" dialogue. This is the first thing to check that comes to mind when reading this.