Reputation: 4323
Joomla seems to have no default pagination support built in... Which I'm sure isn't right. It's meant to be very extensive for SEO customisation.
But my question here is, the pagination at the bottom of the page is giving URLs such as /itemlist?start=4
- Where 4 is the item number to start the list from.
The problem here is that, all of the pages have the same browser title. How can I append 'Page #' on the end of a browser title, without using a plugin?
UPDATE:
I've stumbled upon this API page https://api.joomla.org/cms-3/classes/JPagination.html and this seems to reference the following, which I'll try and use, and see if I can get a result into the title tag somehow.
getPagesCounter
Create and return the pagination pages counter string, ie. Page 2 of 4.
getPagesCounter() : string
UPDATE:
I've no idea how to output this string onto a page, I've tried using echo getPagesCounter()
, but that returns null. Any help or info is greatly appreciated. How can I use this function in template overrides?
Upvotes: 2
Views: 848
Reputation: 1108
You can use $this->pagination->pagesCurrent
to get the current page #.
You can then use
$document = JFactory::getDocument();
$document->setTitle( $document->getTitle() . ' - Page ' . $this->pagination->pagesCurrent);
in components > com_content > views > category > tmpl > blog.php
to add the page number to the title.
You should of course copy blog.php
to your template folder to create an override instead of editing the core Joomla files.
Upvotes: 0
Reputation: 4271
You can do this in a content plugin, by checking the GET variable, and then using something like the below:
$app = JFactory::getApplication();
$this->setTitle( $this->getTitle() . ' - ' . 'Page N');
Where N is the number of the current page that you can get from $_GET.
Upvotes: -1