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

Pagination #5

Closed
jamestagal opened this issue Oct 7, 2022 · 4 comments
Closed

Pagination #5

jamestagal opened this issue Oct 7, 2022 · 4 comments

Comments

@jamestagal
Copy link
Owner

jamestagal commented Oct 7, 2022

Hi @jimafisk
I've just finished putting the pagination together for this theme and followed along with your tutorial but I am seeing a couple of problems. All the code seems to be fine and I am not getting any errors. However here are the issues:

  1. When I refresh the page, blog you can see the pagination ui appear quickly at the top of the page then it disappears. So it does not remain visible on the page.
  2. I set the postsPerPage to 4 but I still see 6 on the blog page.

Could you please take a look for me when you can. 😄

Best regards,
Ben

@jimafisk
Copy link
Collaborator

jimafisk commented Oct 7, 2022

Hi @jamestagal,

By default pagers are set to null instead of 1 now: plentico/plenti#191 (comment)

So you need to change this line: https://github.com/jamestagal/plenti-educenter/blob/main/layouts/content/blog.svelte#L7

To something like:

$: currentPage = content.pager ? content.pager : 1;

Let me know if that works! Thanks!

@jamestagal
Copy link
Owner Author

jamestagal commented Oct 7, 2022

Hi @jimafisk
Thanks for pointing that change out. However that causes it to append blog to the end of the current blog url when clicking page 2 or 1 buttons. see screenshot.
Screen Shot 2022-10-08 at 10 01 49 am
Also the other forward and back buttons are disabled.

Ben

@jimafisk
Copy link
Collaborator

jimafisk commented Oct 8, 2022

Hi @jamestagal,

I just pushed a change that should fix this: 331f2dc

The problem was the pagination links are all using relative links:

https://github.com/jamestagal/plenti-educenter/blob/331f2dc459e778ee704ec8b537f2f50aca9ce7c2/layouts/components/pagination.svelte

You could have changed all the relative links (e.g. blog/2) to absolute links (e.g. /blog/2) and that would have fixed it as well. However, adding a baseurl (like I did in my commit) allows you to serve your site off a subfolder (like https://mysite.com/mysite) if you'd like :).

@jamestagal
Copy link
Owner Author

jamestagal commented Oct 8, 2022

Hi @jimafisk
Thank you. Yes that fixed it! and having a baseurl is a nice to have feature. 😃

thanks again Jim.
Ben

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

2 participants