My external link redirects to "http://localhost:1313/mydomain.com

Hello,

I am wondering how I can get rid of the “/localhost:1313/” so that the link redirects to the correct url.
here’s what I did.

<h5>{{.Title}}<br><a href="{{ .Params.website}}" target="_blank">{{ .Params.website}}</a></h5>

This is the content.md file:

---
title: My Title
website: mywebsite.com
---

EDIT: I initially answered the wrong question.

Here’s the real answer. Change your front matter to:

---
title: My Title
website: https://mywebsite.com
---

Thank you Sir, it redirects correctly to the specific website but the user interface now gets the whole url :
https://mywebsite.com instead of mywebsite.com. Can I remove the https may be with a trim method on Hugo?

My code:
<h5>{{.Title}}<br><a href="{{ .Params.website | safeURL}}" target="_blank">{{ .Params.website}}</a></h5>

content

---
title: My Title
websiteURL: https://mywebsite.com
websiteName: mywebsite
---

template

<a href="{{ .Params.websiteURL }}">{{ .Params.websiteName }}</a>

thank you very much Sir !

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.