Canonical urls in oscar filtered pages and duplicate content in GWT

17 views
Skip to first unread message

Bastien Roques

unread,
Jun 11, 2017, 6:12:36 AM6/11/17
to django-oscar
Hi,

How do you do with canonical urls in filtered pages? By default, it seems that all filtered pages are set without it and Google Webmaster Tools takes it as duplicate content. 

What is your solution to avoid this?

Thanks

Bastien Roques

unread,
Jun 14, 2017, 11:55:48 AM6/14/17
to django-oscar
Here is what I've done to integrate rel prev&next tags: I've included a file with this content from browse.html

{% if paginator.num_pages > 1 %}
  {% if page_obj.has_previous %}
    <link rel="prev" href="{{ url_path }}?{% get_parameters page %}page={{ page_obj.previous_page_number }}" />
  {% endif %}
  {% if page_obj.has_next %}
    {% if page_obj.next_page_number == 2 %}
      <link rel="canonical" href="{{ url_path }}" />
    {% endif %}
    <link rel="next" href="{{ url_path }}?{% get_parameters page %}page={{ page_obj.next_page_number }}" />
  {% endif %}
{% endif %}


Reply all
Reply to author
Forward
0 new messages