No follow enlazado interno .atom en Shopify

Tabla de Contenidos

Debemos lozalizar la línea en el theme.liquid que contenga {{ content_for_header }} 

y reemplazarlo por este fragmento de código para que esa URL que genera se ponga como comentario a nivel código y robots no la rastree

{% capture cfh %}

{{ content_for_header }}

{% endcapture %}

{% assign clnurl = canonical_url | split: «?» | first | remove: shop.secure_url | join | string %}

{% assign atomurl = ‘<link rel=»alternate» type=»application/atom+xml» title=»Feed» href=»‘ | append: clnurl | append: ‘.atom» />’ %}

{% if cfh contains «application/atom+xml» %} <!– {{ atomurl | string }} –>

{% endif %}

{{ cfh | remove: atomurl }}

Pero si queremos dejar el feed y simplemente añadirle un nofollow usaremos este código:

{% capture cfh %}
{{ content_for_header }}
{% endcapture %}
{% assign clnurl = canonical_url | split: «?» | first | remove: shop.secure_url | join | string %}
{% assign atomurl_nofollow = ‘<link rel=»alternate» type=»application/atom+xml» title=»Feed» rel=»nofollow» href=»‘ | append: clnurl | append: ‘.atom» />’ %}
{% assign atomurl_standard = ‘<link rel=»alternate» type=»application/atom+xml» title=»Feed» href=»‘ | append: clnurl | append: ‘.atom» />’ %}
{% if cfh contains atomurl_standard %}
{{ atomurl_nofollow }}
{{ cfh | remove: atomurl_standard }}
{% else %}
{{ cfh }}
{% endif %}

Con esto conseguiremos añadirle un nofollow al enlace que nos genera automaticamente Shopify en las collections .atom 🙂

Recursos: https://byradiant.com/blog/how-to-remove-atom-urls-on-shopify

Suscríbete a la Newsletter