Closed Koc closed 9 years ago
@Koc I understand the problem you're dealing with, but I think the solution will make things very complicated. The extension currently captures all the output of the cache block and stores that. When you have a cache hit, the previously rendered HTML will be outputted immediately. There is no render step.
A "solution" for your problem could be flagging the active category with javascript instead.
<ul data-active="{{ activeCategory.id }}">
{% cache 'sidebar-categories'~activeCategory.id ttl %}
{% set categories = categoriesHelper.loadCategories() %}
{% for category in categories %}
<li class="category-{{ category.id }}">
<a href="{{ category.url }}">{{ category.title }} (...)</a>
</li>
{% endfor %}
{% endcache %}
</ul>
I know about js way to solve this problem but some requirements needed for SEO.
@Koc did find a nice way of solving this?
currently not. I cann't invent good syntax for this.
@asm89 can you suggest nice syntax for this?
@Koc I'm unsure:
Closing this, because I'm not sure this extension would be able to fix this.
I'm rendering big list of categories using
ul+li
. Selected category should usespan
instead ofa
. Using standard way (cache key depends on active category id) we store N keys, N - categories count.This is inefficient:
I'm proposing add some syntax for second pass for cached entry. Example:
Syntax sux, but I hope you understand the goal.