Z
Z
Zaplytnyy2020-09-04 03:50:52
Twig
Zaplytnyy, 2020-09-04 03:50:52

How to fix the problem of duplicate links in a project?

The code:

<label class="frt-checkbox-color {{ class }} " style="background: {{ colorMap[child.vars.value]|default('#808080') }};" title="{{ child.vars.label }}">
                        <input class="frt-checkbox-color__input" style="display: block !important;"
                               type="checkbox" onclick="{{ onClick }}" {% if child.vars.value is defined %} value="{{ child.vars.value }}"{% endif %}{% if child.vars.checked %} checked="checked"{% endif %} />

                        {% if child.vars.countOfFilterAttributes is same as(0) and child.vars.productsCount is defined and child.vars.productsCount >= 3 %}
                            <a class="frt-checkbox-color__title" href="{{ child.vars.filterUrl }}">
                                <span>{{ child.vars.value|capitalize }}</span>
                            </a>
                        {% else %}
                            <span class="frt-checkbox-color__title">{{ child.vars.value|capitalize }}</span>
                        {% endif %}

                    </label>

Page source code
<label class="frt-checkbox-color " style="background: #A52A2A;" title="Brown">
<input class="frt-checkbox-color__input" style="display: block !important;"
type="checkbox" onclick="javascript:window.location .href='/bedroom-furniture/beds/sleigh-beds/filter-brown'; return false;" value="brown" />

<a class="frt-checkbox-color__title" href="/bedroom-furniture/beds/sleigh-beds/filter-brown">
<span>Brown</span>
</a>
</label>


I work in the Twig template engine.
You need to change the layout so that the links are not duplicated in the project code. Top link , runs for product filters . If you disable onclick , then the filters will fall off. The bottom link is for SEO. We need a solution that will preserve the possibility of indexing for SEO and keep the filters working. At the same time, there should not be duplicate links, this is the task of the task. I started working recently and I still don’t know a lot, please don’t scold me harshly, I really need your advice. Thank you all in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question