How to get markdown _markup site url

When I try to call the site address in the Markdown _markup, I get an error. Is there any solution for this?

Error:

execute of template failed at <.Site.BaseURL>: can’t evaluate field Site in type goldmark.linkContext

.Site is not in context.

Use either of these instead:

{{ site.BaseURL }}
{{ .Page.Site.BaseURL }}

thank you for solving my problem. But I wondered something, why doesn’t it add https:// as output?

Are you looking at the output from hugo or hugo server?
What is the baseURL in your site configuration?

When I typed {{ .Page.Site.BaseURL }} it gave me //localhost output, probably because I am on localhost. When I install it on my website, I think it will add it per https://. Thanks again for your reply.

If you are seeing this:

//localhost

Then your baseURL is either empty or /. Neither of those are valid.

The baseURL should be the fully qualified URL to your production site, with a trailing slash.

https://www.example.org/
https://something.github.io/my-project/

Thank you for your answer.