// in next page link messes up S3

Hi Everyone,

New to Hugo but great experience so far.

I am having a problem with pagination, front page generates fine. But after the first 10 posts the next link at the bottom of the page generates a uri with a double slash ‘//’. The site is hosted on Amazon S3 which gets screwed up by this so I get a 404. Manually deleting the extra / allows the page to load.

You can see what I mean at http://neavey.net, scroll to the bottom and click Next.

I am using the Icarus theme if that makes any difference.

Thanks

P.

Out of curiosity, do you have your baseurl set to http://neavey.net or http://neavey.net/. If the latter, have you tried removing the final slash?

It is set with trailing slash. I did remove it but it causes other problems with various css files not being found. They were being looked for at uri’s such as neavey.netcss/styles.css.

I am still not sure whether the correct way is to add the trailing slash or not, seems some themes require it some don’t

Anyhow it must be fixed in the theme, so you should raise an issue at that theme’s issue tracker.

Theme authors should use the absURL and its relatives for all URL string creation, that should resolve most issues like this.

Ok, I’ll do that. Thanks for your help.

I had the same problem except I couldn’t use your solution because when I put asbURL I would get an error message. If others have the same problem, here is how I fixed the problem on my site, hoping it doesn’t have secondary effets.

  1. In config.toml you add: absurl = “http://www.indalit.com
  2. In list.html you change:
{{ if .Paginator.HasPrev }}
<li class="previous"><a href="{{ .Site.BaseURL }}{{ .Paginator.Prev.URL }}">&larr; {{ i18n "newer" }}</a></li>

To:

{{ if .Paginator.HasPrev }}
<li class="previous"><a href="{{ .Site.Params.absURL }}{{ .Paginator.Prev.URL }}">&larr; {{ i18n "newer" }}</a></li>
  1. You do this for .Paginator.HasPrev and .Paginator.HasNext

Next works fine for me, and the URL looks perfectly fine: “https://www.neavey.net/page/2/

That problem was fixed for me some time ago, can’t remember the exact issue but I think a theme update solved it.