mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Fix a crash for ref page#anchor.
- Remove an improperly shadowed variable. - Fixes #741.
This commit is contained in:
parent
029a3ae79e
commit
5e0a16ea21
1 changed files with 1 additions and 3 deletions
|
@ -160,8 +160,6 @@ func (s *SiteInfo) refLink(ref string, page *Page, relative bool) (string, error
|
||||||
var link string = ""
|
var link string = ""
|
||||||
|
|
||||||
if refUrl.Path != "" {
|
if refUrl.Path != "" {
|
||||||
var target *Page
|
|
||||||
|
|
||||||
for _, page := range []*Page(*s.Pages) {
|
for _, page := range []*Page(*s.Pages) {
|
||||||
if page.Source.Path() == refUrl.Path || page.Source.LogicalName() == refUrl.Path {
|
if page.Source.Path() == refUrl.Path || page.Source.LogicalName() == refUrl.Path {
|
||||||
target = page
|
target = page
|
||||||
|
@ -187,7 +185,7 @@ func (s *SiteInfo) refLink(ref string, page *Page, relative bool) (string, error
|
||||||
if refUrl.Fragment != "" {
|
if refUrl.Fragment != "" {
|
||||||
link = link + "#" + refUrl.Fragment
|
link = link + "#" + refUrl.Fragment
|
||||||
|
|
||||||
if refUrl.Path != "" {
|
if refUrl.Path != "" && target != nil {
|
||||||
link = link + ":" + target.UniqueId()
|
link = link + ":" + target.UniqueId()
|
||||||
} else if page != nil {
|
} else if page != nil {
|
||||||
link = link + ":" + page.UniqueId()
|
link = link + ":" + page.UniqueId()
|
||||||
|
|
Loading…
Reference in a new issue