YAG-Gallery / yag

YAG - Yet Another Gallery
http://www.yag-gallery.de
31 stars 34 forks source link

Additional Header Data prev und next #115

Closed fighterii closed 7 years ago

fighterii commented 7 years ago

For SEO purposes i`d like to have the additonal links in the header for the previous and next page of an itemList.

At the moment i achieved the following: In Classes/Controller/ItemListController.php i added the following lines to the function "listAction":

        $pager = $this->extListContext->getPagerCollection();
        $nextLinkUid = $pager->getNextPage();
        $prevLinkUid = $pager->getPreviousPage();
        $prev = '<link rel="prev" href="' . $prevLinkUid . '">';
        $next = '<link rel="next" href="' . $nextLinkUid . '">';
        $this->response->addAdditionalHeaderData($prev . PHP_EOL . $next);

With this i get two additional tags in the <head> section of my page with

<link rel="prev" href="1">
<link rel="next" href="2">

So far, so good - i have a the right entries and i have the page uids of the prev and the next link.

Does anyone have an idea how can i get the actual link in this place? like the one which is rendered within Resources/Private/Partials/Pager/Default.html

<f:if condition="{pager.showPreviousLink}">
   <li class="previous">
      <extlist:link.action controller="{controller}" action="{action}" arguments="{extlist:namespace.GPArray(object:'{pagerCollection}' arguments:'page:{pager.previousPage}')}"><span>&lt;</span></extlist:link.action>
   </li>
</f:if>

What Action do i have to call from the controller to get a Link?

fighterii commented 7 years ago

I solved this by adding the additional tags directly within the Pager Partial: PR: #116