Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional Header Data prev und next #115

Closed
fighterii opened this issue Oct 12, 2017 · 1 comment
Closed

Additional Header Data prev und next #115

fighterii opened this issue Oct 12, 2017 · 1 comment

Comments

@fighterii
Copy link

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant