I ran into trouble when using the theme ‘Casper’ from @vjeantet with the pagination tool. As it’s not necessarily a bug, I thought about posting it here first (before opening an issue on GH).
I tried to insert {{.Site.BaseURL}} before .Next.URL but I get the following error :
ERROR: 2015/06/21 template: theme/partials/pagination.html:7:42: executing "theme/partials/pagination.html" at <.Site.BaseURL>: Site is not a field of struct type *hugolib.Pager in theme/partials/pagination.html
I guess I am missing something here. If not, can we think of using the baseURL when the pagination is generated ?
First, I’m pretty sure you are wrong when stating that the Next.URL is http://example.com/page/2. The Paginator URL is relative to the context root (=> blog).
Second: BaseURL isn’t a property of Pager, so you probably want to say:
{{ $.Site.BaseURL }}
BTW; I recently added some utility funcs named absURL and relURL. Both of them take BaseURL into account, so you can do
{{ .Next.URL | absURL }}
These are only available in Hugo DEV (0.15) if memory serves me correctly.
Thanks for your answer @bep. I am probably wrong, but this is the behavior I’m observing.
My version is 0.14 windows build by the way.
I didn’t know the {{ $.Site.BaseURL }} syntax. What does the “$” stands for ? Is it the same as variable definition in template ?
I couldn’t get how to make it work properly.
Here is the code that generates the pagination in Casper :
I could not understand what you meant by the absurify setting ? Don’t remember having seen that in the doc before (I’m not a power user if that’s not yet clear ;-D ).