-
Notifications
You must be signed in to change notification settings - Fork 0
/
Duplicate-headers-bloglisting
61 lines (49 loc) · 2.42 KB
/
Duplicate-headers-bloglisting
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!-- `is_listing_view` is a HubL variable in the developer info pane that checks if the page is a listing view such as blog listing page -->
{% if is_listing_view %}
{% if request.path|split("/", 5)|last == "1" %}
<script>
//Append page num to title so you don't have duplicate title tags
document.title += " | Page {{current_page_num}}";
// Replace Current Meta Description with new one that appends page num before it.
document.querySelector('meta[name="description"]').setAttribute("content","Page {{current_page_num}} - {{content.meta_description|escapejs}}");
</script>
{% elif current_page_num > 1 %}
<link rel="canonical" href="{{ content.absolute_url }}/page/{{ current_page_num }}">
{% else %}
{% if request.path is string_containing '/all' %}
<link rel="canonical" href="{{ content.absolute_url }}/all">
{% else %}
<link rel="canonical" href="{{ content.absolute_url }}">
{% endif %}
{% endif %}
{% if blog_author %}
{% if current_page_num > 1 %}
<script>
document.title += " | Page {{ current_page_num }}";
document.querySelector('meta[name="description"]').setAttribute("content","Page {{current_page_num}} - {{blog_author.display_name}} - {{content.meta_description|escapejs}}");
</script>
{% endif %}
{% elif topic %}
{% if current_page_num > 1 %}
<script>
document.title += " | Page {{ current_page_num }} ";
document.querySelector('meta[name="description"]').setAttribute("content", "Page {{current_page_num}} - {{ topic }} - {{content.meta_description|escapejs}}");
</script>
{% endif %}
{% elif tag %}
{% if current_page_num > 1 %}
<script>
document.title += " | Page {{ current_page_num }} ";
document.querySelector('meta[name="description"]').setAttribute("content", "Page {{current_page_num}} - {{ tag }} - {{content.meta_description|escapejs}}");
</script>
{% endif %}
{% else current_page_num > 1 %}
<script>
//Append page num to title so you don't have duplicate title tags
document.title += " | Page {{current_page_num}}";
// Replace Current Meta Description with new one that appends page num before it.
document.querySelector('meta[name="description"]').setAttribute("content","Page {{current_page_num}} - {{content.meta_description|escapejs}}");
</script>
{% endif %}
{% endif %}
<!-- /End listing view IF -->