mirror of
https://github.com/gohugoio/hugo.git
synced 2024-05-11 05:54:58 +00:00
Fix a crash for ref page#anchor.
- Remove an improperly shadowed variable. - Fixes #741.
This commit is contained in:
@ -160,8 +160,6 @@ func (s *SiteInfo) refLink(ref string, page *Page, relative bool) (string, error
|
||||
var link string = ""
|
||||
|
||||
if refUrl.Path != "" {
|
||||
var target *Page
|
||||
|
||||
for _, page := range []*Page(*s.Pages) {
|
||||
if page.Source.Path() == refUrl.Path || page.Source.LogicalName() == refUrl.Path {
|
||||
target = page
|
||||
@ -187,7 +185,7 @@ func (s *SiteInfo) refLink(ref string, page *Page, relative bool) (string, error
|
||||
if refUrl.Fragment != "" {
|
||||
link = link + "#" + refUrl.Fragment
|
||||
|
||||
if refUrl.Path != "" {
|
||||
if refUrl.Path != "" && target != nil {
|
||||
link = link + ":" + target.UniqueId()
|
||||
} else if page != nil {
|
||||
link = link + ":" + page.UniqueId()
|
||||
|
Reference in New Issue
Block a user