Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hi, I've got bunch of blog posts with alot of pages on my blog.
When I click on 'older posts' I've got domain.comblog/?pg=2 and that is fine.

But I need add Page counter to my title tag.
I've checked whole docs, and I don't see anything that can help me.
Where to look for some advice?
How would that counter in title tag look like? Provide example format.
For example
https://domain.com/blog/
Should have tag:
Code: Select all
<title>Blog -  Domain</title>

https://domain.com/blog/?pg=2
Should have tag:
Code: Select all
<title>Blog - Page 2 -  Domain</title>

https://domain.com/blog/?pg=3
Should have tag:
Code: Select all
<title>Blog - Page 3 -  Domain</title>

etc.
If that title is situated in your HTML within cms:pages block, then there exists a system variable k_current_page -
Code: Select all
<cms:if k_current_page gt '1' >
    Blog - Page <cms:show k_current_page /> - Site
<cms:else />
    Blog - Site
</cms:if>


If your title tag is outside of cms:pages, then instead of system variable use tag cms:gpc to craft one yourself and use in the same condition as above -
Code: Select all
<cms:set my_current_page = "<cms:gpc 'pg' />" />
Yeah! That works! Thank you for quick help
5 posts Page 1 of 1