Skip to content

Additional Header Data prev und next #115

@fighterii

Description

@fighterii

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions