Read more link anchor

Hi all,

First - love using Hugo and thanks for all the hard work making it awesome!

I’ve done quite a bit of searching on this and couldn’t find anything, but apologies anyway if it’s been asked before:

I wanted the “Read more…” link to link to an anchor in the post rather than just the permalink, so the reader could be delivered to the place they stopped reading rather than the top of a new page.

I was able to do this by including <a id="jumphere"></a> after the <!--more--> tag in my post and then using <a href="{{ .RelPermalink }}#jumphere">Read more...</a> in my li.html template.

However, I was wondering if there was an easier way that I had overlooked? If not, I was thinking a feature idea for Hugo may be to insert an anchor automatically when parsing the <!--more--> tag much like heading anchors currently work, and a function to link directly to it.

Thanks
Travis

1 Like