CMS Development

dansilber
Membro

Detecting Page 2+ On Blog Listing Pages

resolver

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 Avaliação positiva
1 Solução aceita
anthonypizzurro
Solução
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

Detecting Page 2+ On Blog Listing Pages

resolver

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

Exibir solução no post original

1 Resposta 1
anthonypizzurro
Solução
Equipe de Produto da HubSpot
Equipe de Produto da HubSpot

Detecting Page 2+ On Blog Listing Pages

resolver

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