Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link with anchor has leading slash #64

Open
longlu opened this issue Jan 12, 2022 · 0 comments
Open

Link with anchor has leading slash #64

longlu opened this issue Jan 12, 2022 · 0 comments

Comments

@longlu
Copy link

longlu commented Jan 12, 2022

https://discourse.gohugo.io/t/link-with-anchor-has-leading-slash/30391

it seems it can be fixed by changing relURL to safeUrl.
although i don't know what it means.
After changed to safeUrl, there is no slash for anchor link.

<a href="{{ .Destination | relURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text | safeHTML }}</a>

<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text | safeHTML }}</a>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant