-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat(pagination): added pagination urls to sitemap #19
Conversation
3cc732f
to
fa1b74f
Compare
Hi @rq-abrahamsson and thanks! Can you show an example of how this should be used? |
Hi @nunof07! I'm not super experienced with Eleventy and have not written any plugin for it before so I hope my explanation will make sense. But the use case I had was that I get data for a list of football pitches and I want to create one page for each with the same template so I did that with pagination and set size to 1. With the example data below this will create two pages and I want to index them both. So when using this plugin for generating a sitemap only the url for one of the generated pages was added which was not how I was expecting it to work. But maybe the current behavior is how it's expected to work for some? pitches.html: ---
pagination:
data: pitches
size: 1
alias: pitch
permalink: '{{ pitch.url }}'
layout: templates/layouts/base.liquid
---
<div class="main-content" >
<h1>{{ pitch.name }}</h1>
</div> pitches.json [
{
"name": "Name of first pitch",
"url": "/name-of-first-pitch/",
...
},
{
"name": "Name of second pitch",
"url": "/name-of-second-pitch/",
...
}
]
|
Thanks for the explanation. Hadn't tried this use case yet. Makes sense that the sitemap should include all paginated items. I will setup an example with pagination and run some tests to make sure everything is covered. Thanks again, appreciate it! |
🎉 This PR is included in version 2.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hi @rq-abrahamsson , I've made a few changes to your PR. Added a pagination example and refactored the functions a bit. Now calls the Thanks again and let me know if you find any issue with it! |
I use pagination to generate a tag page for each occurrence of a tag on my site. After updating to v2.1.0 which includes this, the sitemap is adding a Poking around even more, v2.1.0 adds multiple entires for all of my /posts/ paginated pages, but doesn't include the page number, which results in duplicate entries as well. In v2.0.5 there was only one /posts/ entry, which seems to be what this PR was intending on fixing. Any thoughts with this? I'd be happy to poke at it some more, but this broke two different pagination configs on my site, so I thought I'd at least call it out 🙂 |
Hi @BrianMitchL , thank you for reporting this. |
No worries! Let me know if you want me to test anything out (commenting here, or tagging me in a new PR or something), or try to help with a fix. |
Hi @BrianMitchL , I pushed a couple of fixes for both issues (v2.1.3). Let me know if you still have any issues. Thanks! |
@nunof07 v2.1.3 looks great!! 🚀 👏 |
Needed to index all pages created by pagination and this is how I did it. Could maybe be useful for someone else.