CMS Development

dansilber
Member

Detecting Page 2+ On Blog Listing Pages

SOLVE

I'm looking for a way to detect for paginated blog listing pages.

 

For example:

 

website.com/blog/topic/thetopic/2

website.com/blog/topic/anothertopic/3

website.com/blog/page/2

website.com/blog/page/3

 

The following examples are fine and I don't want them to be included:

 

website.com/blog

website.com/blog/topic/thetopic

website.com/blog/topic/anothertopic

 

I just want to be able to add a noindex meta tag on anything deeper than page 1 for these listings. Anyone have a way to identify them with an if statement?

0 Upvotes
1 Accepted solution
anthonypizzurro
Solution
HubSpot Product Team
HubSpot Product Team

Detecting Page 2+ On Blog Listing Pages

SOLVE

You should be able to do this by using the token:

current_page_num 

 

For example: 

{% if current_page_num > 1 %}
<!-- Your HTML -->
{% endif %}

 

I hope that helps,

Anthony

View solution in original post

1 Reply 1
anthonypizzurro
Solution
HubSpot Product Team
HubSpot Product Team

Detecting Page 2+ On Blog Listing Pages

SOLVE

You should be able to do this by using the token:

current_page_num 

 

For example: 

{% if current_page_num > 1 %}
<!-- Your HTML -->
{% endif %}

 

I hope that helps,

Anthony