Make each generated page’s footnotes unique.

If content pages are fully rendered in a list page, footnotes that use
the same reference (`[^fn]`) will have duplicated anchors. This change
builds on #526 to put the page filename (`Page.File.Name`) as part of
the anchor for a footnote.

This would fix discussion [116](http://discuss.gohugo.io/t/footnote-references-are-duplicated-on-list-pages/116).
This commit is contained in:
Austin Ziegler
2014-09-29 10:02:45 -04:00
committed by spf13
parent e68e7ef96f
commit 603b24a163
2 changed files with 21 additions and 19 deletions

View File

@@ -93,7 +93,7 @@ func ShortcodesHandle(stringToParse string, p *Page, t Template) string {
var data = &ShortcodeWithPage{Params: params, Page: p}
if endStart > 0 {
s := stringToParse[leadEnd+3 : leadEnd+endStart]
data.Inner = template.HTML(renderBytes([]byte(CleanP(ShortcodesHandle(s, p, t))), p.guessMarkupType()))
data.Inner = template.HTML(renderBytes([]byte(CleanP(ShortcodesHandle(s, p, t))), p.guessMarkupType(), p.File.Name))
remainder := CleanP(stringToParse[leadEnd+endEnd:])
return CleanP(stringToParse[:leadStart]) +