jmcclell/django-bootstrap-pagination

Linking to an anchor within a page

mhb11 opened this issue · 3 comments

mhb11 commented

I used bootstrap pagination in my template like so:
{% bootstrap_paginate page_obj range=10 show_prev_next="false" show_first_last="true" %}

Each index links to www.example.com/?page=n under this scheme.

I want it to link to www.example.com/?page=n#top instead. I.e. I have <a name=top> defined in each page that I want the paginated links to redirect to.

I can't figure out how to do that via bootstrap pagination. Can you show it to me via an example? Is it even possible?

Looking forward to hearing back from you.

mhb11 commented

@jmcclell any word on this?

You know, I am not sure if this is possible or not.

The only way for it to be possible, currently, is if anchors are supported in django paths themselves which the template lib uses directly by name. I have not used django in quite some time, unfortunately, so I am not sure if it would be possible.

If it is not supported by django paths themselves, then an additional property would be needed to append them at render-time. I vaguely recall a PR for doing this at one point, perhaps yours?

Here you go: #25

I've merged this in. I had been hoping to have some time to write some tests before doing any more merges, but this one is pretty basic. Let me know if you have any issues with it.